dsh-science-plugin 0.14.0 → 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.
Files changed (35) hide show
  1. package/README.md +37 -9
  2. package/agents/_README.md +5 -5
  3. package/agents/figure-expert.md +35 -35
  4. package/agents/presentation.md +78 -78
  5. package/agents/simulator.md +30 -30
  6. package/agents/topic-designer.md +26 -26
  7. package/agents/trainer.md +36 -36
  8. package/client/client.js +154 -177
  9. package/client/client.js.map +2 -2
  10. package/cordis.patch.yml +11 -12
  11. package/lib/action-cards.js +7 -4
  12. package/lib/db.js +386 -386
  13. package/lib/httpdata-auth.js +12 -21
  14. package/lib/httpdata.js +41 -45
  15. package/lib/index.js +3 -2
  16. package/lib/project-experts.js +94 -0
  17. package/lib/router.js +1 -1
  18. package/lib/skillmenu.js +87 -52
  19. package/lib/ssh.js +66 -20
  20. package/lib/store.js +50 -50
  21. package/lib/team.js +19 -11
  22. package/package.json +74 -71
  23. package/skills/sci-autoresearch/SKILL.md +41 -41
  24. package/skills/sci-hypothesis/SKILL.md +31 -31
  25. package/skills/sci-polish/SKILL.md +28 -28
  26. package/skills/sci-slides/SKILL.md +73 -73
  27. package/skills/sci-writing/SKILL.md +33 -33
  28. package/docs/DEVLOG.md +0 -864
  29. package/docs/SPEC.md +0 -452
  30. package/docs/research/2026-11-12-academic-figure-skill-/350/257/204/344/274/260.md +0 -33
  31. 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
  32. 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
  33. 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
  34. 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
  35. 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/client/client.js CHANGED
@@ -1,4 +1,4 @@
1
- window.__ModuleLoader__.load({ id: "dsh-science", factory: (require) => {
1
+ window.__ModuleLoader__.load({ id: "dsh-science-plugin", factory: (require) => {
2
2
  var module = { exports: {} };
3
3
  var exports = module.exports;
4
4
  var __create = Object.create;
@@ -204,6 +204,7 @@ function WorkspaceOverview({ view, raw, busy, onAction, onNavigate, onOpenConver
204
204
  /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { "aria-hidden": "true", children: "\u2197" })
205
205
  ] }),
206
206
  /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Button, { disabled: busy, onClick: () => onAction(hasProject ? "literature" : "import_results"), children: hasProject ? "\u63A2\u7D22\u6587\u732E" : "\u6574\u7406\u5DF2\u6709\u7ED3\u679C" }),
207
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Button, { onClick: () => onNavigate("experts"), children: "\u914D\u7F6E\u9879\u76EE\u4E13\u5BB6" }),
207
208
  onOpenCatalog && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Button, { disabled: busy, onClick: onOpenCatalog, children: "\u67E5\u770B\u5168\u90E8\u9879\u76EE" })
208
209
  ] })
209
210
  ] }),
@@ -334,6 +335,8 @@ var RESEARCH_DESK_CSS = `
334
335
  @media(hover:hover){.sci-desk-tile:hover{transform:translateY(-2px);box-shadow:0 8px 20px #0000000e}}
335
336
  @media(max-width:760px){.sci-desk-hero[data-active=true]{grid-template-columns:1fr}}
336
337
  @media(prefers-reduced-motion:reduce){.sci-desk .sci-desk-scene,.sci-desk .sci-button,.sci-desk .sci-desk-tile{animation:none;transition:none;transform:none}}
338
+
339
+ .sci-project-experts{max-width:960px;margin:auto}.sci-expert-form,.sci-expert-row,.sci-expert-presets{display:flex;align-items:center;flex-wrap:wrap;gap:8px;margin:10px 0}.sci-expert-row{justify-content:space-between;overflow-wrap:anywhere}.sci-expert-form input,.sci-expert-form select{padding:7px 9px;max-width:100%;color:inherit;background:var(--sci-card);border:1px solid var(--sci-border);border-radius:6px}.sci-expert-form input{flex:1;min-width:12em}.sci-expert-presets button{display:grid;text-align:left}.sci-expert-presets small{font-size:.8em;font-weight:400}
337
340
  `;
338
341
 
339
342
  // client-src/workbench/PaperSpinePage.jsx
@@ -915,182 +918,144 @@ function ArtifactsPage({ view, onAction }) {
915
918
  // client-src/workbench/ExpertSetupPage.jsx
916
919
  var import_react7 = __toESM(require("react"), 1);
917
920
  var import_jsx_runtime6 = require("react/jsx-runtime");
918
- var tool = (name, category) => ({
919
- name,
920
- category,
921
- environment: "\u672C\u673A\u8FD0\u884C\u4F9D\u8D56\u672A\u63A2\u6D4B\uFF1B\u9700\u6309\u5DE5\u5177\u5B98\u65B9\u6587\u6863\u6838\u5BF9\u3002",
922
- status: "\u672C\u673A\u5B89\u88C5\u72B6\u6001\u4E0E\u7248\u672C\u672A\u68C0\u6D4B\u3002"
923
- });
924
- var ROLE_INFO = {
925
- simulator: { title: "\u8BA1\u7B97\u6A21\u62DF\u4E13\u5BB6", purpose: "\u5206\u5B50\u52A8\u529B\u5B66\u3001\u5206\u5B50\u5BF9\u63A5\u4E0E\u86CB\u767D\u590D\u5408\u7269\u5EFA\u6A21\u3002", tools: [tool("GROMACS", "\u5206\u5B50\u52A8\u529B\u5B66\u8F6F\u4EF6"), tool("OpenMM", "\u5206\u5B50\u52A8\u529B\u5B66\u6846\u67B6"), tool("NAMD", "\u5206\u5B50\u52A8\u529B\u5B66\u8F6F\u4EF6"), tool("Boltz", "\u86CB\u767D\u8D28\u7ED3\u6784/\u590D\u5408\u7269\u9884\u6D4B"), tool("AutoDock Vina", "\u5206\u5B50\u5BF9\u63A5\u8F6F\u4EF6"), tool("ORCA", "\u91CF\u5B50\u5316\u5B66\u8F6F\u4EF6"), tool("Quantum ESPRESSO", "\u7B2C\u4E00\u6027\u539F\u7406\u8BA1\u7B97\u8F6F\u4EF6")] },
926
- trainer: { title: "\u6A21\u578B\u8BAD\u7EC3\u4E13\u5BB6", purpose: "\u86CB\u767D\u8D28\u8BED\u8A00\u6A21\u578B\u3001\u53EF\u590D\u73B0\u8BAD\u7EC3\u4E0E\u53C2\u6570\u9AD8\u6548\u5FAE\u8C03\u3002", tools: [tool("ESM / ESMC", "\u86CB\u767D\u8D28\u8BED\u8A00\u6A21\u578B"), tool("ProtT5", "\u86CB\u767D\u8D28\u8BED\u8A00\u6A21\u578B"), tool("PyTorch Lightning", "\u6DF1\u5EA6\u5B66\u4E60\u8BAD\u7EC3\u6846\u67B6"), tool("Hugging Face / PEFT", "\u6A21\u578B\u4E0E\u53C2\u6570\u9AD8\u6548\u5FAE\u8C03\u5DE5\u5177")] },
927
- "figure-expert": { title: "\u79D1\u7814\u7ED8\u56FE\u4E13\u5BB6", purpose: "\u7EC4\u5B66\u7EDF\u8BA1\u56FE\u3001\u7ED3\u6784\u4E0E\u4E92\u4F5C\u56FE\u3001\u673A\u5236\u793A\u610F\u56FE\u548C\u6295\u7A3F\u524D\u68C0\u67E5\u3002", tools: [tool("Matplotlib / Seaborn / Plotly", "\u6570\u636E\u53EF\u89C6\u5316\u5E93"), tool("\u7ED3\u6784\u89C6\u56FE\u4E0E\u4E92\u4F5C\u56FE", "\u7ED3\u6784\u5206\u6790\u4E0E\u7ED8\u56FE\u5DE5\u5177"), tool("\u53EF\u7F16\u8F91 SVG / PDF", "\u77E2\u91CF\u56FE\u683C\u5F0F")] },
928
- analyst: { title: "\u6570\u636E\u5206\u6790\u5E08", purpose: "NGS\u3001\u5355\u7EC6\u80DE\u3001\u7A7A\u95F4\u7EC4\u5B66\u3001\u86CB\u767D\u8D28\u7EC4\u548C\u5E38\u89C4\u751F\u7269\u7EDF\u8BA1\u3002", tools: [tool("FastQC / MultiQC", "\u6D4B\u5E8F\u8D28\u63A7\u5DE5\u5177"), tool("DESeq2 / edgeR", "\u5DEE\u5F02\u8868\u8FBE\u5206\u6790\u5305"), tool("Scanpy / Seurat", "\u5355\u7EC6\u80DE\u5206\u6790\u5DE5\u5177"), tool("R / Python", "\u7EDF\u8BA1\u4E0E\u811A\u672C\u8BED\u8A00")] },
929
- "literature-scout": { title: "\u6587\u732E\u8C03\u7814\u4E13\u5458", purpose: "\u7CFB\u7EDF\u68C0\u7D22\u3001\u7B5B\u9009\u548C\u6838\u5BF9\u7814\u7A76\u8BC1\u636E\u3002", tools: [tool("PubMed / Europe PMC", "\u6587\u732E\u6570\u636E\u5E93"), tool("Crossref / DOI \u6821\u9A8C", "\u4E66\u76EE\u4E0E\u6807\u8BC6\u7B26\u670D\u52A1"), tool("\u7CFB\u7EDF\u7EFC\u8FF0\u8BB0\u5F55", "\u8BC1\u636E\u6574\u7406\u65B9\u6CD5")] },
930
- "topic-designer": { title: "\u8BFE\u9898\u8BBE\u8BA1\u4E13\u5BB6", purpose: "\u7814\u7A76\u95EE\u9898\u3001\u5B9E\u9A8C\u8BBE\u8BA1\u3001\u5173\u952E\u5BF9\u7167\u548C\u53EF\u68C0\u9A8C\u5047\u8BBE\u3002", tools: [tool("\u7814\u7A76\u8BBE\u8BA1\u4E0E\u529F\u6548\u5206\u6790", "\u7EDF\u8BA1\u8BBE\u8BA1\u65B9\u6CD5"), tool("\u56E0\u679C\u56FE\u4E0E\u53CD\u8BC1\u6761\u4EF6", "\u56E0\u679C\u63A8\u7406\u65B9\u6CD5"), tool("\u5B9E\u9A8C\u53EF\u884C\u6027\u8BC4\u4F30", "\u65B9\u6848\u8BC4\u4F30\u65B9\u6CD5")] },
931
- writer: { title: "\u6587\u7AE0\u64B0\u5199\u4E13\u5BB6", purpose: "\u56F4\u7ED5\u5DF2\u786E\u8BA4\u7ED3\u679C\u7EC4\u7EC7\u7A3F\u4EF6\uFF0C\u4E0D\u8865\u9020\u8BC1\u636E\u3002", tools: [tool("\u8BBA\u6587\u7ED3\u6784\u4E0E\u671F\u520A\u683C\u5F0F", "\u5199\u4F5C\u89C4\u8303"), tool("\u5F15\u6587\u548C\u56FE\u8868\u5B9A\u4F4D", "\u7A3F\u4EF6\u7EC4\u7EC7\u65B9\u6CD5"), tool("\u4E2D\u82F1\u6587\u7A3F\u4EF6", "\u5B66\u672F\u5199\u4F5C")] },
932
- reviewer: { title: "\u79D1\u7814\u5BA1\u67E5\u4E13\u5BB6", purpose: "\u68C0\u67E5\u4E3B\u5F20\u3001\u8BC1\u636E\u3001\u7EDF\u8BA1\u548C\u62A5\u544A\u89C4\u8303\u4E4B\u95F4\u7684\u4E00\u81F4\u6027\u3002", tools: [tool("\u8BC1\u636E\u94FE\u5BA1\u67E5", "\u8BC1\u636E\u6838\u67E5\u65B9\u6CD5"), tool("\u504F\u501A\u4E0E\u5C40\u9650\u6027\u6838\u67E5", "\u7814\u7A76\u8D28\u91CF\u8BC4\u4F30"), tool("\u6295\u7A3F\u524D\u6E05\u5355", "\u62A5\u544A\u89C4\u8303\u68C0\u67E5")] },
933
- presentation: { title: "\u6C47\u62A5 PPT \u4E13\u5BB6", purpose: "\u5C06\u5DF2\u786E\u8BA4\u7ED3\u679C\u6574\u7406\u6210\u53EF\u8BB2\u8FF0\u7684\u5B66\u672F\u6C47\u62A5\u3002", tools: [tool("\u4F1A\u8BAE\u6C47\u62A5\u7ED3\u6784", "\u6C47\u62A5\u8BBE\u8BA1"), tool("\u7ED3\u679C\u56FE\u8868\u7F16\u6392", "\u79D1\u5B66\u4F20\u64AD"), tool("\u7B54\u8FA9\u53D9\u4E8B", "\u6C47\u62A5\u8BBE\u8BA1")] }
934
- };
935
- function installedFor(installed, role2, catalogId) {
936
- return (installed?.[role2] || []).find((item) => item.catalogId === catalogId || item.name === catalogId);
937
- }
938
- function ExpertSetupPage({ view, refresh }) {
939
- const [busy, setBusy] = (0, import_react7.useState)(null);
940
- const [notice, setNotice] = (0, import_react7.useState)(null);
941
- const skillMenu = view.experts.skillMenu || {};
942
- const catalog = skillMenu.catalog || {};
943
- const installed = skillMenu.installed || {};
944
- const roles = Object.keys(ROLE_INFO);
945
- const candidateCards = (0, import_react7.useMemo)(() => roles.flatMap((role2) => (catalog[role2] || []).map((entry) => ({ ...entry, role: role2 }))), [catalog]);
946
- const catalogEntryKeys = new Set(candidateCards.map((entry) => `${entry.role}:${entry.id}`));
947
- const customInstalled = roles.flatMap((role2) => (installed[role2] || []).map((entry) => ({ ...entry, role: role2, id: entry.name }))).filter((entry) => !catalogEntryKeys.has(`${entry.role}:${entry.catalogId || entry.name}`));
948
- const manageSkill = async (entry, action) => {
949
- const key = `${entry.role}:${entry.id}`;
950
- setBusy(key);
951
- setNotice(null);
921
+ async function request(binding, payload, signal) {
922
+ const response = await fetch("/plugins/dsh-science/skill-manage", {
923
+ method: "POST",
924
+ credentials: "same-origin",
925
+ signal,
926
+ headers: { "content-type": "application/json" },
927
+ body: JSON.stringify({ sessionId: binding.sessionId, expectedProjectId: binding.projectId, ...payload })
928
+ });
929
+ const data = await response.json();
930
+ if (!response.ok) throw new Error(data.error || "\u65E0\u6CD5\u8BFB\u53D6\u9879\u76EE\u4E13\u5BB6");
931
+ return data;
932
+ }
933
+ function Expert({ role: role2, data, act, busy, openManager }) {
934
+ const [kind, setKind] = (0, import_react7.useState)("global");
935
+ const [value, setValue] = (0, import_react7.useState)("");
936
+ const links = data.config.links[role2] || [];
937
+ const local = data.installed[role2] || [];
938
+ const options = kind === "global" ? data.global.map((s) => s.name) : data.legacy[role2] || [];
939
+ const typeLabel = { global: "\u5168\u5C40 Skill", legacy: "\u65E7\u7248\u6280\u80FD", local: "\u9879\u76EE Skill", plugin: "DSH \u63D2\u4EF6" };
940
+ const choose = kind === "global" || kind === "legacy";
941
+ const submit = async (event) => {
942
+ event.preventDefault();
943
+ const ok = await act(kind === "local" ? { action: "install", role: role2, repoUrl: value.trim() } : { action: "link", role: role2, kind, value: value.trim() });
944
+ if (ok) setValue("");
945
+ };
946
+ return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(Panel, { title: data.roles[role2]?.label || role2, action: data.writable && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Button, { small: true, quiet: true, disabled: busy, onClick: () => act({ action: "hide", role: role2 }), children: "\u79FB\u51FA\u9879\u76EE\u4E13\u5BB6" }), children: [
947
+ links.map((l) => /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "sci-expert-row", children: [
948
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("span", { children: [
949
+ typeLabel[l.kind],
950
+ " \xB7 ",
951
+ l.kind === "plugin" ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("a", { href: l.value, target: "_blank", rel: "noreferrer", children: l.value }) : l.value
952
+ ] }),
953
+ data.writable && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Button, { small: true, quiet: true, disabled: busy, onClick: () => act({ action: "unlink", role: role2, kind: l.kind, value: l.value }), children: "\u53D6\u6D88\u5173\u8054" })
954
+ ] }, l.kind + "/" + l.value)),
955
+ local.map((s) => /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "sci-expert-row", children: [
956
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("span", { children: [
957
+ "\u9879\u76EE Skill \xB7 ",
958
+ s.name,
959
+ s.warn ? "\uFF08\u4ED3\u5E93\u4E2D\u672A\u53D1\u73B0 SKILL.md\uFF09" : ""
960
+ ] }),
961
+ data.writable && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Button, { small: true, quiet: true, disabled: busy, onClick: () => act({ action: "remove", role: role2, name: s.name }), children: "\u4ECE\u672C\u9879\u76EE\u5378\u8F7D" })
962
+ ] }, s.name)),
963
+ data.writable && /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("form", { className: "sci-expert-form", onSubmit: submit, children: [
964
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("select", { "aria-label": "\u6269\u5C55\u7C7B\u578B", value: kind, onChange: (e) => {
965
+ setKind(e.target.value);
966
+ setValue("");
967
+ }, children: [
968
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("option", { value: "global", children: "\u5F15\u7528\u5168\u5C40 Skill" }),
969
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("option", { value: "local", children: "\u5B89\u88C5\u9879\u76EE Skill" }),
970
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("option", { value: "plugin", children: "\u5173\u8054 DSH \u63D2\u4EF6" }),
971
+ !!data.legacy[role2]?.length && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("option", { value: "legacy", children: "\u5F15\u7528\u65E7\u7248\u89D2\u8272\u6280\u80FD" })
972
+ ] }),
973
+ choose ? /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("select", { "aria-label": "\u9009\u62E9\u6280\u80FD", value, onChange: (e) => setValue(e.target.value), children: [
974
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("option", { value: "", children: options.length ? "\u9009\u62E9\u5DF2\u5B89\u88C5\u7684\u6280\u80FD" : "\u6682\u65E0\u53EF\u5F15\u7528\u7684\u6280\u80FD" }),
975
+ options.map((n) => /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("option", { children: n }, n))
976
+ ] }) : /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("input", { "aria-label": "\u6269\u5C55\u6765\u6E90\u94FE\u63A5", type: "url", required: true, value, placeholder: kind === "plugin" ? "npm \u5305\u6216 GitHub / GitLab \u4ED3\u5E93\u94FE\u63A5" : "GitHub / GitLab \u4ED3\u5E93\u9996\u9875\u94FE\u63A5", onChange: (e) => setValue(e.target.value) }),
977
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Button, { small: true, type: "submit", disabled: busy || !value.trim(), children: kind === "local" ? "\u5B89\u88C5\u5230\u9879\u76EE" : "\u5173\u8054" })
978
+ ] }),
979
+ (kind === "plugin" || links.some((l) => l.kind === "plugin")) && /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("p", { className: "sci-small", children: [
980
+ "\u9879\u76EE\u4FDD\u5B58\u63D2\u4EF6\u6765\u6E90\u3002\u5B89\u88C5\u548C\u542F\u7528\u4F1A\u4F5C\u7528\u4E8E\u5F53\u524D DSH \u914D\u7F6E\u3002 ",
981
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Button, { quiet: true, small: true, onClick: openManager, children: "\u6253\u5F00 DSH \u63D2\u4EF6\u7BA1\u7406\u5668" })
982
+ ] })
983
+ ] });
984
+ }
985
+ function ExpertSetupPage({ binding, services }) {
986
+ const [data, setData] = (0, import_react7.useState)(null);
987
+ const [busy, setBusy] = (0, import_react7.useState)(false);
988
+ const [error, setError] = (0, import_react7.useState)("");
989
+ const [role2, setRole] = (0, import_react7.useState)("");
990
+ const [retry, setRetry] = (0, import_react7.useState)(0);
991
+ (0, import_react7.useEffect)(() => {
992
+ if (!binding.projectId) return;
993
+ const abort = new AbortController();
994
+ request(binding, { action: "inspect" }, abort.signal).then(setData).catch((e) => {
995
+ if (!abort.signal.aborted) setError(e.message);
996
+ });
997
+ return () => abort.abort();
998
+ }, [binding.sessionId, binding.projectId, retry]);
999
+ const act = async (payload) => {
1000
+ setBusy(true);
1001
+ setError("");
952
1002
  try {
953
- const payloadBody = action === "remove" ? { action, role: entry.role, name: entry.id } : { action, role: entry.role, repoId: entry.id };
954
- const response = await fetch("/plugins/dsh-science/skill-manage", { method: "POST", credentials: "same-origin", headers: { "content-type": "application/json" }, body: JSON.stringify(payloadBody) });
955
- const payload = await response.json().catch(() => ({}));
956
- if (!response.ok || payload.ok === false) throw new Error(payload.error || `HTTP ${response.status}`);
957
- setNotice({ tone: "success", text: action === "install" ? `${entry.name} \u5DF2\u5B89\u88C5\u3002` : `${entry.name} \u5DF2\u79FB\u9664\u3002` });
958
- await refresh();
959
- } catch (error) {
960
- setNotice({ tone: "error", text: `\u64CD\u4F5C\u5931\u8D25\uFF1A${error.message}` });
1003
+ await request(binding, payload);
1004
+ setData(await request(binding, { action: "inspect" }));
1005
+ return true;
1006
+ } catch (e) {
1007
+ setError(e.message);
1008
+ return false;
961
1009
  } finally {
962
- setBusy(null);
1010
+ setBusy(false);
963
1011
  }
964
1012
  };
965
- return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "sci-stack", children: [
966
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Panel, { title: "\u4E13\u5BB6\u80FD\u529B", subtitle: "\u672C\u8868\u662F\u73AF\u5883\u5DE5\u5177\u5019\u9009\u8BF4\u660E\uFF08\u53EA\u8BFB\uFF09\uFF1A\u8FD0\u884C\u4F9D\u8D56\u4E0E\u672C\u673A\u7248\u672C\u9700\u6309\u5DE5\u5177\u5B98\u65B9\u6587\u6863\u5B89\u88C5\u540E\u81EA\u884C\u6838\u5BF9\u2014\u2014\u672C\u63D2\u4EF6\u4E0D\u63A2\u6D4B\u5B89\u88C5\u72B6\u6001\uFF0C\u4E5F\u4E0D\u628A\u300C\u8BF4\u660E\u5B58\u5728\u300D\u5F53\u4F5C\u300C\u5DF2\u5B89\u88C5\u300D\u3002\u53EF\u5B89\u88C5\u7684\u6280\u80FD\u589E\u5F3A\u89C1\u4E0B\u65B9\u300C\u53EF\u9009\u6280\u80FD\u589E\u5F3A\u300D\u3002", children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: "sci-expert-grid", children: roles.map((role2) => {
967
- const info = ROLE_INFO[role2];
968
- const member = view.experts.roles?.[role2];
969
- const installedCount = (installed[role2] || []).length;
970
- return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("article", { className: "sci-expert-card", children: [
971
- /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "sci-result-top", children: [
972
- /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { children: [
973
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("h3", { children: member?.label || info.title }),
974
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("p", { children: info.purpose })
975
- ] }),
976
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Badge, { children: installedCount > 0 ? `${installedCount} \u9879\u6269\u5C55\u5DF2\u5B89\u88C5` : "\u65E0\u6269\u5C55" })
977
- ] }),
978
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: "sci-tool-list", "aria-label": `${info.title}\u73AF\u5883\u5DE5\u5177\u5019\u9009`, children: info.tools.map((item) => /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "sci-tool-row", children: [
979
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("b", { children: item.name }),
980
- /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("span", { children: [
981
- "\u7C7B\u522B\uFF1A",
982
- item.category
983
- ] })
984
- ] }, item.name)) })
985
- ] }, role2);
986
- }) }) }),
987
- /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(Panel, { title: "\u53EF\u9009\u6280\u80FD\u589E\u5F3A", subtitle: "\u6280\u80FD\u53EA\u63D0\u4F9B\u64CD\u4F5C\u8BF4\u660E\u3002\u8FD0\u884C\u4F9D\u8D56\u3001\u6A21\u578B\u6743\u91CD\u3001\u5916\u90E8 API \u548C\u6570\u636E\u8BB8\u53EF\u4ECD\u9700\u5355\u72EC\u6838\u5BF9\u3002", children: [
988
- notice && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(StatusMessage, { tone: notice.tone === "error" ? "error" : "success", children: notice.text }),
989
- candidateCards.length ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: "sci-expert-grid", children: candidateCards.map((entry) => {
990
- const installedEntry = installedFor(installed, entry.role, entry.id);
991
- const canInstall = entry.installable === true && Boolean(entry.gitRef);
992
- return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("article", { className: "sci-expert-card", children: [
993
- /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "sci-result-top", children: [
994
- /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { children: [
995
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("h3", { children: entry.name }),
996
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("p", { children: entry.description })
997
- ] }),
998
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Badge, { tone: installedEntry ? "good" : canInstall ? "default" : "warn", children: installedEntry ? "\u5DF2\u5B89\u88C5" : canInstall ? "\u53EF\u5B89\u88C5\u6280\u80FD" : "\u73AF\u5883\u5DE5\u5177 / \u5F85\u6838\u9A8C" })
999
- ] }),
1000
- /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "sci-small", children: [
1001
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("b", { children: "\u89D2\u8272\uFF1A" }),
1002
- ROLE_INFO[entry.role]?.title || entry.role
1003
- ] }),
1004
- /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "sci-small", children: [
1005
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("b", { children: "\u8FD0\u884C\u73AF\u5883\u4E0E\u4F9D\u8D56\uFF1A" }),
1006
- entry.environment || "\u672A\u8BB0\u5F55\uFF0C\u9700\u6838\u5BF9\u4ED3\u5E93\u8BF4\u660E\u3002"
1007
- ] }),
1008
- /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "sci-small", children: [
1009
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("b", { children: "\u6765\u6E90\u4ED3\u5E93\uFF1A" }),
1010
- entry.repo ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("a", { href: entry.repo, target: "_blank", rel: "noreferrer", children: entry.repo }) : "\u672A\u8BB0\u5F55"
1011
- ] }),
1012
- /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "sci-small", children: [
1013
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("b", { children: "\u8BB8\u53EF\u8BC1\uFF1A" }),
1014
- entry.license || "\u672A\u6838\u9A8C"
1015
- ] }),
1016
- /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "sci-small", children: [
1017
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("b", { children: "SKILL.md\uFF1A" }),
1018
- entry.hasSkillMd ? `\u5DF2\u6838\u9A8C \xB7 ${entry.subdir ? `${entry.subdir}/SKILL.md` : "SKILL.md"}` : "\u672A\u6838\u9A8C\u6216\u672A\u53D1\u73B0"
1019
- ] }),
1020
- /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "sci-small", children: [
1021
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("b", { children: "\u5B89\u88C5\u72B6\u6001\uFF1A" }),
1022
- installedEntry ? `\u5DF2\u5B89\u88C5${installedEntry.dir ? ` \xB7 ${installedEntry.dir}` : ""}` : "\u5C1A\u672A\u5B89\u88C5"
1023
- ] }),
1024
- entry.gitRef && /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "sci-small", children: [
1025
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("b", { children: "\u56FA\u5B9A\u7248\u672C\uFF1A" }),
1026
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("code", { children: entry.gitRef })
1027
- ] }),
1028
- !entry.gitRef && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: "sci-risk", children: "\u5F53\u524D\u6CA1\u6709\u5DF2\u6838\u5B9E\u7684\u56FA\u5B9A\u63D0\u4EA4\uFF0C\u5B89\u88C5\u5165\u53E3\u6682\u4E0D\u53EF\u7528\u3002" }),
1029
- /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "sci-risk", children: [
1030
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("b", { children: "\u4F7F\u7528\u98CE\u9669\uFF1A" }),
1031
- entry.risk || "\u98CE\u9669\u4FE1\u606F\u672A\u8BB0\u5F55\uFF1B\u5B89\u88C5\u524D\u9700\u81EA\u884C\u6838\u5BF9\u4F9D\u8D56\u3001\u6570\u636E\u5916\u4F20\u548C\u8BB8\u53EF\u8FB9\u754C\u3002"
1032
- ] }),
1033
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: "sci-result-actions", children: installedEntry ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Button, { small: true, onClick: () => manageSkill(entry, "remove"), disabled: busy === `${entry.role}:${entry.id}`, children: "\u79FB\u9664\u6269\u5C55" }) : /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Button, { small: true, primary: true, onClick: () => manageSkill(entry, "install"), disabled: !canInstall || busy === `${entry.role}:${entry.id}`, children: busy === `${entry.role}:${entry.id}` ? "\u5904\u7406\u4E2D\u2026" : canInstall ? "\u5B89\u88C5\u5230\u8BE5\u4E13\u5BB6" : "\u6682\u4E0D\u53EF\u5B89\u88C5" }) })
1034
- ] }, `${entry.role}:${entry.id}`);
1035
- }) }) : /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: "sci-small", children: "\u76EE\u524D\u6CA1\u6709\u56FA\u5B9A\u7248\u672C\u4E14\u53EF\u76F4\u63A5\u5B89\u88C5\u7684\u6280\u80FD\u6761\u76EE\u3002\u73AF\u5883\u5DE5\u5177\u5019\u9009\u4ECD\u53EF\u7531\u8BA1\u7B97\u4E13\u5BB6\u6309\u5B98\u65B9\u6587\u6863\u914D\u7F6E\u3002" })
1013
+ const bind = async () => {
1014
+ setBusy(true);
1015
+ try {
1016
+ const r = await binding.act({ actionId: "project.ensure-binding", commandId: crypto.randomUUID(), payload: {} });
1017
+ if (r.status !== 200) throw new Error(r.body?.reason || "\u521B\u5EFA\u9879\u76EE\u5931\u8D25");
1018
+ await binding.refresh();
1019
+ } catch (e) {
1020
+ setError(e.message);
1021
+ } finally {
1022
+ setBusy(false);
1023
+ }
1024
+ };
1025
+ const openManager = () => {
1026
+ if (!services.openPluginManager?.()) setError("\u8BF7\u4ECE DSH \u8BBE\u7F6E\u6253\u5F00\u300C\u63D2\u4EF6\u300D\u7BA1\u7406\u9875\u9762\u3002");
1027
+ };
1028
+ return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "sci-project-experts", children: [
1029
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("h1", { children: "\u9879\u76EE\u4E13\u5BB6" }),
1030
+ error && /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(StatusMessage, { tone: "error", children: [
1031
+ error,
1032
+ " ",
1033
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Button, { small: true, onClick: () => {
1034
+ setError("");
1035
+ setRetry(retry + 1);
1036
+ }, children: "\u91CD\u65B0\u8BFB\u53D6" })
1036
1037
  ] }),
1037
- customInstalled.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Panel, { title: "\u5DF2\u5B89\u88C5\u7684\u81EA\u5B9A\u4E49\u6280\u80FD", subtitle: "\u81EA\u5B9A\u4E49\u4ED3\u5E93\u4E0D\u4F1A\u81EA\u52A8\u83B7\u5F97\u4F9D\u8D56\u6216\u98CE\u9669\u80CC\u4E66\uFF1B\u8BF7\u6309\u4ED3\u5E93\u6765\u6E90\u9010\u9879\u6838\u5BF9\u3002", children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: "sci-expert-grid", children: customInstalled.map((entry) => /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("article", { className: "sci-expert-card", children: [
1038
- /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "sci-result-top", children: [
1039
- /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { children: [
1040
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("h3", { children: entry.name }),
1041
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("p", { children: ROLE_INFO[entry.role]?.title || entry.role })
1042
- ] }),
1043
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Badge, { tone: "good", children: "\u5DF2\u5B89\u88C5" })
1044
- ] }),
1045
- /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "sci-small", children: [
1046
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("b", { children: "\u8FD0\u884C\u73AF\u5883\u4E0E\u4F9D\u8D56\uFF1A" }),
1047
- entry.environment || "\u672A\u8BB0\u5F55"
1048
- ] }),
1049
- /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "sci-small", children: [
1050
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("b", { children: "\u6765\u6E90\u4ED3\u5E93\uFF1A" }),
1051
- entry.repo ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("a", { href: entry.repo, target: "_blank", rel: "noreferrer", children: entry.repo }) : "\u672A\u8BB0\u5F55"
1052
- ] }),
1053
- /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "sci-small", children: [
1054
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("b", { children: "\u8BB8\u53EF\u8BC1\uFF1A" }),
1055
- entry.license || "\u672A\u6838\u9A8C"
1056
- ] }),
1057
- /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "sci-small", children: [
1058
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("b", { children: "SKILL.md\uFF1A" }),
1059
- entry.hasSkillMd ? `\u5DF2\u53D1\u73B0 \xB7 ${(entry.skillMdPaths || []).join("\uFF1B") || entry.dir}` : "\u672A\u53D1\u73B0\uFF1B\u76EE\u5F55\u53EA\u767B\u8BB0\u4E86\u8DEF\u5F84"
1060
- ] }),
1061
- /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "sci-small", children: [
1062
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("b", { children: "\u5B89\u88C5\u4F4D\u7F6E\uFF1A" }),
1063
- entry.dir || "\u672A\u8BB0\u5F55"
1064
- ] }),
1065
- /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "sci-risk", children: [
1066
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("b", { children: "\u4F7F\u7528\u98CE\u9669\uFF1A" }),
1067
- entry.risk || "\u5C1A\u672A\u6838\u9A8C\uFF1B\u4F7F\u7528\u524D\u9700\u68C0\u67E5\u4ED3\u5E93\u8BF4\u660E\u3001\u6267\u884C\u547D\u4EE4\u3001\u4F9D\u8D56\u8BB8\u53EF\u548C\u6570\u636E\u5916\u4F20\u8FB9\u754C\u3002"
1068
- ] }),
1069
- entry.warn && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: "sci-risk", children: "\u5B89\u88C5\u8BB0\u5F55\u6807\u8BB0\uFF1A\u672A\u53D1\u73B0\u6807\u51C6 SKILL.md\u3002" }),
1070
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: "sci-result-actions", children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Button, { small: true, onClick: () => manageSkill(entry, "remove"), disabled: busy === `${entry.role}:${entry.id}`, children: busy === `${entry.role}:${entry.id}` ? "\u5904\u7406\u4E2D\u2026" : "\u79FB\u9664\u6269\u5C55" }) })
1071
- ] }, `${entry.role}:${entry.id}`)) }) }),
1072
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Panel, { title: "\u72EC\u7ACB\u96C6\u6210\u4E0E\u6570\u636E\u8FB9\u754C", subtitle: "\u4EE5\u4E0B\u80FD\u529B\u9700\u8981\u5355\u72EC\u5B89\u88C5\u6216\u5916\u90E8\u670D\u52A1\uFF0C\u4E0D\u4F1A\u4F5C\u4E3A\u672C\u5730\u6280\u80FD\u4F2A\u88C5\u6210\u4E00\u952E\u529F\u80FD\u3002", children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: "sci-expert-grid", children: (skillMenu.integrations || []).map((integration) => /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("article", { className: "sci-expert-card", children: [
1073
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("h3", { children: integration.name }),
1074
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("p", { children: integration.description }),
1075
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Badge, { tone: integration.tone || "default", children: integration.status }),
1076
- integration.environment && /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "sci-small", children: [
1077
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("b", { children: "\u73AF\u5883/\u4F9D\u8D56\uFF1A" }),
1078
- integration.environment
1079
- ] }),
1080
- integration.license && /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "sci-small", children: [
1081
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("b", { children: "\u8BB8\u53EF\uFF1A" }),
1082
- integration.license
1083
- ] }),
1084
- /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "sci-small", children: [
1085
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("b", { children: "\u6765\u6E90\uFF1A" }),
1086
- integration.repo || integration.sourceUrl ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("a", { href: integration.repo || integration.sourceUrl, target: "_blank", rel: "noreferrer", children: integration.repo || integration.sourceUrl }) : integration.sourcePath ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("code", { children: integration.sourcePath }) : "\u672A\u8BB0\u5F55"
1087
- ] }),
1088
- integration.installCommand && /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "sci-small", children: [
1089
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("b", { children: "\u5B89\u88C5\u547D\u4EE4\uFF1A" }),
1090
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("code", { children: integration.installCommand })
1091
- ] }),
1092
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: "sci-result-actions", children: integration.actionUrl ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("a", { className: "sci-button sci-button-small", href: integration.actionUrl, target: "_blank", rel: "noreferrer", children: integration.actionLabel || "\u6253\u5F00\u6765\u6E90" }) : /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: "sci-small", children: integration.actionLabel || "\u5F53\u524D\u672A\u914D\u7F6E\u53EF\u6267\u884C\u8FDE\u63A5" }) })
1093
- ] }, integration.id)) }) })
1038
+ !binding.projectId ? /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(Panel, { title: "\u4E3A\u5F53\u524D\u8BFE\u9898\u914D\u7F6E\u4E13\u5BB6", children: [
1039
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("p", { children: "\u5148\u5C06\u6B64\u4F1A\u8BDD\u7ED1\u5B9A\u5230\u79D1\u7814\u9879\u76EE\uFF0C\u518D\u9009\u62E9\u9700\u8981\u7684\u4E13\u5BB6\u548C\u6269\u5C55\u3002" }),
1040
+ binding.ref?.relationship === "unbound" && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Button, { primary: true, disabled: busy, onClick: bind, children: "\u521B\u5EFA\u5F53\u524D\u79D1\u7814\u9879\u76EE" })
1041
+ ] }) : !data ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("p", { role: "status", children: "\u6B63\u5728\u8BFB\u53D6\u4E13\u5BB6\u914D\u7F6E\u2026" }) : /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(import_jsx_runtime6.Fragment, { children: [
1042
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Panel, { title: "\u9009\u62E9\u4E13\u5BB6", subtitle: "\u9009\u62E9\u53EA\u4FDD\u5B58\u5728\u5F53\u524D\u9879\u76EE\u3002\u6D3E\u53D1\u4EFB\u52A1\u65F6\u624D\u4F1A\u542F\u52A8\u4E13\u5BB6\u3002", children: data.writable ? /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(import_jsx_runtime6.Fragment, { children: [
1043
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: "sci-expert-presets", children: Object.entries(data.presets).map(([id, p]) => /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(Button, { disabled: busy || p.roles.every((r) => data.config.roles.includes(r)), onClick: () => act({ action: "preset", value: id }), children: [
1044
+ p.label,
1045
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("small", { children: p.roles.map((r) => data.roles[r].label).join(" \xB7 ") })
1046
+ ] }, id)) }),
1047
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "sci-expert-form", children: [
1048
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("select", { "aria-label": "\u6DFB\u52A0\u5355\u4E2A\u4E13\u5BB6", value: role2, onChange: (e) => setRole(e.target.value), children: [
1049
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("option", { value: "", children: "\u9009\u62E9\u5176\u4ED6\u4E13\u5BB6" }),
1050
+ Object.entries(data.roles).filter(([id]) => !data.config.roles.includes(id)).map(([id, d]) => /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("option", { value: id, children: d.label }, id))
1051
+ ] }),
1052
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Button, { small: true, disabled: busy || !role2, onClick: async () => {
1053
+ if (await act({ action: "add", role: role2 })) setRole("");
1054
+ }, children: "\u6DFB\u52A0\u4E13\u5BB6" })
1055
+ ] })
1056
+ ] }) : /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("p", { children: "\u8BF7\u5728\u9879\u76EE\u7684\u4E3B\u4F1A\u8BDD\u4FEE\u6539\u4E13\u5BB6\u914D\u7F6E\u3002" }) }),
1057
+ data.config.roles.map((r) => /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Expert, { role: r, data, act, busy, openManager }, r))
1058
+ ] })
1094
1059
  ] });
1095
1060
  }
1096
1061
 
@@ -1989,11 +1954,11 @@ function ProjectCatalog({ services }) {
1989
1954
  var import_jsx_runtime8 = require("react/jsx-runtime");
1990
1955
  var NAV = [
1991
1956
  { id: "overview", label: "\u6982\u89C8" },
1957
+ { id: "experts", label: "\u9879\u76EE\u4E13\u5BB6" },
1992
1958
  { id: "catalog", label: "\u9879\u76EE\u603B\u89C8" },
1993
1959
  { id: "paper", label: "\u8BBA\u6587\u4E3B\u7EBF" },
1994
1960
  { id: "team", label: "\u56E2\u961F\u8FDB\u5C55" },
1995
- { id: "artifacts", label: "\u56FE\u8868\u4E0E\u6210\u679C" },
1996
- { id: "experts", label: "\u4E13\u5BB6\u914D\u7F6E" }
1961
+ { id: "artifacts", label: "\u56FE\u8868\u4E0E\u6210\u679C" }
1997
1962
  ];
1998
1963
  function WorkbenchMark() {
1999
1964
  return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { className: "sci-wb-mark", "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("svg", { width: "22", height: "22", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "1.7", strokeLinecap: "round", strokeLinejoin: "round", children: [
@@ -2091,7 +2056,7 @@ function ResearchWorkbench({ services }) {
2091
2056
  page === "paper" && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(PaperSpinePage, { view: currentView, raw: state.raw, onAction: openAction, onConfirm: confirmResult, busy, onOpenConversation: openConversation, onNavigate: setPage }),
2092
2057
  page === "team" && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(TeamProgressPage, { view: currentView, openMemberSession: services?.openMemberSession, memberOpenAvailable: services?.memberOpenAvailable?.(currentView) }),
2093
2058
  page === "artifacts" && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(ArtifactsPage, { view: currentView, onAction: openAction }),
2094
- page === "experts" && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(ExpertSetupPage, { view: currentView, refresh: state.refresh }),
2059
+ page === "experts" && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(ExpertSetupPage, { binding: state, services }, JSON.stringify([state.sessionId, state.projectId])),
2095
2060
  state.error && /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "sci-small", style: { marginTop: 14 }, role: "status", children: [
2096
2061
  "\u72B6\u6001\u5237\u65B0\u5931\u8D25\uFF0C\u6B63\u5728\u663E\u793A\u4E0A\u4E00\u6B21\u6210\u529F\u8BFB\u53D6\u7684\u6570\u636E\uFF1A",
2097
2062
  state.error
@@ -3082,7 +3047,7 @@ function useCurrentObjectRevision(sessionId, objectId) {
3082
3047
  const res = await fetch(`/plugins/dsh-science/project/get?sessionId=${encodeURIComponent(sessionId)}`);
3083
3048
  if (!alive || !res || !res.ok) return;
3084
3049
  const body = await res.json();
3085
- const paper = body && body.project && body.project.paper;
3050
+ const paper = body?.project?.snapshot?.paper ?? body?.project?.paper;
3086
3051
  if (!paper) return;
3087
3052
  const obj = objectId === "core" ? paper.core : (paper.results || []).find((r) => r && r.id === objectId);
3088
3053
  const revision = obj && Number(obj.revision);
@@ -3336,7 +3301,19 @@ function makeServices(ctx) {
3336
3301
  const prepareHandoff = async (kind, target = null) => {
3337
3302
  return handoffToComposer({ ctx, sessionId: getSessionId(), kind, target, openConversation });
3338
3303
  };
3339
- return { getSessionId, subscribeSession, getCurrentSession, openConversation, openWorkbench, openRootSession, openMemberSession, memberOpenAvailable, prepareHandoff };
3304
+ let manager;
3305
+ ctx.inject?.(["pluginNavigation"], (scope) => {
3306
+ manager = scope.pluginNavigation;
3307
+ scope.effect(() => () => {
3308
+ manager = void 0;
3309
+ });
3310
+ });
3311
+ const openPluginManager = () => {
3312
+ if (!manager?.openList) return false;
3313
+ manager.openList();
3314
+ return true;
3315
+ };
3316
+ return { openPluginManager, getSessionId, subscribeSession, getCurrentSession, openConversation, openWorkbench, openRootSession, openMemberSession, memberOpenAvailable, prepareHandoff };
3340
3317
  }
3341
3318
  function WorkbenchIcon({ size = 22, active = false }) {
3342
3319
  return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("svg", { width: size, height: size, viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "1.7", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": "true", "data-active": active || void 0, children: [