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
package/client/client.js
ADDED
|
@@ -0,0 +1,3425 @@
|
|
|
1
|
+
window.__ModuleLoader__.load({ id: "dsh-science-plugin", factory: (require) => {
|
|
2
|
+
var module = { exports: {} };
|
|
3
|
+
var exports = module.exports;
|
|
4
|
+
var __create = Object.create;
|
|
5
|
+
var __defProp = Object.defineProperty;
|
|
6
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
7
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
8
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
9
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
10
|
+
var __export = (target, all) => {
|
|
11
|
+
for (var name in all)
|
|
12
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
13
|
+
};
|
|
14
|
+
var __copyProps = (to, from, except, desc) => {
|
|
15
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
16
|
+
for (let key of __getOwnPropNames(from))
|
|
17
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
18
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
19
|
+
}
|
|
20
|
+
return to;
|
|
21
|
+
};
|
|
22
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
23
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
24
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
25
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
26
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
27
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
28
|
+
mod
|
|
29
|
+
));
|
|
30
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
31
|
+
|
|
32
|
+
// client-src/index.jsx
|
|
33
|
+
var index_exports = {};
|
|
34
|
+
__export(index_exports, {
|
|
35
|
+
apply: () => apply,
|
|
36
|
+
inject: () => inject
|
|
37
|
+
});
|
|
38
|
+
module.exports = __toCommonJS(index_exports);
|
|
39
|
+
var import_react15 = __toESM(require("react"), 1);
|
|
40
|
+
|
|
41
|
+
// client-src/workbench/ResearchWorkbench.jsx
|
|
42
|
+
var import_react10 = __toESM(require("react"), 1);
|
|
43
|
+
|
|
44
|
+
// client-src/workbench/workbench-actions.js
|
|
45
|
+
function semanticHandoffOf(action, targetId = null) {
|
|
46
|
+
switch (action) {
|
|
47
|
+
case "explore":
|
|
48
|
+
return { kind: "explore" };
|
|
49
|
+
case "import_results":
|
|
50
|
+
return { kind: "results" };
|
|
51
|
+
case "literature":
|
|
52
|
+
return { kind: "literature" };
|
|
53
|
+
case "generate_structure":
|
|
54
|
+
return { kind: "structure" };
|
|
55
|
+
case "structure":
|
|
56
|
+
return { kind: "structure", target: targetId };
|
|
57
|
+
case "optimize_structure":
|
|
58
|
+
return { kind: "structure", target: targetId && targetId !== "core" ? targetId : null };
|
|
59
|
+
case "refine_tasks":
|
|
60
|
+
return { kind: "explore", target: targetId };
|
|
61
|
+
case "draw":
|
|
62
|
+
return { kind: "draw", target: targetId };
|
|
63
|
+
case "write":
|
|
64
|
+
return { kind: "write" };
|
|
65
|
+
case "slides":
|
|
66
|
+
return { kind: "slides" };
|
|
67
|
+
default:
|
|
68
|
+
return null;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
async function confirmObjectViaAct({ sessionId, objectId, expectedObjectRevision, expectedHash, expectedRevision, fetchImpl } = {}) {
|
|
72
|
+
const _fetch = fetchImpl || ((url, opts) => fetch(url, opts));
|
|
73
|
+
if (!sessionId) return { ok: false, kind: "no-session", reason: "\u5F53\u524D\u6CA1\u6709\u4F1A\u8BDD\u3002" };
|
|
74
|
+
if (expectedObjectRevision == null) return { ok: false, kind: "stale", reason: "\u7F3A\u5C11\u5BF9\u8C61\u4FEE\u8BA2\u53F7\uFF0C\u8BF7\u5237\u65B0\u540E\u91CD\u8BD5\u3002" };
|
|
75
|
+
if (expectedHash == null || String(expectedHash).trim() === "") return { ok: false, kind: "stale", reason: "\u7F3A\u5C11\u5BF9\u8C61\u5185\u5BB9\u54C8\u5E0C\uFF0C\u8BF7\u5237\u65B0\u540E\u91CD\u8BD5\u3002" };
|
|
76
|
+
if (expectedRevision == null) return { ok: false, kind: "stale", reason: "\u7F3A\u5C11\u9879\u76EE\u4FEE\u8BA2\u53F7\uFF0C\u8BF7\u5237\u65B0\u540E\u91CD\u8BD5\u3002" };
|
|
77
|
+
try {
|
|
78
|
+
const res = await _fetch("/plugins/dsh-science/project/act", {
|
|
79
|
+
method: "POST",
|
|
80
|
+
credentials: "same-origin",
|
|
81
|
+
headers: { "content-type": "application/json" },
|
|
82
|
+
body: JSON.stringify({
|
|
83
|
+
sessionId,
|
|
84
|
+
actionId: "paper.confirm-revision",
|
|
85
|
+
// 稳定幂等键(同一对象修订+内容哈希+项目修订的重试返回原回执,不重复确认)
|
|
86
|
+
commandId: `wb-confirm-${objectId}-r${expectedObjectRevision}-h${String(expectedHash).slice(0, 12)}-p${expectedRevision}`,
|
|
87
|
+
payload: { objectId, expectedObjectRevision, expectedHash },
|
|
88
|
+
expectedRevision
|
|
89
|
+
})
|
|
90
|
+
});
|
|
91
|
+
const body = await res.json().catch(() => null);
|
|
92
|
+
if (res.status === 200 && body && (body.kind === "applied" || body.kind === "already-applied")) {
|
|
93
|
+
return { ok: true, receipt: body.receipt || body };
|
|
94
|
+
}
|
|
95
|
+
if (body && body.kind === "conflict") {
|
|
96
|
+
return { ok: false, kind: "conflict", reason: "\u8BE5\u5BF9\u8C61\u5DF2\u88AB\u4FEE\u6539\uFF08\u65E7\u786E\u8BA4\u5931\u6548\uFF09\uFF1B\u8BF7\u5237\u65B0\u5361\u7247\u540E\u57FA\u4E8E\u65B0\u4FEE\u8BA2\u91CD\u65B0\u786E\u8BA4\u3002" };
|
|
97
|
+
}
|
|
98
|
+
if (body && body.kind === "forbidden") {
|
|
99
|
+
return { ok: false, kind: "forbidden", reason: body.reason || "\u5F53\u524D\u4F1A\u8BDD\u6CA1\u6709\u8BBA\u6587\u5199\u6743\u9650\u3002" };
|
|
100
|
+
}
|
|
101
|
+
return { ok: false, kind: "invalid", reason: body && body.reason || `\u786E\u8BA4\u672A\u6267\u884C\uFF08HTTP ${res.status}\uFF09\u3002` };
|
|
102
|
+
} catch (err) {
|
|
103
|
+
return { ok: false, kind: "network", reason: `\u7F51\u7EDC\u9519\u8BEF\uFF1A${err && err.message || "unknown"}` };
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
// client-src/workbench/styles.js
|
|
108
|
+
var import_react = __toESM(require("react"), 1);
|
|
109
|
+
var WORKBENCH_CSS = `
|
|
110
|
+
.sci-workbench:lang(zh){font-family:"PingFang SC","Microsoft YaHei UI","Microsoft YaHei","Noto Sans CJK SC","Noto Sans SC","WenQuanYi Micro Hei",sans-serif}
|
|
111
|
+
.sci-workbench:lang(zh) :is(button,input,textarea,select){font-family:inherit}
|
|
112
|
+
.sci-workbench{--sci-fg:var(--dsw-alias-label-primary,inherit);--sci-muted:var(--dsw-alias-label-secondary,#737b88);--sci-faint:var(--dsw-alias-label-tertiary,#9299a4);--sci-accent:var(--dsw-alias-state-business-primary,#3568c8);--sci-good:var(--dsw-alias-state-success-primary,#16836b);--sci-warn:var(--dsw-alias-state-warn-primary,#b77912);--sci-bad:var(--dsw-alias-state-error-primary,#c34236);--sci-bg:var(--dsw-alias-bg-layer-0,transparent);--sci-card:var(--dsw-alias-bg-layer-1,rgba(127,127,127,.06));--sci-raised:var(--dsw-alias-bg-layer-2,rgba(127,127,127,.11));--sci-border:var(--dsw-alias-border-l1,rgba(127,127,127,.2));--sci-line:var(--dsw-alias-separator-primary,rgba(127,127,127,.14));box-sizing:border-box;color:var(--sci-fg);font-family:inherit;font-size:14px;line-height:1.55;min-height:100%;background:var(--sci-bg)}
|
|
113
|
+
.sci-workbench *{box-sizing:border-box}.sci-wb-shell{min-height:100%;padding:24px clamp(16px,3vw,40px) 40px}.sci-wb-content{max-width:1400px;margin:0 auto}.sci-wb-header{display:flex;align-items:center;justify-content:space-between;gap:20px;margin:0 auto 22px;max-width:1400px}.sci-wb-brand{display:flex;align-items:center;gap:12px;min-width:0}.sci-wb-mark{width:38px;height:38px;display:grid;place-items:center;border-radius:12px;background:color-mix(in srgb,var(--sci-accent) 12%,transparent);color:var(--sci-accent)}.sci-wb-brand h1{font-size:21px;line-height:1.2;margin:0;font-weight:650;letter-spacing:-.02em}.sci-wb-subtitle{font-size:13px;color:var(--sci-muted);margin-top:4px}.sci-wb-head-actions{display:flex;align-items:center;gap:10px}.sci-wb-nav{display:flex;gap:4px;padding:4px;border:1px solid var(--sci-border);border-radius:12px;background:var(--sci-card);margin-bottom:18px;overflow:auto}.sci-wb-nav button{border:0;background:transparent;color:var(--sci-muted);font:inherit;font-weight:550;padding:9px 15px;border-radius:9px;white-space:nowrap;cursor:pointer}.sci-wb-nav button[aria-current=true]{background:var(--sci-raised);color:var(--sci-fg);box-shadow:0 1px 2px rgba(0,0,0,.06)}
|
|
114
|
+
.sci-wb-content,.sci-stack,.sci-grid,.sci-grid>*{min-width:0}.sci-stack{grid-template-columns:minmax(0,1fr)}
|
|
115
|
+
.sci-panel{border:1px solid var(--sci-border);border-radius:14px;background:var(--sci-card);padding:20px}.sci-panel + .sci-panel{margin-top:16px}.sci-panel-heading{display:flex;align-items:flex-start;justify-content:space-between;gap:12px;margin-bottom:14px}.sci-panel-heading h2,.sci-panel-heading h3{margin:0;font-size:17px;line-height:1.3}.sci-panel-heading p{margin:4px 0 0;color:var(--sci-muted);font-size:13px}.sci-grid{display:grid;grid-template-columns:repeat(12,minmax(0,1fr));gap:16px}.sci-col-8{grid-column:span 8}.sci-col-4{grid-column:span 4}.sci-col-6{grid-column:span 6}.sci-col-12{grid-column:span 12}.sci-stack{display:grid;gap:16px}.sci-muted{color:var(--sci-muted)}.sci-small{font-size:12px;color:var(--sci-muted)}.sci-kicker{font-size:11px;text-transform:uppercase;letter-spacing:.08em;color:var(--sci-muted);font-weight:650}.sci-title{font-size:24px;line-height:1.25;letter-spacing:-.02em;margin:0 0 6px}.sci-copy{font-size:14px;color:var(--sci-muted);margin:0}.sci-rule{border:0;border-top:1px solid var(--sci-line);margin:16px 0}.sci-button{display:inline-flex;justify-content:center;align-items:center;gap:8px;min-height:38px;padding:8px 13px;border:1px solid var(--sci-border);border-radius:9px;background:transparent;color:var(--sci-fg);font:inherit;font-weight:560;cursor:pointer;transition:background .16s,border-color .16s,transform .16s}.sci-button:hover:not(:disabled){background:var(--sci-raised);border-color:color-mix(in srgb,var(--sci-accent) 35%,var(--sci-border))}.sci-button:focus-visible,.sci-wb-nav button:focus-visible,.sci-field input:focus-visible,.sci-field textarea:focus-visible,.sci-field select:focus-visible{outline:2px solid var(--sci-accent);outline-offset:2px}.sci-button:active:not(:disabled){transform:translateY(1px)}.sci-button:disabled{opacity:.55;cursor:not-allowed}.sci-button-primary{background:var(--sci-accent);border-color:var(--sci-accent);color:white}.sci-button-primary:hover:not(:disabled){background:color-mix(in srgb,var(--sci-accent) 87%,#111);border-color:var(--sci-accent);color:white}.sci-button-quiet{border-color:transparent}.sci-button-small{min-height:32px;padding:5px 9px;font-size:13px}.sci-badge{display:inline-flex;align-items:center;gap:5px;border:1px solid var(--sci-border);border-radius:999px;padding:3px 9px;font-size:12px;white-space:nowrap;color:var(--sci-muted);background:var(--sci-card)}.sci-badge-good{color:var(--sci-good);border-color:color-mix(in srgb,var(--sci-good) 30%,var(--sci-border));background:color-mix(in srgb,var(--sci-good) 8%,transparent)}.sci-badge-warn{color:var(--sci-warn);border-color:color-mix(in srgb,var(--sci-warn) 30%,var(--sci-border));background:color-mix(in srgb,var(--sci-warn) 8%,transparent)}.sci-badge-bad{color:var(--sci-bad);border-color:color-mix(in srgb,var(--sci-bad) 30%,var(--sci-border));background:color-mix(in srgb,var(--sci-bad) 8%,transparent)}.sci-stat-row{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:12px}.sci-stat{padding:14px;border:1px solid var(--sci-border);border-radius:12px;background:var(--sci-card)}.sci-stat strong{display:block;font-size:22px;line-height:1.2;font-weight:650}.sci-stat span{display:block;color:var(--sci-muted);font-size:12px;margin-top:5px}.sci-stage-track{display:grid;grid-template-columns:repeat(6,minmax(135px,1fr));gap:0;overflow:auto;padding:2px 0 6px}.sci-stage{position:relative;min-width:135px;padding:4px 14px 8px 0}.sci-stage:not(:last-child):after{content:"";position:absolute;height:2px;left:26px;right:6px;top:14px;background:var(--sci-border)}.sci-stage[data-state=completed]:after{background:color-mix(in srgb,var(--sci-good) 65%,var(--sci-border))}.sci-stage-dot{position:relative;z-index:1;width:28px;height:28px;border-radius:50%;display:grid;place-items:center;border:1px solid var(--sci-border);background:var(--sci-card);color:var(--sci-muted);font-size:12px}.sci-stage[data-state=current] .sci-stage-dot{background:var(--sci-accent);border-color:var(--sci-accent);color:#fff;box-shadow:0 0 0 4px color-mix(in srgb,var(--sci-accent) 13%,transparent)}.sci-stage[data-state=completed] .sci-stage-dot{color:var(--sci-good);border-color:var(--sci-good)}.sci-stage-label{font-size:12px;margin-top:8px;color:var(--sci-muted)}.sci-stage[data-state=current] .sci-stage-label{font-weight:650;color:var(--sci-fg)}
|
|
116
|
+
.sci-hero{padding:24px;border:1px solid color-mix(in srgb,var(--sci-accent) 24%,var(--sci-border));border-radius:16px;background:color-mix(in srgb,var(--sci-accent) 5%,var(--sci-card))}.sci-empty{min-height:180px;display:grid;place-items:center;text-align:center;padding:28px}.sci-empty h2,.sci-empty h3{margin:0 0 8px}.sci-empty p{max-width:620px;margin:0 auto 16px;color:var(--sci-muted)}.sci-step-row{display:grid;grid-template-columns:repeat(3,1fr);gap:12px;margin-top:20px}.sci-step{border:1px solid var(--sci-border);border-radius:11px;padding:12px;background:var(--sci-card);text-align:left}.sci-step b{display:block;font-size:13px}.sci-step span{font-size:12px;color:var(--sci-muted)}.sci-field{display:grid;gap:6px;margin:12px 0}.sci-field label{font-size:13px;font-weight:600}.sci-field input,.sci-field textarea,.sci-field select{width:100%;padding:10px 11px;border:1px solid var(--sci-border);border-radius:9px;background:var(--sci-bg);color:var(--sci-fg);font:inherit;resize:vertical}.sci-field textarea{min-height:88px}.sci-form-actions{display:flex;justify-content:flex-end;gap:9px;margin-top:18px}.sci-modal-backdrop{position:fixed;inset:0;z-index:10000;display:grid;place-items:center;padding:20px;background:rgba(12,17,27,.46)}.sci-modal{width:min(620px,100%);max-height:min(90vh,900px);overflow:auto;padding:22px;border-radius:16px;border:1px solid var(--sci-border);background:var(--dsw-alias-bg-layer-0,#fff);box-shadow:0 20px 70px rgba(0,0,0,.24)}.sci-modal h2{margin:0;font-size:20px}.sci-error-box{padding:12px;border:1px solid color-mix(in srgb,var(--sci-bad) 35%,var(--sci-border));border-radius:10px;background:color-mix(in srgb,var(--sci-bad) 6%,transparent);color:var(--sci-fg);margin-top:12px}.sci-success-box{padding:12px;border:1px solid color-mix(in srgb,var(--sci-good) 35%,var(--sci-border));border-radius:10px;background:color-mix(in srgb,var(--sci-good) 6%,transparent);margin:12px 0}.sci-result-card{border:1px solid var(--sci-border);border-radius:13px;background:var(--sci-card);padding:17px}.sci-result-top{display:flex;align-items:flex-start;justify-content:space-between;gap:12px}.sci-result-card h3{font-size:16px;margin:0 0 5px}.sci-result-claim{color:var(--sci-muted);margin:8px 0 14px}.sci-readiness{display:grid;grid-template-columns:repeat(4,1fr);gap:8px;margin:12px 0}.sci-readiness-item{border:1px solid var(--sci-border);border-radius:9px;padding:8px;font-size:12px}.sci-readiness-item b{display:block;font-weight:600}.sci-result-actions{display:flex;flex-wrap:wrap;gap:7px;margin-top:12px}.sci-note-list{padding-left:20px;margin:8px 0;color:var(--sci-muted)}.sci-note-list li{margin:4px 0}.sci-members{display:grid;grid-template-columns:repeat(auto-fit,minmax(210px,1fr));gap:10px}.sci-member{border:1px solid var(--sci-border);border-radius:11px;padding:13px}.sci-member h3{font-size:14px;margin:0}.sci-member p{font-size:12px;color:var(--sci-muted);margin:5px 0 0}.sci-task-graph{position:relative;overflow:auto;min-height:150px}.sci-task-canvas{position:relative;min-height:180px}.sci-task-node{position:absolute;width:188px;min-height:72px;padding:10px;border:1px solid var(--sci-border);border-radius:10px;background:var(--dsw-alias-bg-layer-1,rgba(127,127,127,.08));color:var(--sci-fg);text-align:left;z-index:1}.sci-task-node:hover{border-color:var(--sci-accent)}.sci-task-node strong{display:block;font-size:13px}.sci-task-node span{display:block;font-size:11px;color:var(--sci-muted);margin-top:4px}.sci-task-lines{position:absolute;inset:0;pointer-events:none;overflow:visible}.sci-task-line{stroke:var(--sci-muted);stroke-width:1.5;fill:none;opacity:.7}.sci-task-list{display:grid;gap:8px}.sci-task-row{display:grid;grid-template-columns:minmax(200px,2fr) minmax(100px,1fr) auto;gap:12px;align-items:center;border-bottom:1px solid var(--sci-line);padding:10px 0}.sci-gallery{display:grid;grid-template-columns:repeat(auto-fill,minmax(220px,1fr));gap:14px}.sci-figure{border:1px solid var(--sci-border);border-radius:12px;overflow:hidden;background:var(--sci-card);cursor:pointer}.sci-figure img{width:100%;height:180px;object-fit:contain;background:var(--sci-raised);display:block}.sci-figure-copy{padding:11px}.sci-figure-copy strong{display:block;font-size:13px}.sci-figure-copy span{display:block;color:var(--sci-muted);font-size:12px;margin-top:4px}.sci-group{margin-top:24px}.sci-group h3{font-size:15px;margin:0 0 10px}.sci-file-list{display:grid;grid-template-columns:repeat(auto-fill,minmax(230px,1fr));gap:9px}.sci-file{display:flex;align-items:center;justify-content:space-between;gap:10px;border:1px solid var(--sci-border);border-radius:10px;padding:11px}.sci-file strong{font-size:13px;display:block;word-break:break-word}.sci-expert-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(280px,1fr));gap:14px}.sci-expert-card{border:1px solid var(--sci-border);border-radius:12px;background:var(--sci-card);padding:16px}.sci-expert-card h3{font-size:15px;margin:0}.sci-expert-card p{font-size:13px;color:var(--sci-muted);margin:8px 0}.sci-risk{font-size:12px;padding:9px;border-radius:9px;background:var(--sci-raised);margin-top:10px}.sci-toast{position:fixed;right:22px;bottom:22px;z-index:9000;max-width:420px;padding:12px 16px;border:1px solid var(--sci-border);border-radius:11px;background:var(--dsw-alias-bg-layer-2,#fff);box-shadow:0 8px 30px rgba(0,0,0,.15)}.sci-quick{padding:16px}.sci-quick .sci-panel{padding:15px}.sci-quick .sci-title{font-size:18px}
|
|
117
|
+
.sci-tool-list{display:grid;gap:8px;margin-top:10px}.sci-tool-row{display:grid;gap:3px;border-top:1px solid var(--sci-line);padding:8px 0;font-size:12px;color:var(--sci-muted)}.sci-tool-row b{font-size:13px;color:var(--sci-fg)}
|
|
118
|
+
@media(max-width:900px){.sci-col-8,.sci-col-4,.sci-col-6{grid-column:span 12}.sci-wb-header{align-items:flex-start}.sci-stat-row{grid-template-columns:repeat(2,1fr)}}@media(max-width:640px){.sci-wb-shell{padding:16px 12px 28px}.sci-wb-header{flex-direction:column}.sci-wb-head-actions{width:100%;flex-wrap:wrap}.sci-wb-nav button{padding:8px 11px}.sci-panel{padding:15px}.sci-stage-track{grid-template-columns:repeat(6,120px)}.sci-step-row{grid-template-columns:1fr}.sci-readiness{grid-template-columns:repeat(2,1fr)}.sci-task-row{grid-template-columns:1fr}.sci-stat strong{font-size:19px}}
|
|
119
|
+
@media(prefers-reduced-motion:reduce){.sci-workbench *, .sci-workbench *:before,.sci-workbench *:after{scroll-behavior:auto!important;transition:none!important;animation:none!important}}
|
|
120
|
+
`;
|
|
121
|
+
function WorkbenchStyles() {
|
|
122
|
+
return import_react.default.createElement("style", { id: "dsh-science-workbench-styles" }, WORKBENCH_CSS);
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
// client-src/workbench/components/ui.jsx
|
|
126
|
+
var import_react2 = __toESM(require("react"), 1);
|
|
127
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
128
|
+
function Button({ children, primary = false, small = false, quiet = false, ...props }) {
|
|
129
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", { ...props, className: ["sci-button", primary && "sci-button-primary", small && "sci-button-small", quiet && "sci-button-quiet", props.className].filter(Boolean).join(" "), children });
|
|
130
|
+
}
|
|
131
|
+
function Panel({ title, subtitle, action, children, className = "" }) {
|
|
132
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("section", { className: `sci-panel ${className}`, children: [
|
|
133
|
+
(title || subtitle || action) && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("header", { className: "sci-panel-heading", children: [
|
|
134
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { children: [
|
|
135
|
+
title && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("h2", { children: title }),
|
|
136
|
+
subtitle && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { children: subtitle })
|
|
137
|
+
] }),
|
|
138
|
+
action
|
|
139
|
+
] }),
|
|
140
|
+
children
|
|
141
|
+
] });
|
|
142
|
+
}
|
|
143
|
+
function Badge({ children, tone = "default" }) {
|
|
144
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: `sci-badge ${tone === "good" ? "sci-badge-good" : tone === "warn" ? "sci-badge-warn" : tone === "bad" ? "sci-badge-bad" : ""}`, children });
|
|
145
|
+
}
|
|
146
|
+
function EmptyState({ title, children, action, secondary }) {
|
|
147
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "sci-empty", children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { children: [
|
|
148
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("h2", { children: title }),
|
|
149
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { children }),
|
|
150
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "sci-result-actions", style: { justifyContent: "center" }, children: [
|
|
151
|
+
action,
|
|
152
|
+
secondary
|
|
153
|
+
] })
|
|
154
|
+
] }) });
|
|
155
|
+
}
|
|
156
|
+
function StatusMessage({ tone = "default", children }) {
|
|
157
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: tone === "error" ? "sci-error-box" : tone === "success" ? "sci-success-box" : "sci-panel", role: tone === "error" ? "alert" : void 0, children });
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
// client-src/workbench/WorkspaceOverview.jsx
|
|
161
|
+
var import_react3 = __toESM(require("react"), 1);
|
|
162
|
+
var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
163
|
+
function Tile({ label, count, title, note, action, children }) {
|
|
164
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("article", { className: "sci-desk-tile", children: [
|
|
165
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "sci-desk-tile-top", children: [
|
|
166
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { children: label }),
|
|
167
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { children: count })
|
|
168
|
+
] }),
|
|
169
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("h2", { children: title }),
|
|
170
|
+
note && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("p", { children: note }),
|
|
171
|
+
children,
|
|
172
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(Button, { quiet: true, small: true, onClick: action, children: [
|
|
173
|
+
"\u67E5\u770B",
|
|
174
|
+
label,
|
|
175
|
+
" ",
|
|
176
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { "aria-hidden": "true", children: "\u2197" })
|
|
177
|
+
] })
|
|
178
|
+
] });
|
|
179
|
+
}
|
|
180
|
+
function WorkspaceOverview({ view, raw, busy, onAction, onNavigate, onOpenConversation, onOpenCatalog }) {
|
|
181
|
+
const { paper, team, artifacts } = view;
|
|
182
|
+
const hasProject = Boolean(raw?.projectId || paper.core.title || paper.core.claim || paper.results.length);
|
|
183
|
+
const pending = paper.results.filter((r) => !r.confirmed && r.manuscriptRole !== "excluded" && r.status !== "dropped");
|
|
184
|
+
const corePending = Boolean(paper.core.claim && !paper.core.confirmed);
|
|
185
|
+
const failed = team.tasks.filter((task) => task.status === "failed" && !task.isBlocked).length;
|
|
186
|
+
const total = team.tasks.length;
|
|
187
|
+
const completed = team.counts.completed;
|
|
188
|
+
const active = team.tasks.find((task) => task.isRunning && !task.isBlocked);
|
|
189
|
+
const figure = artifacts.figures[0];
|
|
190
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "sci-desk-overview", children: [
|
|
191
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("section", { className: "sci-desk-hero", "data-active": hasProject || void 0, children: [
|
|
192
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "sci-desk-hero-copy", children: [
|
|
193
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: "sci-desk-eyebrow", children: hasProject ? `\u5F53\u524D\u8BFE\u9898\u3000/\u3000${paper.stageLabel}` : "\u4F60\u7684\u79D1\u7814\u7A7A\u95F4" }),
|
|
194
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("h1", { children: hasProject ? paper.title : "\u4F60\u60F3\u7814\u7A76\u4EC0\u4E48\uFF1F" }),
|
|
195
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("p", { children: paper.question || raw?.blueprint?.question || paper.core.claim || (hasProject ? "\u4ECE\u5BF9\u8BDD\u8865\u5145\u7814\u7A76\u95EE\u9898\uFF0C\u968F\u65F6\u56DE\u6765\u770B\u8BBA\u6587\u548C\u56E2\u961F\u8FDB\u5EA6\u3002" : "\u4ECE\u4E00\u4E2A\u7814\u7A76\u95EE\u9898\uFF0C\u6216\u4E00\u7EC4\u5DF2\u6709\u7ED3\u679C\u5F00\u59CB\u3002\u7814\u7A76\u6750\u6599\u4F1A\u968F\u5BF9\u8BDD\u6574\u7406\u5230\u8FD9\u91CC\u3002") }),
|
|
196
|
+
hasProject && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("dl", { className: "sci-desk-metrics", children: [["\u7814\u7A76\u7ED3\u679C", paper.totalResults], ["\u4E3B\u5F20\u5F85\u786E\u8BA4", pending.length + Number(corePending)], ["\u4EFB\u52A1\u8FDB\u884C\u4E2D", team.counts.running], ["\u767B\u8BB0\u56FE\u4EF6", artifacts.figures.length]].map(([label, count]) => /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { children: [
|
|
197
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("dt", { children: label }),
|
|
198
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("dd", { children: count })
|
|
199
|
+
] }, label)) }),
|
|
200
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "sci-desk-actions", children: [
|
|
201
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(Button, { primary: true, disabled: busy, onClick: hasProject ? onOpenConversation : () => onAction("explore"), children: [
|
|
202
|
+
hasProject ? "\u7EE7\u7EED\u7814\u7A76\u5BF9\u8BDD" : "\u5728\u5BF9\u8BDD\u4E2D\u5F00\u59CB\u63A2\u7D22",
|
|
203
|
+
" ",
|
|
204
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { "aria-hidden": "true", children: "\u2197" })
|
|
205
|
+
] }),
|
|
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
|
+
onOpenCatalog && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Button, { disabled: busy, onClick: onOpenCatalog, children: "\u67E5\u770B\u5168\u90E8\u9879\u76EE" })
|
|
208
|
+
] })
|
|
209
|
+
] }),
|
|
210
|
+
hasProject && /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("aside", { className: "sci-desk-brief", "aria-label": "\u73B0\u5728\u503C\u5F97\u5173\u6CE8", children: [
|
|
211
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "sci-desk-eyebrow", children: "\u73B0\u5728\u503C\u5F97\u5173\u6CE8" }),
|
|
212
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("h2", { children: corePending ? "\u6838\u5BF9\u6838\u5FC3\u4E3B\u5F20" : pending[0] ? "\u6838\u5BF9\u7814\u7A76\u7ED3\u679C" : active ? "\u8DDF\u8FDB\u5F53\u524D\u4EFB\u52A1" : "\u56DE\u770B\u8BBA\u6587\u4E3B\u7EBF" }),
|
|
213
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("p", { children: corePending ? paper.core.title : pending[0]?.title || active?.subject || "\u67E5\u770B\u5F53\u524D\u4E3B\u5F20\u4E0E\u8BC1\u636E\u7684\u5BF9\u5E94\u5173\u7CFB\u3002" }),
|
|
214
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(Button, { quiet: true, small: true, onClick: () => onNavigate(!corePending && !pending.length && active ? "team" : "paper"), children: [
|
|
215
|
+
"\u67E5\u770B\u8BE6\u60C5 ",
|
|
216
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { "aria-hidden": "true", children: "\u2197" })
|
|
217
|
+
] })
|
|
218
|
+
] })
|
|
219
|
+
] }),
|
|
220
|
+
hasProject && /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "sci-desk-grid", children: [
|
|
221
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
222
|
+
Tile,
|
|
223
|
+
{
|
|
224
|
+
label: "\u8BBA\u6587",
|
|
225
|
+
count: `${paper.totalResults} \u9879\u7ED3\u679C`,
|
|
226
|
+
title: corePending ? "\u6838\u5FC3\u4E3B\u5F20\u5F85\u786E\u8BA4" : pending.length ? `${pending.length} \u9879\u7ED3\u679C\u5F85\u786E\u8BA4` : "\u8BBA\u6587\u4E3B\u7EBF",
|
|
227
|
+
note: corePending ? paper.core.claim : pending[0]?.title || paper.narrative || paper.core.claim || "\u6574\u7406\u7ED3\u679C\u548C\u652F\u6301\u5B83\u4EEC\u7684\u8BC1\u636E\u3002",
|
|
228
|
+
action: () => onNavigate("paper"),
|
|
229
|
+
children: paper.results.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("ol", { className: "sci-desk-result-preview", children: paper.results.slice(0, 3).map((r) => /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("li", { children: [
|
|
230
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { children: r.title }),
|
|
231
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("small", { children: r.confirmed ? "\u5DF2\u786E\u8BA4" : "\u5F85\u786E\u8BA4" })
|
|
232
|
+
] }, r.id)) })
|
|
233
|
+
}
|
|
234
|
+
),
|
|
235
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
236
|
+
Tile,
|
|
237
|
+
{
|
|
238
|
+
label: "\u56E2\u961F",
|
|
239
|
+
count: `${team.members.length} \u4F4D\u6210\u5458`,
|
|
240
|
+
title: active?.subject || "\u56E2\u961F\u8FDB\u5C55",
|
|
241
|
+
note: team.counts.blocked || failed ? `${team.counts.blocked} \u9879\u53D7\u963B \xB7 ${failed} \u9879\u5931\u8D25` : active ? "\u4EFB\u52A1\u6B63\u5728\u8FDB\u884C" : "\u5F53\u524D\u6CA1\u6709\u8FD0\u884C\u4E2D\u7684\u4EFB\u52A1\u3002",
|
|
242
|
+
action: () => onNavigate("team"),
|
|
243
|
+
children: total > 0 && /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "sci-desk-progress", children: [
|
|
244
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("span", { children: [
|
|
245
|
+
"\u5DF2\u5B8C\u6210 ",
|
|
246
|
+
completed,
|
|
247
|
+
" / ",
|
|
248
|
+
total,
|
|
249
|
+
" \u9879\u4EFB\u52A1"
|
|
250
|
+
] }),
|
|
251
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("progress", { value: completed, max: total, "aria-label": "\u5DF2\u5B8C\u6210\u4EFB\u52A1" })
|
|
252
|
+
] })
|
|
253
|
+
}
|
|
254
|
+
),
|
|
255
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
256
|
+
Tile,
|
|
257
|
+
{
|
|
258
|
+
label: "\u6210\u679C",
|
|
259
|
+
count: `${artifacts.figures.length} \u5F20\u56FE\u4EF6`,
|
|
260
|
+
title: figure?.title || "\u7814\u7A76\u6210\u679C",
|
|
261
|
+
note: figure ? figure.resultId ? `\u5BF9\u5E94 ${figure.resultId}` : "\u5DF2\u767B\u8BB0\u56FE\u4EF6" : "\u767B\u8BB0\u7684\u56FE\u8868\u548C\u7814\u7A76\u6750\u6599\u4F1A\u5728\u6210\u679C\u9875\u6C47\u603B\u3002",
|
|
262
|
+
action: () => onNavigate("artifacts"),
|
|
263
|
+
children: figure?.previewable && figure.url && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(OverviewFigure, { figure }, figure.url)
|
|
264
|
+
}
|
|
265
|
+
)
|
|
266
|
+
] })
|
|
267
|
+
] });
|
|
268
|
+
}
|
|
269
|
+
function OverviewFigure({ figure }) {
|
|
270
|
+
const [failed, setFailed] = import_react3.default.useState(false);
|
|
271
|
+
return failed ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("p", { children: "\u56FE\u4EF6\u9884\u89C8\u4E0D\u53EF\u7528\uFF0C\u53EF\u5728\u6210\u679C\u9875\u6253\u5F00\u539F\u56FE\u3002" }) : /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("img", { className: "sci-desk-preview", src: figure.url, alt: figure.title, loading: "lazy", onError: () => setFailed(true) });
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
// client-src/workbench/research-desk-styles.js
|
|
275
|
+
var RESEARCH_DESK_CSS = `
|
|
276
|
+
.sci-desk,.sci-rs{--rd-ink:var(--dsw-alias-label-primary,CanvasText);--rd-muted:var(--dsw-alias-label-secondary,GrayText);--rd-line:color-mix(in srgb,var(--rd-ink) 12%,transparent);--rd-card:var(--dsw-alias-bg-layer-1,Canvas);--rd-ease:cubic-bezier(.2,.75,.24,1)}
|
|
277
|
+
.sci-desk .sci-wb-shell{padding:20px clamp(16px,3.3vw,48px) 40px}
|
|
278
|
+
.sci-desk .sci-wb-header{max-width:1240px;flex-wrap:wrap;gap:12px;margin-bottom:25px}
|
|
279
|
+
.sci-desk .sci-wb-brand{font-weight:650;gap:8px}
|
|
280
|
+
.sci-desk .sci-wb-mark{color:var(--rd-ink);background:transparent;width:27px;height:30px}
|
|
281
|
+
.sci-desk .sci-wb-nav{margin:0;border-color:var(--rd-line);background:var(--rd-card);border-radius:13px;flex-wrap:wrap;overflow:visible}
|
|
282
|
+
.sci-desk .sci-wb-nav button{padding:6px 12px;min-height:32px;font-weight:550}
|
|
283
|
+
.sci-desk .sci-wb-nav button[aria-current=page]{background:var(--rd-ink);color:var(--rd-card)}
|
|
284
|
+
.sci-desk .sci-wb-content{max-width:1240px}
|
|
285
|
+
.sci-desk-page-head{padding:8px 2px 12px;overflow-wrap:anywhere}
|
|
286
|
+
.sci-desk-page-head h1{font-size:1.85rem;font-weight:500;letter-spacing:-.025em;margin:0}
|
|
287
|
+
.sci-desk-page-head p{color:var(--rd-muted);margin:4px 0 0}
|
|
288
|
+
.sci-desk-section-title{font-size:1rem;margin:0;padding:6px 2px 2px}
|
|
289
|
+
.sci-desk-section-title small{margin-inline-start:4px;color:var(--rd-muted);font-weight:400}
|
|
290
|
+
.sci-desk .sci-desk-scene{animation:sci-desk-arrive 280ms var(--rd-ease) both}
|
|
291
|
+
@keyframes sci-desk-arrive{from{opacity:0;transform:translateY(6px)}to{opacity:1;transform:none}}
|
|
292
|
+
.sci-desk .sci-panel,.sci-desk .sci-result-card,.sci-desk .sci-member,.sci-desk .sci-expert-card,.sci-desk .sci-figure{border-radius:16px;border-color:var(--rd-line);background:var(--rd-card)}
|
|
293
|
+
.sci-desk .sci-button{border-radius:999px;transition:background 150ms,transform 180ms var(--rd-ease);white-space:normal}
|
|
294
|
+
.sci-desk .sci-button-primary{background:var(--rd-ink);color:var(--rd-card);border-color:transparent}
|
|
295
|
+
.sci-desk .sci-button-primary:hover:not(:disabled){background:color-mix(in srgb,var(--rd-ink) 85%,var(--rd-card))}
|
|
296
|
+
.sci-desk .sci-button:active:not(:disabled){transform:scale(.97)}
|
|
297
|
+
.sci-desk :is(button,a):focus-visible{outline:2px solid var(--sci-accent);outline-offset:3px}
|
|
298
|
+
.sci-desk-overview{display:grid;gap:14px}
|
|
299
|
+
.sci-desk-hero{border:1px solid var(--rd-line);border-radius:22px;padding:clamp(22px,4.7vw,62px);background:radial-gradient(ellipse at 100% 15%,color-mix(in srgb,#a899d9 19%,transparent),transparent 61%),radial-gradient(ellipse at 92% 100%,color-mix(in srgb,#92b7b0 20%,transparent),transparent 65%),var(--rd-card);overflow-wrap:anywhere}
|
|
300
|
+
.sci-desk-eyebrow,.sci-desk-tile-top{font-size:.75rem;color:var(--rd-muted);font-weight:600}
|
|
301
|
+
.sci-desk-hero h1{font-size:clamp(1.7rem,4.25vw,3.15rem);font-weight:500;line-height:1.24;margin:10px 0}
|
|
302
|
+
.sci-desk-hero p{max-width:62ch;margin:0;color:var(--rd-muted);line-height:1.7;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:3;overflow:hidden}
|
|
303
|
+
.sci-desk-hero[data-active=true]{display:grid;grid-template-columns:minmax(0,1fr) minmax(0,.44fr);align-items:end;gap:clamp(18px,4vw,54px)}
|
|
304
|
+
.sci-desk-brief{background:color-mix(in srgb,var(--rd-card) 78%,transparent);border:1px solid var(--rd-line);border-radius:16px;padding:16px;box-shadow:0 8px 24px #00000008}
|
|
305
|
+
.sci-desk-brief h2{font-size:1.12rem;margin:4px 0;font-weight:600}
|
|
306
|
+
.sci-desk-brief .sci-button{margin-top:8px}
|
|
307
|
+
.sci-desk-metrics{display:flex;flex-wrap:wrap;gap:14px clamp(18px,4vw,46px);margin:24px 0 0}
|
|
308
|
+
.sci-desk-metrics div{display:flex;flex-direction:column-reverse;gap:2px}
|
|
309
|
+
.sci-desk-metrics dt{font-size:.75rem;color:var(--rd-muted)}
|
|
310
|
+
.sci-desk-metrics dd{font:400 1.85rem/1 Georgia,serif;font-variant-numeric:tabular-nums;margin:0}
|
|
311
|
+
.sci-desk-actions{display:flex;flex-wrap:wrap;gap:8px;margin-top:21px}
|
|
312
|
+
.sci-desk-grid,.sci-catalog-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(min(100%,235px),1fr));gap:14px}
|
|
313
|
+
.sci-catalog{display:grid;gap:16px}
|
|
314
|
+
.sci-catalog-head h2{margin:4px 0 0;font-size:1.6rem;font-weight:560}
|
|
315
|
+
.sci-catalog-head p:last-child{color:var(--rd-muted);max-width:62ch}
|
|
316
|
+
.sci-catalog-card{display:grid;gap:8px;padding:16px;border:1px solid var(--rd-line);border-radius:16px;background:var(--rd-card)}
|
|
317
|
+
.sci-catalog-card header{display:flex;justify-content:space-between;color:var(--rd-muted);font-size:.75rem}
|
|
318
|
+
.sci-catalog-card h3{margin:0;font-size:1.05rem}
|
|
319
|
+
.sci-catalog-card p,.sci-catalog-card dd{margin:0}
|
|
320
|
+
.sci-catalog-card dl{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:8px}
|
|
321
|
+
.sci-catalog-card dt{color:var(--rd-muted);font-size:.75rem}
|
|
322
|
+
.sci-desk-tile{display:flex;flex-direction:column;align-items:stretch;gap:10px;padding:19px;border-radius:17px;border:1px solid var(--rd-line);background:var(--rd-card);overflow-wrap:anywhere;transition:transform 230ms var(--rd-ease),box-shadow 230ms var(--rd-ease)}
|
|
323
|
+
.sci-desk-tile-top{display:flex;justify-content:space-between;flex-wrap:wrap;gap:6px}
|
|
324
|
+
.sci-desk-tile h2{font-size:1.12rem;line-height:1.35;margin:0;font-weight:620}
|
|
325
|
+
.sci-desk-tile p{margin:0;color:var(--rd-muted);display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:3;overflow:hidden}
|
|
326
|
+
.sci-desk-tile button{align-self:flex-start;margin-top:auto}
|
|
327
|
+
.sci-desk-preview{width:100%;height:105px;object-fit:contain;background:var(--sci-raised);border-radius:10px}
|
|
328
|
+
.sci-desk-result-preview{margin:0;padding:0;list-style:none}
|
|
329
|
+
.sci-desk-result-preview li{display:flex;justify-content:space-between;gap:8px;border-top:1px solid var(--rd-line);padding:6px 0}
|
|
330
|
+
.sci-desk-result-preview li span{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
|
|
331
|
+
.sci-desk-result-preview small{flex:none;color:var(--rd-muted)}
|
|
332
|
+
.sci-desk-progress{display:grid;gap:6px;font-size:.75rem;color:var(--rd-muted)}
|
|
333
|
+
.sci-desk-progress progress{width:100%;height:6px;accent-color:var(--sci-accent)}
|
|
334
|
+
@media(hover:hover){.sci-desk-tile:hover{transform:translateY(-2px);box-shadow:0 8px 20px #0000000e}}
|
|
335
|
+
@media(max-width:760px){.sci-desk-hero[data-active=true]{grid-template-columns:1fr}}
|
|
336
|
+
@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}}
|
|
337
|
+
`;
|
|
338
|
+
|
|
339
|
+
// client-src/workbench/PaperSpinePage.jsx
|
|
340
|
+
var import_react4 = __toESM(require("react"), 1);
|
|
341
|
+
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
342
|
+
var READINESS_LABELS = [["scientific", "\u79D1\u5B66\u8BC1\u636E"], ["manuscript", "\u7A3F\u4EF6\u5C31\u7EEA"], ["submission", "\u6295\u7A3F\u5C31\u7EEA"]];
|
|
343
|
+
function readinessText(value) {
|
|
344
|
+
if (!value) return "\u5F85\u6838\u5BF9";
|
|
345
|
+
if (value.state === "ready" || value.state === "completed") return "\u5DF2\u5177\u5907";
|
|
346
|
+
if (value.state === "in_progress") return "\u8FDB\u884C\u4E2D";
|
|
347
|
+
return "\u5F85\u5B8C\u5584";
|
|
348
|
+
}
|
|
349
|
+
function ResultCard({ result, onAction, onConfirm, busy = false }) {
|
|
350
|
+
const [expanded, setExpanded] = (0, import_react4.useState)(false);
|
|
351
|
+
const gatesOpen = result.coreConfirmed === true && result.confirmed === true;
|
|
352
|
+
const unconfirmedReason = result.coreConfirmed !== true ? "\u6838\u5FC3\u7814\u7A76\u7ED3\u8BBA\u5C1A\u672A\u786E\u8BA4\uFF1B\u5148\u786E\u8BA4\u6838\u5FC3\u7ED3\u8BBA\u540E\uFF0C\u624D\u80FD\u7EC6\u5316\u6B63\u5F0F\u4EFB\u52A1\u6216\u542F\u52A8\u6B63\u5F0F\u7ED8\u56FE\u3002" : `\u201C${result.title}\u201D\u5C1A\u672A\u786E\u8BA4\uFF1B\u5148\u786E\u8BA4\u8BE5\u7814\u7A76\u7ED3\u679C\u540E\uFF0C\u624D\u80FD\u7EC6\u5316\u6B63\u5F0F\u4EFB\u52A1\u6216\u542F\u52A8\u6B63\u5F0F\u7ED8\u56FE\u3002`;
|
|
353
|
+
const run = (action) => onAction(action, result.id);
|
|
354
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("article", { className: "sci-result-card", children: [
|
|
355
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "sci-result-top", children: [
|
|
356
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { children: [
|
|
357
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("h3", { children: result.title }),
|
|
358
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "sci-small", children: [
|
|
359
|
+
result.statusLabel,
|
|
360
|
+
" \xB7 ",
|
|
361
|
+
result.confirmed ? "\u5F53\u524D\u4FEE\u8BA2\u5DF2\u786E\u8BA4" : "\u5F85\u786E\u8BA4"
|
|
362
|
+
] })
|
|
363
|
+
] }),
|
|
364
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Badge, { tone: result.confirmed ? "good" : "warn", children: result.confirmed ? "\u5DF2\u786E\u8BA4" : "\u5F85\u786E\u8BA4" })
|
|
365
|
+
] }),
|
|
366
|
+
result.claim && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("p", { className: "sci-result-claim", children: result.claim }),
|
|
367
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: "sci-readiness", style: { gridTemplateColumns: "repeat(auto-fit,minmax(140px,1fr))" }, children: READINESS_LABELS.map(([key, label]) => /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "sci-readiness-item", children: [
|
|
368
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("b", { children: label }),
|
|
369
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { children: readinessText(result.readiness?.[key]) })
|
|
370
|
+
] }, key)) }),
|
|
371
|
+
result.requiredItems.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { children: [
|
|
372
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("b", { className: "sci-small", children: "\u5FC5\u987B\u5904\u7406" }),
|
|
373
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("ul", { className: "sci-note-list", children: result.requiredItems.map((item) => /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("li", { children: item }, item)) })
|
|
374
|
+
] }),
|
|
375
|
+
result.recommendedItems.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { children: [
|
|
376
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("b", { className: "sci-small", children: "\u5EFA\u8BAE\u5904\u7406" }),
|
|
377
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("ul", { className: "sci-note-list", children: result.recommendedItems.map((item) => /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("li", { children: item }, item)) })
|
|
378
|
+
] }),
|
|
379
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "sci-result-actions", children: [
|
|
380
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Button, { small: true, onClick: () => setExpanded((value) => !value), "aria-expanded": expanded, children: expanded ? "\u6536\u8D77\u8BE6\u60C5" : "\u67E5\u770B\u8BE6\u60C5" }),
|
|
381
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Button, { small: true, onClick: () => run("optimize_structure"), children: "\u5728\u5BF9\u8BDD\u4E2D\u4F18\u5316" }),
|
|
382
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Button, { small: true, disabled: !gatesOpen, title: !gatesOpen ? unconfirmedReason : void 0, onClick: () => run("refine_tasks"), children: "\u7EC6\u5316\u4EFB\u52A1" }),
|
|
383
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Button, { small: true, disabled: !gatesOpen, title: !gatesOpen ? unconfirmedReason : void 0, onClick: () => run("draw"), children: "\u5F00\u59CB\u7ED8\u56FE" }),
|
|
384
|
+
!result.confirmed && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Button, { small: true, primary: true, disabled: busy, onClick: () => onConfirm(result.id, result.revision, result.contentHash), children: "\u786E\u8BA4\u5F53\u524D\u4FEE\u8BA2" })
|
|
385
|
+
] }),
|
|
386
|
+
!gatesOpen && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: "sci-small", role: "note", style: { marginTop: 8 }, children: unconfirmedReason }),
|
|
387
|
+
expanded && /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "sci-small", style: { marginTop: 14 }, children: [
|
|
388
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { children: [
|
|
389
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("b", { children: "Result \u7F16\u53F7\uFF1A" }),
|
|
390
|
+
result.id,
|
|
391
|
+
"\u3000",
|
|
392
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("b", { children: "\u4FEE\u8BA2\uFF1A" }),
|
|
393
|
+
result.revision || 1
|
|
394
|
+
] }),
|
|
395
|
+
result.purpose && /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { children: [
|
|
396
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("b", { children: "\u76EE\u7684\uFF1A" }),
|
|
397
|
+
result.purpose
|
|
398
|
+
] }),
|
|
399
|
+
result.direction && /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { children: [
|
|
400
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("b", { children: "\u7ED3\u679C\u65B9\u5411\uFF1A" }),
|
|
401
|
+
result.direction
|
|
402
|
+
] }),
|
|
403
|
+
["data", "code", "figure", "manuscript"].map((kind) => {
|
|
404
|
+
const rows = (result.materials || []).filter((item) => item.kind === kind);
|
|
405
|
+
if (rows.length === 0) return null;
|
|
406
|
+
const label = { data: "\u76F8\u5173\u6570\u636E", code: "\u751F\u6210\u4EE3\u7801", figure: "\u56FE\u4EF6", manuscript: "\u7A3F\u6BB5" }[kind];
|
|
407
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { children: [
|
|
408
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("b", { children: [
|
|
409
|
+
label,
|
|
410
|
+
"\uFF1A"
|
|
411
|
+
] }),
|
|
412
|
+
rows.map((item) => `${item.summary || item.id}\uFF08${item.status === "missing" ? "\u5DF2\u5931\u8054" : item.verified ? "\u5DF2\u6838\u9A8C\u8BC1\u636E" : "\u5DF2\u767B\u8BB0\uFF0C\u5C1A\u672A\u6838\u9A8C"}\uFF09`).join("\uFF1B")
|
|
413
|
+
] }, kind);
|
|
414
|
+
}),
|
|
415
|
+
result.notes && /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { children: [
|
|
416
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("b", { children: "\u5907\u6CE8\uFF1A" }),
|
|
417
|
+
result.notes
|
|
418
|
+
] }),
|
|
419
|
+
result.evidence?.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { children: [
|
|
420
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("b", { children: "\u8BC1\u636E\u8BB0\u5F55\uFF1A" }),
|
|
421
|
+
result.evidence.map((row, index) => {
|
|
422
|
+
if (!row) return `\u8BC1\u636E ${index + 1}`;
|
|
423
|
+
const flag = row.state === "verified" ? "\u2713" : row.state === "disputed" || row.state === "invalidated" ? "\u2717" : "\u2026";
|
|
424
|
+
return `${flag} ${row.sourceLocator || row.title || `\u8BC1\u636E ${index + 1}`}`;
|
|
425
|
+
}).join("\uFF1B")
|
|
426
|
+
] }),
|
|
427
|
+
result.references?.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { children: [
|
|
428
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("b", { children: "\u53C2\u8003\u6587\u732E\uFF08\u6309\u7528\u9014\uFF09\uFF1A" }),
|
|
429
|
+
["method", "concept", "background", "evidence"].map((usedAs) => {
|
|
430
|
+
const rows = (result.references || []).filter((row) => row && row.usedAs === usedAs);
|
|
431
|
+
if (rows.length === 0) return null;
|
|
432
|
+
const label = { method: "\u65B9\u6CD5", concept: "\u6982\u5FF5", background: "\u80CC\u666F", evidence: "\u8BC1\u636E" }[usedAs];
|
|
433
|
+
return `${label}\uFF1A${rows.map((row) => `${row.title || row.doi || "\u672A\u547D\u540D\u6587\u732E"}${row.verified ? "\u2713" : "\uFF08\u672A\u6838\u5BF9\uFF09"}`).join("\u3001")}`;
|
|
434
|
+
}).filter(Boolean).join("\uFF1B")
|
|
435
|
+
] })
|
|
436
|
+
] })
|
|
437
|
+
] });
|
|
438
|
+
}
|
|
439
|
+
function PaperSpinePage({ view, raw, onAction, onConfirm, busy = false, onOpenConversation, onNavigate }) {
|
|
440
|
+
const paper = view.paper;
|
|
441
|
+
const hasSpine = Boolean(paper.core.claim || paper.results.length || paper.core.title);
|
|
442
|
+
const [showAllResults, setShowAllResults] = (0, import_react4.useState)(false);
|
|
443
|
+
const previewLimit = 5;
|
|
444
|
+
const visibleResults = showAllResults ? paper.results : paper.results.slice(0, previewLimit);
|
|
445
|
+
const nextStep = paper.nextStep;
|
|
446
|
+
const nextAction = () => nextStep.action ? onAction(nextStep.action, nextStep.targetId || null) : nextStep.page && onNavigate(nextStep.page);
|
|
447
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "sci-stack", children: [
|
|
448
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("header", { className: "sci-desk-page-head", children: [
|
|
449
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("h1", { children: "\u8BBA\u6587\u4E3B\u7EBF" }),
|
|
450
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("p", { children: [
|
|
451
|
+
paper.stageLabel,
|
|
452
|
+
paper.venue ? ` \xB7 \u76EE\u6807\u671F\u520A\uFF1A${paper.venue}` : "",
|
|
453
|
+
" \xB7 ",
|
|
454
|
+
paper.totalResults,
|
|
455
|
+
" \u9879\u7ED3\u679C"
|
|
456
|
+
] })
|
|
457
|
+
] }),
|
|
458
|
+
!hasSpine ? /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(Panel, { className: "sci-hero", children: [
|
|
459
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(EmptyState, { title: "\u5F00\u59CB\u4E00\u9879\u7814\u7A76", children: "\u4ECE\u4E00\u4E2A\u7814\u7A76\u95EE\u9898\u5F00\u59CB\uFF0C\u4E5F\u53EF\u4EE5\u5148\u6574\u7406\u5DF2\u7ECF\u5B8C\u6210\u7684\u7ED3\u679C\u3002" }),
|
|
460
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("button", { type: "button", className: "sci-button sci-button-primary", onClick: () => onAction("explore"), children: "\u5F00\u59CB\u63A2\u7D22" }),
|
|
461
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Button, { onClick: () => onAction("import_results"), children: "\u5BFC\u5165\u5DF2\u6709\u7ED3\u679C" })
|
|
462
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "sci-grid", children: [
|
|
463
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "sci-col-8 sci-stack", children: [
|
|
464
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(Panel, { title: "\u6838\u5FC3\u7814\u7A76\u7ED3\u8BBA", subtitle: paper.core.confirmed ? "\u5F53\u524D\u4FEE\u8BA2\u5DF2\u786E\u8BA4" : "\u5019\u9009\u7ED3\u8BBA\u4ECD\u5F85\u786E\u8BA4", action: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Badge, { tone: paper.core.confirmed ? "good" : "warn", children: paper.core.confirmed ? "\u5DF2\u786E\u8BA4" : "\u5F85\u786E\u8BA4" }), children: [
|
|
465
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("h2", { className: "sci-title", children: paper.core.title || "\u5C1A\u672A\u547D\u540D" }),
|
|
466
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("p", { className: "sci-copy", children: paper.core.claim || "\u5F53\u524D\u8FD8\u6CA1\u6709\u6838\u5FC3\u7ED3\u8BBA\u5019\u9009\u3002\u4F60\u53EF\u4EE5\u5148\u751F\u6210\u6587\u7AE0\u7ED3\u6784\u3002" }),
|
|
467
|
+
paper.core.innovation && /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("p", { className: "sci-small", style: { marginTop: 10 }, children: [
|
|
468
|
+
"\u521B\u65B0\u70B9\uFF1A",
|
|
469
|
+
paper.core.innovation
|
|
470
|
+
] }),
|
|
471
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "sci-result-actions", children: [
|
|
472
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Button, { primary: true, onClick: () => onAction(paper.results.length ? "optimize_structure" : "generate_structure", "core"), children: paper.results.length ? "\u5728\u5BF9\u8BDD\u4E2D\u4F18\u5316\u7ED3\u6784" : "\u751F\u6210\u6587\u7AE0\u7ED3\u6784" }),
|
|
473
|
+
!paper.core.confirmed && paper.core.claim && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Button, { onClick: () => onConfirm("core", paper.core.revision, paper.core.contentHash), disabled: busy, children: "\u786E\u8BA4\u5F53\u524D\u4FEE\u8BA2" })
|
|
474
|
+
] })
|
|
475
|
+
] }),
|
|
476
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("section", { className: "sci-stack", children: [
|
|
477
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("h2", { className: "sci-desk-section-title", children: [
|
|
478
|
+
"\u7814\u7A76\u7ED3\u679C ",
|
|
479
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("small", { children: paper.totalResults })
|
|
480
|
+
] }),
|
|
481
|
+
paper.results.length ? /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "sci-stack", children: [
|
|
482
|
+
visibleResults.map((result) => /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(ResultCard, { result: { ...result, coreConfirmed: paper.core.confirmed }, onAction, onConfirm, busy }, result.id)),
|
|
483
|
+
paper.results.length > previewLimit && /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "sci-result-actions", children: [
|
|
484
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Button, { small: true, onClick: () => setShowAllResults((value) => !value), children: showAllResults ? "\u6536\u8D77\u7ED3\u679C\u5217\u8868" : `\u663E\u793A\u5168\u90E8 ${paper.results.length} \u9879` }),
|
|
485
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: "sci-small", children: showAllResults ? "\u5DF2\u5C55\u5F00\u5168\u90E8 Result\uFF1B\u53EF\u7528\u5BF9\u8BDD\u5408\u5E76\u6216\u6392\u9664\u5F31\u7ED3\u679C\u3002" : `\u9ED8\u8BA4\u663E\u793A\u524D ${previewLimit} \u9879\uFF08\u5F53\u524D ${paper.results.length} \u9879\uFF09\uFF1B\u8D85\u8FC7 5 \u4E2A\u662F\u8F6F\u63D0\u9192\uFF0C\u4E0D\u5F71\u54CD\u7EE7\u7EED\u5DE5\u4F5C\u3002` })
|
|
486
|
+
] })
|
|
487
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: "sci-small", children: "\u8FD8\u6CA1\u6709\u7814\u7A76\u7ED3\u679C\u8349\u6848\u3002\u751F\u6210\u6587\u7AE0\u7ED3\u6784\u540E\uFF0C\u5019\u9009\u7ED3\u679C\u4F1A\u663E\u793A\u5728\u8FD9\u91CC\u3002" })
|
|
488
|
+
] })
|
|
489
|
+
] }),
|
|
490
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("aside", { className: "sci-col-4 sci-stack", style: { alignSelf: "start" }, children: [
|
|
491
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(Panel, { title: "\u5EFA\u8BAE\u65B9\u5411", subtitle: "\u9636\u6BB5\u662F\u63CF\u8FF0\uFF0C\u4E0D\u662F\u5F3A\u5236\u6D41\u7A0B\uFF1B\u968F\u65F6\u53EF\u4EE5\u5728\u5BF9\u8BDD\u4E2D\u8DF3\u8DC3\u3001\u56DE\u9000\u6216\u5E76\u884C\u3002", children: [
|
|
492
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("h3", { style: { fontSize: 16, margin: "0 0 8px" }, children: nextStep.label }),
|
|
493
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Button, { primary: true, onClick: nextAction, children: nextStep.action ? "\u5728\u5BF9\u8BDD\u4E2D\u7EE7\u7EED" : "\u67E5\u770B" })
|
|
494
|
+
] }),
|
|
495
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Panel, { title: "\u8FD1\u671F\u6D3B\u52A8", children: view.team.activity.length ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: "sci-stack", children: view.team.activity.slice(0, 4).map((row) => /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "sci-small", children: [
|
|
496
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("b", { children: row.summary }),
|
|
497
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { children: [
|
|
498
|
+
row.at ? new Date(row.at).toLocaleString() : "\u65F6\u95F4\u672A\u8BB0\u5F55",
|
|
499
|
+
" \xB7 ",
|
|
500
|
+
row.status
|
|
501
|
+
] })
|
|
502
|
+
] }, row.id)) }) : /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: "sci-small", children: "\u6682\u65E0\u4EFB\u52A1\u56DE\u62A5\u8BB0\u5F55\u3002" }) }),
|
|
503
|
+
view.team.blockedTasks.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(Panel, { title: "\u5F53\u524D\u963B\u585E", subtitle: `${view.team.blockedTasks.length} \u9879\u4EFB\u52A1\u6709\u672A\u5B8C\u6210\u4F9D\u8D56`, children: [
|
|
504
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("ul", { className: "sci-note-list", children: view.team.blockedTasks.slice(0, 5).map((task) => /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("li", { children: [
|
|
505
|
+
task.subject || task.id,
|
|
506
|
+
"\uFF1A",
|
|
507
|
+
task.blockers.join("\uFF1B")
|
|
508
|
+
] }, task.id)) }),
|
|
509
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Button, { small: true, onClick: () => onNavigate("team"), children: "\u67E5\u770B\u56E2\u961F\u8FDB\u5C55" })
|
|
510
|
+
] })
|
|
511
|
+
] })
|
|
512
|
+
] }),
|
|
513
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "sci-result-actions", children: [
|
|
514
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Button, { small: true, onClick: () => onAction("literature"), children: "\u6269\u5C55\u6587\u732E\u63A2\u7D22" }),
|
|
515
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Button, { small: true, onClick: () => onAction("write"), children: "\u64B0\u5199\u8BBA\u6587" }),
|
|
516
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Button, { small: true, onClick: () => onNavigate("artifacts"), children: "\u67E5\u770B\u56FE\u8868\u4E0E\u6210\u679C" })
|
|
517
|
+
] })
|
|
518
|
+
] });
|
|
519
|
+
}
|
|
520
|
+
|
|
521
|
+
// client-src/workbench/TeamProgressPage.jsx
|
|
522
|
+
var import_react5 = __toESM(require("react"), 1);
|
|
523
|
+
var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
524
|
+
function graphLayout(tasks) {
|
|
525
|
+
const byId = new Map(tasks.map((task) => [task.id, task]));
|
|
526
|
+
const depthCache = /* @__PURE__ */ new Map();
|
|
527
|
+
const depthOf = (task, visiting = /* @__PURE__ */ new Set()) => {
|
|
528
|
+
if (depthCache.has(task.id)) return depthCache.get(task.id);
|
|
529
|
+
if (visiting.has(task.id)) return 0;
|
|
530
|
+
const nextVisiting = new Set(visiting).add(task.id);
|
|
531
|
+
const dependencies = Array.isArray(task.blockedBy) ? task.blockedBy.map((id) => byId.get(id)).filter(Boolean) : [];
|
|
532
|
+
const depth = dependencies.length ? Math.min(6, 1 + Math.max(...dependencies.map((dep) => depthOf(dep, nextVisiting)))) : 0;
|
|
533
|
+
depthCache.set(task.id, depth);
|
|
534
|
+
return depth;
|
|
535
|
+
};
|
|
536
|
+
const columns = [];
|
|
537
|
+
for (const task of tasks) {
|
|
538
|
+
const depth = depthOf(task);
|
|
539
|
+
columns[depth] ||= [];
|
|
540
|
+
columns[depth].push(task);
|
|
541
|
+
}
|
|
542
|
+
columns.forEach((column) => column?.sort((a, b) => String(a.id).localeCompare(String(b.id), void 0, { numeric: true })));
|
|
543
|
+
const position = /* @__PURE__ */ new Map();
|
|
544
|
+
columns.forEach((column, col) => column?.forEach((task, row) => position.set(task.id, { x: col * 228, y: row * 96 })));
|
|
545
|
+
const width = Math.max(228, columns.length * 228);
|
|
546
|
+
const height = Math.max(180, ...columns.map((col) => col?.length * 96 || 0));
|
|
547
|
+
return { columns, position, width, height, byId };
|
|
548
|
+
}
|
|
549
|
+
var STATE_TONE = { completed: "good", failed: "bad", blocked: "warn", in_progress: "default", claimed: "default", pending: "default" };
|
|
550
|
+
function TeamProgressPage({ view, openMemberSession, memberOpenAvailable }) {
|
|
551
|
+
const [mode, setMode] = (0, import_react5.useState)("graph");
|
|
552
|
+
const [memberError, setMemberError] = (0, import_react5.useState)(null);
|
|
553
|
+
const tasks = view.team.tasks;
|
|
554
|
+
const layout = (0, import_react5.useMemo)(() => graphLayout(tasks), [tasks]);
|
|
555
|
+
const openMember = async (member) => {
|
|
556
|
+
try {
|
|
557
|
+
await openMemberSession(member);
|
|
558
|
+
setMemberError(null);
|
|
559
|
+
} catch (error) {
|
|
560
|
+
setMemberError({ member, message: error?.message || "\u65E0\u6CD5\u6253\u5F00\u8BE5\u6210\u5458\u4F1A\u8BDD\u3002" });
|
|
561
|
+
}
|
|
562
|
+
};
|
|
563
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "sci-stack", children: [
|
|
564
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "sci-stat-row", children: [
|
|
565
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "sci-stat", children: [
|
|
566
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("strong", { children: view.team.counts.running }),
|
|
567
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { children: "\u8FD0\u884C\u4E2D" })
|
|
568
|
+
] }),
|
|
569
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "sci-stat", children: [
|
|
570
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("strong", { children: view.team.counts.waiting }),
|
|
571
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { children: "\u7B49\u5F85\u4E2D" })
|
|
572
|
+
] }),
|
|
573
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "sci-stat", children: [
|
|
574
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("strong", { children: view.team.counts.completed }),
|
|
575
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { children: "\u5DF2\u5B8C\u6210" })
|
|
576
|
+
] }),
|
|
577
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "sci-stat", "data-tone": view.team.counts.blocked > 0 ? "warn" : "default", style: view.team.counts.blocked > 0 ? { color: "var(--dsh-warning, #b7791f)" } : void 0, children: [
|
|
578
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("strong", { children: view.team.counts.blocked }),
|
|
579
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { children: "\u53D7\u963B" })
|
|
580
|
+
] })
|
|
581
|
+
] }),
|
|
582
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(Panel, { title: "\u7814\u7A76\u56E2\u961F", subtitle: "\u6210\u5458\u72B6\u6001\u548C\u5F53\u524D\u8D1F\u8D23\u7684\u4EFB\u52A1\u3002\u70B9\u51FB\u6210\u5458\u53EF\u67E5\u770B\u5BF9\u5E94\u4F1A\u8BDD\u3002", children: [
|
|
583
|
+
memberError && /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(StatusMessage, { tone: "error", children: [
|
|
584
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("b", { children: [
|
|
585
|
+
memberError.member.name || "\u6210\u5458",
|
|
586
|
+
"\u4F1A\u8BDD\u672A\u80FD\u6253\u5F00\u3002"
|
|
587
|
+
] }),
|
|
588
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { children: memberError.message }),
|
|
589
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "sci-result-actions", children: [
|
|
590
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Button, { small: true, onClick: () => openMember(memberError.member), children: "\u91CD\u8BD5" }),
|
|
591
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Button, { small: true, onClick: () => setMemberError(null), children: "\u5173\u95ED\u63D0\u793A" })
|
|
592
|
+
] })
|
|
593
|
+
] }),
|
|
594
|
+
view.team.members.length ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: "sci-members", children: view.team.members.map((member) => /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "sci-member", children: [
|
|
595
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "sci-result-top", children: [
|
|
596
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("h3", { children: view.experts.roles?.[member.role]?.label || member.role || member.name }),
|
|
597
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Badge, { tone: member.liveStatusTone, children: member.liveStatusLabel })
|
|
598
|
+
] }),
|
|
599
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("p", { children: member.currentTasks.length ? member.currentTasks.map((task) => task.subject || task.id).join("\uFF1B") : "\u5F53\u524D\u6CA1\u6709\u8FDB\u884C\u4E2D\u7684\u4EFB\u52A1" }),
|
|
600
|
+
member.lastReport && /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("p", { children: [
|
|
601
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("b", { children: "\u6700\u8FD1\u56DE\u62A5\uFF1A" }),
|
|
602
|
+
member.lastReport
|
|
603
|
+
] }),
|
|
604
|
+
memberOpenAvailable && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: "sci-result-actions", children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Button, { small: true, onClick: () => openMember(member), children: "\u6253\u5F00\u6210\u5458\u4F1A\u8BDD" }) })
|
|
605
|
+
] }, member.name)) }) : /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(EmptyState, { title: "\u56E2\u961F\u5C1A\u672A\u542F\u52A8", children: "\u5F00\u59CB\u7EC6\u5316\u5DF2\u786E\u8BA4\u7684\u7814\u7A76\u7ED3\u679C\u540E\uFF0C\u56E2\u961F\u4EFB\u52A1\u4F1A\u663E\u793A\u5728\u8FD9\u91CC\u3002" })
|
|
606
|
+
] }),
|
|
607
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Panel, { title: "\u6267\u884C\u4EFB\u52A1", subtitle: "\u4F9D\u8D56\u7EBF\u4ECE\u4E0A\u6E38\u4EFB\u52A1\u6307\u5411\u7B49\u5F85\u5B83\u5B8C\u6210\u7684\u4EFB\u52A1\u3002", action: /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "sci-result-actions", children: [
|
|
608
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Button, { small: true, primary: mode === "graph", "aria-pressed": mode === "graph", onClick: () => setMode("graph"), children: "\u4F9D\u8D56\u56FE" }),
|
|
609
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Button, { small: true, primary: mode === "list", "aria-pressed": mode === "list", onClick: () => setMode("list"), children: "\u5217\u8868" })
|
|
610
|
+
] }), children: tasks.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: "sci-small", children: "\u8FD8\u6CA1\u6709\u8BB0\u5F55\u7684\u6267\u884C\u4EFB\u52A1\u3002" }) : mode === "list" ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: "sci-task-list", children: tasks.map((task) => /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "sci-task-row", children: [
|
|
611
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { children: [
|
|
612
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("b", { children: task.subject || task.id }),
|
|
613
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: "sci-small", children: task.description || task.resultIds.join("\u3001") || "\u672A\u5173\u8054\u7814\u7A76\u7ED3\u679C" })
|
|
614
|
+
] }),
|
|
615
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { children: task.assignee || "\u672A\u5206\u914D" }),
|
|
616
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Badge, { tone: STATE_TONE[task.status], children: task.label }),
|
|
617
|
+
task.blockers.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "sci-small", children: [
|
|
618
|
+
"\u963B\u585E\uFF1A",
|
|
619
|
+
task.blockers.join("\uFF1B")
|
|
620
|
+
] })
|
|
621
|
+
] }, task.id)) }) : /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: "sci-task-graph", children: /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "sci-task-canvas", style: { width: layout.width, height: layout.height }, children: [
|
|
622
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("svg", { className: "sci-task-lines", width: layout.width, height: layout.height, viewBox: `0 0 ${layout.width} ${layout.height}`, "aria-hidden": "true", children: [
|
|
623
|
+
tasks.flatMap((task) => (task.blockedBy || []).map((id) => {
|
|
624
|
+
const from = layout.position.get(id), to = layout.position.get(task.id);
|
|
625
|
+
if (!from || !to) return null;
|
|
626
|
+
const startX = from.x + 188, startY = from.y + 36, endX = to.x, endY = to.y + 36, bend = Math.max(22, (endX - startX) / 2);
|
|
627
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("path", { className: "sci-task-line", d: `M ${startX} ${startY} C ${startX + bend} ${startY}, ${endX - bend} ${endY}, ${endX} ${endY}`, markerEnd: "url(#sci-arrow)" }, `${id}-${task.id}`);
|
|
628
|
+
})),
|
|
629
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("defs", { children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("marker", { id: "sci-arrow", markerWidth: "7", markerHeight: "7", refX: "6", refY: "3.5", orient: "auto", children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("path", { d: "M0,0 L7,3.5 L0,7", fill: "none", stroke: "currentColor" }) }) })
|
|
630
|
+
] }),
|
|
631
|
+
tasks.map((task) => {
|
|
632
|
+
const point = layout.position.get(task.id);
|
|
633
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "sci-task-node", style: { left: point.x, top: point.y }, children: [
|
|
634
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("strong", { children: task.subject || task.id }),
|
|
635
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("span", { children: [
|
|
636
|
+
task.assignee || "\u672A\u5206\u914D",
|
|
637
|
+
" \xB7 ",
|
|
638
|
+
task.label
|
|
639
|
+
] }),
|
|
640
|
+
task.resultIds.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { children: task.resultIds.join("\u3001") })
|
|
641
|
+
] }, task.id);
|
|
642
|
+
})
|
|
643
|
+
] }) }) }),
|
|
644
|
+
view.team.blockedTasks.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Panel, { title: "\u53D7\u963B\u4E8B\u9879", subtitle: "\u53EA\u5217\u51FA\u660E\u786E\u7684\u672A\u5B8C\u6210\u4F9D\u8D56\u6216\u88AB\u6807\u8BB0\u4E3A\u963B\u585E\u7684\u4EFB\u52A1\u3002", children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: "sci-task-list", children: view.team.blockedTasks.map((task) => /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "sci-task-row", children: [
|
|
645
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("b", { children: task.subject || task.id }),
|
|
646
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: "sci-small", children: task.blockers.join("\uFF1B") }),
|
|
647
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Badge, { tone: "warn", children: "\u53D7\u963B" })
|
|
648
|
+
] }, task.id)) }) }),
|
|
649
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Panel, { title: "\u6700\u8FD1\u56DE\u62A5", children: view.team.activity.length ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: "sci-task-list", children: view.team.activity.map((item) => /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "sci-task-row", children: [
|
|
650
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("b", { children: item.summary }),
|
|
651
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: "sci-small", children: item.resultIds.length ? `\u5173\u8054\u7ED3\u679C\uFF1A${item.resultIds.join("\u3001")}` : "\u672A\u5173\u8054\u7ED3\u679C" }),
|
|
652
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: "sci-small", children: item.at ? new Date(item.at).toLocaleString() : "\u65F6\u95F4\u672A\u8BB0\u5F55" })
|
|
653
|
+
] }, item.id)) }) : /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: "sci-small", children: "\u6682\u65E0\u6210\u5458\u56DE\u62A5\u3002" }) })
|
|
654
|
+
] });
|
|
655
|
+
}
|
|
656
|
+
|
|
657
|
+
// client-src/workbench/ArtifactsPage.jsx
|
|
658
|
+
var import_react6 = __toESM(require("react"), 1);
|
|
659
|
+
|
|
660
|
+
// client-src/workbench/bounded-list.js
|
|
661
|
+
function visibleItems(items, expanded = false, limit = 5) {
|
|
662
|
+
const rows = Array.isArray(items) ? items : [];
|
|
663
|
+
const safeLimit = Number.isFinite(limit) && limit >= 0 ? Math.floor(limit) : 5;
|
|
664
|
+
return expanded ? rows : rows.slice(0, safeLimit);
|
|
665
|
+
}
|
|
666
|
+
|
|
667
|
+
// client-src/workbench/ArtifactsPage.jsx
|
|
668
|
+
var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
669
|
+
var ARTIFACT_PREVIEW_LIMIT = 5;
|
|
670
|
+
function timestampLabel(value) {
|
|
671
|
+
const time = Number(value || 0);
|
|
672
|
+
return Number.isFinite(time) && time > 0 ? new Date(time).toLocaleString() : "\u65F6\u95F4\u672A\u8BB0\u5F55";
|
|
673
|
+
}
|
|
674
|
+
function retryUrl(url, attempt) {
|
|
675
|
+
if (!url || !attempt) return url;
|
|
676
|
+
return `${url}${url.includes("?") ? "&" : "?"}previewAttempt=${attempt}`;
|
|
677
|
+
}
|
|
678
|
+
function ImagePreview({ figure, compact = false }) {
|
|
679
|
+
const [failed, setFailed] = (0, import_react6.useState)(false);
|
|
680
|
+
const [loaded, setLoaded] = (0, import_react6.useState)(false);
|
|
681
|
+
const [attempt, setAttempt] = (0, import_react6.useState)(0);
|
|
682
|
+
const retry = () => {
|
|
683
|
+
setFailed(false);
|
|
684
|
+
setLoaded(false);
|
|
685
|
+
setAttempt((value) => value + 1);
|
|
686
|
+
};
|
|
687
|
+
const frameStyle = {
|
|
688
|
+
width: "100%",
|
|
689
|
+
minHeight: compact ? 180 : 260,
|
|
690
|
+
display: "flex",
|
|
691
|
+
alignItems: "center",
|
|
692
|
+
justifyContent: "center",
|
|
693
|
+
background: "repeating-conic-gradient(rgba(127,127,127,.10) 0% 25%, transparent 0% 50%) 50% / 22px 22px",
|
|
694
|
+
border: "1px solid var(--dsh-border, rgba(127,127,127,.3))",
|
|
695
|
+
borderRadius: 6,
|
|
696
|
+
overflow: "hidden",
|
|
697
|
+
position: "relative"
|
|
698
|
+
};
|
|
699
|
+
if (!figure.previewable || !figure.url || failed) {
|
|
700
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "sci-image-fallback sci-empty", role: failed ? "alert" : "status", style: { ...frameStyle, flexDirection: "column", gap: 6 }, children: [
|
|
701
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("b", { children: failed ? "\u56FE\u7247\u672A\u80FD\u52A0\u8F7D" : "\u6B64\u6587\u4EF6\u4E0D\u9002\u5408\u5185\u5D4C\u9884\u89C8" }),
|
|
702
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: "sci-small", children: failed ? "\u6587\u4EF6\u53EF\u80FD\u4E0D\u5B58\u5728\u3001\u683C\u5F0F\u4E0D\u53D7\u6D4F\u89C8\u5668\u652F\u6301\uFF0C\u6216\u5F53\u524D\u5DE5\u4F5C\u533A\u65E0\u6CD5\u8BFB\u53D6\u3002" : figure.path?.split(".").pop()?.toUpperCase() || "\u6587\u4EF6" }),
|
|
703
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "sci-result-actions", children: [
|
|
704
|
+
figure.previewable && figure.url && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Button, { small: true, onClick: retry, children: "\u91CD\u65B0\u52A0\u8F7D" }),
|
|
705
|
+
figure.url && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("a", { className: "sci-button sci-button-small", href: figure.url, target: "_blank", rel: "noreferrer", children: "\u6253\u5F00\u539F\u6587\u4EF6" })
|
|
706
|
+
] })
|
|
707
|
+
] });
|
|
708
|
+
}
|
|
709
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { style: frameStyle, "data-loaded": loaded ? "true" : "false", children: [
|
|
710
|
+
!loaded && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: "sci-small", style: { position: "absolute", top: 6, left: 8, opacity: 0.7 }, children: "\u52A0\u8F7D\u4E2D\u2026" }),
|
|
711
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
712
|
+
"img",
|
|
713
|
+
{
|
|
714
|
+
className: compact ? "sci-figure-image-compact" : "sci-figure-image-large",
|
|
715
|
+
src: retryUrl(figure.url, attempt),
|
|
716
|
+
alt: figure.title,
|
|
717
|
+
loading: compact ? "lazy" : void 0,
|
|
718
|
+
onLoad: () => setLoaded(true),
|
|
719
|
+
onError: () => setFailed(true),
|
|
720
|
+
style: { maxWidth: "100%", maxHeight: compact ? 180 : "70vh", display: "block", objectFit: "contain" }
|
|
721
|
+
},
|
|
722
|
+
attempt
|
|
723
|
+
)
|
|
724
|
+
] });
|
|
725
|
+
}
|
|
726
|
+
function FigureCard({ figure, previous, onOpen, onCompare }) {
|
|
727
|
+
const audit2 = figure.audit?.overallStatus || figure.audit?.status;
|
|
728
|
+
const manual = audit2 === "approved" ? "\u4EBA\u5DE5\u7EC8\u5BA1\u5DF2\u6279\u51C6" : audit2 === "ready-for-manual-review" ? "\u7B49\u5F85\u4EBA\u5DE5\u7EC8\u5BA1" : audit2 ? `\u6295\u7A3F\u524D\u68C0\uFF1A${audit2}` : "\u5C1A\u65E0\u6295\u7A3F\u524D\u68C0\u8BB0\u5F55";
|
|
729
|
+
const dimensions = figure.width && figure.height ? `${figure.width} \xD7 ${figure.height}${figure.unit ? ` ${figure.unit}` : ""}` : figure.dimensions || "\u5C3A\u5BF8\u672A\u8BB0\u5F55";
|
|
730
|
+
const previousLabel = figure.previousVersionRelation === "recorded" ? "\u4E0A\u4E00\u767B\u8BB0\u7248\u672C" : "\u53EF\u80FD\u7684\u4E0A\u4E00\u6761\u540C\u540D\u8BB0\u5F55\uFF08\u63A8\u6D4B\uFF09";
|
|
731
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("article", { className: "sci-figure", children: [
|
|
732
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "sci-figure-preview", role: "group", "aria-label": `\u56FE\u4EF6\u9884\u89C8\uFF1A${figure.title}`, style: { width: "100%", padding: 0, color: "inherit", textAlign: "left", font: "inherit" }, children: [
|
|
733
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(ImagePreview, { figure, compact: true }),
|
|
734
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "sci-figure-copy", children: [
|
|
735
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("strong", { children: figure.title }),
|
|
736
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("span", { children: [
|
|
737
|
+
figure.resultId || "\u672A\u5173\u8054\u7814\u7A76\u7ED3\u679C",
|
|
738
|
+
" \xB7 ",
|
|
739
|
+
figure.version ? `\u7248\u672C ${figure.version}` : "\u7248\u672C\u672A\u8BB0\u5F55",
|
|
740
|
+
figure.path ? ` \xB7 ${figure.path.split(/[\/]/).pop()}` : ""
|
|
741
|
+
] }),
|
|
742
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("span", { children: [
|
|
743
|
+
dimensions,
|
|
744
|
+
" \xB7 ",
|
|
745
|
+
manual
|
|
746
|
+
] })
|
|
747
|
+
] })
|
|
748
|
+
] }),
|
|
749
|
+
previous && /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "sci-figure-history", children: [
|
|
750
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("span", { children: [
|
|
751
|
+
previousLabel,
|
|
752
|
+
"\uFF1A",
|
|
753
|
+
previous.version ? `\u7248\u672C ${previous.version}` : previous.title
|
|
754
|
+
] }),
|
|
755
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { "aria-hidden": "true", children: " \xB7 " }),
|
|
756
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { children: timestampLabel(previous.registeredAt || previous.createdAt) })
|
|
757
|
+
] }),
|
|
758
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "sci-result-actions sci-figure-actions", children: [
|
|
759
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Button, { small: true, disabled: !figure.previewable, title: figure.previewable ? void 0 : "\u8BE5\u6587\u4EF6\u4E0D\u652F\u6301\u5185\u5D4C\u9884\u89C8\uFF0C\u8BF7\u76F4\u63A5\u6253\u5F00\u6587\u4EF6", onClick: () => onOpen(figure), children: "\u653E\u5927\u67E5\u770B" }),
|
|
760
|
+
previous && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Button, { small: true, onClick: () => onCompare({ current: figure, previous }), children: figure.previousVersionRelation === "recorded" ? "\u5BF9\u6BD4\u4E0A\u4E00\u7248\u672C" : "\u5BF9\u6BD4\u4E0A\u4E00\u6761\u8BB0\u5F55" }),
|
|
761
|
+
figure.url && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("a", { className: "sci-button sci-button-small", href: figure.url, target: "_blank", rel: "noreferrer", children: "\u6253\u5F00\u6587\u4EF6" })
|
|
762
|
+
] })
|
|
763
|
+
] });
|
|
764
|
+
}
|
|
765
|
+
function FileGroup({ group }) {
|
|
766
|
+
const [expanded, setExpanded] = (0, import_react6.useState)(false);
|
|
767
|
+
const items = visibleItems(group.items, expanded, ARTIFACT_PREVIEW_LIMIT);
|
|
768
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "sci-group", children: [
|
|
769
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("h3", { children: [
|
|
770
|
+
group.label,
|
|
771
|
+
" ",
|
|
772
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("span", { className: "sci-small", children: [
|
|
773
|
+
"\u5171 ",
|
|
774
|
+
group.items.length,
|
|
775
|
+
" \u9879"
|
|
776
|
+
] })
|
|
777
|
+
] }),
|
|
778
|
+
group.items.length ? /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_jsx_runtime5.Fragment, { children: [
|
|
779
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "sci-file-list", children: items.map((file) => /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "sci-file", children: [
|
|
780
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { children: [
|
|
781
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("strong", { children: file.path.split(/[\\/]/).pop() || file.path }),
|
|
782
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: "sci-small", children: file.path })
|
|
783
|
+
] }),
|
|
784
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("a", { className: "sci-button sci-button-small", href: file.url, target: "_blank", rel: "noreferrer", children: "\u6253\u5F00" })
|
|
785
|
+
] }, file.path)) }),
|
|
786
|
+
group.items.length > ARTIFACT_PREVIEW_LIMIT && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("button", { type: "button", className: "sci-button sci-button-small", "aria-expanded": expanded, onClick: () => setExpanded((value) => !value), children: expanded ? "\u6536\u8D77" : `\u67E5\u770B\u5168\u90E8 ${group.items.length} \u9879` })
|
|
787
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "sci-small", children: [
|
|
788
|
+
"\u6682\u65E0",
|
|
789
|
+
group.label,
|
|
790
|
+
"\u3002"
|
|
791
|
+
] })
|
|
792
|
+
] });
|
|
793
|
+
}
|
|
794
|
+
function ReviewGroup({ reviews }) {
|
|
795
|
+
const [expanded, setExpanded] = (0, import_react6.useState)(false);
|
|
796
|
+
const items = visibleItems(reviews, expanded, ARTIFACT_PREVIEW_LIMIT);
|
|
797
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "sci-group", children: [
|
|
798
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("h3", { children: [
|
|
799
|
+
"\u5BA1\u67E5\u8BB0\u5F55 ",
|
|
800
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("span", { className: "sci-small", children: [
|
|
801
|
+
"\u5171 ",
|
|
802
|
+
reviews.length,
|
|
803
|
+
" \u6761"
|
|
804
|
+
] })
|
|
805
|
+
] }),
|
|
806
|
+
reviews.length ? /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_jsx_runtime5.Fragment, { children: [
|
|
807
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "sci-task-list", children: items.map((review) => /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "sci-task-row", children: [
|
|
808
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { children: [
|
|
809
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("b", { children: review.resultTitle || review.scope || review.runId || "\u4E3B\u5F20\u5BA1\u67E5" }),
|
|
810
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "sci-small", children: review.message || review.summary || "\u6458\u8981\u672A\u63D0\u4F9B" })
|
|
811
|
+
] }),
|
|
812
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Badge, { tone: review.severity === "fail" ? "bad" : review.severity === "warn" ? "warn" : "default", children: review.severity || "\u72B6\u6001\u5F85\u6838\u5BF9" })
|
|
813
|
+
] }, review.runId || review.id || JSON.stringify(review))) }),
|
|
814
|
+
reviews.length > ARTIFACT_PREVIEW_LIMIT && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("button", { type: "button", className: "sci-button sci-button-small", "aria-expanded": expanded, onClick: () => setExpanded((value) => !value), children: expanded ? "\u6536\u8D77" : `\u67E5\u770B\u5168\u90E8 ${reviews.length} \u6761` })
|
|
815
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "sci-small", children: "\u6682\u65E0\u5BA1\u67E5\u8BB0\u5F55\u3002" })
|
|
816
|
+
] });
|
|
817
|
+
}
|
|
818
|
+
function FigureDialog({ figure, onClose }) {
|
|
819
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "sci-modal-backdrop", role: "presentation", onMouseDown: (event) => {
|
|
820
|
+
if (event.target === event.currentTarget) onClose();
|
|
821
|
+
}, children: /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("section", { className: "sci-modal", role: "dialog", "aria-modal": "true", "aria-label": `\u56FE\u4EF6\u9884\u89C8\uFF1A${figure.title}`, children: [
|
|
822
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "sci-panel-heading", children: [
|
|
823
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { children: [
|
|
824
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("h2", { children: figure.title }),
|
|
825
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("p", { children: figure.resultId || "\u672A\u5173\u8054\u7814\u7A76\u7ED3\u679C" })
|
|
826
|
+
] }),
|
|
827
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Button, { onClick: onClose, children: "\u5173\u95ED" })
|
|
828
|
+
] }),
|
|
829
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(ImagePreview, { figure }),
|
|
830
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "sci-small", style: { marginTop: 12 }, children: [
|
|
831
|
+
figure.version ? `\u767B\u8BB0\u7248\u672C ${figure.version}` : "\u767B\u8BB0\u7248\u672C\u672A\u8BB0\u5F55",
|
|
832
|
+
" \xB7 ",
|
|
833
|
+
timestampLabel(figure.registeredAt || figure.createdAt),
|
|
834
|
+
" \xB7 ",
|
|
835
|
+
figure.path || "\u6587\u4EF6\u8DEF\u5F84\u672A\u8BB0\u5F55"
|
|
836
|
+
] })
|
|
837
|
+
] }) });
|
|
838
|
+
}
|
|
839
|
+
function FigureCompareDialog({ comparison, onClose }) {
|
|
840
|
+
const { current, previous } = comparison;
|
|
841
|
+
const inferred = current.previousVersionRelation !== "recorded";
|
|
842
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "sci-modal-backdrop", role: "presentation", onMouseDown: (event) => {
|
|
843
|
+
if (event.target === event.currentTarget) onClose();
|
|
844
|
+
}, children: /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("section", { className: "sci-modal sci-modal-wide", role: "dialog", "aria-modal": "true", "aria-label": `\u56FE\u4EF6\u7248\u672C\u5BF9\u6BD4\uFF1A${current.title}`, children: [
|
|
845
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "sci-panel-heading", children: [
|
|
846
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { children: [
|
|
847
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("h2", { children: "\u56FE\u4EF6\u7248\u672C\u5BF9\u6BD4" }),
|
|
848
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("p", { children: inferred ? "\u4E0A\u4E00\u6761\u8BB0\u5F55\u6309\u540C\u4E00\u7814\u7A76\u7ED3\u679C\u3001\u540C\u540D\u6587\u4EF6\u548C\u65F6\u95F4\u987A\u5E8F\u63A8\u6D4B\uFF1B\u540E\u7AEF\u672A\u8BB0\u5F55\u7248\u672C\u5173\u7CFB\u3002" : "\u4E0A\u4E00\u7248\u672C\u6765\u81EA\u540E\u7AEF\u767B\u8BB0\u7684 prevId \u7248\u672C\u94FE\u3002" })
|
|
849
|
+
] }),
|
|
850
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Button, { onClick: onClose, children: "\u5173\u95ED" })
|
|
851
|
+
] }),
|
|
852
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "sci-compare-grid", style: { display: "grid", gridTemplateColumns: "repeat(auto-fit,minmax(260px,1fr))", gap: 18 }, children: [previous, current].map((figure, index) => /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("article", { className: "sci-compare-item", children: [
|
|
853
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("h3", { children: index === 0 ? inferred ? "\u8F83\u65E9\u7684\u540C\u540D\u8BB0\u5F55\uFF08\u63A8\u6D4B\uFF09" : "\u4E0A\u4E00\u767B\u8BB0\u7248\u672C" : "\u5F53\u524D\u8BB0\u5F55" }),
|
|
854
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "sci-small", children: [
|
|
855
|
+
figure.version ? `\u7248\u672C ${figure.version}` : "\u7248\u672C\u672A\u8BB0\u5F55",
|
|
856
|
+
" \xB7 ",
|
|
857
|
+
timestampLabel(figure.registeredAt || figure.createdAt)
|
|
858
|
+
] }),
|
|
859
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(ImagePreview, { figure }),
|
|
860
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "sci-small", children: figure.path || "\u6587\u4EF6\u8DEF\u5F84\u672A\u8BB0\u5F55" })
|
|
861
|
+
] }, figure.id || figure.path)) })
|
|
862
|
+
] }) });
|
|
863
|
+
}
|
|
864
|
+
function ArtifactsPage({ view, onAction }) {
|
|
865
|
+
const [preview, setPreview] = (0, import_react6.useState)(null);
|
|
866
|
+
const [comparison, setComparison] = (0, import_react6.useState)(null);
|
|
867
|
+
const [kind, setKind] = (0, import_react6.useState)("all");
|
|
868
|
+
const [resultId, setResultId] = (0, import_react6.useState)("all");
|
|
869
|
+
const indexed = (view.artifacts.index || []).filter((item) => (kind === "all" || item.kind === kind) && (resultId === "all" || item.resultIds.includes(resultId)));
|
|
870
|
+
const figures = view.artifacts.figures;
|
|
871
|
+
const figureById = new Map(figures.filter((figure) => figure.id).map((figure) => [figure.id, figure]));
|
|
872
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "sci-stack", children: [
|
|
873
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Panel, { title: "\u56FE\u8868", subtitle: "\u56FE\u4EF6\u4F1A\u5728\u6D4F\u89C8\u5668\u5B9E\u9645\u52A0\u8F7D\u6210\u529F\u540E\u663E\u793A\uFF1B\u52A0\u8F7D\u5931\u8D25\u65F6\u53EF\u91CD\u8BD5\u6216\u76F4\u63A5\u6253\u5F00\u6587\u4EF6\u3002\u767B\u8BB0\u8FC7\u7248\u672C\u5173\u7CFB\u7684\u56FE\u4EF6\u53EF\u5E76\u6392\u6BD4\u8F83\u3002", action: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Button, { primary: true, onClick: () => onAction("draw", view.paper.results.find((item) => item.confirmed)?.id || null), disabled: !view.paper.results.some((item) => item.confirmed && view.paper.core.confirmed), title: !view.paper.results.some((item) => item.confirmed && view.paper.core.confirmed) ? "\u5148\u786E\u8BA4\u6838\u5FC3\u7ED3\u8BBA\u548C\u4E00\u9879\u7814\u7A76\u7ED3\u679C\uFF0C\u518D\u5EFA\u7ACB\u6B63\u5F0F\u7ED8\u56FE\u8BA1\u5212\u3002" : void 0, children: "\u57FA\u4E8E\u73B0\u6709\u7ED3\u679C\u5F00\u59CB\u7ED8\u56FE" }), children: figures.length ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "sci-gallery", children: figures.map((figure) => /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(FigureCard, { figure, previous: figureById.get(figure.previousVersionId), onOpen: setPreview, onCompare: setComparison }, figure.id || figure.path)) }) : /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(EmptyState, { title: "\u8FD8\u6CA1\u6709\u767B\u8BB0\u56FE\u4EF6", children: "\u57FA\u4E8E\u5DF2\u786E\u8BA4\u7684\u6838\u5FC3\u7ED3\u8BBA\u548C\u7814\u7A76\u7ED3\u679C\u5EFA\u7ACB\u7ED8\u56FE\u8BA1\u5212\u540E\uFF0C\u56FE\u4EF6\u4F1A\u51FA\u73B0\u5728\u8FD9\u91CC\u3002" }) }),
|
|
874
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(Panel, { title: "\u9879\u76EE\u7D22\u5F15", subtitle: "\u53EA\u663E\u793A\u5F53\u524D\u9879\u76EE\u5DF2\u767B\u8BB0\u7684\u6587\u4EF6\u3002\u5B58\u5728\u6587\u4EF6\u4E0D\u7B49\u4E8E\u8BC1\u636E\u5DF2\u6838\u9A8C\u3002", children: [
|
|
875
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "sci-result-actions", children: [
|
|
876
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("select", { "aria-label": "\u6309\u7C7B\u578B\u7B5B\u9009", value: kind, onChange: (event) => setKind(event.target.value), children: [
|
|
877
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("option", { value: "all", children: "\u5168\u90E8\u7C7B\u578B" }),
|
|
878
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("option", { value: "data", children: "\u6570\u636E" }),
|
|
879
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("option", { value: "code", children: "\u4EE3\u7801" }),
|
|
880
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("option", { value: "figure", children: "\u56FE\u4EF6" }),
|
|
881
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("option", { value: "manuscript", children: "\u7A3F\u6BB5" })
|
|
882
|
+
] }),
|
|
883
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("select", { "aria-label": "\u6309 Result \u7B5B\u9009", value: resultId, onChange: (event) => setResultId(event.target.value), children: [
|
|
884
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("option", { value: "all", children: "\u5168\u90E8 Result" }),
|
|
885
|
+
view.paper.results.map((result) => /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("option", { value: result.id, children: result.title }, result.id))
|
|
886
|
+
] })
|
|
887
|
+
] }),
|
|
888
|
+
indexed.length ? indexed.map((item) => /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "sci-file", children: [
|
|
889
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { children: [
|
|
890
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("strong", { children: item.summary || item.id }),
|
|
891
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("span", { className: "sci-small", children: [
|
|
892
|
+
item.kind,
|
|
893
|
+
" \xB7 ",
|
|
894
|
+
item.source,
|
|
895
|
+
" \xB7 ",
|
|
896
|
+
item.status === "missing" ? "\u5DF2\u5931\u8054" : "\u53EF\u5B9A\u4F4D"
|
|
897
|
+
] })
|
|
898
|
+
] }),
|
|
899
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Button, { small: true, onClick: () => onAction("structure", { objectId: item.resultIds[0] || "core", revision: view.paper.results.find((result) => result.id === item.resultIds[0])?.revision }), children: "\u5728\u5BF9\u8BDD\u4E2D\u5F15\u7528" })
|
|
900
|
+
] }, item.id)) : /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "sci-small", children: "\u5F53\u524D\u7B5B\u9009\u4E0B\u6CA1\u6709\u767B\u8BB0\u6210\u679C\u3002" })
|
|
901
|
+
] }),
|
|
902
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(Panel, { title: "\u5176\u4ED6\u6210\u679C", subtitle: "\u6309\u7528\u9014\u5206\u7EC4\u6D4F\u89C8\u5DE5\u4F5C\u533A\u6587\u4EF6\u3002", children: [
|
|
903
|
+
view.artifacts.groups.filter((group) => group.id !== "figures").map((group) => /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(FileGroup, { group }, group.id)),
|
|
904
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(ReviewGroup, { reviews: view.artifacts.reviews })
|
|
905
|
+
] }),
|
|
906
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "sci-result-actions", children: [
|
|
907
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Button, { onClick: () => onAction("write"), children: "\u64B0\u5199\u8BBA\u6587" }),
|
|
908
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Button, { onClick: () => onAction("slides"), children: "\u5236\u4F5C\u6C47\u62A5 PPT" })
|
|
909
|
+
] }),
|
|
910
|
+
preview && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(FigureDialog, { figure: preview, onClose: () => setPreview(null) }, preview.id || preview.path),
|
|
911
|
+
comparison && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(FigureCompareDialog, { comparison, onClose: () => setComparison(null) }, `${comparison.previous.id}:${comparison.current.id}`)
|
|
912
|
+
] });
|
|
913
|
+
}
|
|
914
|
+
|
|
915
|
+
// client-src/workbench/ExpertSetupPage.jsx
|
|
916
|
+
var import_react7 = __toESM(require("react"), 1);
|
|
917
|
+
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);
|
|
952
|
+
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}` });
|
|
961
|
+
} finally {
|
|
962
|
+
setBusy(null);
|
|
963
|
+
}
|
|
964
|
+
};
|
|
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" })
|
|
1036
|
+
] }),
|
|
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)) }) })
|
|
1094
|
+
] });
|
|
1095
|
+
}
|
|
1096
|
+
|
|
1097
|
+
// client-src/project/use-project-binding.js
|
|
1098
|
+
var import_react8 = require("react");
|
|
1099
|
+
|
|
1100
|
+
// client-src/project/project-binding.js
|
|
1101
|
+
function createProjectBinding({ getSessionId, fetchImpl, eventSourceImpl, onLog } = {}) {
|
|
1102
|
+
const fetchJson = fetchImpl || ((url, opts) => fetch(url, { credentials: "same-origin", ...opts }).then(async (r) => ({ ok: r.ok, status: r.status, body: await r.json().catch(() => null) })));
|
|
1103
|
+
const fetchImplFallback = fetchJson;
|
|
1104
|
+
const _fetch = fetchJson;
|
|
1105
|
+
const ES = eventSourceImpl || (typeof EventSource !== "undefined" ? EventSource : null);
|
|
1106
|
+
let generation = 0;
|
|
1107
|
+
let disposed = false;
|
|
1108
|
+
let observe = null;
|
|
1109
|
+
let state = { status: "loading", project: null, ref: null, revision: null, error: null, stale: false, updatedAt: 0 };
|
|
1110
|
+
const listeners = /* @__PURE__ */ new Set();
|
|
1111
|
+
function emit(patch) {
|
|
1112
|
+
state = { ...state, ...patch };
|
|
1113
|
+
for (const listener of listeners) {
|
|
1114
|
+
try {
|
|
1115
|
+
listener(state);
|
|
1116
|
+
} catch {
|
|
1117
|
+
}
|
|
1118
|
+
}
|
|
1119
|
+
}
|
|
1120
|
+
function closeObserve() {
|
|
1121
|
+
if (observe) {
|
|
1122
|
+
try {
|
|
1123
|
+
observe.es.close();
|
|
1124
|
+
} catch {
|
|
1125
|
+
}
|
|
1126
|
+
observe = null;
|
|
1127
|
+
}
|
|
1128
|
+
}
|
|
1129
|
+
function startObserve(sid, gen) {
|
|
1130
|
+
if (disposed || !ES) return;
|
|
1131
|
+
if (observe && observe.sid === sid && observe.gen === gen) return;
|
|
1132
|
+
closeObserve();
|
|
1133
|
+
let es;
|
|
1134
|
+
try {
|
|
1135
|
+
es = new ES(`/plugins/dsh-science/project/observe?sessionId=${encodeURIComponent(sid)}`);
|
|
1136
|
+
} catch (err) {
|
|
1137
|
+
emit({ stale: true, error: `observe \u5EFA\u7ACB\u5931\u8D25\uFF1A${err && err.message}` });
|
|
1138
|
+
return;
|
|
1139
|
+
}
|
|
1140
|
+
observe = { es, sid, gen };
|
|
1141
|
+
const guarded = (fn) => (...args) => {
|
|
1142
|
+
if (disposed || gen !== generation || !observe || observe.es !== es) return;
|
|
1143
|
+
fn(...args);
|
|
1144
|
+
};
|
|
1145
|
+
es.addEventListener("baseline", guarded((ev) => {
|
|
1146
|
+
const data = safeParse(ev.data);
|
|
1147
|
+
if (!data) return;
|
|
1148
|
+
if (data.revision != null && data.revision !== state.revision) {
|
|
1149
|
+
void refetch(sid, gen);
|
|
1150
|
+
} else if (data.revision == null && state.status === "ready") {
|
|
1151
|
+
emit({ status: "empty", project: null, revision: null, stale: false });
|
|
1152
|
+
}
|
|
1153
|
+
}));
|
|
1154
|
+
es.addEventListener("change", guarded((ev) => {
|
|
1155
|
+
const frame = safeParse(ev.data);
|
|
1156
|
+
if (!frame) return;
|
|
1157
|
+
const rev = frame.projectRevision;
|
|
1158
|
+
if (rev == null) return;
|
|
1159
|
+
if (state.revision != null && rev <= state.revision) return;
|
|
1160
|
+
if (rev > (state.revision ?? -1) + 1) {
|
|
1161
|
+
void refetch(sid, gen);
|
|
1162
|
+
return;
|
|
1163
|
+
}
|
|
1164
|
+
void refetch(sid, gen);
|
|
1165
|
+
}));
|
|
1166
|
+
es.addEventListener("reset", guarded((ev) => {
|
|
1167
|
+
const data = safeParse(ev.data);
|
|
1168
|
+
if (!data) return;
|
|
1169
|
+
emit({ stale: false });
|
|
1170
|
+
void refetch(sid, gen);
|
|
1171
|
+
}));
|
|
1172
|
+
es.addEventListener("streamFailure", guarded((ev) => {
|
|
1173
|
+
const data = safeParse(ev.data) || {};
|
|
1174
|
+
emit({ stale: true, error: `\u6D41\u5931\u8D25\uFF1A${data.reason || "unknown"}` });
|
|
1175
|
+
closeObserve();
|
|
1176
|
+
scheduleReconnect(sid, gen);
|
|
1177
|
+
}));
|
|
1178
|
+
es.onerror = guarded(() => {
|
|
1179
|
+
emit({ stale: true, error: "\u8FDE\u63A5\u4E2D\u65AD\uFF0C\u72B6\u6001\u53EF\u80FD\u8FC7\u671F" });
|
|
1180
|
+
});
|
|
1181
|
+
}
|
|
1182
|
+
let reconnectTimer = null;
|
|
1183
|
+
function scheduleReconnect(sid, gen) {
|
|
1184
|
+
if (disposed || reconnectTimer) return;
|
|
1185
|
+
reconnectTimer = setTimeout(() => {
|
|
1186
|
+
reconnectTimer = null;
|
|
1187
|
+
if (disposed || gen !== generation) return;
|
|
1188
|
+
void refresh();
|
|
1189
|
+
}, 2e3);
|
|
1190
|
+
}
|
|
1191
|
+
async function refetch(sid, gen) {
|
|
1192
|
+
try {
|
|
1193
|
+
const res = await _fetch(`/plugins/dsh-science/project/get?sessionId=${encodeURIComponent(sid)}`);
|
|
1194
|
+
if (disposed || gen !== generation) return;
|
|
1195
|
+
if (!res.ok || !res.body) {
|
|
1196
|
+
emit({ stale: true, error: `\u8BFB\u53D6\u5931\u8D25\uFF08HTTP ${res.status}\uFF09` });
|
|
1197
|
+
return;
|
|
1198
|
+
}
|
|
1199
|
+
const body = res.body;
|
|
1200
|
+
if (!body.project) {
|
|
1201
|
+
emit({ status: "empty", project: null, ref: body.ref || state.ref, revision: null, stale: false, error: null, updatedAt: Date.now() });
|
|
1202
|
+
return;
|
|
1203
|
+
}
|
|
1204
|
+
emit({
|
|
1205
|
+
status: "ready",
|
|
1206
|
+
project: body.project,
|
|
1207
|
+
team: body.team || { members: [], tasks: [] },
|
|
1208
|
+
ref: body.ref || state.ref,
|
|
1209
|
+
revision: body.project.revision,
|
|
1210
|
+
stale: false,
|
|
1211
|
+
error: null,
|
|
1212
|
+
updatedAt: Date.now()
|
|
1213
|
+
});
|
|
1214
|
+
} catch (err) {
|
|
1215
|
+
if (disposed || gen !== generation) return;
|
|
1216
|
+
emit({ stale: true, error: `\u8BFB\u53D6\u5931\u8D25\uFF1A${err && err.message || "network"}` });
|
|
1217
|
+
}
|
|
1218
|
+
}
|
|
1219
|
+
async function refresh() {
|
|
1220
|
+
if (disposed) return state;
|
|
1221
|
+
const gen = ++generation;
|
|
1222
|
+
closeObserve();
|
|
1223
|
+
if (reconnectTimer) {
|
|
1224
|
+
clearTimeout(reconnectTimer);
|
|
1225
|
+
reconnectTimer = null;
|
|
1226
|
+
}
|
|
1227
|
+
const sid = getSessionId();
|
|
1228
|
+
if (!sid) {
|
|
1229
|
+
emit({ status: "loading", project: null, ref: null, revision: null, stale: false, error: null });
|
|
1230
|
+
return state;
|
|
1231
|
+
}
|
|
1232
|
+
try {
|
|
1233
|
+
const res = await _fetch(`/plugins/dsh-science/project/get?sessionId=${encodeURIComponent(sid)}`);
|
|
1234
|
+
if (disposed || gen !== generation) return state;
|
|
1235
|
+
if (res.status === 404) {
|
|
1236
|
+
emit({ status: "unauthorized", project: null, ref: null, revision: null, stale: false, error: "unknown-session" });
|
|
1237
|
+
return state;
|
|
1238
|
+
}
|
|
1239
|
+
if (!res.ok || !res.body) {
|
|
1240
|
+
emit({ status: "offline", stale: true, error: `HTTP ${res.status}` });
|
|
1241
|
+
scheduleReconnect(sid, gen);
|
|
1242
|
+
return state;
|
|
1243
|
+
}
|
|
1244
|
+
const body = res.body;
|
|
1245
|
+
if (!body.project) {
|
|
1246
|
+
emit({ status: "empty", project: null, ref: body.ref || null, revision: null, stale: false, error: null, updatedAt: Date.now() });
|
|
1247
|
+
startObserve(sid, gen);
|
|
1248
|
+
return state;
|
|
1249
|
+
}
|
|
1250
|
+
emit({ status: "ready", project: body.project, team: body.team || { members: [], tasks: [] }, ref: body.ref || null, revision: body.project.revision, stale: false, error: null, updatedAt: Date.now() });
|
|
1251
|
+
startObserve(sid, gen);
|
|
1252
|
+
return state;
|
|
1253
|
+
} catch (err) {
|
|
1254
|
+
if (disposed || gen !== generation) return state;
|
|
1255
|
+
emit({ status: "offline", stale: true, error: err && err.message || "network" });
|
|
1256
|
+
scheduleReconnect(sid, gen);
|
|
1257
|
+
return state;
|
|
1258
|
+
}
|
|
1259
|
+
}
|
|
1260
|
+
async function act({ actionId, commandId, payload, expectedRevision }) {
|
|
1261
|
+
const sid = getSessionId();
|
|
1262
|
+
if (!sid) return { status: 400, body: { kind: "invalid", reason: "\u65E0\u5F53\u524D\u4F1A\u8BDD" } };
|
|
1263
|
+
try {
|
|
1264
|
+
const raw = await fetchImplFallback(`/plugins/dsh-science/project/act`, {
|
|
1265
|
+
method: "POST",
|
|
1266
|
+
credentials: "same-origin",
|
|
1267
|
+
headers: { "content-type": "application/json" },
|
|
1268
|
+
body: JSON.stringify({ sessionId: sid, actionId, commandId, payload, expectedRevision })
|
|
1269
|
+
});
|
|
1270
|
+
let status = 0;
|
|
1271
|
+
let body = null;
|
|
1272
|
+
if (typeof raw.json === "function") {
|
|
1273
|
+
status = raw.status;
|
|
1274
|
+
body = await raw.json().catch(() => null);
|
|
1275
|
+
} else {
|
|
1276
|
+
status = raw.status;
|
|
1277
|
+
body = raw.body;
|
|
1278
|
+
}
|
|
1279
|
+
return { status, body };
|
|
1280
|
+
} catch (err) {
|
|
1281
|
+
return { status: 0, body: { kind: "invalid", reason: err && err.message || "network" } };
|
|
1282
|
+
}
|
|
1283
|
+
}
|
|
1284
|
+
function subscribe(listener) {
|
|
1285
|
+
listeners.add(listener);
|
|
1286
|
+
listener(state);
|
|
1287
|
+
return () => listeners.delete(listener);
|
|
1288
|
+
}
|
|
1289
|
+
function getState() {
|
|
1290
|
+
return state;
|
|
1291
|
+
}
|
|
1292
|
+
function dispose() {
|
|
1293
|
+
disposed = true;
|
|
1294
|
+
closeObserve();
|
|
1295
|
+
if (reconnectTimer) {
|
|
1296
|
+
clearTimeout(reconnectTimer);
|
|
1297
|
+
reconnectTimer = null;
|
|
1298
|
+
}
|
|
1299
|
+
listeners.clear();
|
|
1300
|
+
}
|
|
1301
|
+
return { refresh, act, subscribe, getState, dispose };
|
|
1302
|
+
}
|
|
1303
|
+
function safeParse(text) {
|
|
1304
|
+
try {
|
|
1305
|
+
return JSON.parse(text);
|
|
1306
|
+
} catch {
|
|
1307
|
+
return null;
|
|
1308
|
+
}
|
|
1309
|
+
}
|
|
1310
|
+
|
|
1311
|
+
// client-src/project/object-hash.js
|
|
1312
|
+
var EXCLUDED = /* @__PURE__ */ new Set(["revision", "confirmed", "confirmation", "contentHash", "updatedAt", "history"]);
|
|
1313
|
+
function contentOf(value) {
|
|
1314
|
+
if (!value || typeof value !== "object") return {};
|
|
1315
|
+
const out = {};
|
|
1316
|
+
for (const [key, inner] of Object.entries(value)) {
|
|
1317
|
+
if (!EXCLUDED.has(key)) out[key] = inner;
|
|
1318
|
+
}
|
|
1319
|
+
return out;
|
|
1320
|
+
}
|
|
1321
|
+
async function hashOf(value) {
|
|
1322
|
+
const subtle = globalThis.crypto && globalThis.crypto.subtle;
|
|
1323
|
+
if (!subtle || typeof subtle.digest !== "function") return "";
|
|
1324
|
+
const data = new TextEncoder().encode(JSON.stringify(contentOf(value)));
|
|
1325
|
+
const digest = await subtle.digest("SHA-256", data);
|
|
1326
|
+
return [...new Uint8Array(digest)].map((byte) => byte.toString(16).padStart(2, "0")).join("");
|
|
1327
|
+
}
|
|
1328
|
+
async function objectContentHashesOf(project) {
|
|
1329
|
+
const paper = project && project.snapshot && project.snapshot.paper;
|
|
1330
|
+
if (!paper || typeof paper !== "object") return { core: "", results: {} };
|
|
1331
|
+
try {
|
|
1332
|
+
const results = {};
|
|
1333
|
+
for (const result of Array.isArray(paper.results) ? paper.results : []) {
|
|
1334
|
+
if (result && result.id) results[result.id] = await hashOf(result);
|
|
1335
|
+
}
|
|
1336
|
+
return { core: await hashOf(paper.core), results };
|
|
1337
|
+
} catch {
|
|
1338
|
+
return { core: "", results: {} };
|
|
1339
|
+
}
|
|
1340
|
+
}
|
|
1341
|
+
|
|
1342
|
+
// client-src/workbench/state-view.js
|
|
1343
|
+
var STAGES = Object.freeze([
|
|
1344
|
+
{ id: "explore", label: "\u7814\u7A76\u63A2\u7D22" },
|
|
1345
|
+
{ id: "frame", label: "\u6587\u7AE0\u7ED3\u6784" },
|
|
1346
|
+
{ id: "execute", label: "\u4EFB\u52A1\u7EC6\u5316" },
|
|
1347
|
+
{ id: "synthesize", label: "\u5206\u6790\u4E0E\u7ED8\u56FE" },
|
|
1348
|
+
{ id: "draft", label: "\u8BBA\u6587\u5199\u4F5C" },
|
|
1349
|
+
{ id: "audit", label: "\u6C47\u62A5\u4E0E\u6295\u7A3F" }
|
|
1350
|
+
]);
|
|
1351
|
+
var LIVE_STATUSES = /* @__PURE__ */ new Set(["claimed", "in_progress", "running", "working"]);
|
|
1352
|
+
var DONE_STATUSES = /* @__PURE__ */ new Set(["completed", "done"]);
|
|
1353
|
+
var HIDDEN_STATUSES = /* @__PURE__ */ new Set(["deleted", "cancelled"]);
|
|
1354
|
+
var IMAGE_EXTENSIONS = /* @__PURE__ */ new Set(["png", "jpg", "jpeg", "webp", "svg"]);
|
|
1355
|
+
var asArray = (value) => Array.isArray(value) ? value : [];
|
|
1356
|
+
var asText = (value) => typeof value === "string" ? value : "";
|
|
1357
|
+
var nonEmpty = (value) => asText(value).trim();
|
|
1358
|
+
function listOf(value) {
|
|
1359
|
+
if (Array.isArray(value)) return value;
|
|
1360
|
+
if (value && typeof value === "object") return Object.values(value);
|
|
1361
|
+
return [];
|
|
1362
|
+
}
|
|
1363
|
+
function stageStateOf(stage, currentStage) {
|
|
1364
|
+
const stageIndex = STAGES.findIndex((item) => item.id === stage.id);
|
|
1365
|
+
const currentIndex = Math.max(0, STAGES.findIndex((item) => item.id === currentStage));
|
|
1366
|
+
if (stageIndex < currentIndex) return "completed";
|
|
1367
|
+
if (stageIndex === currentIndex) return "current";
|
|
1368
|
+
return "upcoming";
|
|
1369
|
+
}
|
|
1370
|
+
function statusLabel(status) {
|
|
1371
|
+
const labels = {
|
|
1372
|
+
pending: "\u7B49\u5F85\u4E2D",
|
|
1373
|
+
claimed: "\u5DF2\u9886\u53D6",
|
|
1374
|
+
in_progress: "\u8FDB\u884C\u4E2D",
|
|
1375
|
+
working: "\u5DE5\u4F5C\u4E2D",
|
|
1376
|
+
running: "\u8FD0\u884C\u4E2D",
|
|
1377
|
+
completed: "\u5DF2\u5B8C\u6210",
|
|
1378
|
+
failed: "\u5931\u8D25",
|
|
1379
|
+
blocked: "\u53D7\u963B",
|
|
1380
|
+
cancelled: "\u5DF2\u53D6\u6D88"
|
|
1381
|
+
};
|
|
1382
|
+
return labels[status] || "\u72B6\u6001\u5F85\u66F4\u65B0";
|
|
1383
|
+
}
|
|
1384
|
+
function taskResultIds(task) {
|
|
1385
|
+
const ids = [];
|
|
1386
|
+
if (typeof task?.resultId === "string" && task.resultId) ids.push(task.resultId);
|
|
1387
|
+
for (const id of asArray(task?.resultIds)) if (typeof id === "string" && id && !ids.includes(id)) ids.push(id);
|
|
1388
|
+
return ids;
|
|
1389
|
+
}
|
|
1390
|
+
function readinessForResult(blueprint, result) {
|
|
1391
|
+
const row = asArray(blueprint?.paperSpine?.results).find((item) => item && item.id === result.id);
|
|
1392
|
+
if (row?.readiness && typeof row.readiness === "object") return row.readiness;
|
|
1393
|
+
const evidence2 = asArray(result.evidence).filter((item) => item && item.state === "verified").length;
|
|
1394
|
+
const claims = asArray(result.claims).length;
|
|
1395
|
+
const manuscript = nonEmpty(result.manuscriptRole) && result.manuscriptRole !== "excluded";
|
|
1396
|
+
return {
|
|
1397
|
+
scientific: { state: evidence2 > 0 ? "in_progress" : "blocked", blockers: evidence2 > 0 ? [] : ["\u5C1A\u65E0\u53EF\u6838\u9A8C\u8BC1\u636E"] },
|
|
1398
|
+
manuscript: { state: manuscript && claims > 0 ? "in_progress" : "blocked", blockers: manuscript && claims > 0 ? [] : ["\u5C1A\u65E0\u5199\u4F5C\u6750\u6599"] },
|
|
1399
|
+
submission: { state: "blocked", blockers: ["\u6295\u7A3F\u51C6\u5907\u4FE1\u606F\u5C1A\u672A\u6838\u5BF9"] }
|
|
1400
|
+
};
|
|
1401
|
+
}
|
|
1402
|
+
function memberLiveLabel(status) {
|
|
1403
|
+
const labels = {
|
|
1404
|
+
claimed: "\u5DF2\u9886\u53D6",
|
|
1405
|
+
working: "\u5DE5\u4F5C\u4E2D",
|
|
1406
|
+
running: "\u6B63\u5728\u8FD0\u884C",
|
|
1407
|
+
idle: "\u7A7A\u95F2",
|
|
1408
|
+
offline: "\u79BB\u7EBF",
|
|
1409
|
+
unknown: "\u72B6\u6001\u5F85\u786E\u8BA4",
|
|
1410
|
+
"claimed/working": "\u5DF2\u9886\u53D6 \xB7 \u5DE5\u4F5C\u72B6\u6001\u5F85\u786E\u8BA4"
|
|
1411
|
+
};
|
|
1412
|
+
return labels[status] || "\u72B6\u6001\u5F85\u66F4\u65B0";
|
|
1413
|
+
}
|
|
1414
|
+
function memberLiveTone(status) {
|
|
1415
|
+
if (status === "running" || status === "working") return "good";
|
|
1416
|
+
if (status === "claimed" || status === "claimed/working") return "warn";
|
|
1417
|
+
if (status === "offline") return "bad";
|
|
1418
|
+
return "default";
|
|
1419
|
+
}
|
|
1420
|
+
function taskBlockers(task, taskById) {
|
|
1421
|
+
const blockers = [];
|
|
1422
|
+
if (task.status === "blocked") blockers.push(nonEmpty(task.blockedReason) || "\u4EFB\u52A1\u5DF2\u6807\u8BB0\u4E3A\u53D7\u963B");
|
|
1423
|
+
for (const id of asArray(task.blockedBy)) {
|
|
1424
|
+
const dependency = taskById.get(id);
|
|
1425
|
+
if (!dependency || !DONE_STATUSES.has(dependency.status)) {
|
|
1426
|
+
blockers.push(dependency ? `\u7B49\u5F85\u201C${dependency.subject || dependency.id}\u201D\u5B8C\u6210` : `\u4F9D\u8D56\u4EFB\u52A1 ${id} \u4E0D\u5728\u5F53\u524D\u4EFB\u52A1\u677F`);
|
|
1427
|
+
}
|
|
1428
|
+
}
|
|
1429
|
+
return [...new Set(blockers)];
|
|
1430
|
+
}
|
|
1431
|
+
function nextStepOf(paper, team) {
|
|
1432
|
+
if (!paper.core.claim && paper.results.length === 0) return { label: "\u5F00\u59CB\u63A2\u7D22\u7814\u7A76\u95EE\u9898", action: "explore" };
|
|
1433
|
+
if (paper.core.claim && !paper.core.confirmed) return { label: "\u786E\u8BA4\u6838\u5FC3\u7814\u7A76\u7ED3\u8BBA", action: "confirm", targetId: "core" };
|
|
1434
|
+
const unconfirmed = paper.results.find((result) => !result.confirmed);
|
|
1435
|
+
if (unconfirmed) return { label: "\u68C0\u67E5\u5E76\u786E\u8BA4\u6587\u7AE0\u7ED3\u6784", action: "confirm", targetId: unconfirmed.id };
|
|
1436
|
+
const withoutTasks = paper.results.find((result) => result.confirmed && result.taskCount === 0 && !["dropped"].includes(result.status));
|
|
1437
|
+
if (withoutTasks) return { label: "\u7EC6\u5316\u6267\u884C\u4EFB\u52A1", action: "refine_tasks", targetId: withoutTasks.id };
|
|
1438
|
+
if (team.counts.running > 0 || team.counts.waiting > 0 || team.counts.blocked > 0) return { label: "\u67E5\u770B\u56E2\u961F\u6267\u884C\u8FDB\u5C55", page: "team" };
|
|
1439
|
+
if (paper.results.length > 0) return { label: "\u6839\u636E\u5DF2\u786E\u8BA4\u7ED3\u679C\u7EE7\u7EED\u5199\u4F5C", action: "write" };
|
|
1440
|
+
return { label: "\u751F\u6210\u6587\u7AE0\u7ED3\u6784\u8349\u6848", action: "generate_structure" };
|
|
1441
|
+
}
|
|
1442
|
+
function fileCategory(path) {
|
|
1443
|
+
const text = asText(path).toLowerCase();
|
|
1444
|
+
const ext = text.split(".").pop() || "";
|
|
1445
|
+
if (IMAGE_EXTENSIONS.has(ext) || ["pdf", "tif", "tiff", "eps"].includes(ext) || /figure|plot|chart|图/.test(text)) return "figures";
|
|
1446
|
+
if (["doc", "docx", "md", "tex", "rtf"].includes(ext) || /manuscript|paper|draft|论文/.test(text)) return "manuscript";
|
|
1447
|
+
if (["ppt", "pptx", "key"].includes(ext) || /slide|presentation|汇报|答辩/.test(text)) return "presentation";
|
|
1448
|
+
if (["csv", "tsv", "parquet", "rds", "rdata", "ipynb", "py", "r", "m", "jl", "json"].includes(ext) || /data|code|analysis|result|数据|代码/.test(text)) return "data-code";
|
|
1449
|
+
return "other";
|
|
1450
|
+
}
|
|
1451
|
+
function fileUrl(path) {
|
|
1452
|
+
return `/plugins/dsh-science/file?path=${encodeURIComponent(path)}`;
|
|
1453
|
+
}
|
|
1454
|
+
var ARTIFACT_KIND_LABELS = Object.freeze({
|
|
1455
|
+
data: "\u6570\u636E",
|
|
1456
|
+
code: "\u4EE3\u7801",
|
|
1457
|
+
figure: "\u56FE\u4EF6",
|
|
1458
|
+
manuscript: "\u7A3F\u6BB5",
|
|
1459
|
+
reference: "\u53C2\u8003\u6587\u732E",
|
|
1460
|
+
other: "\u5176\u4ED6\u6210\u679C"
|
|
1461
|
+
});
|
|
1462
|
+
function railFiguresOf(snapshot) {
|
|
1463
|
+
const legacy = listOf(snapshot.figures);
|
|
1464
|
+
if (legacy.length > 0) return legacy;
|
|
1465
|
+
const projectId = nonEmpty(snapshot.projectId);
|
|
1466
|
+
return asArray(snapshot.artifactIndex?.items).filter((item) => item && item.kind === "figure" && (!projectId || !item.projectId || item.projectId === projectId)).slice().sort((a, b) => Number(b.registeredAt || b.updatedAt || 0) - Number(a.registeredAt || a.updatedAt || 0)).slice(0, 8).map((item) => ({
|
|
1467
|
+
id: item.id,
|
|
1468
|
+
title: nonEmpty(item.summary) || ARTIFACT_KIND_LABELS.figure,
|
|
1469
|
+
resultId: asArray(item.resultIds)[0] || "",
|
|
1470
|
+
version: nonEmpty(item.versionToken),
|
|
1471
|
+
status: nonEmpty(item.status) || "available",
|
|
1472
|
+
source: nonEmpty(item.source),
|
|
1473
|
+
verified: item.verified === true,
|
|
1474
|
+
registeredAt: item.registeredAt || item.updatedAt || null,
|
|
1475
|
+
previewable: false,
|
|
1476
|
+
url: null
|
|
1477
|
+
}));
|
|
1478
|
+
}
|
|
1479
|
+
function stateViewOf(snapshot) {
|
|
1480
|
+
if (!snapshot || typeof snapshot !== "object" || snapshot.error) {
|
|
1481
|
+
return { available: false, error: asText(snapshot?.error) || "\u5F53\u524D\u65E0\u6CD5\u8BFB\u53D6\u79D1\u7814\u5DE5\u4F5C\u53F0\u72B6\u6001\u3002" };
|
|
1482
|
+
}
|
|
1483
|
+
const blueprint = snapshot.blueprint && typeof snapshot.blueprint === "object" ? snapshot.blueprint : {};
|
|
1484
|
+
const teamState = snapshot.team && typeof snapshot.team === "object" ? snapshot.team : {};
|
|
1485
|
+
const rawResults = asArray(blueprint.results);
|
|
1486
|
+
const rawTasks = asArray(teamState.tasks).filter((task) => task && !HIDDEN_STATUSES.has(task.status));
|
|
1487
|
+
const taskById = new Map(rawTasks.filter((task) => task.id).map((task) => [task.id, task]));
|
|
1488
|
+
const figures = railFiguresOf(snapshot);
|
|
1489
|
+
const files = asArray(snapshot.files);
|
|
1490
|
+
const tasks = rawTasks.map((task) => {
|
|
1491
|
+
const blockers = taskBlockers(task, taskById);
|
|
1492
|
+
return {
|
|
1493
|
+
...task,
|
|
1494
|
+
// 术语统一:有未满足依赖/被标记受阻的任务一律显示「受阻」,不再与「等待中」双口径
|
|
1495
|
+
label: blockers.length > 0 ? "\u53D7\u963B" : statusLabel(task.status),
|
|
1496
|
+
resultIds: taskResultIds(task),
|
|
1497
|
+
blockers,
|
|
1498
|
+
isBlocked: blockers.length > 0,
|
|
1499
|
+
isRunning: LIVE_STATUSES.has(task.status),
|
|
1500
|
+
isComplete: DONE_STATUSES.has(task.status)
|
|
1501
|
+
};
|
|
1502
|
+
});
|
|
1503
|
+
const resultRows = rawResults.filter((result) => result && typeof result === "object").map((result) => {
|
|
1504
|
+
const linkedTasks = tasks.filter((task) => taskResultIds(task).includes(result.id) || asArray(result.tasks).includes(task.id));
|
|
1505
|
+
const linkedFigures = figures.filter((figure) => figure && (figure.resultId === result.id || asArray(figure.resultIds).includes(result.id) || asArray(result.figures).includes(figure.id)));
|
|
1506
|
+
const readiness = readinessForResult(blueprint, result);
|
|
1507
|
+
const required = Object.values(readiness).filter((item) => item && item.state === "blocked").flatMap((item) => asArray(item.blockers));
|
|
1508
|
+
const recommended = Object.values(readiness).filter((item) => item && item.state === "in_progress").flatMap((item) => asArray(item.blockers));
|
|
1509
|
+
return {
|
|
1510
|
+
...result,
|
|
1511
|
+
title: nonEmpty(result.title) || nonEmpty(result.claim) || "\u672A\u547D\u540D\u7814\u7A76\u7ED3\u679C",
|
|
1512
|
+
statusLabel: { planned: "\u8BA1\u5212\u4E2D", in_progress: "\u8FDB\u884C\u4E2D", supported: "\u5DF2\u83B7\u5F97\u652F\u6301", negative: "\u4E0E\u9884\u671F\u4E0D\u7B26", dropped: "\u4E0D\u7EB3\u5165\u6B63\u6587" }[result.status] || "\u72B6\u6001\u5F85\u6838\u5BF9",
|
|
1513
|
+
confirmed: result.confirmed === true,
|
|
1514
|
+
readiness,
|
|
1515
|
+
taskCount: linkedTasks.length,
|
|
1516
|
+
completedTaskCount: linkedTasks.filter((task) => task.isComplete).length,
|
|
1517
|
+
runningTaskCount: linkedTasks.filter((task) => task.isRunning).length,
|
|
1518
|
+
figures: linkedFigures,
|
|
1519
|
+
materials: (snapshot.artifactIndex && snapshot.artifactIndex.items || []).filter((item) => item.resultIds && item.resultIds.includes(result.id)),
|
|
1520
|
+
requiredItems: [...new Set(required)],
|
|
1521
|
+
recommendedItems: [...new Set(recommended)],
|
|
1522
|
+
tasks: linkedTasks
|
|
1523
|
+
};
|
|
1524
|
+
});
|
|
1525
|
+
const activeTasks = tasks.filter((task) => !task.isComplete);
|
|
1526
|
+
const counts = {
|
|
1527
|
+
running: tasks.filter((task) => task.isRunning && !task.isBlocked).length,
|
|
1528
|
+
waiting: tasks.filter((task) => task.status === "pending" && !task.isBlocked).length,
|
|
1529
|
+
completed: tasks.filter((task) => task.isComplete).length,
|
|
1530
|
+
blocked: tasks.filter((task) => task.isBlocked).length
|
|
1531
|
+
};
|
|
1532
|
+
const members = asArray(teamState.members).map((member) => {
|
|
1533
|
+
const liveStatus = snapshot.memberLive?.[member.name] || "unknown";
|
|
1534
|
+
return {
|
|
1535
|
+
...member,
|
|
1536
|
+
liveStatus,
|
|
1537
|
+
liveStatusLabel: memberLiveLabel(liveStatus),
|
|
1538
|
+
liveStatusTone: memberLiveTone(liveStatus),
|
|
1539
|
+
currentTasks: tasks.filter((task) => task.assignee === member.name && !task.isComplete),
|
|
1540
|
+
lastReport: nonEmpty(member.lastReport) || nonEmpty(member.lastSummary) || ""
|
|
1541
|
+
};
|
|
1542
|
+
});
|
|
1543
|
+
const blockedTasks = tasks.filter((task) => task.isBlocked);
|
|
1544
|
+
const activity = tasks.filter((task) => nonEmpty(task.report) || nonEmpty(task.resultSummary) || nonEmpty(task.updatedAt) || nonEmpty(task.completedAt)).sort((a, b) => Number(b.updatedAt || b.completedAt || 0) - Number(a.updatedAt || a.completedAt || 0)).slice(0, 8).map((task) => ({
|
|
1545
|
+
id: task.id,
|
|
1546
|
+
summary: nonEmpty(task.report) || nonEmpty(task.resultSummary) || task.subject || task.id,
|
|
1547
|
+
resultIds: task.resultIds,
|
|
1548
|
+
at: task.updatedAt || task.completedAt || task.createdAt || null,
|
|
1549
|
+
status: task.status
|
|
1550
|
+
}));
|
|
1551
|
+
const paper = {
|
|
1552
|
+
// T6:只写研究问题时,项目卡/右栏用问题作为可读标题,而不是“未命名研究项目”。
|
|
1553
|
+
title: nonEmpty(blueprint.core?.title) || nonEmpty(blueprint.question) || "\u672A\u547D\u540D\u7814\u7A76\u9879\u76EE",
|
|
1554
|
+
stage: STAGES.some((stage) => stage.id === blueprint.stage) ? blueprint.stage : "explore",
|
|
1555
|
+
stageLabel: STAGES.find((stage) => stage.id === blueprint.stage)?.label || "\u7814\u7A76\u63A2\u7D22",
|
|
1556
|
+
stageUpdatedAt: Number(blueprint.stageUpdatedAt || 0),
|
|
1557
|
+
stages: STAGES.map((stage) => ({ ...stage, state: stageStateOf(stage, blueprint.stage || "explore") })),
|
|
1558
|
+
venue: nonEmpty(blueprint.core?.venue),
|
|
1559
|
+
core: {
|
|
1560
|
+
title: nonEmpty(blueprint.core?.title),
|
|
1561
|
+
claim: nonEmpty(blueprint.core?.claim),
|
|
1562
|
+
innovation: nonEmpty(blueprint.core?.innovation),
|
|
1563
|
+
confirmed: blueprint.core?.confirmed === true,
|
|
1564
|
+
revision: blueprint.core?.revision || 1,
|
|
1565
|
+
// T4:确认按钮必须携带对象内容哈希
|
|
1566
|
+
contentHash: asText(blueprint.core?.contentHash)
|
|
1567
|
+
},
|
|
1568
|
+
narrative: nonEmpty(blueprint.narrative),
|
|
1569
|
+
question: nonEmpty(blueprint.question),
|
|
1570
|
+
scope: nonEmpty(blueprint.scope),
|
|
1571
|
+
sourceSummary: nonEmpty(blueprint.sourceSummary),
|
|
1572
|
+
questionUpdatedAt: Number(blueprint.questionUpdatedAt || 0),
|
|
1573
|
+
results: resultRows,
|
|
1574
|
+
supportedResults: resultRows.filter((result) => result.status === "supported").length,
|
|
1575
|
+
totalResults: resultRows.length,
|
|
1576
|
+
updatedAt: blueprint.updatedAt || snapshot.ts || null,
|
|
1577
|
+
error: nonEmpty(snapshot.blueprintError)
|
|
1578
|
+
};
|
|
1579
|
+
const pendingCore = (paper.core.claim || paper.core.title) && !paper.core.confirmed ? 1 : 0;
|
|
1580
|
+
paper.pendingConfirmationCount = pendingCore + resultRows.filter((result) => !result.confirmed && result.status !== "dropped" && result.manuscriptRole !== "excluded").length;
|
|
1581
|
+
const artifacts = files.map((file) => {
|
|
1582
|
+
const path = asText(file.path);
|
|
1583
|
+
const category = fileCategory(path);
|
|
1584
|
+
const ext = path.split(".").pop()?.toLowerCase() || "";
|
|
1585
|
+
return {
|
|
1586
|
+
...file,
|
|
1587
|
+
path,
|
|
1588
|
+
category,
|
|
1589
|
+
url: path ? fileUrl(path) : null,
|
|
1590
|
+
previewable: category === "figures" && IMAGE_EXTENSIONS.has(ext)
|
|
1591
|
+
};
|
|
1592
|
+
});
|
|
1593
|
+
const figureRecords = figures.map((figure) => {
|
|
1594
|
+
const path = nonEmpty(figure.file) || nonEmpty(figure.path) || nonEmpty(figure.filePath) || nonEmpty(figure.outputPath);
|
|
1595
|
+
const ext = path.split(".").pop()?.toLowerCase() || "";
|
|
1596
|
+
return {
|
|
1597
|
+
...figure,
|
|
1598
|
+
path,
|
|
1599
|
+
url: path ? fileUrl(path) : null,
|
|
1600
|
+
previewable: IMAGE_EXTENSIONS.has(ext),
|
|
1601
|
+
title: nonEmpty(figure.title) || nonEmpty(figure.name) || nonEmpty(path.split(/[\\/]/).pop()) || figure.id || "\u672A\u547D\u540D\u56FE\u4EF6"
|
|
1602
|
+
};
|
|
1603
|
+
});
|
|
1604
|
+
const figureById = new Map(figureRecords.filter((figure) => figure.id).map((figure) => [figure.id, figure]));
|
|
1605
|
+
const figureFamilyKey = (figure) => {
|
|
1606
|
+
const familyId = nonEmpty(figure.figureId) || nonEmpty(figure.familyId);
|
|
1607
|
+
if (familyId) return `id:${familyId}`;
|
|
1608
|
+
const stem = figure.path.split(/[\\/]/).pop()?.replace(/\.[^.]+$/, "").trim().toLowerCase();
|
|
1609
|
+
const resultId = nonEmpty(figure.resultId);
|
|
1610
|
+
return stem && resultId ? `result:${resultId}:stem:${stem}` : "";
|
|
1611
|
+
};
|
|
1612
|
+
for (const figure of figureRecords) {
|
|
1613
|
+
const explicitPreviousId = nonEmpty(figure.prevId) || nonEmpty(figure.previousVersionId);
|
|
1614
|
+
if (explicitPreviousId && figureById.has(explicitPreviousId)) {
|
|
1615
|
+
figure.previousVersionId = explicitPreviousId;
|
|
1616
|
+
figure.previousVersionRelation = "recorded";
|
|
1617
|
+
continue;
|
|
1618
|
+
}
|
|
1619
|
+
const timestamp = Number(figure.registeredAt || figure.createdAt || 0);
|
|
1620
|
+
const family = figureFamilyKey(figure);
|
|
1621
|
+
if (!family || !Number.isFinite(timestamp) || timestamp <= 0) continue;
|
|
1622
|
+
const previous = figureRecords.filter((candidate) => candidate !== figure && figureFamilyKey(candidate) === family).filter((candidate) => {
|
|
1623
|
+
const candidateTime = Number(candidate.registeredAt || candidate.createdAt || 0);
|
|
1624
|
+
return Number.isFinite(candidateTime) && candidateTime > 0 && candidateTime < timestamp;
|
|
1625
|
+
}).sort((a, b) => Number(b.registeredAt || b.createdAt || 0) - Number(a.registeredAt || a.createdAt || 0))[0];
|
|
1626
|
+
if (previous?.id) {
|
|
1627
|
+
figure.previousVersionId = previous.id;
|
|
1628
|
+
figure.previousVersionRelation = "inferred";
|
|
1629
|
+
}
|
|
1630
|
+
}
|
|
1631
|
+
const team = {
|
|
1632
|
+
members,
|
|
1633
|
+
tasks,
|
|
1634
|
+
activeTasks,
|
|
1635
|
+
counts,
|
|
1636
|
+
blockedTasks,
|
|
1637
|
+
activity,
|
|
1638
|
+
updatedAt: snapshot.ts || null
|
|
1639
|
+
};
|
|
1640
|
+
paper.nextStep = nextStepOf(paper, team);
|
|
1641
|
+
return {
|
|
1642
|
+
available: true,
|
|
1643
|
+
generatedAt: snapshot.generatedAt || null,
|
|
1644
|
+
paper,
|
|
1645
|
+
team,
|
|
1646
|
+
artifacts: {
|
|
1647
|
+
figures: figureRecords,
|
|
1648
|
+
plans: asArray(snapshot.figurePlans),
|
|
1649
|
+
files: artifacts,
|
|
1650
|
+
reviews: asArray(snapshot.reviews),
|
|
1651
|
+
workspaceRoot: asText(snapshot.workspaceRoot),
|
|
1652
|
+
index: snapshot.artifactIndex && snapshot.artifactIndex.items || [],
|
|
1653
|
+
recent: (snapshot.artifactIndex && snapshot.artifactIndex.items || []).slice(-3).reverse(),
|
|
1654
|
+
groups: [
|
|
1655
|
+
{ id: "figures", label: "\u56FE\u8868", items: artifacts.filter((item) => item.category === "figures") },
|
|
1656
|
+
{ id: "manuscript", label: "\u8BBA\u6587\u6587\u7A3F", items: artifacts.filter((item) => item.category === "manuscript") },
|
|
1657
|
+
{ id: "presentation", label: "\u6C47\u62A5\u6750\u6599", items: artifacts.filter((item) => item.category === "presentation") },
|
|
1658
|
+
{ id: "data-code", label: "\u6570\u636E\u4E0E\u4EE3\u7801", items: artifacts.filter((item) => item.category === "data-code") },
|
|
1659
|
+
{ id: "other", label: "\u5176\u4ED6\u6587\u4EF6", items: artifacts.filter((item) => item.category === "other") }
|
|
1660
|
+
]
|
|
1661
|
+
},
|
|
1662
|
+
experts: {
|
|
1663
|
+
roles: snapshot.roles && typeof snapshot.roles === "object" ? snapshot.roles : {},
|
|
1664
|
+
skillMenu: snapshot.skillMenu && typeof snapshot.skillMenu === "object" ? snapshot.skillMenu : { catalog: {}, installed: {}, integrations: [] }
|
|
1665
|
+
}
|
|
1666
|
+
};
|
|
1667
|
+
}
|
|
1668
|
+
function scopedTeamOf(team, projectId, rootSessionId) {
|
|
1669
|
+
const source = team && typeof team === "object" ? team : { members: [], tasks: [] };
|
|
1670
|
+
const matches = (record) => {
|
|
1671
|
+
if (!record || typeof record !== "object") return false;
|
|
1672
|
+
if (record.projectId) return Boolean(projectId) && String(record.projectId) === String(projectId);
|
|
1673
|
+
if (record.rootSessionId) return Boolean(rootSessionId) && String(record.rootSessionId) === String(rootSessionId);
|
|
1674
|
+
return false;
|
|
1675
|
+
};
|
|
1676
|
+
return {
|
|
1677
|
+
members: asArray(source.members).filter(matches).map((member) => ({
|
|
1678
|
+
name: asText(member.name),
|
|
1679
|
+
role: asText(member.role),
|
|
1680
|
+
label: asText(member.label) || asText(member.role) || asText(member.name),
|
|
1681
|
+
childId: asText(member.childId),
|
|
1682
|
+
parentSessionId: asText(member.parentSessionId)
|
|
1683
|
+
})),
|
|
1684
|
+
tasks: asArray(source.tasks).filter(matches).slice(-20).map((task) => ({
|
|
1685
|
+
id: asText(task.id),
|
|
1686
|
+
subject: asText(task.subject),
|
|
1687
|
+
status: asText(task.status) || "pending",
|
|
1688
|
+
assignee: asText(task.assignee),
|
|
1689
|
+
blockedBy: asArray(task.blockedBy).map(asText).filter(Boolean),
|
|
1690
|
+
resultIds: taskResultIds(task)
|
|
1691
|
+
}))
|
|
1692
|
+
};
|
|
1693
|
+
}
|
|
1694
|
+
function projectRawOf(project, { hashes = null, ref = null, team = null, now = null } = {}) {
|
|
1695
|
+
const snapshot = project && project.snapshot && typeof project.snapshot === "object" ? project.snapshot : {};
|
|
1696
|
+
const paper = snapshot.paper && typeof snapshot.paper === "object" ? snapshot.paper : { core: {}, results: [] };
|
|
1697
|
+
const core = { ...paper.core || {}, contentHash: hashes && hashes.core || asText(paper.core?.contentHash) };
|
|
1698
|
+
const results = asArray(paper.results).map((result) => ({
|
|
1699
|
+
...result,
|
|
1700
|
+
contentHash: hashes && hashes.results && hashes.results[result.id] || asText(result?.contentHash)
|
|
1701
|
+
}));
|
|
1702
|
+
return {
|
|
1703
|
+
ts: now || Date.now(),
|
|
1704
|
+
projectId: project?.projectId || null,
|
|
1705
|
+
projectRevision: project?.revision ?? null,
|
|
1706
|
+
relationship: ref?.relationship || null,
|
|
1707
|
+
capabilities: ref?.capabilities || null,
|
|
1708
|
+
focus: snapshot.focus || null,
|
|
1709
|
+
blueprint: { ...paper, core, results },
|
|
1710
|
+
team: scopedTeamOf(team, project?.projectId || ref?.projectId || null, ref?.rootSessionId || null),
|
|
1711
|
+
figures: [],
|
|
1712
|
+
artifactIndex: snapshot.artifactIndex || { items: [] },
|
|
1713
|
+
figurePlans: [],
|
|
1714
|
+
reviews: [],
|
|
1715
|
+
files: [],
|
|
1716
|
+
roles: {},
|
|
1717
|
+
skillMenu: { catalog: {}, installed: {}, integrations: [] },
|
|
1718
|
+
memberLive: {},
|
|
1719
|
+
workspaceRoot: ""
|
|
1720
|
+
};
|
|
1721
|
+
}
|
|
1722
|
+
|
|
1723
|
+
// client-src/project/use-project-binding.js
|
|
1724
|
+
var SESSION_POLL_MS = 1e3;
|
|
1725
|
+
var registry = /* @__PURE__ */ new Map();
|
|
1726
|
+
function sessionOf(services) {
|
|
1727
|
+
try {
|
|
1728
|
+
return services?.getSessionId?.() || null;
|
|
1729
|
+
} catch {
|
|
1730
|
+
return null;
|
|
1731
|
+
}
|
|
1732
|
+
}
|
|
1733
|
+
function acquire(sessionId) {
|
|
1734
|
+
const existing = registry.get(sessionId);
|
|
1735
|
+
if (existing) {
|
|
1736
|
+
existing.refs += 1;
|
|
1737
|
+
return { entry: existing, created: false };
|
|
1738
|
+
}
|
|
1739
|
+
const entry = { binding: createProjectBinding({ getSessionId: () => sessionId }), refs: 1 };
|
|
1740
|
+
registry.set(sessionId, entry);
|
|
1741
|
+
return { entry, created: true };
|
|
1742
|
+
}
|
|
1743
|
+
function release(sessionId) {
|
|
1744
|
+
const entry = registry.get(sessionId);
|
|
1745
|
+
if (!entry) return;
|
|
1746
|
+
entry.refs -= 1;
|
|
1747
|
+
if (entry.refs > 0) return;
|
|
1748
|
+
try {
|
|
1749
|
+
entry.binding.dispose();
|
|
1750
|
+
} catch {
|
|
1751
|
+
}
|
|
1752
|
+
registry.delete(sessionId);
|
|
1753
|
+
}
|
|
1754
|
+
var LOADING = Object.freeze({ status: "loading", project: null, ref: null, revision: null, stale: false, error: null, updatedAt: 0 });
|
|
1755
|
+
function useProjectBinding(services) {
|
|
1756
|
+
const readSession = (0, import_react8.useCallback)(() => sessionOf(services), [services]);
|
|
1757
|
+
const [sessionId, setSessionId] = (0, import_react8.useState)(readSession);
|
|
1758
|
+
const [snap, setSnap] = (0, import_react8.useState)(LOADING);
|
|
1759
|
+
const [derived, setDerived] = (0, import_react8.useState)({ projectId: null, revision: null, raw: null, view: null, hashes: null, hashesReady: false });
|
|
1760
|
+
(0, import_react8.useEffect)(() => {
|
|
1761
|
+
const current = readSession();
|
|
1762
|
+
if (current !== sessionId) setSessionId(current);
|
|
1763
|
+
});
|
|
1764
|
+
(0, import_react8.useEffect)(() => {
|
|
1765
|
+
let disposed = false;
|
|
1766
|
+
const check = () => {
|
|
1767
|
+
if (disposed) return;
|
|
1768
|
+
if (readSession() !== sessionId) setSessionId(readSession());
|
|
1769
|
+
};
|
|
1770
|
+
const timer = setInterval(check, SESSION_POLL_MS);
|
|
1771
|
+
let unsubscribe = null;
|
|
1772
|
+
try {
|
|
1773
|
+
const maybe = services?.subscribeSession?.(check);
|
|
1774
|
+
if (typeof maybe === "function") unsubscribe = maybe;
|
|
1775
|
+
} catch {
|
|
1776
|
+
}
|
|
1777
|
+
return () => {
|
|
1778
|
+
disposed = true;
|
|
1779
|
+
clearInterval(timer);
|
|
1780
|
+
if (unsubscribe) {
|
|
1781
|
+
try {
|
|
1782
|
+
unsubscribe();
|
|
1783
|
+
} catch {
|
|
1784
|
+
}
|
|
1785
|
+
}
|
|
1786
|
+
};
|
|
1787
|
+
}, [readSession, services, sessionId]);
|
|
1788
|
+
(0, import_react8.useEffect)(() => {
|
|
1789
|
+
let active = true;
|
|
1790
|
+
setSnap(LOADING);
|
|
1791
|
+
setDerived({ projectId: null, revision: null, raw: null, view: null, hashes: null, hashesReady: false });
|
|
1792
|
+
if (!sessionId) {
|
|
1793
|
+
setSnap({ ...LOADING, status: "empty" });
|
|
1794
|
+
return void 0;
|
|
1795
|
+
}
|
|
1796
|
+
const { entry, created } = acquire(sessionId);
|
|
1797
|
+
const { binding } = entry;
|
|
1798
|
+
setSnap(binding.getState());
|
|
1799
|
+
const unsubscribe = binding.subscribe((next) => {
|
|
1800
|
+
if (active) setSnap(next);
|
|
1801
|
+
});
|
|
1802
|
+
if (created) void binding.refresh();
|
|
1803
|
+
return () => {
|
|
1804
|
+
active = false;
|
|
1805
|
+
try {
|
|
1806
|
+
unsubscribe();
|
|
1807
|
+
} catch {
|
|
1808
|
+
}
|
|
1809
|
+
release(sessionId);
|
|
1810
|
+
};
|
|
1811
|
+
}, [sessionId]);
|
|
1812
|
+
(0, import_react8.useEffect)(() => {
|
|
1813
|
+
let active = true;
|
|
1814
|
+
const status = snap.status;
|
|
1815
|
+
if (status === "ready" && snap.project) {
|
|
1816
|
+
const project = snap.project;
|
|
1817
|
+
const base = projectRawOf(project, { hashes: null, ref: snap.ref, team: snap.team });
|
|
1818
|
+
setDerived({ projectId: project.projectId || null, revision: project.revision ?? null, raw: base, view: stateViewOf(base), hashes: null, hashesReady: false });
|
|
1819
|
+
objectContentHashesOf(project).then((hashes) => {
|
|
1820
|
+
if (!active) return;
|
|
1821
|
+
const raw = projectRawOf(project, { hashes, ref: snap.ref, team: snap.team });
|
|
1822
|
+
setDerived({ projectId: project.projectId || null, revision: project.revision ?? null, raw, view: stateViewOf(raw), hashes, hashesReady: true });
|
|
1823
|
+
}).catch(() => {
|
|
1824
|
+
if (active) setDerived((current) => ({ ...current, hashesReady: true }));
|
|
1825
|
+
});
|
|
1826
|
+
return () => {
|
|
1827
|
+
active = false;
|
|
1828
|
+
};
|
|
1829
|
+
}
|
|
1830
|
+
if (status === "empty") {
|
|
1831
|
+
const raw = projectRawOf(null, { ref: snap.ref });
|
|
1832
|
+
setDerived({ projectId: null, revision: null, raw, view: stateViewOf(raw), hashes: null, hashesReady: true });
|
|
1833
|
+
}
|
|
1834
|
+
return () => {
|
|
1835
|
+
active = false;
|
|
1836
|
+
};
|
|
1837
|
+
}, [snap.status, snap.project, snap.revision, snap.ref, snap.team]);
|
|
1838
|
+
const refresh = (0, import_react8.useCallback)(async () => {
|
|
1839
|
+
const sid = readSession();
|
|
1840
|
+
const entry = sid ? registry.get(sid) : null;
|
|
1841
|
+
if (!entry) return null;
|
|
1842
|
+
return entry.binding.refresh();
|
|
1843
|
+
}, [readSession]);
|
|
1844
|
+
const act = (0, import_react8.useCallback)(async (action) => {
|
|
1845
|
+
const sid = readSession();
|
|
1846
|
+
const entry = sid ? registry.get(sid) : null;
|
|
1847
|
+
if (!entry) return { status: 0, body: { kind: "invalid", reason: "\u5F53\u524D\u6CA1\u6709\u4F1A\u8BDD" } };
|
|
1848
|
+
return entry.binding.act(action);
|
|
1849
|
+
}, [readSession]);
|
|
1850
|
+
return {
|
|
1851
|
+
sessionId,
|
|
1852
|
+
status: snap.status,
|
|
1853
|
+
stale: snap.stale === true,
|
|
1854
|
+
error: snap.error,
|
|
1855
|
+
project: snap.project,
|
|
1856
|
+
ref: snap.ref,
|
|
1857
|
+
revision: snap.revision,
|
|
1858
|
+
projectId: derived.projectId || snap.project?.projectId || null,
|
|
1859
|
+
raw: derived.raw,
|
|
1860
|
+
view: derived.view,
|
|
1861
|
+
hashes: derived.hashes,
|
|
1862
|
+
hashesReady: derived.hashesReady,
|
|
1863
|
+
loading: snap.status === "loading" || snap.status === "ready" && !derived.view,
|
|
1864
|
+
refresh,
|
|
1865
|
+
act
|
|
1866
|
+
};
|
|
1867
|
+
}
|
|
1868
|
+
|
|
1869
|
+
// client-src/workbench/ProjectCatalog.jsx
|
|
1870
|
+
var import_react9 = __toESM(require("react"), 1);
|
|
1871
|
+
var import_jsx_runtime7 = require("react/jsx-runtime");
|
|
1872
|
+
var EMPTY = Object.freeze({ status: "loading", assignment: "unbound", projects: [], stale: false, error: null });
|
|
1873
|
+
async function readJson(res) {
|
|
1874
|
+
if (typeof res.json === "function") return res.json().catch(() => null);
|
|
1875
|
+
return res.body || null;
|
|
1876
|
+
}
|
|
1877
|
+
function ProjectCatalog({ services }) {
|
|
1878
|
+
const sessionId = services?.getSessionId?.() || "";
|
|
1879
|
+
const [state, setState] = (0, import_react9.useState)(EMPTY);
|
|
1880
|
+
const [notice, setNotice] = (0, import_react9.useState)(null);
|
|
1881
|
+
const [busyHandle, setBusyHandle] = (0, import_react9.useState)("");
|
|
1882
|
+
(0, import_react9.useEffect)(() => {
|
|
1883
|
+
let active = true;
|
|
1884
|
+
const generation = sessionId;
|
|
1885
|
+
setState(EMPTY);
|
|
1886
|
+
setNotice(null);
|
|
1887
|
+
if (!sessionId) {
|
|
1888
|
+
setState({ ...EMPTY, status: "empty", assignment: "unbound" });
|
|
1889
|
+
return void 0;
|
|
1890
|
+
}
|
|
1891
|
+
;
|
|
1892
|
+
(async () => {
|
|
1893
|
+
try {
|
|
1894
|
+
const res = await fetch(`/plugins/dsh-science/project/catalog?sessionId=${encodeURIComponent(sessionId)}`, { credentials: "same-origin" });
|
|
1895
|
+
if (!active || generation !== sessionId) return;
|
|
1896
|
+
const body = await readJson(res);
|
|
1897
|
+
if (res.status === 404) {
|
|
1898
|
+
setState({ status: "unauthorized", assignment: "unbound", projects: [], stale: false, error: "\u5F53\u524D\u4F1A\u8BDD\u65E0\u6548\uFF0C\u65E0\u6CD5\u5217\u51FA\u8BFE\u9898\u3002" });
|
|
1899
|
+
return;
|
|
1900
|
+
}
|
|
1901
|
+
if (!res.ok || !body) {
|
|
1902
|
+
setState((current) => ({ ...current, status: current.projects.length ? "ready" : "offline", stale: true, error: `\u8BFB\u53D6\u8BFE\u9898\u76EE\u5F55\u5931\u8D25\uFF08HTTP ${res.status}\uFF09` }));
|
|
1903
|
+
return;
|
|
1904
|
+
}
|
|
1905
|
+
setState({ status: "ready", assignment: body.assignment || "unbound", projects: Array.isArray(body.projects) ? body.projects : [], stale: false, error: null });
|
|
1906
|
+
} catch (err) {
|
|
1907
|
+
if (!active) return;
|
|
1908
|
+
setState((current) => ({ ...current, status: current.projects.length ? "ready" : "offline", stale: true, error: err && err.message || "\u8BFB\u53D6\u8BFE\u9898\u76EE\u5F55\u5931\u8D25" }));
|
|
1909
|
+
}
|
|
1910
|
+
})();
|
|
1911
|
+
return () => {
|
|
1912
|
+
active = false;
|
|
1913
|
+
};
|
|
1914
|
+
}, [sessionId]);
|
|
1915
|
+
const openProject = async (item) => {
|
|
1916
|
+
if (!item?.openHandle || !sessionId) return;
|
|
1917
|
+
setBusyHandle(item.openHandle);
|
|
1918
|
+
setNotice(null);
|
|
1919
|
+
try {
|
|
1920
|
+
const res = await fetch("/plugins/dsh-science/project/open", {
|
|
1921
|
+
method: "POST",
|
|
1922
|
+
credentials: "same-origin",
|
|
1923
|
+
headers: { "content-type": "application/json" },
|
|
1924
|
+
body: JSON.stringify({ sessionId, openHandle: item.openHandle })
|
|
1925
|
+
});
|
|
1926
|
+
const body = await readJson(res);
|
|
1927
|
+
if (body?.kind === "unavailable") {
|
|
1928
|
+
setNotice(body.message);
|
|
1929
|
+
return;
|
|
1930
|
+
}
|
|
1931
|
+
if (!res.ok || body?.kind !== "open" || !body.sessionId) {
|
|
1932
|
+
setNotice("\u65E0\u6CD5\u6253\u5F00\u8BE5\u8BFE\u9898\u3002\u53E5\u67C4\u65E0\u6548\uFF0C\u6216\u5B83\u4E0D\u5C5E\u4E8E\u5F53\u524D\u5DE5\u4F5C\u533A\u3002\u5F53\u524D\u4F1A\u8BDD\u6CA1\u6709\u88AB\u6539\u7ED1\u3002");
|
|
1933
|
+
return;
|
|
1934
|
+
}
|
|
1935
|
+
await services.openRootSession(body.sessionId);
|
|
1936
|
+
} catch (err) {
|
|
1937
|
+
setNotice(err && err.message || "\u65E0\u6CD5\u6253\u5F00\u8BE5\u8BFE\u9898\u7684\u539F\u4F1A\u8BDD\u3002");
|
|
1938
|
+
} finally {
|
|
1939
|
+
setBusyHandle("");
|
|
1940
|
+
}
|
|
1941
|
+
};
|
|
1942
|
+
const projects = state.projects || [];
|
|
1943
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("section", { className: "sci-catalog", "aria-label": "\u9879\u76EE\u603B\u89C8", children: [
|
|
1944
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("header", { className: "sci-catalog-head", children: [
|
|
1945
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { children: [
|
|
1946
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("p", { className: "sci-desk-eyebrow", children: "\u540C\u4E00\u5DE5\u4F5C\u533A" }),
|
|
1947
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("h2", { children: "\u9879\u76EE\u603B\u89C8" })
|
|
1948
|
+
] }),
|
|
1949
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("p", { children: "\u8FD9\u91CC\u53EA\u663E\u793A\u8BFE\u9898\u3001\u9636\u6BB5\u548C\u5F85\u5904\u7406\u6570\u91CF\u3002\u6253\u5F00\u540E\u8FDB\u5165\u8BE5\u8BFE\u9898\u81EA\u5DF1\u7684\u4F1A\u8BDD\uFF0C\u4E0D\u4F1A\u628A\u5F53\u524D\u4F1A\u8BDD\u6539\u7ED1\u8FC7\u53BB\u3002" })
|
|
1950
|
+
] }),
|
|
1951
|
+
state.stale && /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("p", { role: "status", children: [
|
|
1952
|
+
"\u8BFE\u9898\u76EE\u5F55\u53EF\u80FD\u5DF2\u8FC7\u671F\u3002",
|
|
1953
|
+
state.error
|
|
1954
|
+
] }),
|
|
1955
|
+
state.error && !state.stale && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("p", { role: "alert", children: state.error }),
|
|
1956
|
+
notice && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("p", { role: "status", children: notice }),
|
|
1957
|
+
state.assignment === "legacy-unassigned" && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("p", { children: "\u5F53\u524D\u8BFE\u9898\u8FD8\u4E0D\u80FD\u552F\u4E00\u5F52\u5165\u8FD9\u4E2A\u5DE5\u4F5C\u533A\uFF0C\u56E0\u6B64\u4E0D\u4F1A\u6DF7\u8FDB\u4E0B\u9762\u7684\u76EE\u5F55\u3002\u5B83\u4ECD\u7559\u5728\u539F\u6765\u7684\u4F1A\u8BDD\u91CC\u3002" }),
|
|
1958
|
+
state.assignment === "workspace-unknown" && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("p", { children: "\u5F53\u524D\u4F1A\u8BDD\u6CA1\u6709\u53EF\u786E\u8BA4\u7684\u5DE5\u4F5C\u533A\uFF0C\u6240\u4EE5\u4E0D\u80FD\u5217\u51FA\u5176\u4ED6\u8BFE\u9898\u3002" }),
|
|
1959
|
+
state.assignment === "ambiguous" && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("p", { children: "\u5F53\u524D\u4F1A\u8BDD\u7684\u5DE5\u4F5C\u533A\u4E8B\u5B9E\u4E0D\u4E00\u81F4\uFF0C\u76EE\u5F55\u5DF2\u5173\u95ED\uFF0C\u907F\u514D\u628A\u8BFE\u9898\u5F52\u9519\u3002" }),
|
|
1960
|
+
state.status === "loading" && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("p", { role: "status", children: "\u6B63\u5728\u8BFB\u53D6\u8BFE\u9898\u76EE\u5F55\u2026" }),
|
|
1961
|
+
state.status !== "loading" && projects.length === 0 && !state.error && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("p", { children: "\u8FD9\u4E2A\u5DE5\u4F5C\u533A\u8FD8\u6CA1\u6709\u53EF\u5217\u51FA\u7684\u8BFE\u9898\u3002" }),
|
|
1962
|
+
projects.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "sci-catalog-grid", children: projects.map((item) => /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("article", { className: "sci-catalog-card", "data-current": item.current || void 0, children: [
|
|
1963
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("header", { children: [
|
|
1964
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { children: item.stageLabel || "\u7814\u7A76\u63A2\u7D22" }),
|
|
1965
|
+
item.current && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("strong", { children: "\u5F53\u524D" })
|
|
1966
|
+
] }),
|
|
1967
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("h3", { children: item.title || "\u672A\u547D\u540D\u8BFE\u9898" }),
|
|
1968
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("p", { children: item.questionExcerpt || "\u8FD8\u6CA1\u6709\u7814\u7A76\u95EE\u9898\u6458\u8981\u3002" }),
|
|
1969
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("dl", { children: [
|
|
1970
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { children: [
|
|
1971
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("dt", { children: "\u5F85\u5904\u7406" }),
|
|
1972
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("dd", { children: item.attentionCount || 0 })
|
|
1973
|
+
] }),
|
|
1974
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { children: [
|
|
1975
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("dt", { children: "\u8FDB\u884C\u4E2D" }),
|
|
1976
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("dd", { children: item.runningCount || 0 })
|
|
1977
|
+
] }),
|
|
1978
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { children: [
|
|
1979
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("dt", { children: "\u53D7\u963B" }),
|
|
1980
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("dd", { children: item.blockedCount || 0 })
|
|
1981
|
+
] })
|
|
1982
|
+
] }),
|
|
1983
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Button, { primary: item.current, disabled: !item.openable || busyHandle === item.openHandle, onClick: () => openProject(item), children: item.openable ? item.current ? "\u56DE\u5230\u8FD9\u4E2A\u8BFE\u9898" : "\u6253\u5F00\u8BFE\u9898" : "\u539F\u4F1A\u8BDD\u4E0D\u5728\u7EBF" })
|
|
1984
|
+
] }, item.openHandle)) })
|
|
1985
|
+
] });
|
|
1986
|
+
}
|
|
1987
|
+
|
|
1988
|
+
// client-src/workbench/ResearchWorkbench.jsx
|
|
1989
|
+
var import_jsx_runtime8 = require("react/jsx-runtime");
|
|
1990
|
+
var NAV = [
|
|
1991
|
+
{ id: "overview", label: "\u6982\u89C8" },
|
|
1992
|
+
{ id: "catalog", label: "\u9879\u76EE\u603B\u89C8" },
|
|
1993
|
+
{ id: "paper", label: "\u8BBA\u6587\u4E3B\u7EBF" },
|
|
1994
|
+
{ id: "team", label: "\u56E2\u961F\u8FDB\u5C55" },
|
|
1995
|
+
{ id: "artifacts", label: "\u56FE\u8868\u4E0E\u6210\u679C" },
|
|
1996
|
+
{ id: "experts", label: "\u4E13\u5BB6\u914D\u7F6E" }
|
|
1997
|
+
];
|
|
1998
|
+
function WorkbenchMark() {
|
|
1999
|
+
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: [
|
|
2000
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("path", { d: "M9 3h6M10 3v6.2l-5.3 9.1A2.5 2.5 0 0 0 6.9 22h10.2a2.5 2.5 0 0 0 2.2-3.7L14 9.2V3" }),
|
|
2001
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("path", { d: "M8 15h8M9.4 12.5h5.2" })
|
|
2002
|
+
] }) });
|
|
2003
|
+
}
|
|
2004
|
+
function ResearchWorkbench({ services }) {
|
|
2005
|
+
const state = useProjectBinding(services);
|
|
2006
|
+
const [page, setPage] = (0, import_react10.useState)("overview");
|
|
2007
|
+
(0, import_react10.useEffect)(() => {
|
|
2008
|
+
try {
|
|
2009
|
+
if (window.__DSH_SCIENCE_OPEN_PAGE__ === "catalog") {
|
|
2010
|
+
setPage("catalog");
|
|
2011
|
+
window.__DSH_SCIENCE_OPEN_PAGE__ = "";
|
|
2012
|
+
}
|
|
2013
|
+
} catch {
|
|
2014
|
+
}
|
|
2015
|
+
}, []);
|
|
2016
|
+
const [busy, setBusy] = (0, import_react10.useState)(false);
|
|
2017
|
+
const [notice, setNotice] = (0, import_react10.useState)(null);
|
|
2018
|
+
const openAction = async (action, targetId = null) => {
|
|
2019
|
+
const handoff = semanticHandoffOf(action, targetId);
|
|
2020
|
+
if (!handoff) {
|
|
2021
|
+
setNotice({ tone: "error", text: "\u65E0\u6CD5\u8BC6\u522B\u8FD9\u4E2A\u52A8\u4F5C\u3002" });
|
|
2022
|
+
return;
|
|
2023
|
+
}
|
|
2024
|
+
setBusy(true);
|
|
2025
|
+
setNotice(null);
|
|
2026
|
+
try {
|
|
2027
|
+
const r = await services?.prepareHandoff?.(handoff.kind, handoff.target);
|
|
2028
|
+
if (r && r.ok) {
|
|
2029
|
+
setNotice({ tone: "success", text: "\u5DF2\u5728\u5BF9\u8BDD\u8F93\u5165\u6846\u51C6\u5907\u8BF7\u6C42\uFF1B\u8BF7\u8865\u5145\u8BF4\u660E\u540E\u53D1\u9001\u3002" });
|
|
2030
|
+
} else {
|
|
2031
|
+
const reason = r && (r.reason || r.code) || "\u5F53\u524D\u4F1A\u8BDD\u4E0D\u652F\u6301\u9884\u586B\u3002";
|
|
2032
|
+
setNotice({ tone: "error", text: `\u672A\u80FD\u51C6\u5907\u5230\u8F93\u5165\u6846\uFF08${reason}\uFF09\u3002\u8BF7\u6253\u5F00\u5BF9\u8BDD\u624B\u52A8\u63CF\u8FF0\u3002` });
|
|
2033
|
+
try {
|
|
2034
|
+
services?.openConversation?.();
|
|
2035
|
+
} catch {
|
|
2036
|
+
}
|
|
2037
|
+
}
|
|
2038
|
+
} finally {
|
|
2039
|
+
setBusy(false);
|
|
2040
|
+
}
|
|
2041
|
+
};
|
|
2042
|
+
const confirmResult = async (objectId, expectedObjectRevision, expectedHash) => {
|
|
2043
|
+
setBusy(true);
|
|
2044
|
+
setNotice(null);
|
|
2045
|
+
try {
|
|
2046
|
+
const r = await confirmObjectViaAct({
|
|
2047
|
+
sessionId: state.sessionId,
|
|
2048
|
+
objectId,
|
|
2049
|
+
expectedObjectRevision,
|
|
2050
|
+
expectedHash,
|
|
2051
|
+
expectedRevision: state.revision
|
|
2052
|
+
});
|
|
2053
|
+
if (r.ok) {
|
|
2054
|
+
setNotice({ tone: "success", text: "\u5DF2\u786E\u8BA4\u5F53\u524D\u4FEE\u8BA2\uFF1B\u786E\u8BA4\u540E\u624D\u80FD\u636E\u6B64\u6D3E\u53D1\u6267\u884C\u4EFB\u52A1\u3002" });
|
|
2055
|
+
await state.refresh();
|
|
2056
|
+
} else {
|
|
2057
|
+
setNotice({ tone: "error", text: r.reason || "\u786E\u8BA4\u672A\u6267\u884C\u3002" });
|
|
2058
|
+
}
|
|
2059
|
+
} finally {
|
|
2060
|
+
setBusy(false);
|
|
2061
|
+
}
|
|
2062
|
+
};
|
|
2063
|
+
const openConversation = () => services?.openConversation?.();
|
|
2064
|
+
const currentView = state.view;
|
|
2065
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "sci-workbench sci-desk", lang: "zh-CN", children: [
|
|
2066
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(WorkbenchStyles, {}),
|
|
2067
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("style", { children: RESEARCH_DESK_CSS }),
|
|
2068
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "sci-wb-shell", children: [
|
|
2069
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("header", { className: "sci-wb-header", children: [
|
|
2070
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "sci-wb-brand", children: [
|
|
2071
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(WorkbenchMark, {}),
|
|
2072
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { children: "\u79D1\u7814\u5DE5\u4F5C\u53F0" })
|
|
2073
|
+
] }),
|
|
2074
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("nav", { className: "sci-wb-nav", "aria-label": "\u79D1\u7814\u5DE5\u4F5C\u53F0\u9875\u9762", children: NAV.map((item) => /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("button", { type: "button", "aria-current": page === item.id ? "page" : void 0, onClick: () => setPage(item.id), children: item.label }, item.id)) }),
|
|
2075
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: "sci-wb-head-actions", children: /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(Button, { onClick: openConversation, children: [
|
|
2076
|
+
"\u56DE\u5230\u5BF9\u8BDD ",
|
|
2077
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { "aria-hidden": "true", children: "\u2197" })
|
|
2078
|
+
] }) })
|
|
2079
|
+
] }),
|
|
2080
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("main", { className: "sci-wb-content", children: page === "catalog" ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: "sci-desk-scene", children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(ProjectCatalog, { services }) }) : state.loading && !currentView ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Panel, { children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: "sci-empty", children: /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { children: [
|
|
2081
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("h2", { children: "\u6B63\u5728\u8BFB\u53D6\u7814\u7A76\u72B6\u6001" }),
|
|
2082
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("p", { children: "\u5DE5\u4F5C\u53F0\u4ECE\u5F53\u524D DSH \u9879\u76EE\u8BFB\u53D6\u8BBA\u6587\u4E3B\u7EBF\u3001\u56E2\u961F\u4EFB\u52A1\u548C\u5DF2\u767B\u8BB0\u6210\u679C\u3002" })
|
|
2083
|
+
] }) }) }) : state.error && !currentView ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Panel, { title: "\u6682\u65F6\u65E0\u6CD5\u8BFB\u53D6\u5DE5\u4F5C\u53F0\u72B6\u6001", children: /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(StatusMessage, { tone: "error", children: [
|
|
2084
|
+
state.error,
|
|
2085
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "sci-result-actions", children: [
|
|
2086
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Button, { onClick: state.refresh, children: "\u91CD\u65B0\u8BFB\u53D6" }),
|
|
2087
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Button, { onClick: openConversation, children: "\u6253\u5F00\u5BF9\u8BDD" })
|
|
2088
|
+
] })
|
|
2089
|
+
] }) }) : currentView && /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "sci-desk-scene", children: [
|
|
2090
|
+
page === "overview" && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(WorkspaceOverview, { view: currentView, raw: state.raw, busy, onAction: openAction, onNavigate: setPage, onOpenConversation: openConversation, onOpenCatalog: () => setPage("catalog") }),
|
|
2091
|
+
page === "paper" && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(PaperSpinePage, { view: currentView, raw: state.raw, onAction: openAction, onConfirm: confirmResult, busy, onOpenConversation: openConversation, onNavigate: setPage }),
|
|
2092
|
+
page === "team" && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(TeamProgressPage, { view: currentView, openMemberSession: services?.openMemberSession, memberOpenAvailable: services?.memberOpenAvailable?.(currentView) }),
|
|
2093
|
+
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 }),
|
|
2095
|
+
state.error && /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "sci-small", style: { marginTop: 14 }, role: "status", children: [
|
|
2096
|
+
"\u72B6\u6001\u5237\u65B0\u5931\u8D25\uFF0C\u6B63\u5728\u663E\u793A\u4E0A\u4E00\u6B21\u6210\u529F\u8BFB\u53D6\u7684\u6570\u636E\uFF1A",
|
|
2097
|
+
state.error
|
|
2098
|
+
] })
|
|
2099
|
+
] }, page) })
|
|
2100
|
+
] }),
|
|
2101
|
+
notice && /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: `sci-toast`, role: "status", "data-tone": notice.tone, children: [
|
|
2102
|
+
notice.text,
|
|
2103
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "sci-result-actions", children: [
|
|
2104
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Button, { small: true, onClick: openConversation, children: "\u6253\u5F00\u5BF9\u8BDD" }),
|
|
2105
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Button, { small: true, onClick: () => setNotice(null), children: "\u5173\u95ED" })
|
|
2106
|
+
] })
|
|
2107
|
+
] })
|
|
2108
|
+
] });
|
|
2109
|
+
}
|
|
2110
|
+
|
|
2111
|
+
// client-src/workbench/QuickWorkbench.jsx
|
|
2112
|
+
var import_react12 = __toESM(require("react"), 1);
|
|
2113
|
+
|
|
2114
|
+
// client-src/workbench/ResearchRail.jsx
|
|
2115
|
+
var import_react11 = __toESM(require("react"), 1);
|
|
2116
|
+
|
|
2117
|
+
// client-src/workbench/research-rail-styles.js
|
|
2118
|
+
var RESEARCH_RAIL_CSS = `
|
|
2119
|
+
.sci-rs.sci-quick{display:grid;align-content:start;gap:1rem;min-width:0;padding:12px 12px 24px;font-size:.8125rem}
|
|
2120
|
+
.sci-rs *{min-width:0}
|
|
2121
|
+
.sci-rs :is(h2,h3,p){margin:0;overflow-wrap:anywhere}
|
|
2122
|
+
.sci-rs button,.sci-rs a,.sci-rs summary{font:inherit}
|
|
2123
|
+
.sci-rs :is(button,a,summary):focus-visible{outline:2px solid var(--sci-accent);outline-offset:2px}
|
|
2124
|
+
.sci-rs-mast,.sci-rs-head,.sci-rs-kicker,.sci-rs-card-footer,.sci-rs-meta{display:flex;align-items:center;gap:7px}
|
|
2125
|
+
.sci-rs-mast{justify-content:space-between;flex-wrap:wrap;padding:0 2px}
|
|
2126
|
+
.sci-rs-mast h2{font-size:1rem;font-weight:700;color:var(--sci-fg)}
|
|
2127
|
+
.sci-rs-mark,.sci-rs-icon{display:inline-grid;place-items:center;flex:none;width:28px;height:28px;border-radius:9px;color:var(--sci-accent);background:color-mix(in srgb,var(--sci-accent) 13%,transparent)}
|
|
2128
|
+
.sci-rs-section,.sci-rs-stack{display:grid;gap:8px}
|
|
2129
|
+
.sci-rs-head{width:100%;border:0;border-radius:7px;background:transparent;color:inherit;cursor:pointer;text-align:left;font-weight:700!important;padding:4px 3px}
|
|
2130
|
+
.sci-rs-head:hover{background:var(--sci-raised)}
|
|
2131
|
+
.sci-rs-count{margin-left:auto;background:var(--sci-raised);border-radius:999px;padding:0 7px;color:var(--sci-muted);font-variant-numeric:tabular-nums}
|
|
2132
|
+
.sci-rs-chevron{color:var(--sci-muted);display:inline-flex;flex:none}
|
|
2133
|
+
.sci-rs-head[aria-expanded=true] .sci-rs-chevron{transform:rotate(90deg)}
|
|
2134
|
+
.sci-rs-card{display:grid;gap:8px;padding:11px 12px;border:1px solid var(--sci-border);border-radius:12px;background:var(--sci-card)}
|
|
2135
|
+
.sci-rs-card[data-variant=project]{gap:10px;padding:13px;border-color:color-mix(in srgb,var(--sci-accent) 30%,var(--sci-border));background:linear-gradient(145deg,color-mix(in srgb,var(--sci-accent) 10%,transparent),transparent 80%),var(--sci-card)}
|
|
2136
|
+
.sci-rs-card[data-variant=attention]{border-inline-start:3px solid var(--sci-warn)}
|
|
2137
|
+
.sci-rs-card[data-variant=attention] .sci-rs-icon{color:var(--sci-warn);background:color-mix(in srgb,var(--sci-warn) 14%,transparent)}
|
|
2138
|
+
.sci-rs-card[data-variant=problem]{border-inline-start:3px solid var(--sci-bad)}
|
|
2139
|
+
.sci-rs-kicker{color:var(--sci-muted);font-size:.75rem;font-weight:600;flex-wrap:wrap;overflow-wrap:anywhere}
|
|
2140
|
+
.sci-rs-kicker .sci-rs-pill{margin-inline-start:auto}
|
|
2141
|
+
.sci-rs-card h3{font-size:.875rem;font-weight:700;line-height:1.4}
|
|
2142
|
+
.sci-rs-card[data-variant=project] h3{font-size:1.125rem;letter-spacing:-.015em}
|
|
2143
|
+
.sci-rs-copy,.sci-rs-meta,.sci-rs-empty{color:var(--sci-muted);overflow-wrap:anywhere}
|
|
2144
|
+
.sci-rs-meta{flex-wrap:wrap;font-size:.75rem;font-variant-numeric:tabular-nums}
|
|
2145
|
+
.sci-rs-meta span+span::before{content:'\xB7';margin-inline-end:7px}
|
|
2146
|
+
.sci-rs-pill{display:inline-flex;align-items:center;gap:5px;border-radius:999px;padding:2px 7px;background:var(--sci-raised);color:var(--sci-fg);font-size:.6875rem;font-weight:650}
|
|
2147
|
+
.sci-rs-pill::before{content:'';width:6px;height:6px;flex:none;border-radius:50%;background:var(--sci-muted)}
|
|
2148
|
+
.sci-rs-pill[data-tone=good]::before{background:var(--sci-good)}
|
|
2149
|
+
.sci-rs-pill[data-tone=warn]::before{background:var(--sci-warn)}
|
|
2150
|
+
.sci-rs-pill[data-tone=bad]::before{background:var(--sci-bad)}
|
|
2151
|
+
.sci-rs-pill[data-tone=good]{background:color-mix(in srgb,var(--sci-good) 12%,transparent)}
|
|
2152
|
+
.sci-rs-pill[data-tone=warn]{background:color-mix(in srgb,var(--sci-warn) 14%,transparent)}
|
|
2153
|
+
.sci-rs-pill[data-tone=bad]{background:color-mix(in srgb,var(--sci-bad) 12%,transparent)}
|
|
2154
|
+
.sci-rs-next{padding:7px 9px;border-radius:7px;background:var(--sci-raised);color:var(--sci-fg);overflow-wrap:anywhere}
|
|
2155
|
+
.sci-rs-next b{display:block;font-size:.6875rem;margin-bottom:2px}
|
|
2156
|
+
.sci-rs-card-footer{flex-wrap:wrap;padding-top:3px}
|
|
2157
|
+
.sci-rs .sci-rs-action{display:inline-flex;align-items:center;gap:6px;max-width:100%;border:1px solid var(--sci-border);border-radius:8px;background:transparent;color:var(--sci-fg);padding:5px 8px;min-height:28px;text-align:left;text-decoration:none;overflow-wrap:anywhere;cursor:pointer}
|
|
2158
|
+
.sci-rs .sci-rs-action[data-primary=true]{background:color-mix(in srgb,var(--sci-accent) 15%,var(--sci-card));border-color:color-mix(in srgb,var(--sci-accent) 40%,var(--sci-border));font-weight:650}
|
|
2159
|
+
.sci-rs .sci-rs-action:hover:not(:disabled),.sci-rs-more:hover{background:var(--sci-raised)}
|
|
2160
|
+
.sci-rs .sci-rs-action:disabled{opacity:.55;cursor:default}
|
|
2161
|
+
.sci-rs-stats{display:grid;grid-template-columns:repeat(auto-fit,minmax(min(100%,3.4rem),1fr));gap:5px;margin:0}
|
|
2162
|
+
.sci-rs-stats div{display:flex;flex-direction:column-reverse;align-items:flex-start;gap:2px;border-radius:7px;background:color-mix(in srgb,var(--sci-card) 65%,transparent);padding:5px 7px}
|
|
2163
|
+
.sci-rs-stats dt{font-size:.6875rem;color:var(--sci-muted);overflow-wrap:anywhere}
|
|
2164
|
+
.sci-rs-stats dd{margin:0;font-size:1rem;font-weight:700;line-height:1.1;font-variant-numeric:tabular-nums}
|
|
2165
|
+
.sci-rs-empty{border:1px dashed var(--sci-border);border-radius:10px;padding:9px 11px}
|
|
2166
|
+
.sci-rs-skills{display:grid;grid-template-columns:repeat(auto-fit,minmax(min(100%,6.2rem),1fr));gap:7px}
|
|
2167
|
+
.sci-rs-skills .sci-rs-action{min-height:35px}
|
|
2168
|
+
.sci-rs-details{overflow-wrap:anywhere;color:var(--sci-muted)}
|
|
2169
|
+
.sci-rs-details summary,.sci-rs-more{cursor:pointer;color:var(--sci-fg);border-radius:7px}
|
|
2170
|
+
.sci-rs-details[open] summary{margin-bottom:5px}
|
|
2171
|
+
.sci-rs-excerpt{color:var(--sci-muted)}
|
|
2172
|
+
.sci-rs-expand,.sci-rs-collapse{white-space:nowrap}
|
|
2173
|
+
.sci-rs-details:not([open]) .sci-rs-collapse,.sci-rs-details[open] :is(.sci-rs-excerpt,.sci-rs-expand){display:none}
|
|
2174
|
+
.sci-rs-more{padding:5px 8px;background:transparent;border:1px dashed var(--sci-border);text-align:center}
|
|
2175
|
+
.sci-rs-figure{display:block;width:100%;height:95px;object-fit:contain;background:var(--sci-raised);border-radius:7px}
|
|
2176
|
+
.sci-rs{--rd-ink:var(--dsw-alias-label-primary,CanvasText);--rd-card:var(--dsw-alias-bg-layer-1,Canvas);--rd-line:color-mix(in srgb,var(--rd-ink) 12%,transparent)}
|
|
2177
|
+
.sci-rs .sci-rs-card{border-color:var(--rd-line);background:var(--rd-card);border-radius:14px}
|
|
2178
|
+
.sci-rs .sci-rs-card[data-variant=attention]{border-inline-start-width:1px}
|
|
2179
|
+
.sci-rs .sci-rs-card[data-variant=project]{background:radial-gradient(ellipse at 100% 10%,color-mix(in srgb,#a899d9 20%,transparent),transparent 74%),radial-gradient(ellipse at 80% 100%,color-mix(in srgb,#92b7b0 18%,transparent),transparent 77%),var(--rd-card);padding:16px}
|
|
2180
|
+
.sci-rs .sci-rs-hero h3{font-size:1.45rem;font-weight:500;line-height:1.22}
|
|
2181
|
+
.sci-rs-stage{margin-inline-start:auto;font-weight:500}
|
|
2182
|
+
.sci-rs-switch{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:3px;padding:4px;border:1px solid var(--rd-line);border-radius:11px;background:var(--rd-card)}
|
|
2183
|
+
.sci-rs-switch button{border:0;border-radius:7px;padding:5px 2px;background:transparent;color:var(--sci-muted);cursor:pointer;transition:background 160ms,color 160ms;overflow-wrap:anywhere}
|
|
2184
|
+
.sci-rs-switch button[aria-pressed=true],.sci-rs .sci-rs-action[data-primary=true]{background:var(--rd-ink);color:var(--rd-card);border-color:transparent}
|
|
2185
|
+
.sci-rs .sci-rs-action[data-primary=true]:hover:not(:disabled){background:color-mix(in srgb,var(--rd-ink) 84%,var(--rd-card))}
|
|
2186
|
+
.sci-rs .sci-rs-action{border-radius:999px;transition:background 160ms,transform 180ms}
|
|
2187
|
+
.sci-rs .sci-rs-action:active:not(:disabled){transform:scale(.97)}
|
|
2188
|
+
.sci-rs-kicker .sci-rs-icon{width:21px;height:21px;color:inherit;background:transparent}
|
|
2189
|
+
.sci-rs-preview{display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden}
|
|
2190
|
+
.sci-rs-heading{display:flex;align-items:center;justify-content:space-between;gap:8px;color:var(--sci-muted);font-size:.75rem}
|
|
2191
|
+
.sci-rs-heading h3{color:var(--rd-ink);font-size:.85rem}
|
|
2192
|
+
.sci-rs-text-button{display:inline-flex;align-items:center;gap:5px;justify-self:start;border:0;border-radius:6px;color:var(--sci-muted);background:transparent;padding:2px 4px;cursor:pointer;text-align:left}
|
|
2193
|
+
.sci-rs-text-button:hover{background:var(--sci-raised)}
|
|
2194
|
+
.sci-rs-stats div{padding:3px 4px;background:none}
|
|
2195
|
+
.sci-rs-stats dd{font:400 1.28rem/1 Georgia,serif}
|
|
2196
|
+
.sci-rs-activity .sci-rs-copy{padding:6px 8px;background:color-mix(in srgb,var(--rs-module-color,#3b9b87) 9%,var(--rd-card));border-radius:8px}
|
|
2197
|
+
.sci-rs .sci-rs-card{transition:border-color 180ms,box-shadow 180ms}
|
|
2198
|
+
@media(hover:hover){.sci-rs .sci-rs-card:focus-within,.sci-rs .sci-rs-card:hover{border-color:color-mix(in srgb,var(--rd-ink) 22%,transparent);box-shadow:0 3px 12px #0000000b}}
|
|
2199
|
+
@media(prefers-reduced-motion:reduce){.sci-rs :is(button,a){transition:none;transform:none!important}}
|
|
2200
|
+
.sci-rs [data-kind=project]{--rs-module-color:#8772ce}
|
|
2201
|
+
.sci-rs [data-kind=paper]{--rs-module-color:#5a8dcd}
|
|
2202
|
+
.sci-rs [data-kind=team]{--rs-module-color:#3b9b87}
|
|
2203
|
+
.sci-rs [data-kind=figure]{--rs-module-color:#bc77a0}
|
|
2204
|
+
.sci-rs [data-kind=alert]{--rs-module-color:#c48c4d}
|
|
2205
|
+
.sci-rs [data-kind=explore]{--rs-module-color:#8772ce}
|
|
2206
|
+
.sci-rs-module-title{display:flex;align-items:center;gap:8px}
|
|
2207
|
+
.sci-rs-module-mark{position:relative;display:inline-grid;place-items:center;flex:none;width:36px;height:36px;border-radius:13px;background:linear-gradient(145deg,color-mix(in srgb,var(--rs-module-color) 26%,var(--rd-card)),color-mix(in srgb,var(--rs-module-color) 10%,var(--rd-card)));color:color-mix(in srgb,var(--rs-module-color) 70%,var(--rd-ink))}
|
|
2208
|
+
.sci-rs-module-mark[data-compact=true]{width:29px;height:29px;border-radius:10px}
|
|
2209
|
+
.sci-rs .sci-rs-switch{border:0;gap:5px;background:transparent;padding:0}
|
|
2210
|
+
.sci-rs .sci-rs-switch button{display:grid;justify-items:center;align-content:start;gap:4px;padding:5px 2px 6px;border-radius:12px;color:var(--rd-ink);background:var(--rd-card);font-size:.75rem;box-shadow:0 1px 3px #0000000a}
|
|
2211
|
+
.sci-rs .sci-rs-switch button:hover{background:var(--sci-raised)}
|
|
2212
|
+
.sci-rs .sci-rs-switch button[aria-pressed=true]{background:var(--rd-ink);color:var(--rd-card)}
|
|
2213
|
+
.sci-rs .sci-rs-module{padding:8px;border-radius:17px;background:color-mix(in srgb,var(--rs-module-color) 10%,var(--rd-card));gap:8px}
|
|
2214
|
+
.sci-rs .sci-rs-module .sci-rs-card{border-color:transparent;background:var(--rd-card)}
|
|
2215
|
+
.sci-rs .sci-rs-module .sci-rs-heading{padding:0 3px}
|
|
2216
|
+
.sci-rs .sci-rs-head{gap:8px}
|
|
2217
|
+
.sci-rs .sci-rs-hero h3,.sci-desk .sci-desk-hero h1{letter-spacing:normal}
|
|
2218
|
+
/* \u76EE\u5F55\u9875\u5728\u53F3\u680F\u4E5F\u8981\u5361\u7247\u5316\uFF1AProjectCatalog \u7684 sci-catalog* \u89C4\u5219\u539F\u672C\u53EA\u5728\u5B8C\u6574\u5DE5\u4F5C\u53F0\u6CE8\u5165\u3002 */
|
|
2219
|
+
.sci-rs .sci-catalog{display:grid;gap:10px}
|
|
2220
|
+
.sci-rs .sci-catalog-head h2{margin:2px 0 0;font-size:1.05rem;font-weight:600;color:var(--sci-fg)}
|
|
2221
|
+
.sci-rs .sci-catalog-head p:last-child{color:var(--sci-muted);font-size:.75rem;line-height:1.6}
|
|
2222
|
+
.sci-rs .sci-catalog-grid{display:grid;grid-template-columns:1fr;gap:10px}
|
|
2223
|
+
.sci-rs .sci-catalog-card{display:grid;gap:7px;padding:12px;border:1px solid var(--sci-line);border-radius:14px;background:var(--sci-raised)}
|
|
2224
|
+
.sci-rs .sci-catalog-card header{display:flex;justify-content:space-between;gap:8px;color:var(--sci-muted);font-size:.7rem}
|
|
2225
|
+
.sci-rs .sci-catalog-card h3{margin:0;font-size:.9rem;line-height:1.4;color:var(--sci-fg)}
|
|
2226
|
+
.sci-rs .sci-catalog-card p,.sci-rs .sci-catalog-card dd{margin:0;font-size:.75rem;line-height:1.55}
|
|
2227
|
+
.sci-rs .sci-catalog-card dl{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:6px;margin:0}
|
|
2228
|
+
.sci-rs .sci-catalog-card dt{color:var(--sci-muted);font-size:.7rem}
|
|
2229
|
+
.sci-rs .sci-catalog-card dd{font-variant-numeric:tabular-nums;font-weight:600}
|
|
2230
|
+
.sci-rs .sci-rs-back{display:inline-flex;align-items:center;gap:6px;align-self:flex-start;padding:4px 10px;border-radius:9px;border:1px solid var(--sci-line);background:var(--sci-raised);color:var(--sci-fg);font-size:.75rem;cursor:pointer}
|
|
2231
|
+
`;
|
|
2232
|
+
|
|
2233
|
+
// client-src/workbench/ResearchRail.jsx
|
|
2234
|
+
var import_jsx_runtime9 = require("react/jsx-runtime");
|
|
2235
|
+
var icons = {
|
|
2236
|
+
project: "M4 5h16v14H4z M8 9h8m-8 4h5",
|
|
2237
|
+
paper: "M6 3h8l4 4v14H6z M14 3v5h4M9 12h6m-6 4h6",
|
|
2238
|
+
alert: "M12 3l9 16H3z M12 9v4m0 3h.01",
|
|
2239
|
+
team: "M8 16a3 3 0 0 1-3 3H2v-2a4 4 0 0 1 4-4h2m8 3a3 3 0 0 0 3 3h3v-2a4 4 0 0 0-4-4h-2M9 8a3 3 0 1 0 6 0 3 3 0 1 0-6 0m-2 13v-3a5 5 0 0 1 10 0v3",
|
|
2240
|
+
figure: "M4 4h16v16H4z M7 16l4-5 3 3 2-2 4 4 M8 8h.01",
|
|
2241
|
+
explore: "M11 3l2.4 6.6L20 12l-6.6 2.4L11 21l-2.4-6.6L2 12l6.6-2.4z M19 3v4m-2-2h4",
|
|
2242
|
+
search: "M16 10a6 6 0 1 1-12 0 6 6 0 0 1 12 0zm-2 4 5 5",
|
|
2243
|
+
structure: "M4 4h6v5H4zm10 11h6v5h-6zM7 9v8h7",
|
|
2244
|
+
write: "M4 20l4-.8L20 7l-3-3L5 16z M14 7l3 3",
|
|
2245
|
+
slides: "M3 4h18v12H3z M12 16v4m-4 1 4-2 4 2",
|
|
2246
|
+
check: "m5 12 4 4L19 6",
|
|
2247
|
+
arrow: "M5 12h14m-5-5 5 5-5 5",
|
|
2248
|
+
chevron: "m9 6 6 6-6 6",
|
|
2249
|
+
compute: "M4 5h16v14H4z M8 9l3 3-3 3m5 0h3"
|
|
2250
|
+
};
|
|
2251
|
+
function Icon({ name, size = 16 }) {
|
|
2252
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("svg", { "aria-hidden": "true", width: size, height: size, viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "1.65", strokeLinecap: "round", strokeLinejoin: "round", children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("path", { d: icons[name] || icons.team }) });
|
|
2253
|
+
}
|
|
2254
|
+
var marks = {
|
|
2255
|
+
project: () => /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(import_jsx_runtime9.Fragment, { children: [
|
|
2256
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("circle", { cx: "16", cy: "16", r: "10", opacity: ".27" }),
|
|
2257
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("ellipse", { cx: "16", cy: "16", rx: "12", ry: "5", transform: "rotate(-38 16 16)", opacity: ".65" }),
|
|
2258
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("circle", { cx: "16", cy: "16", r: "3", fill: "currentColor", stroke: "none" }),
|
|
2259
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("circle", { cx: "24.5", cy: "9", r: "2", fill: "currentColor", stroke: "none" })
|
|
2260
|
+
] }),
|
|
2261
|
+
paper: () => /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(import_jsx_runtime9.Fragment, { children: [
|
|
2262
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("path", { d: "M10 5h12l3 3v16H10z", fill: "currentColor", fillOpacity: ".15" }),
|
|
2263
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("path", { d: "M7 10v17h13M14 12h7m-7 4h7m-7 4h4" })
|
|
2264
|
+
] }),
|
|
2265
|
+
team: () => /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(import_jsx_runtime9.Fragment, { children: [
|
|
2266
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("path", { d: "m9 22 7-12 8 12H9z", opacity: ".55" }),
|
|
2267
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("circle", { cx: "16", cy: "9", r: "4", fill: "currentColor", stroke: "none" }),
|
|
2268
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("circle", { cx: "8", cy: "23", r: "4", fill: "currentColor", stroke: "none" }),
|
|
2269
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("circle", { cx: "24", cy: "23", r: "4", fill: "currentColor", stroke: "none" })
|
|
2270
|
+
] }),
|
|
2271
|
+
figure: () => /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(import_jsx_runtime9.Fragment, { children: [
|
|
2272
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("rect", { x: "5", y: "6", width: "22", height: "20", rx: "4", fill: "currentColor", fillOpacity: ".13" }),
|
|
2273
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("path", { d: "M9 21l5-6 4 3 5-8" }),
|
|
2274
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("circle", { cx: "23", cy: "10", r: "2.3", fill: "currentColor", stroke: "none" })
|
|
2275
|
+
] }),
|
|
2276
|
+
alert: () => /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(import_jsx_runtime9.Fragment, { children: [
|
|
2277
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("path", { d: "M16 4 28 16 16 28 4 16z", fill: "currentColor", fillOpacity: ".15" }),
|
|
2278
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("path", { d: "M16 10v6m0 4v1" })
|
|
2279
|
+
] }),
|
|
2280
|
+
explore: () => /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(import_jsx_runtime9.Fragment, { children: [
|
|
2281
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("path", { d: "M16 5q1 10 11 11-10 1-11 11Q15 17 5 16 15 15 16 5Z", fill: "currentColor", fillOpacity: ".17" }),
|
|
2282
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("path", { d: "M25 5v6m-3-3h6" })
|
|
2283
|
+
] })
|
|
2284
|
+
};
|
|
2285
|
+
function ModuleMark({ kind, compact = false }) {
|
|
2286
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { className: "sci-rs-module-mark", "data-kind": kind, "data-compact": compact || void 0, children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("svg", { viewBox: "0 0 32 32", width: compact ? 20 : 24, height: compact ? 20 : 24, "aria-hidden": "true", fill: "none", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round", children: marks[kind]?.() }) });
|
|
2287
|
+
}
|
|
2288
|
+
function ModuleTitle({ kind, children }) {
|
|
2289
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("h3", { className: "sci-rs-module-title", children: [
|
|
2290
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(ModuleMark, { kind }),
|
|
2291
|
+
children
|
|
2292
|
+
] });
|
|
2293
|
+
}
|
|
2294
|
+
function Action({ href, icon, primary, children, ...props }) {
|
|
2295
|
+
const common = { className: "sci-rs-action", "data-primary": primary || void 0, ...props };
|
|
2296
|
+
const content = /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(import_jsx_runtime9.Fragment, { children: [
|
|
2297
|
+
icon && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Icon, { name: icon, size: 14 }),
|
|
2298
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { children })
|
|
2299
|
+
] });
|
|
2300
|
+
return href ? /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("a", { ...common, href, target: "_blank", rel: "noreferrer", children: content }) : /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("button", { ...common, type: "button", children: content });
|
|
2301
|
+
}
|
|
2302
|
+
function Pill({ tone, children }) {
|
|
2303
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { className: "sci-rs-pill", "data-tone": tone, children });
|
|
2304
|
+
}
|
|
2305
|
+
function Card({ variant, icon, label, title, status, action, children }) {
|
|
2306
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("article", { className: "sci-rs-card", "data-variant": variant, children: [
|
|
2307
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "sci-rs-kicker", children: [
|
|
2308
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { className: "sci-rs-icon", children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Icon, { name: icon }) }),
|
|
2309
|
+
label,
|
|
2310
|
+
status
|
|
2311
|
+
] }),
|
|
2312
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("h3", { children: title }),
|
|
2313
|
+
children,
|
|
2314
|
+
action && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: "sci-rs-card-footer", children: action })
|
|
2315
|
+
] });
|
|
2316
|
+
}
|
|
2317
|
+
function Copy({ text, limit = 95 }) {
|
|
2318
|
+
if (!text) return null;
|
|
2319
|
+
const shortened = text.length > limit;
|
|
2320
|
+
return shortened ? /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("details", { className: "sci-rs-details", children: [
|
|
2321
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("summary", { children: [
|
|
2322
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("span", { className: "sci-rs-excerpt", children: [
|
|
2323
|
+
text.slice(0, limit),
|
|
2324
|
+
"\u2026 "
|
|
2325
|
+
] }),
|
|
2326
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { className: "sci-rs-expand", children: "\u5C55\u5F00\u5168\u6587" }),
|
|
2327
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { className: "sci-rs-collapse", children: "\u6536\u8D77\u5168\u6587" })
|
|
2328
|
+
] }),
|
|
2329
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("p", { children: text })
|
|
2330
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("p", { className: "sci-rs-copy", children: text });
|
|
2331
|
+
}
|
|
2332
|
+
function Metrics({ items }) {
|
|
2333
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("dl", { className: "sci-rs-stats", children: items.map(([label, value]) => /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { children: [
|
|
2334
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("dt", { children: label }),
|
|
2335
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("dd", { children: value })
|
|
2336
|
+
] }, label)) });
|
|
2337
|
+
}
|
|
2338
|
+
function Section({ title, icon, count, children, defaultOpen = true }) {
|
|
2339
|
+
const [open, setOpen] = (0, import_react11.useState)(defaultOpen);
|
|
2340
|
+
const contentId = (0, import_react11.useId)();
|
|
2341
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("section", { className: "sci-rs-section", children: [
|
|
2342
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("h3", { children: /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("button", { type: "button", className: "sci-rs-head", "aria-expanded": open, "aria-controls": contentId, onClick: () => setOpen(!open), children: [
|
|
2343
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(ModuleMark, { kind: icon }),
|
|
2344
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { children: title }),
|
|
2345
|
+
count != null && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { className: "sci-rs-count", children: count }),
|
|
2346
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { className: "sci-rs-chevron", children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Icon, { name: "chevron", size: 13 }) })
|
|
2347
|
+
] }) }),
|
|
2348
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { id: contentId, hidden: !open, children: open && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: "sci-rs-stack", children }) })
|
|
2349
|
+
] });
|
|
2350
|
+
}
|
|
2351
|
+
function CardList({ items, render, limit = 3, label }) {
|
|
2352
|
+
const [visible, setVisible] = (0, import_react11.useState)(limit);
|
|
2353
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(import_jsx_runtime9.Fragment, { children: [
|
|
2354
|
+
items.slice(0, visible).map(render),
|
|
2355
|
+
visible < items.length && /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("button", { type: "button", className: "sci-rs-action sci-rs-more", onClick: () => setVisible(visible + limit), children: [
|
|
2356
|
+
"\u66F4\u591A",
|
|
2357
|
+
label,
|
|
2358
|
+
"\uFF08\u5269\u4F59 ",
|
|
2359
|
+
items.length - visible,
|
|
2360
|
+
"\uFF09"
|
|
2361
|
+
] })
|
|
2362
|
+
] });
|
|
2363
|
+
}
|
|
2364
|
+
var skills = [
|
|
2365
|
+
["explore", "explore", "\u5F00\u59CB\u63A2\u7D22"],
|
|
2366
|
+
["literature", "search", "\u67E5\u6587\u732E"],
|
|
2367
|
+
["structure", "structure", "\u8C03\u6574\u7ED3\u6784"],
|
|
2368
|
+
["draw", "figure", "\u7ED8\u56FE"],
|
|
2369
|
+
["write", "write", "\u5199\u4F5C"],
|
|
2370
|
+
["slides", "slides", "\u6C47\u62A5"]
|
|
2371
|
+
];
|
|
2372
|
+
var direction = { not_assessed: "\u65B9\u5411\u5F85\u8BC4\u4F30", supports: "\u652F\u6301\u4E3B\u5F20", contradicts: "\u4E0E\u4E3B\u5F20\u76F8\u53CD", inconclusive: "\u65B9\u5411\u4E0D\u786E\u5B9A", not_applicable: "\u65B9\u5411\u4E0D\u9002\u7528" };
|
|
2373
|
+
var evidence = { planned: "\u8BC1\u636E\u5F85\u6536\u96C6", observed: "\u5DF2\u8BB0\u5F55\u89C2\u5BDF", verified: "\u8BC1\u636E\u5DF2\u6838\u9A8C", disputed: "\u8BC1\u636E\u6709\u4E89\u8BAE", invalidated: "\u8BC1\u636E\u5DF2\u5931\u6548" };
|
|
2374
|
+
var role = { main: "\u4E3B\u7ED3\u679C", validation: "\u9A8C\u8BC1", control: "\u5BF9\u7167", boundary: "\u9002\u7528\u8FB9\u754C", supplement: "\u8865\u5145\u6750\u6599", excluded: "\u4E0D\u7EB3\u5165\u6B63\u6587" };
|
|
2375
|
+
var audit = { approved: "\u4EBA\u5DE5\u7EC8\u5BA1\u901A\u8FC7", "ready-for-manual-review": "\u7B49\u5F85\u4EBA\u5DE5\u7EC8\u5BA1", "needs-attention": "\u56FE\u4EF6\u5F85\u590D\u6838", failed: "\u56FE\u4EF6\u9700\u4FEE\u6B63", rejected: "\u4EBA\u5DE5\u7EC8\u5BA1\u9000\u56DE" };
|
|
2376
|
+
var memberIcons = { reviewer: "check", writer: "write", simulator: "compute", trainer: "compute", analyst: "compute", "figure-expert": "figure", presentation: "slides" };
|
|
2377
|
+
function FigurePreview({ figure }) {
|
|
2378
|
+
const [status, setStatus] = (0, import_react11.useState)("loading");
|
|
2379
|
+
if (!figure.previewable || !figure.url) return null;
|
|
2380
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(import_jsx_runtime9.Fragment, { children: [
|
|
2381
|
+
status !== "error" && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("img", { className: "sci-rs-figure", src: figure.url, alt: figure.title, loading: "lazy", onLoad: () => setStatus("ready"), onError: () => setStatus("error") }),
|
|
2382
|
+
status !== "ready" && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("p", { className: "sci-rs-copy", children: status === "error" ? "\u9884\u89C8\u4E0D\u53EF\u7528\uFF0C\u53EF\u6253\u5F00\u539F\u56FE\u3002" : "\u56FE\u4EF6\u9884\u89C8\u52A0\u8F7D\u4E2D" })
|
|
2383
|
+
] });
|
|
2384
|
+
}
|
|
2385
|
+
function ResearchRail({ view, raw, error, notice, busy, onRefresh, onWorkbench, onHandoff, onConfirm, onOpenMember, onDismiss, onOpenCatalog, catalog }) {
|
|
2386
|
+
const [page, setPage] = (0, import_react11.useState)("overview");
|
|
2387
|
+
const paper = view?.paper;
|
|
2388
|
+
const team = view?.team;
|
|
2389
|
+
const figures = view?.artifacts.figures || [];
|
|
2390
|
+
const hasCore = Boolean(paper?.core.claim || paper?.core.title);
|
|
2391
|
+
const hasPaper = hasCore || Boolean(paper?.results.length || raw?.projectId);
|
|
2392
|
+
const pending = paper ? [
|
|
2393
|
+
...hasCore && !paper.core.confirmed ? [{ ...paper.core, id: "core" }] : [],
|
|
2394
|
+
...paper.results.filter((result) => !result.confirmed && result.status !== "dropped" && result.manuscriptRole !== "excluded")
|
|
2395
|
+
] : [];
|
|
2396
|
+
const issues = team?.tasks.filter((task) => task.isBlocked || task.status === "failed") || [];
|
|
2397
|
+
const active = team?.activeTasks.filter((task) => !task.isBlocked && task.status !== "failed") || [];
|
|
2398
|
+
const counts = team?.counts;
|
|
2399
|
+
const done = counts?.completed || 0;
|
|
2400
|
+
const question = paper?.question || raw?.blueprint?.question;
|
|
2401
|
+
const pendingTotal = pending.length + issues.length;
|
|
2402
|
+
const first = pending[0];
|
|
2403
|
+
const issue = issues[0];
|
|
2404
|
+
const working = active.find((task) => task.isRunning) || active[0];
|
|
2405
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "sci-workbench sci-quick sci-rs", lang: "zh-CN", "aria-label": "\u7814\u7A76\u72B6\u6001", "data-page": page, children: [
|
|
2406
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(WorkbenchStyles, {}),
|
|
2407
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("style", { children: RESEARCH_RAIL_CSS }),
|
|
2408
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("header", { className: "sci-rs-mast", children: [
|
|
2409
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("h2", { className: "sci-rs-module-title", children: [
|
|
2410
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(ModuleMark, { kind: "project", compact: true }),
|
|
2411
|
+
"\u7814\u7A76\u72B6\u6001"
|
|
2412
|
+
] }),
|
|
2413
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Action, { icon: "arrow", onClick: onWorkbench, children: "\u5DE5\u4F5C\u53F0" }),
|
|
2414
|
+
onOpenCatalog && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Action, { icon: "project", onClick: () => {
|
|
2415
|
+
setPage("catalog");
|
|
2416
|
+
onOpenCatalog();
|
|
2417
|
+
}, children: "\u67E5\u770B\u5168\u90E8\u9879\u76EE" })
|
|
2418
|
+
] }),
|
|
2419
|
+
view && hasPaper && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("nav", { className: "sci-rs-switch", "aria-label": "\u7814\u7A76\u72B6\u6001\u89C6\u56FE", children: [["overview", "\u6982\u89C8", "project"], ["paper", "\u8BBA\u6587", "paper"], ["team", "\u56E2\u961F", "team"], ["figures", "\u6210\u679C", "figure"]].map(([id, label, kind]) => /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("button", { type: "button", "aria-pressed": page === id, onClick: () => setPage(id), children: [
|
|
2420
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(ModuleMark, { kind, compact: true }),
|
|
2421
|
+
label
|
|
2422
|
+
] }, id)) }),
|
|
2423
|
+
page === "catalog" && /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("button", { type: "button", className: "sci-rs-back", onClick: () => setPage("overview"), children: [
|
|
2424
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Icon, { name: "chevron", size: 13 }),
|
|
2425
|
+
" \u8FD4\u56DE\u7814\u7A76\u72B6\u6001"
|
|
2426
|
+
] }),
|
|
2427
|
+
page === "catalog" && catalog,
|
|
2428
|
+
page !== "catalog" && error && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Card, { variant: "problem", icon: "alert", label: "\u8FDE\u63A5\u72B6\u6001", title: view ? "\u72B6\u6001\u53EF\u80FD\u5DF2\u8FC7\u671F" : "\u6682\u65F6\u65E0\u6CD5\u8BFB\u53D6\u72B6\u6001", action: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Action, { onClick: onRefresh, children: "\u91CD\u65B0\u8BFB\u53D6" }), children: /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("p", { className: "sci-rs-copy", role: "alert", children: [
|
|
2429
|
+
view ? "\u6B63\u5728\u663E\u793A\u4E0A\u6B21\u8BFB\u53D6\u7684\u5185\u5BB9\u3002" : "",
|
|
2430
|
+
error
|
|
2431
|
+
] }) }),
|
|
2432
|
+
page !== "catalog" && !view && !error && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: "sci-rs-empty", role: "status", children: "\u6B63\u5728\u8BFB\u53D6\u7814\u7A76\u72B6\u6001\u2026" }),
|
|
2433
|
+
notice && /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "sci-rs-next", children: [
|
|
2434
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("p", { role: notice.tone === "error" ? "alert" : "status", children: notice.text }),
|
|
2435
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Action, { onClick: onDismiss, children: "\u5173\u95ED\u63D0\u793A" })
|
|
2436
|
+
] }),
|
|
2437
|
+
page !== "catalog" && view && /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(import_jsx_runtime9.Fragment, { children: [
|
|
2438
|
+
(!hasPaper || page === "overview") && /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("article", { className: "sci-rs-card sci-rs-hero", "data-variant": "project", children: [
|
|
2439
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "sci-rs-kicker", children: [
|
|
2440
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Icon, { name: "project", size: 14 }),
|
|
2441
|
+
hasPaper ? "\u5F53\u524D\u8BFE\u9898" : "\u4ECE\u5BF9\u8BDD\u5F00\u59CB",
|
|
2442
|
+
hasPaper && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { className: "sci-rs-stage", children: paper.stageLabel })
|
|
2443
|
+
] }),
|
|
2444
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("h3", { children: hasPaper ? paper.title : "\u4F60\u60F3\u7814\u7A76\u4EC0\u4E48\uFF1F" }),
|
|
2445
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("p", { className: "sci-rs-copy sci-rs-preview", children: question || paper.core.claim || (hasPaper ? "\u5728\u5BF9\u8BDD\u4E2D\u8865\u5145\u7814\u7A76\u95EE\u9898\u3002" : "\u8BF4\u4E00\u4E2A\u95EE\u9898\uFF0C\u6216\u6574\u7406\u5DF2\u6709\u6570\u636E\u3002\u8BBA\u6587\u4E3B\u7EBF\u3001\u4EFB\u52A1\u548C\u56FE\u4EF6\u4F1A\u968F\u5BF9\u8BDD\u66F4\u65B0\u3002") }),
|
|
2446
|
+
hasPaper ? /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Metrics, { items: [["\u7814\u7A76\u7ED3\u679C", paper.totalResults], ["\u5F85\u5904\u7406", pendingTotal], ["\u4EFB\u52A1\u5B8C\u6210", done]] }) : /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Action, { primary: true, icon: "arrow", disabled: busy, onClick: () => onHandoff("explore"), children: "\u5728\u5BF9\u8BDD\u4E2D\u5F00\u59CB\u63A2\u7D22" }) })
|
|
2447
|
+
] }),
|
|
2448
|
+
hasPaper && page === "overview" && /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(import_jsx_runtime9.Fragment, { children: [
|
|
2449
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("section", { className: "sci-rs-section sci-rs-module", "data-kind": "alert", children: [
|
|
2450
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "sci-rs-heading", children: [
|
|
2451
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(ModuleTitle, { kind: "alert", children: "\u5F85\u4F60\u5904\u7406" }),
|
|
2452
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { children: pendingTotal ? `\u5171 ${pendingTotal} \u9879` : "\u6682\u65E0\u5F85\u529E" })
|
|
2453
|
+
] }),
|
|
2454
|
+
first ? /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
2455
|
+
Card,
|
|
2456
|
+
{
|
|
2457
|
+
variant: "attention",
|
|
2458
|
+
icon: "paper",
|
|
2459
|
+
label: first.id === "core" ? "\u6838\u5FC3\u4E3B\u5F20" : "\u7814\u7A76\u7ED3\u679C",
|
|
2460
|
+
title: first.title || "\u672A\u547D\u540D\u4E3B\u5F20",
|
|
2461
|
+
status: /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(Pill, { tone: "warn", children: [
|
|
2462
|
+
"\u5F85\u786E\u8BA4 \xB7 r",
|
|
2463
|
+
first.revision
|
|
2464
|
+
] }),
|
|
2465
|
+
action: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Action, { primary: true, icon: "arrow", onClick: () => setPage("paper"), children: "\u6838\u5BF9\u4E3B\u5F20" }),
|
|
2466
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("p", { className: "sci-rs-copy sci-rs-preview", children: first.claim || "\u5148\u5728\u5BF9\u8BDD\u4E2D\u8865\u5145\u4E3B\u5F20\u3002" })
|
|
2467
|
+
}
|
|
2468
|
+
) : issue ? /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
2469
|
+
Card,
|
|
2470
|
+
{
|
|
2471
|
+
variant: "attention",
|
|
2472
|
+
icon: "alert",
|
|
2473
|
+
label: "\u56E2\u961F\u4EFB\u52A1",
|
|
2474
|
+
title: issue.subject || issue.id,
|
|
2475
|
+
status: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Pill, { tone: "warn", children: issue.status === "failed" ? "\u5931\u8D25" : "\u53D7\u963B" }),
|
|
2476
|
+
action: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Action, { icon: "arrow", onClick: () => setPage("team"), children: "\u67E5\u770B\u4EFB\u52A1" }),
|
|
2477
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("p", { className: "sci-rs-copy sci-rs-preview", children: issue.blockers?.[0] || issue.resultSummary || "\u5230\u56E2\u961F\u89C6\u56FE\u67E5\u770B\u8FDB\u5C55\u3002" })
|
|
2478
|
+
}
|
|
2479
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("p", { className: "sci-rs-empty", children: "\u76EE\u524D\u6CA1\u6709\u5F85\u786E\u8BA4\u6216\u53D7\u963B\u4E8B\u9879\u3002" }),
|
|
2480
|
+
first && issues.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("button", { type: "button", className: "sci-rs-text-button", onClick: () => setPage("team"), children: [
|
|
2481
|
+
"\u53E6\u6709 ",
|
|
2482
|
+
issues.length,
|
|
2483
|
+
" \u9879\u4EFB\u52A1\u9700\u8981\u5904\u7406 ",
|
|
2484
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Icon, { name: "arrow", size: 13 })
|
|
2485
|
+
] })
|
|
2486
|
+
] }),
|
|
2487
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("section", { className: "sci-rs-section sci-rs-module", "data-kind": "team", children: [
|
|
2488
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "sci-rs-heading", children: [
|
|
2489
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(ModuleTitle, { kind: "team", children: "\u56E2\u961F\u8FDB\u5C55" }),
|
|
2490
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("button", { type: "button", className: "sci-rs-text-button", onClick: () => setPage("team"), children: [
|
|
2491
|
+
"\u67E5\u770B\u56E2\u961F ",
|
|
2492
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Icon, { name: "arrow", size: 13 })
|
|
2493
|
+
] })
|
|
2494
|
+
] }),
|
|
2495
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("article", { className: "sci-rs-card sci-rs-activity", children: [
|
|
2496
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Metrics, { items: [["\u8FD0\u884C\u4E2D", counts.running], ["\u5DF2\u5B8C\u6210", done], ["\u9700\u5904\u7406", issues.length]] }),
|
|
2497
|
+
working && /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("p", { className: "sci-rs-copy sci-rs-preview", children: [
|
|
2498
|
+
working.label,
|
|
2499
|
+
" \xB7 ",
|
|
2500
|
+
working.subject || working.id
|
|
2501
|
+
] })
|
|
2502
|
+
] })
|
|
2503
|
+
] })
|
|
2504
|
+
] }),
|
|
2505
|
+
hasPaper && page === "paper" && /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(Section, { title: "\u5F85\u786E\u8BA4\u7684\u4E3B\u5F20", icon: "alert", count: pending.length, children: [
|
|
2506
|
+
pending.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("p", { className: "sci-rs-empty", children: "\u6CA1\u6709\u5F85\u786E\u8BA4\u7684\u4E3B\u5F20\u3002" }),
|
|
2507
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(CardList, { label: "\u5F85\u786E\u8BA4\u4E3B\u5F20", items: pending, render: (item) => /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
|
|
2508
|
+
Card,
|
|
2509
|
+
{
|
|
2510
|
+
variant: "attention",
|
|
2511
|
+
icon: "paper",
|
|
2512
|
+
label: item.id === "core" ? "\u6838\u5FC3\u4E3B\u5F20" : `\u7814\u7A76\u7ED3\u679C \xB7 ${item.id}`,
|
|
2513
|
+
title: item.title || "\u672A\u547D\u540D\u4E3B\u5F20",
|
|
2514
|
+
status: /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(Pill, { tone: "warn", children: [
|
|
2515
|
+
"\u5F85\u786E\u8BA4 \xB7 r",
|
|
2516
|
+
item.revision
|
|
2517
|
+
] }),
|
|
2518
|
+
action: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Action, { primary: true, icon: "check", disabled: busy || Boolean(error) || !item.claim || !item.contentHash, onClick: () => onConfirm(item.id, item.revision, item.contentHash), children: item.contentHash ? "\u786E\u8BA4\u6B64\u4FEE\u8BA2" : "\u6B63\u5728\u6821\u9A8C\u5185\u5BB9\u2026" }),
|
|
2519
|
+
children: [
|
|
2520
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Copy, { limit: 64, text: item.claim || "\u8BF7\u5148\u5728\u5BF9\u8BDD\u4E2D\u8865\u5145\u53EF\u786E\u8BA4\u7684\u4E3B\u5F20\u3002" }),
|
|
2521
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "sci-rs-meta", children: [
|
|
2522
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { children: "\u53EF\u9000\u56DE" }),
|
|
2523
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { children: "\u6216\u5230\u5BF9\u8BDD\u4E2D\u8BF4\u660E\u4FEE\u6539" })
|
|
2524
|
+
] })
|
|
2525
|
+
]
|
|
2526
|
+
},
|
|
2527
|
+
item.id
|
|
2528
|
+
) })
|
|
2529
|
+
] }),
|
|
2530
|
+
hasPaper && page === "team" && issues.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Section, { title: "\u9700\u8981\u5904\u7406\u7684\u4EFB\u52A1", icon: "alert", count: issues.length, children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(CardList, { label: "\u4EFB\u52A1\u63D0\u9192", items: issues, render: (task) => /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Card, { variant: task.status === "failed" ? "problem" : "attention", icon: "alert", label: task.assignee ? `\u4EFB\u52A1 \xB7 ${task.assignee}` : "\u4EFB\u52A1", title: task.subject || task.id, status: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Pill, { tone: task.status === "failed" ? "bad" : "warn", children: task.status === "failed" ? "\u5931\u8D25" : "\u53D7\u963B" }), children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Copy, { text: task.blockers?.join("\uFF1B") || task.resultSummary || task.report || "\u8BF7\u5728\u5B8C\u6574\u5DE5\u4F5C\u53F0\u67E5\u770B\u4EFB\u52A1\u8BE6\u60C5\u3002" }) }, task.id) }) }),
|
|
2531
|
+
hasPaper && page === "paper" && /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(Section, { title: "\u8BBA\u6587\u4E3B\u7EBF", icon: "paper", count: paper.totalResults, children: [
|
|
2532
|
+
hasCore && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
2533
|
+
Card,
|
|
2534
|
+
{
|
|
2535
|
+
icon: "paper",
|
|
2536
|
+
label: "\u6838\u5FC3\u4E3B\u5F20",
|
|
2537
|
+
title: paper.core.title || "\u8BBA\u6587\u7684\u6838\u5FC3\u4E3B\u5F20",
|
|
2538
|
+
status: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Pill, { tone: paper.core.confirmed ? "good" : "warn", children: paper.core.confirmed ? "\u5DF2\u786E\u8BA4" : "\u5F85\u786E\u8BA4" }),
|
|
2539
|
+
action: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Action, { icon: "write", disabled: busy, onClick: () => onHandoff("structure"), children: "\u5728\u5BF9\u8BDD\u4E2D\u8C03\u6574\u4E3B\u7EBF" }),
|
|
2540
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Copy, { text: paper.core.claim })
|
|
2541
|
+
}
|
|
2542
|
+
),
|
|
2543
|
+
!paper.results.length && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("p", { className: "sci-rs-empty", children: "\u8FD8\u6CA1\u6709\u7ED3\u679C\u8349\u6848\u3002\u53EF\u5728\u5BF9\u8BDD\u4E2D\u68B3\u7406\u8BBA\u6587\u7ED3\u6784\u3002" }),
|
|
2544
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(CardList, { label: "\u7814\u7A76\u7ED3\u679C", items: paper.results, render: (result) => /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
|
|
2545
|
+
Card,
|
|
2546
|
+
{
|
|
2547
|
+
icon: "paper",
|
|
2548
|
+
label: `\u7814\u7A76\u7ED3\u679C \xB7 ${result.id}`,
|
|
2549
|
+
title: result.title,
|
|
2550
|
+
status: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Pill, { tone: result.manuscriptRole === "excluded" || result.status === "dropped" ? void 0 : result.confirmed ? "good" : "warn", children: result.manuscriptRole === "excluded" || result.status === "dropped" ? "\u4E0D\u7EB3\u5165\u6B63\u6587" : result.confirmed ? "\u5DF2\u786E\u8BA4" : "\u5F85\u786E\u8BA4" }),
|
|
2551
|
+
action: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Action, { icon: "write", disabled: busy, onClick: () => onHandoff("structure", { objectId: result.id, revision: result.revision }), children: "\u5728\u5BF9\u8BDD\u4E2D\u4FEE\u6539" }),
|
|
2552
|
+
children: [
|
|
2553
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Copy, { text: result.claim }),
|
|
2554
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: "sci-rs-meta", children: [result.statusLabel, direction[result.direction], evidence[result.evidenceState], role[result.manuscriptRole]].filter(Boolean).map((label) => /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { children: label }, label)) }),
|
|
2555
|
+
result.requiredItems?.[0] && /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "sci-rs-next", children: [
|
|
2556
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("b", { children: "\u5F53\u524D\u7F3A\u53E3" }),
|
|
2557
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Copy, { text: result.requiredItems[0], limit: 60 })
|
|
2558
|
+
] })
|
|
2559
|
+
]
|
|
2560
|
+
},
|
|
2561
|
+
result.id
|
|
2562
|
+
) })
|
|
2563
|
+
] }),
|
|
2564
|
+
hasPaper && page === "team" && /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(Section, { title: "\u56E2\u961F\u8FDB\u5C55", icon: "team", count: team.members.length, children: [
|
|
2565
|
+
!team.members.length && !active.length && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("p", { className: "sci-rs-empty", children: "\u56E2\u961F\u5C1A\u672A\u5F00\u59CB\u5DE5\u4F5C\u3002\u6D3E\u53D1\u4EFB\u52A1\u540E\uFF0C\u6210\u5458\u4E0E\u8FDB\u5EA6\u4F1A\u663E\u793A\u5728\u8FD9\u91CC\u3002" }),
|
|
2566
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(CardList, { label: "\u56E2\u961F\u6210\u5458", items: team.members, render: (member) => /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
|
|
2567
|
+
Card,
|
|
2568
|
+
{
|
|
2569
|
+
icon: memberIcons[member.role] || "team",
|
|
2570
|
+
label: "\u56E2\u961F\u6210\u5458",
|
|
2571
|
+
title: member.label || member.name,
|
|
2572
|
+
status: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Pill, { tone: member.liveStatusTone, children: member.liveStatusLabel }),
|
|
2573
|
+
action: onOpenMember && member.childId && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Action, { icon: "arrow", onClick: () => onOpenMember(member), children: "\u6253\u5F00\u6210\u5458\u4F1A\u8BDD" }),
|
|
2574
|
+
children: [
|
|
2575
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Copy, { text: member.currentTasks.length ? member.currentTasks.map((task) => task.subject || task.id).join("\uFF1B") : "\u5F53\u524D\u6CA1\u6709\u8FDB\u884C\u4E2D\u7684\u4EFB\u52A1\u3002" }),
|
|
2576
|
+
member.lastReport && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Copy, { text: `\u6700\u8FD1\u56DE\u62A5\uFF1A${member.lastReport}` })
|
|
2577
|
+
]
|
|
2578
|
+
},
|
|
2579
|
+
member.name
|
|
2580
|
+
) }),
|
|
2581
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(CardList, { label: "\u6267\u884C\u4EFB\u52A1", items: active, render: (task) => /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Card, { icon: "structure", label: "\u6267\u884C\u4EFB\u52A1", title: task.subject || task.id, status: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Pill, { tone: task.isRunning ? "good" : void 0, children: task.label }), children: /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "sci-rs-meta", children: [
|
|
2582
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { children: task.assignee || "\u5C1A\u672A\u5206\u914D" }),
|
|
2583
|
+
task.resultIds?.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { children: task.resultIds.join("\u3001") })
|
|
2584
|
+
] }) }, task.id) })
|
|
2585
|
+
] }),
|
|
2586
|
+
hasPaper && page === "figures" && /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(Section, { title: "\u767B\u8BB0\u56FE\u4EF6", icon: "figure", count: figures.length, children: [
|
|
2587
|
+
!figures.length && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("p", { className: "sci-rs-empty", children: "\u767B\u8BB0\u56FE\u4EF6\u540E\u53EF\u5728\u8FD9\u91CC\u9884\u89C8\u3002" }),
|
|
2588
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(CardList, { label: "\u56FE\u4EF6", items: figures, render: (figure) => /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
|
|
2589
|
+
Card,
|
|
2590
|
+
{
|
|
2591
|
+
icon: "figure",
|
|
2592
|
+
label: "\u56FE\u4EF6",
|
|
2593
|
+
title: figure.title,
|
|
2594
|
+
action: figure.url && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Action, { icon: "arrow", href: figure.url, children: "\u6253\u5F00\u539F\u56FE" }),
|
|
2595
|
+
children: [
|
|
2596
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: "sci-rs-meta", children: [figure.resultId || "\u672A\u5173\u8054\u7ED3\u679C", figure.version && `v${figure.version}`, audit[figure.audit?.overallStatus]].filter(Boolean).map((label) => /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { children: label }, label)) }),
|
|
2597
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(FigurePreview, { figure }, figure.url)
|
|
2598
|
+
]
|
|
2599
|
+
},
|
|
2600
|
+
figure.id || figure.path
|
|
2601
|
+
) })
|
|
2602
|
+
] }),
|
|
2603
|
+
(!hasPaper || page === "overview") && /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(Section, { title: "\u5E38\u7528\u6280\u80FD", icon: "explore", children: [
|
|
2604
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("p", { className: "sci-rs-copy", children: "\u70B9\u51FB\u540E\u586B\u5165\u5BF9\u8BDD\u8349\u7A3F\uFF0C\u7531\u4F60\u8865\u5145\u5E76\u53D1\u9001\u3002" }),
|
|
2605
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: "sci-rs-skills", children: skills.map(([id, icon, label]) => /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Action, { icon, disabled: busy, onClick: () => onHandoff(id), children: label }, id)) })
|
|
2606
|
+
] })
|
|
2607
|
+
] })
|
|
2608
|
+
] });
|
|
2609
|
+
}
|
|
2610
|
+
|
|
2611
|
+
// client-src/workbench/QuickWorkbench.jsx
|
|
2612
|
+
var import_jsx_runtime10 = require("react/jsx-runtime");
|
|
2613
|
+
function QuickWorkbench({ services }) {
|
|
2614
|
+
const state = useProjectBinding(services);
|
|
2615
|
+
const [busy, setBusy] = (0, import_react12.useState)(false);
|
|
2616
|
+
const [notice, setNotice] = (0, import_react12.useState)(null);
|
|
2617
|
+
const [catalogOpen, setCatalogOpen] = (0, import_react12.useState)(false);
|
|
2618
|
+
const doConfirm = async (objectId, revision, contentHash) => {
|
|
2619
|
+
setBusy(true);
|
|
2620
|
+
setNotice(null);
|
|
2621
|
+
try {
|
|
2622
|
+
const r = await confirmObjectViaAct({
|
|
2623
|
+
sessionId: state.sessionId,
|
|
2624
|
+
objectId,
|
|
2625
|
+
expectedObjectRevision: revision,
|
|
2626
|
+
expectedHash: contentHash,
|
|
2627
|
+
expectedRevision: state.revision
|
|
2628
|
+
});
|
|
2629
|
+
if (r.ok) {
|
|
2630
|
+
setNotice({ tone: "success", text: "\u5DF2\u786E\u8BA4\u5F53\u524D\u4FEE\u8BA2\u3002" });
|
|
2631
|
+
await state.refresh();
|
|
2632
|
+
} else {
|
|
2633
|
+
setNotice({ tone: "error", text: r.reason || "\u786E\u8BA4\u672A\u6267\u884C\u3002" });
|
|
2634
|
+
}
|
|
2635
|
+
} finally {
|
|
2636
|
+
setBusy(false);
|
|
2637
|
+
}
|
|
2638
|
+
};
|
|
2639
|
+
const doHandoff = async (kind, target = null) => {
|
|
2640
|
+
setBusy(true);
|
|
2641
|
+
setNotice(null);
|
|
2642
|
+
try {
|
|
2643
|
+
const handoff = semanticHandoffOf(kind, target) || { kind };
|
|
2644
|
+
const r = await services?.prepareHandoff?.(handoff.kind, handoff.target);
|
|
2645
|
+
if (r?.ok) {
|
|
2646
|
+
setNotice({ tone: "success", text: "\u5DF2\u586B\u5165\u5BF9\u8BDD\u8349\u7A3F\uFF0C\u8BF7\u8865\u5145\u540E\u53D1\u9001\u3002" });
|
|
2647
|
+
} else {
|
|
2648
|
+
setNotice({ tone: "error", text: "\u672A\u80FD\u586B\u5165\u8349\u7A3F\u3002\u8BF7\u56DE\u5230\u5F53\u524D\u5BF9\u8BDD\u540E\u91CD\u8BD5\uFF0C\u6216\u76F4\u63A5\u63CF\u8FF0\u4F60\u60F3\u505A\u7684\u4E8B\u3002" });
|
|
2649
|
+
}
|
|
2650
|
+
} catch {
|
|
2651
|
+
setNotice({ tone: "error", text: "\u672A\u80FD\u586B\u5165\u8349\u7A3F\u3002\u8BF7\u56DE\u5230\u5F53\u524D\u5BF9\u8BDD\u540E\u91CD\u8BD5\u3002" });
|
|
2652
|
+
} finally {
|
|
2653
|
+
setBusy(false);
|
|
2654
|
+
}
|
|
2655
|
+
};
|
|
2656
|
+
const openMember = async (member) => {
|
|
2657
|
+
try {
|
|
2658
|
+
await services.openMemberSession(member);
|
|
2659
|
+
setNotice(null);
|
|
2660
|
+
} catch (error) {
|
|
2661
|
+
setNotice({ tone: "error", text: error?.message || "\u65E0\u6CD5\u6253\u5F00\u8BE5\u6210\u5458\u4F1A\u8BDD\uFF0C\u8BF7\u4ECE\u5B8C\u6574\u5DE5\u4F5C\u53F0\u91CD\u8BD5\u3002" });
|
|
2662
|
+
}
|
|
2663
|
+
};
|
|
2664
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
2665
|
+
ResearchRail,
|
|
2666
|
+
{
|
|
2667
|
+
view: state.view,
|
|
2668
|
+
raw: state.raw,
|
|
2669
|
+
error: state.error,
|
|
2670
|
+
notice,
|
|
2671
|
+
busy,
|
|
2672
|
+
onRefresh: state.refresh,
|
|
2673
|
+
onWorkbench: () => services?.openWorkbench?.(),
|
|
2674
|
+
onHandoff: doHandoff,
|
|
2675
|
+
onConfirm: doConfirm,
|
|
2676
|
+
onOpenCatalog: () => setCatalogOpen(true),
|
|
2677
|
+
catalog: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(ProjectCatalog, { services }),
|
|
2678
|
+
onOpenMember: services?.memberOpenAvailable?.(state.view) ? openMember : void 0,
|
|
2679
|
+
onDismiss: () => setNotice(null)
|
|
2680
|
+
},
|
|
2681
|
+
state.projectId || "unbound"
|
|
2682
|
+
);
|
|
2683
|
+
}
|
|
2684
|
+
|
|
2685
|
+
// client-src/conversation/ScienceDock.jsx
|
|
2686
|
+
var import_react13 = __toESM(require("react"), 1);
|
|
2687
|
+
|
|
2688
|
+
// client-src/conversation/skill-actions.js
|
|
2689
|
+
var SCIENCE_SKILLS = Object.freeze([
|
|
2690
|
+
{ id: "explore", label: "\u5F00\u59CB\u63A2\u7D22", hint: "\u6F84\u6E05\u7814\u7A76\u95EE\u9898\u3001\u5DF2\u6709\u8BC1\u636E\u4E0E\u53EF\u884C\u8303\u56F4", skill: "sci-hypothesis", guide: "\u6211\u60F3\u7814\u7A76\u7684\u65B9\u5411\u662F\uFF1A" },
|
|
2691
|
+
{ id: "results", label: "\u6574\u7406\u5DF2\u6709\u7ED3\u679C", hint: "\u628A\u6563\u843D\u7684\u7ED3\u679C\u6574\u7406\u6210\u53EF\u8FFD\u6EAF\u6E05\u5355", skill: null, prompt: "\u8BF7\u68C0\u67E5\u5E76\u6574\u7406\u6211\u5DF2\u6709\u7684\u79D1\u7814\u7ED3\u679C\uFF1A\u5148\u5217\u51FA\u53EF\u8FFD\u6EAF\u7684\u7ED3\u679C\u3001\u6765\u6E90\u548C\u4E0D\u786E\u5B9A\u9879\uFF0C\u4E0D\u8981\u8865\u9020\u7F3A\u5931\u6570\u636E\u3002" },
|
|
2692
|
+
{ id: "literature", label: "\u67E5\u6587\u732E", hint: "\u56F4\u7ED5\u5F53\u524D\u95EE\u9898\u6269\u5C55\u6587\u732E\u4E0E\u6D41\u7A0B\u63A2\u7D22", skill: "sci-autoresearch", guide: "\u8BF7\u56F4\u7ED5\u6211\u7684\u7814\u7A76\u95EE\u9898\u505A\u6587\u732E\u4E0E\u6D41\u7A0B\u63A2\u7D22\uFF1A" },
|
|
2693
|
+
{ id: "draw", label: "\u7ED8\u56FE", hint: "\u4E3A\u7ED3\u679C\u5EFA\u7ACB\u53EF\u8FFD\u6EAF\u56FE\u4EF6", skill: "sci-figures", guide: "\u8BF7\u4E3A\u4EE5\u4E0B\u7814\u7A76\u7ED3\u679C\u5EFA\u7ACB\u56FE\u4EF6\u65B9\u6848\uFF1A" },
|
|
2694
|
+
{ id: "write", label: "\u5199\u4F5C", hint: "\u56F4\u7ED5\u5DF2\u786E\u8BA4\u7ED3\u679C\u8D77\u8349\u6216\u4FEE\u6539\u7A3F\u4EF6", skill: "sci-writing", guide: "\u8BF7\u57FA\u4E8E\u5F53\u524D\u8BBA\u6587\u4E3B\u7EBF\u8D77\u8349\uFF1A" },
|
|
2695
|
+
{ id: "slides", label: "\u6C47\u62A5", hint: "\u628A\u5DF2\u786E\u8BA4\u7ED3\u679C\u6574\u7406\u6210\u6C47\u62A5 PPT", skill: "sci-slides", guide: "\u8BF7\u57FA\u4E8E\u5F53\u524D\u7814\u7A76\u8FDB\u5C55\u5236\u4F5C\u6C47\u62A5\uFF1A" }
|
|
2696
|
+
]);
|
|
2697
|
+
function insertionTextFor(entry, currentDraft = "") {
|
|
2698
|
+
const body = entry.skill ? `/${entry.skill}
|
|
2699
|
+
${entry.guide || ""}` : String(entry.prompt || "");
|
|
2700
|
+
const draft = String(currentDraft || "");
|
|
2701
|
+
if (draft.includes(body)) return null;
|
|
2702
|
+
if (draft.trim() === "") return body;
|
|
2703
|
+
return `
|
|
2704
|
+
|
|
2705
|
+
${body}`;
|
|
2706
|
+
}
|
|
2707
|
+
function insertSkillEntry(inputActions, inputState, entry) {
|
|
2708
|
+
if (!inputActions || typeof inputActions.captureInsertion !== "function" || typeof inputActions.insertText !== "function") {
|
|
2709
|
+
return { ok: false, code: "no-input-actions", message: "\u5F53\u524D DSH \u7248\u672C\u4E0D\u63D0\u4F9B\u539F\u751F\u8F93\u5165\u63A5\u53E3\u3002" };
|
|
2710
|
+
}
|
|
2711
|
+
if (!entry || !entry.skill && !entry.prompt) {
|
|
2712
|
+
return { ok: false, code: "bad-entry", message: "\u6280\u80FD\u914D\u7F6E\u7F3A\u5931\u3002" };
|
|
2713
|
+
}
|
|
2714
|
+
const phase = inputState ? inputState.phase : "plain";
|
|
2715
|
+
if (phase && phase !== "plain") {
|
|
2716
|
+
return { ok: false, code: "busy", message: "\u8F93\u5165\u6846\u6B63\u5728\u63D0\u4EA4\u4E2D\uFF0C\u8BF7\u7A0D\u540E\u518D\u8BD5\uFF1B\u8349\u7A3F\u672A\u6539\u52A8\u3002" };
|
|
2717
|
+
}
|
|
2718
|
+
const draft = inputState ? String(inputState.draft || "") : "";
|
|
2719
|
+
const text = insertionTextFor(entry, draft);
|
|
2720
|
+
if (text == null) {
|
|
2721
|
+
return { ok: true, inserted: false, message: "\u8BE5\u6280\u80FD\u5DF2\u5728\u8349\u7A3F\u4E2D\u3002" };
|
|
2722
|
+
}
|
|
2723
|
+
let span = null;
|
|
2724
|
+
try {
|
|
2725
|
+
span = inputActions.captureInsertion();
|
|
2726
|
+
} catch (err) {
|
|
2727
|
+
return { ok: false, code: "capture-failed", message: `\u65E0\u6CD5\u6355\u83B7\u63D2\u5165\u70B9\uFF08${err && err.message || "unknown"}\uFF09\uFF1B\u8349\u7A3F\u672A\u6539\u52A8\u3002` };
|
|
2728
|
+
}
|
|
2729
|
+
let accepted = false;
|
|
2730
|
+
try {
|
|
2731
|
+
accepted = inputActions.insertText(text, span) === true;
|
|
2732
|
+
} catch (err) {
|
|
2733
|
+
return { ok: false, code: "insert-failed", message: `\u63D2\u5165\u5931\u8D25\uFF08${err && err.message || "unknown"}\uFF09\uFF1B\u8349\u7A3F\u672A\u6539\u52A8\u3002` };
|
|
2734
|
+
}
|
|
2735
|
+
if (!accepted) {
|
|
2736
|
+
return { ok: false, code: "draft-changed", message: "\u8349\u7A3F\u521A\u521A\u53D1\u751F\u4E86\u53D8\u5316\uFF0C\u672A\u63D2\u5165\uFF1B\u8BF7\u91CD\u65B0\u70B9\u51FB\u3002\u539F\u8349\u7A3F\u5B8C\u6574\u4FDD\u7559\u3002" };
|
|
2737
|
+
}
|
|
2738
|
+
return { ok: true, inserted: true };
|
|
2739
|
+
}
|
|
2740
|
+
|
|
2741
|
+
// client-src/conversation/ScienceDock.jsx
|
|
2742
|
+
var import_jsx_runtime11 = require("react/jsx-runtime");
|
|
2743
|
+
var stylesInjected = false;
|
|
2744
|
+
function ensureStyles() {
|
|
2745
|
+
if (stylesInjected || typeof document === "undefined") return;
|
|
2746
|
+
stylesInjected = true;
|
|
2747
|
+
const style = document.createElement("style");
|
|
2748
|
+
style.id = "dsh-science-dock-styles";
|
|
2749
|
+
style.textContent = `
|
|
2750
|
+
.sci-dock{padding:2px 12px 6px;font-size:12px;color:var(--dsh-text-secondary,inherit)}
|
|
2751
|
+
.sci-dock-row{display:flex;flex-wrap:wrap;gap:6px;align-items:center}
|
|
2752
|
+
.sci-dock-note{opacity:.72;margin-right:2px;white-space:nowrap}
|
|
2753
|
+
.sci-dock-ctx{display:inline-flex;flex-wrap:wrap;gap:8px;align-items:center;white-space:nowrap;opacity:.9}
|
|
2754
|
+
.sci-dock-ctx b{color:inherit;font-weight:600}
|
|
2755
|
+
.sci-dock-chip{border:1px solid var(--dsh-border,rgba(127,127,127,.3));border-radius:999px;padding:0 8px;font-size:11px;line-height:1.7}
|
|
2756
|
+
.sci-dock-chip[data-tone=warn]{color:var(--dsh-warning,#b7791f)}
|
|
2757
|
+
.sci-dock-chip[data-tone=bad]{color:var(--dsh-danger,#d64545)}
|
|
2758
|
+
.sci-dock-chip[data-tone=good]{color:var(--dsh-success,#2f855a)}
|
|
2759
|
+
.sci-dock-btn{display:inline-flex;align-items:center;gap:4px;border:1px solid var(--dsh-border,rgba(127,127,127,.35));background:transparent;color:inherit;border-radius:999px;padding:2px 10px;font-size:12px;line-height:1.6;cursor:pointer}
|
|
2760
|
+
.sci-dock-btn:hover{background:var(--dsh-fill-secondary,rgba(127,127,127,.12))}
|
|
2761
|
+
.sci-dock-btn:focus-visible{outline:2px solid var(--dsh-brand,#4b7bec);outline-offset:1px}
|
|
2762
|
+
.sci-dock-msg{width:100%;font-size:12px;opacity:.85}
|
|
2763
|
+
.sci-dock-msg[data-tone=error]{color:var(--dsh-danger,#d64545)}
|
|
2764
|
+
`;
|
|
2765
|
+
document.head.appendChild(style);
|
|
2766
|
+
}
|
|
2767
|
+
function ScienceDock({ inputActions, useInput, services }) {
|
|
2768
|
+
ensureStyles();
|
|
2769
|
+
const input = useInput ? useInput((s) => s) : null;
|
|
2770
|
+
const [notice, setNotice] = (0, import_react13.useState)(null);
|
|
2771
|
+
const state = useProjectBinding(services);
|
|
2772
|
+
const runSkill = (0, import_react13.useCallback)((entry) => {
|
|
2773
|
+
const result = insertSkillEntry(inputActions, input, entry);
|
|
2774
|
+
if (!result.ok) {
|
|
2775
|
+
setNotice({ tone: "error", text: result.message });
|
|
2776
|
+
return;
|
|
2777
|
+
}
|
|
2778
|
+
setNotice(result.inserted ? { tone: "info", text: "\u5DF2\u5728\u8F93\u5165\u6846\u51C6\u5907\u6280\u80FD\uFF0C\u8BF7\u7EE7\u7EED\u8865\u5145\u540E\u53D1\u9001\u3002" } : { tone: "info", text: result.message });
|
|
2779
|
+
}, [inputActions, input]);
|
|
2780
|
+
const connectProject = (0, import_react13.useCallback)(async () => {
|
|
2781
|
+
if (!state.sessionId) {
|
|
2782
|
+
setNotice({ tone: "error", text: "\u5F53\u524D\u6CA1\u6709\u4F1A\u8BDD\u3002" });
|
|
2783
|
+
return;
|
|
2784
|
+
}
|
|
2785
|
+
const r = await state.act({
|
|
2786
|
+
actionId: "project.ensure-binding",
|
|
2787
|
+
commandId: `dock-bind-${Date.now().toString(36)}`,
|
|
2788
|
+
payload: {}
|
|
2789
|
+
});
|
|
2790
|
+
if (r.status === 200 && (r.body.kind === "applied" || r.body.kind === "already-applied")) {
|
|
2791
|
+
setNotice({ tone: "info", text: "\u5DF2\u8FDE\u63A5\u7814\u7A76\u9879\u76EE\u3002" });
|
|
2792
|
+
void state.refresh();
|
|
2793
|
+
return;
|
|
2794
|
+
}
|
|
2795
|
+
setNotice({ tone: "error", text: r.body && r.body.reason || "\u8FDE\u63A5\u5931\u8D25\uFF1A" + String(r.status) });
|
|
2796
|
+
}, [state]);
|
|
2797
|
+
const keepFocus = (0, import_react13.useCallback)((event) => event.preventDefault(), []);
|
|
2798
|
+
const busy = input ? input.phase !== "plain" : false;
|
|
2799
|
+
const status = state.status;
|
|
2800
|
+
const stale = state.stale;
|
|
2801
|
+
const paper = state.view?.paper || null;
|
|
2802
|
+
const nextDecision = state.raw?.focus?.nextDecisions?.find?.((decision) => decision.status === "pending") || null;
|
|
2803
|
+
const running = state.view?.team?.counts?.running || 0;
|
|
2804
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "sci-dock", role: "toolbar", "aria-label": "\u79D1\u7814\u6280\u80FD", children: [
|
|
2805
|
+
status === "ready" && paper && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: "sci-dock-row", style: { marginBottom: 3 }, children: /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("span", { className: "sci-dock-ctx", children: [
|
|
2806
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("b", { children: paper.title }),
|
|
2807
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { className: "sci-dock-chip", children: paper.stageLabel }),
|
|
2808
|
+
paper.question && paper.question !== paper.title && /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("span", { className: "sci-dock-chip", title: paper.question, children: [
|
|
2809
|
+
"\u7814\u7A76\u95EE\u9898\uFF1A",
|
|
2810
|
+
paper.question.length > 32 ? `${paper.question.slice(0, 32)}\u2026` : paper.question
|
|
2811
|
+
] }),
|
|
2812
|
+
paper.pendingConfirmationCount > 0 && /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("span", { className: "sci-dock-chip", "data-tone": "warn", title: "\u5F85\u786E\u8BA4 = \u5C1A\u672A\u786E\u8BA4\u7684\u6838\u5FC3\u4E0E Result \u6570\uFF1B\u53F3\u680F\u300C\u5F85\u4F60\u5904\u7406\u300D\u53E6\u542B\u53D7\u963B\u4EFB\u52A1", children: [
|
|
2813
|
+
"\u5F85\u786E\u8BA4 ",
|
|
2814
|
+
paper.pendingConfirmationCount
|
|
2815
|
+
] }),
|
|
2816
|
+
running > 0 && /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("span", { className: "sci-dock-chip", children: [
|
|
2817
|
+
"\u4EFB\u52A1 ",
|
|
2818
|
+
running
|
|
2819
|
+
] }),
|
|
2820
|
+
nextDecision && nextDecision.text && /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("span", { className: "sci-dock-chip", "data-tone": "warn", children: [
|
|
2821
|
+
"\u4E0B\u4E00\u51B3\u7B56\uFF1A",
|
|
2822
|
+
String(nextDecision.text).slice(0, 24),
|
|
2823
|
+
String(nextDecision.text).length > 24 ? "\u2026" : ""
|
|
2824
|
+
] }),
|
|
2825
|
+
stale && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { className: "sci-dock-chip", "data-tone": "bad", children: "\u8FDE\u63A5\u4E2D\u65AD\uFF0C\u72B6\u6001\u53EF\u80FD\u8FC7\u671F" })
|
|
2826
|
+
] }) }),
|
|
2827
|
+
status === "empty" && /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "sci-dock-row", style: { marginBottom: 3 }, children: [
|
|
2828
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { className: "sci-dock-ctx", children: "\u5C1A\u672A\u5EFA\u7ACB\u7814\u7A76\u9879\u76EE\u2014\u2014\u4ECE\u4E00\u53E5\u8BDD\u5F00\u59CB\uFF0C\u6216\u6574\u7406\u5DF2\u6709\u7ED3\u679C\u3002" }),
|
|
2829
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("button", { type: "button", className: "sci-dock-btn", onMouseDown: keepFocus, disabled: busy, onClick: connectProject, children: "\u8FDE\u63A5\u73B0\u6709\u9879\u76EE" })
|
|
2830
|
+
] }),
|
|
2831
|
+
status === "offline" && /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "sci-dock-row", style: { marginBottom: 3 }, children: [
|
|
2832
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { className: "sci-dock-chip", "data-tone": "bad", children: "\u7814\u7A76\u72B6\u6001\u8FDE\u63A5\u4E2D\u65AD" }),
|
|
2833
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("button", { type: "button", className: "sci-dock-btn", onMouseDown: keepFocus, onClick: () => state.refresh(), children: "\u91CD\u8FDE" })
|
|
2834
|
+
] }),
|
|
2835
|
+
status === "unauthorized" && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: "sci-dock-row", style: { marginBottom: 3 }, children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { className: "sci-dock-chip", "data-tone": "bad", children: "\u5F53\u524D\u4F1A\u8BDD\u4E0D\u53EF\u7528" }) }),
|
|
2836
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "sci-dock-row", children: [
|
|
2837
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { className: "sci-dock-note", children: "\u79D1\u7814\uFF1A" }),
|
|
2838
|
+
SCIENCE_SKILLS.map((entry) => /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
2839
|
+
"button",
|
|
2840
|
+
{
|
|
2841
|
+
type: "button",
|
|
2842
|
+
className: "sci-dock-btn",
|
|
2843
|
+
title: `${entry.hint}\uFF08\u586B\u5165\u5BF9\u8BDD\uFF0C\u4E0D\u81EA\u52A8\u53D1\u9001\uFF09`,
|
|
2844
|
+
disabled: busy,
|
|
2845
|
+
onMouseDown: keepFocus,
|
|
2846
|
+
onClick: () => runSkill(entry),
|
|
2847
|
+
children: entry.label
|
|
2848
|
+
},
|
|
2849
|
+
entry.id
|
|
2850
|
+
))
|
|
2851
|
+
] }),
|
|
2852
|
+
notice && /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "sci-dock-msg", "data-tone": notice.tone, role: notice.tone === "error" ? "alert" : "status", children: [
|
|
2853
|
+
notice.text,
|
|
2854
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("button", { type: "button", className: "sci-dock-btn", style: { marginLeft: 6 }, onMouseDown: keepFocus, onClick: () => setNotice(null), children: "\u5173\u95ED" })
|
|
2855
|
+
] })
|
|
2856
|
+
] });
|
|
2857
|
+
}
|
|
2858
|
+
|
|
2859
|
+
// client-src/conversation/ScienceTurnCards.jsx
|
|
2860
|
+
var import_jsx_runtime12 = require("react/jsx-runtime");
|
|
2861
|
+
var SCI_TOOLS = /* @__PURE__ */ new Set([
|
|
2862
|
+
"sci_blueprint_set",
|
|
2863
|
+
"sci_result_add",
|
|
2864
|
+
"sci_result_update",
|
|
2865
|
+
"sci_blueprint_confirm",
|
|
2866
|
+
"sci_claim_add",
|
|
2867
|
+
"sci_evidence_add",
|
|
2868
|
+
"sci_blueprint_stage",
|
|
2869
|
+
"sci_submission_check",
|
|
2870
|
+
"sci_result_reference_add",
|
|
2871
|
+
"sci_result_reference_verify",
|
|
2872
|
+
"sci_result_reference_remove",
|
|
2873
|
+
"sci_result_screening",
|
|
2874
|
+
"sci_blueprint_align",
|
|
2875
|
+
"sci_blueprint_link_figure",
|
|
2876
|
+
"sci_blueprint_import_legacy",
|
|
2877
|
+
"sci_team_dispatch",
|
|
2878
|
+
"sci_team_update_task",
|
|
2879
|
+
"sci_claim_retire",
|
|
2880
|
+
"sci_figure_register",
|
|
2881
|
+
"sci_figure_audit",
|
|
2882
|
+
"sci_figure_plan"
|
|
2883
|
+
]);
|
|
2884
|
+
function summarizeResult(_toolName, value) {
|
|
2885
|
+
if (!value || typeof value !== "object") return null;
|
|
2886
|
+
const parts = [];
|
|
2887
|
+
if (value.resultId) parts.push(value.resultId);
|
|
2888
|
+
if (value.objectId) parts.push(value.objectId);
|
|
2889
|
+
if (value.taskId) parts.push(value.taskId);
|
|
2890
|
+
if (value.figureId) parts.push(value.figureId);
|
|
2891
|
+
if (value.claimId) parts.push(value.claimId);
|
|
2892
|
+
if (value.evidenceId) parts.push(value.evidenceId);
|
|
2893
|
+
if (value.stage) parts.push(`\u9636\u6BB5 \u2192 ${value.stage}`);
|
|
2894
|
+
if (value.revision) parts.push(`rev ${value.revision}`);
|
|
2895
|
+
if (Array.isArray(value.changed) && value.changed.length > 0) parts.push(value.changed.join("\u3001"));
|
|
2896
|
+
const wrote = value.saved === true || value.receipt && typeof value.receipt === "object";
|
|
2897
|
+
if (parts.length === 0 && wrote) parts.push("\u5DF2\u4FDD\u5B58");
|
|
2898
|
+
if (value.requireConfirm) parts.push("\u5F85\u7528\u6237\u786E\u8BA4");
|
|
2899
|
+
if (value.stale) parts.push("\u5F15\u7528\u5DF2\u8FC7\u671F");
|
|
2900
|
+
return parts.join(" \xB7 ") || null;
|
|
2901
|
+
}
|
|
2902
|
+
var scienceStateChangeDefinition = {
|
|
2903
|
+
kind: "dsh-science/state-change",
|
|
2904
|
+
target: "chat",
|
|
2905
|
+
match: (event) => {
|
|
2906
|
+
if (event.type === "tool/call" && SCI_TOOLS.has(String(event.data && event.data.name))) {
|
|
2907
|
+
return { id: String(event.data.callId), role: "start" };
|
|
2908
|
+
}
|
|
2909
|
+
if (event.type === "tool/result" && event.data && event.data.message && event.data.message.source) {
|
|
2910
|
+
const source = event.data.message.source;
|
|
2911
|
+
if (source.kind === "tool" && source.callId) {
|
|
2912
|
+
return { id: String(source.callId), role: "update" };
|
|
2913
|
+
}
|
|
2914
|
+
}
|
|
2915
|
+
return null;
|
|
2916
|
+
},
|
|
2917
|
+
start: (_context, match) => {
|
|
2918
|
+
if (match.event.type !== "tool/call") throw new Error("science state-change start requires tool/call");
|
|
2919
|
+
return { toolName: String(match.event.data.name), done: false, summary: null, error: false };
|
|
2920
|
+
},
|
|
2921
|
+
update: (context, match) => {
|
|
2922
|
+
if (match.event.type !== "tool/result") return context.state;
|
|
2923
|
+
const callId = String(match.event.data.message && match.event.data.message.source && match.event.data.message.source.callId || "");
|
|
2924
|
+
if (callId && context.state && context.id && callId !== String(context.id)) return context.state;
|
|
2925
|
+
const failed = match.event.data.error !== void 0 || match.event.data.message && match.event.data.message.isError === true;
|
|
2926
|
+
let value = null;
|
|
2927
|
+
try {
|
|
2928
|
+
const blocks = match.event.data.message && match.event.data.message.content;
|
|
2929
|
+
const text = Array.isArray(blocks) ? blocks.filter((b) => b && b.type === "text").map((b) => b.text).join("") : "";
|
|
2930
|
+
value = text ? JSON.parse(text) : null;
|
|
2931
|
+
} catch {
|
|
2932
|
+
}
|
|
2933
|
+
const summary = !failed && value ? summarizeResult(context.state.toolName, value) : null;
|
|
2934
|
+
return { ...context.state, done: true, error: !!failed, summary };
|
|
2935
|
+
},
|
|
2936
|
+
buildViewNode: (context) => {
|
|
2937
|
+
if (context.start === void 0) return null;
|
|
2938
|
+
const state = context.state;
|
|
2939
|
+
if (!state.done) return null;
|
|
2940
|
+
if (!state.summary && !state.error) return null;
|
|
2941
|
+
return {
|
|
2942
|
+
key: context.key,
|
|
2943
|
+
kind: "dsh-science/state-change",
|
|
2944
|
+
id: context.id,
|
|
2945
|
+
target: "chat",
|
|
2946
|
+
anchorSeq: context.start.event.seq,
|
|
2947
|
+
location: context.start.location,
|
|
2948
|
+
visibility: "visible",
|
|
2949
|
+
data: { toolName: state.toolName, summary: state.summary, error: state.error }
|
|
2950
|
+
};
|
|
2951
|
+
}
|
|
2952
|
+
};
|
|
2953
|
+
var stylesInjected2 = false;
|
|
2954
|
+
function ensureStyles2() {
|
|
2955
|
+
if (stylesInjected2 || typeof document === "undefined") return;
|
|
2956
|
+
stylesInjected2 = true;
|
|
2957
|
+
const style = document.createElement("style");
|
|
2958
|
+
style.id = "dsh-science-turn-card-styles";
|
|
2959
|
+
style.textContent = `
|
|
2960
|
+
.sci-turncard{display:flex;align-items:flex-start;gap:8px;font-size:12px;padding:4px 10px;margin:2px 0;border:1px solid var(--dsh-border,rgba(127,127,127,.25));border-radius:8px;background:var(--dsh-fill-secondary,rgba(127,127,127,.06));color:inherit}
|
|
2961
|
+
.sci-turncard[data-error=true]{border-color:var(--dsh-danger,#d64545)}
|
|
2962
|
+
.sci-turncard .sci-turncard-icon{flex:0 0 auto;opacity:.8}
|
|
2963
|
+
.sci-turncard .sci-turncard-body{min-width:0}
|
|
2964
|
+
.sci-turncard .sci-turncard-title{font-weight:600}
|
|
2965
|
+
.sci-turncard .sci-turncard-summary{opacity:.85;overflow-wrap:anywhere}
|
|
2966
|
+
`;
|
|
2967
|
+
document.head.appendChild(style);
|
|
2968
|
+
}
|
|
2969
|
+
var TOOL_LABELS = {
|
|
2970
|
+
sci_blueprint_set: "\u66F4\u65B0\u6838\u5FC3",
|
|
2971
|
+
sci_result_add: "\u65B0\u589E Result",
|
|
2972
|
+
sci_result_update: "\u66F4\u65B0 Result",
|
|
2973
|
+
sci_blueprint_confirm: "\u786E\u8BA4\u4FEE\u8BA2",
|
|
2974
|
+
sci_claim_add: "\u65B0\u589E Claim",
|
|
2975
|
+
sci_evidence_add: "\u767B\u8BB0\u8BC1\u636E",
|
|
2976
|
+
sci_blueprint_stage: "\u5207\u6362\u9636\u6BB5",
|
|
2977
|
+
sci_submission_check: "\u6295\u7A3F\u68C0\u67E5",
|
|
2978
|
+
sci_result_reference_add: "\u767B\u8BB0\u6587\u732E",
|
|
2979
|
+
sci_result_reference_verify: "\u6838\u5BF9\u6587\u732E",
|
|
2980
|
+
sci_result_reference_remove: "\u79FB\u9664\u6587\u732E",
|
|
2981
|
+
sci_result_screening: "\u6587\u732E\u5FEB\u7B5B",
|
|
2982
|
+
sci_blueprint_align: "\u5BF9\u9F50\u4EFB\u52A1",
|
|
2983
|
+
sci_blueprint_link_figure: "\u6302\u63A5\u56FE\u4EF6",
|
|
2984
|
+
sci_blueprint_import_legacy: "\u5BFC\u5165\u65E7\u6570\u636E",
|
|
2985
|
+
sci_team_dispatch: "\u6D3E\u53D1\u4EFB\u52A1",
|
|
2986
|
+
sci_team_update_task: "\u66F4\u65B0\u4EFB\u52A1",
|
|
2987
|
+
sci_figure_register: "\u767B\u8BB0\u56FE\u4EF6",
|
|
2988
|
+
sci_figure_audit: "\u56FE\u4EF6\u524D\u68C0",
|
|
2989
|
+
sci_figure_plan: "\u56FE\u4EF6\u8BA1\u5212"
|
|
2990
|
+
};
|
|
2991
|
+
function StateChangeCard({ node }) {
|
|
2992
|
+
ensureStyles2();
|
|
2993
|
+
const data = node && node.data || {};
|
|
2994
|
+
const label = TOOL_LABELS[data.toolName] || data.toolName || "\u9879\u76EE\u72B6\u6001";
|
|
2995
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "sci-turncard", "data-error": data.error ? "true" : "false", children: [
|
|
2996
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { className: "sci-turncard-icon", "aria-hidden": "true", children: data.error ? "\u26A0" : "\u{1F9EC}" }),
|
|
2997
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("span", { className: "sci-turncard-body", children: [
|
|
2998
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { className: "sci-turncard-title", children: data.error ? `${label} \u672A\u5B8C\u6210` : `\u5DF2\u540C\u6B65\uFF1A${label}` }),
|
|
2999
|
+
data.summary && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: "sci-turncard-summary", children: data.summary }),
|
|
3000
|
+
data.error && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: "sci-turncard-summary", children: "\u8BE5\u5DE5\u5177\u8C03\u7528\u672A\u6210\u529F\uFF0C\u9879\u76EE\u72B6\u6001\u672A\u53D8\u66F4\uFF1B\u53EF\u5728\u5BF9\u8BDD\u4E2D\u91CD\u8BD5\u3002" })
|
|
3001
|
+
] })
|
|
3002
|
+
] });
|
|
3003
|
+
}
|
|
3004
|
+
|
|
3005
|
+
// client-src/conversation/ScienceConfirmCard.jsx
|
|
3006
|
+
var import_react14 = __toESM(require("react"), 1);
|
|
3007
|
+
var import_jsx_runtime13 = require("react/jsx-runtime");
|
|
3008
|
+
var SCIENCE_CONFIRM_ACTION = "sci-paper-confirm";
|
|
3009
|
+
var SCIENCE_CONFIRM_LOCALE = "dsh-science-confirm";
|
|
3010
|
+
var COPY = Object.freeze({
|
|
3011
|
+
zh: {
|
|
3012
|
+
confirm: "\u786E\u8BA4\u6B64\u4FEE\u8BA2",
|
|
3013
|
+
reject: "\u9000\u56DE\u5E76\u56DE\u5BF9\u8BDD",
|
|
3014
|
+
confirmed: "\u5DF2\u786E\u8BA4",
|
|
3015
|
+
rejected: "\u5DF2\u9000\u56DE",
|
|
3016
|
+
dismissed: "\u5DF2\u5FFD\u7565",
|
|
3017
|
+
replaced: "\u5DF2\u88AB\u65B0\u5361\u7247\u66FF\u4EE3",
|
|
3018
|
+
unavailable: "\u8FD9\u6B21\u64CD\u4F5C\u6CA1\u6709\u5B8C\u6210\uFF0C\u8BF7\u91CD\u8BD5\u3002",
|
|
3019
|
+
rejectHint: "\u9000\u56DE\u4E0D\u4F1A\u6539\u52A8\u8BBA\u6587\u5185\u5BB9\uFF0C\u53EA\u8BB0\u5F55\u51B3\u5B9A\uFF1B\u8BF7\u5728\u5BF9\u8BDD\u4E2D\u8BF4\u660E\u4FEE\u6539\u610F\u89C1\u3002",
|
|
3020
|
+
settled: "\u8FD9\u5F20\u5361\u7247\u5DF2\u5904\u7406\u5B8C\u6210\u3002",
|
|
3021
|
+
revision: "\u4FEE\u8BA2",
|
|
3022
|
+
stale: "\u8FD9\u5F20\u5361\u7247\u5BF9\u5E94 r{shown}\uFF0C\u5F53\u524D\u5DF2\u662F r{current}\uFF0C\u8BF7\u8BA9\u961F\u957F\u57FA\u4E8E\u6700\u65B0\u4FEE\u8BA2\u91CD\u65B0\u53D1\u8D77\u3002"
|
|
3023
|
+
},
|
|
3024
|
+
en: {
|
|
3025
|
+
confirm: "Confirm this revision",
|
|
3026
|
+
reject: "Return to conversation",
|
|
3027
|
+
confirmed: "Confirmed",
|
|
3028
|
+
rejected: "Returned",
|
|
3029
|
+
dismissed: "Dismissed",
|
|
3030
|
+
replaced: "Replaced by a newer card",
|
|
3031
|
+
unavailable: "This action did not finish. Try again.",
|
|
3032
|
+
rejectHint: "Returning does not change the paper content; it only records the decision. Explain your edits in the conversation.",
|
|
3033
|
+
settled: "This card has been handled.",
|
|
3034
|
+
revision: "Revision",
|
|
3035
|
+
stale: "This card targets r{shown} but the object is now r{current}. Ask the lead to propose a new card from the latest revision."
|
|
3036
|
+
}
|
|
3037
|
+
});
|
|
3038
|
+
function textOf(t, key) {
|
|
3039
|
+
if (typeof t === "function") {
|
|
3040
|
+
try {
|
|
3041
|
+
const value = t(key);
|
|
3042
|
+
if (value && value !== key) return value;
|
|
3043
|
+
} catch {
|
|
3044
|
+
}
|
|
3045
|
+
}
|
|
3046
|
+
const language = typeof navigator === "object" && String(navigator.language || "").toLowerCase().startsWith("en") ? "en" : "zh";
|
|
3047
|
+
return COPY[language] && COPY[language][key] || (COPY.zh[key] ?? key);
|
|
3048
|
+
}
|
|
3049
|
+
var FINAL_PHASES = ["confirmed", "rejected", "dismissed", "replaced"];
|
|
3050
|
+
var stylesInjected3 = false;
|
|
3051
|
+
function ensureStyles3() {
|
|
3052
|
+
if (stylesInjected3 || typeof document === "undefined") return;
|
|
3053
|
+
stylesInjected3 = true;
|
|
3054
|
+
const style = document.createElement("style");
|
|
3055
|
+
style.id = "dsh-science-confirm-card-styles";
|
|
3056
|
+
style.textContent = `
|
|
3057
|
+
.sci-confirm-card{display:flex;flex-direction:column;gap:8px;margin-top:8px;padding:12px 14px;border:1px solid var(--dsh-border,rgba(127,127,127,.28));border-radius:10px;background:var(--dsh-fill-secondary,rgba(127,127,127,.06))}
|
|
3058
|
+
.sci-confirm-meta{display:flex;align-items:center;gap:8px;font-size:12px;opacity:.72;overflow-wrap:anywhere}
|
|
3059
|
+
.sci-confirm-chip{padding:1px 6px;border-radius:999px;border:1px solid var(--dsh-border,rgba(127,127,127,.3));font-variant-numeric:tabular-nums}
|
|
3060
|
+
.sci-confirm-actions{display:flex;flex-wrap:wrap;gap:8px;margin-top:2px}
|
|
3061
|
+
.sci-confirm-actions button{font:inherit;font-size:13px;line-height:1.6;padding:5px 14px;border-radius:8px;cursor:pointer;border:1px solid var(--dsh-border,rgba(127,127,127,.4));background:transparent;color:inherit;transition:background .12s ease}
|
|
3062
|
+
.sci-confirm-actions button:first-child{background:var(--dsh-accent,#3b6df6);border-color:transparent;color:#fff;font-weight:600}
|
|
3063
|
+
.sci-confirm-actions button:first-child:hover:not(:disabled){filter:brightness(1.06)}
|
|
3064
|
+
.sci-confirm-actions button:last-child:hover:not(:disabled){background:var(--dsh-fill-tertiary,rgba(127,127,127,.12))}
|
|
3065
|
+
.sci-confirm-actions button:disabled{opacity:.5;cursor:not-allowed}
|
|
3066
|
+
.sci-confirm-hint{font-size:12px;opacity:.7}
|
|
3067
|
+
.sci-confirm-status{display:flex;align-items:center;gap:6px;font-size:13px;font-weight:600}
|
|
3068
|
+
.sci-confirm-status[data-tone=good]{color:var(--dsh-success,#2f9e5f)}
|
|
3069
|
+
.sci-confirm-status[data-tone=warn]{color:var(--dsh-warning,#b07a12)}
|
|
3070
|
+
.sci-confirm-notice{font-size:12px;line-height:1.6;color:var(--dsh-warning,#b07a12)}
|
|
3071
|
+
.sci-confirm-error{font-size:12px;line-height:1.6;color:var(--dsh-danger,#d64545)}
|
|
3072
|
+
`;
|
|
3073
|
+
document.head.appendChild(style);
|
|
3074
|
+
}
|
|
3075
|
+
function useCurrentObjectRevision(sessionId, objectId) {
|
|
3076
|
+
const [current, setCurrent] = (0, import_react14.useState)(null);
|
|
3077
|
+
(0, import_react14.useEffect)(() => {
|
|
3078
|
+
if (!sessionId || !objectId || typeof fetch !== "function") return void 0;
|
|
3079
|
+
let alive = true;
|
|
3080
|
+
(async () => {
|
|
3081
|
+
try {
|
|
3082
|
+
const res = await fetch(`/plugins/dsh-science/project/get?sessionId=${encodeURIComponent(sessionId)}`);
|
|
3083
|
+
if (!alive || !res || !res.ok) return;
|
|
3084
|
+
const body = await res.json();
|
|
3085
|
+
const paper = body && body.project && body.project.paper;
|
|
3086
|
+
if (!paper) return;
|
|
3087
|
+
const obj = objectId === "core" ? paper.core : (paper.results || []).find((r) => r && r.id === objectId);
|
|
3088
|
+
const revision = obj && Number(obj.revision);
|
|
3089
|
+
if (alive && Number.isFinite(revision)) setCurrent(revision);
|
|
3090
|
+
} catch {
|
|
3091
|
+
}
|
|
3092
|
+
})();
|
|
3093
|
+
return () => {
|
|
3094
|
+
alive = false;
|
|
3095
|
+
};
|
|
3096
|
+
}, [sessionId, objectId]);
|
|
3097
|
+
return current;
|
|
3098
|
+
}
|
|
3099
|
+
function ScienceConfirmBody({ proposal, decision, sessionId, summary, act, t }) {
|
|
3100
|
+
ensureStyles3();
|
|
3101
|
+
const [pending, setPending] = (0, import_react14.useState)(false);
|
|
3102
|
+
const [settled, setSettled] = (0, import_react14.useState)(false);
|
|
3103
|
+
const [error, setError] = (0, import_react14.useState)("");
|
|
3104
|
+
const phase = decision?.phase;
|
|
3105
|
+
const done = FINAL_PHASES.includes(phase) || settled;
|
|
3106
|
+
const details = proposal && proposal.details || {};
|
|
3107
|
+
const shownRevision = details.objectRevision;
|
|
3108
|
+
const liveRevision = useCurrentObjectRevision(sessionId, details.objectId);
|
|
3109
|
+
const stale = !done && liveRevision != null && shownRevision != null && Number(liveRevision) !== Number(shownRevision);
|
|
3110
|
+
const hashShort = typeof details.expectedHash === "string" ? details.expectedHash.slice(0, 8) : "";
|
|
3111
|
+
const send = async (verb) => {
|
|
3112
|
+
if (done || pending || typeof act !== "function") return;
|
|
3113
|
+
setPending(true);
|
|
3114
|
+
setError("");
|
|
3115
|
+
try {
|
|
3116
|
+
const result = await act(verb);
|
|
3117
|
+
if (!result || result.status === "refused" || result.status === "unconfirmed") {
|
|
3118
|
+
setError(result?.reason || textOf(t, "unavailable"));
|
|
3119
|
+
} else {
|
|
3120
|
+
setSettled(true);
|
|
3121
|
+
}
|
|
3122
|
+
} catch (err) {
|
|
3123
|
+
setError(err?.message || textOf(t, "unavailable"));
|
|
3124
|
+
} finally {
|
|
3125
|
+
setPending(false);
|
|
3126
|
+
}
|
|
3127
|
+
};
|
|
3128
|
+
const statusKey = done ? settled && !phase ? "settled" : phase : "";
|
|
3129
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "sci-confirm-card", "data-action": proposal?.action || SCIENCE_CONFIRM_ACTION, children: [
|
|
3130
|
+
summary,
|
|
3131
|
+
(shownRevision != null || hashShort) && /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "sci-confirm-meta", children: [
|
|
3132
|
+
details.objectId && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { children: details.objectId }),
|
|
3133
|
+
shownRevision != null && /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("span", { className: "sci-confirm-chip", children: [
|
|
3134
|
+
textOf(t, "revision"),
|
|
3135
|
+
" r",
|
|
3136
|
+
shownRevision
|
|
3137
|
+
] }),
|
|
3138
|
+
hashShort && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { className: "sci-confirm-chip", children: hashShort })
|
|
3139
|
+
] }),
|
|
3140
|
+
stale && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("p", { className: "sci-confirm-notice", role: "alert", children: textOf(t, "stale").replace("{shown}", String(shownRevision)).replace("{current}", String(liveRevision)) }),
|
|
3141
|
+
done && /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("p", { className: "sci-confirm-status", role: "status", "data-tone": phase === "confirmed" ? "good" : "warn", children: [
|
|
3142
|
+
phase === "confirmed" ? "\u2713" : "\u21A9",
|
|
3143
|
+
" ",
|
|
3144
|
+
textOf(t, statusKey || "settled")
|
|
3145
|
+
] }),
|
|
3146
|
+
error && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("p", { className: "sci-confirm-error", role: "alert", children: error }),
|
|
3147
|
+
!done && /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "sci-confirm-actions", children: [
|
|
3148
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("button", { type: "button", disabled: pending || stale, onClick: () => send("confirm"), children: textOf(t, "confirm") }),
|
|
3149
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("button", { type: "button", disabled: pending || stale, onClick: () => send("reject"), children: textOf(t, "reject") })
|
|
3150
|
+
] }),
|
|
3151
|
+
!done && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("p", { className: "sci-confirm-hint", children: textOf(t, "rejectHint") })
|
|
3152
|
+
] });
|
|
3153
|
+
}
|
|
3154
|
+
function scienceConfirmLocale() {
|
|
3155
|
+
return {
|
|
3156
|
+
zh: { ...COPY.zh },
|
|
3157
|
+
en: { ...COPY.en }
|
|
3158
|
+
};
|
|
3159
|
+
}
|
|
3160
|
+
|
|
3161
|
+
// lib/skeleton-context.js
|
|
3162
|
+
var SKELETON_LIFECYCLE = Object.freeze([
|
|
3163
|
+
{ action: "propose", command: "paper.propose-core | paper.propose-result | paper.record-proposal", effect: "\u8FFD\u52A0\u5F85\u786E\u8BA4\u8349\u6848\uFF1B\u5FC5\u987B\u5E26\u6765\u6E90\uFF1B\u4E0D\u81EA\u52A8\u786E\u8BA4\u3001\u4E0D\u6D3E\u53D1\u4EFB\u52A1" },
|
|
3164
|
+
{ action: "confirm", command: "paper.confirm-revision", effect: "\u53EA\u786E\u8BA4 expectedObjectRevision + expectedHash \u5BF9\u5E94\u7684\u5F53\u524D\u5BF9\u8C61\uFF1B\u63A2\u7D22\u548C\u6574\u7406\u6750\u6599\u4E0D\u53D7\u9636\u6BB5\u9650\u5236" },
|
|
3165
|
+
{ action: "revise", command: "paper.update-result | paper.propose-core | paper.record-claim | paper.retire-claim", effect: "\u8BED\u4E49\u53D8\u5316\u8FFD\u52A0 history \u5E76\u63A8\u8FDB\u5BF9\u8C61\u4FEE\u8BA2\uFF1B\u65E7\u786E\u8BA4\u5931\u6548\uFF1B\u65E7\u4EFB\u52A1/\u8BC1\u636E\u5173\u7CFB\u4ECD\u53EF\u6309\u4FEE\u8BA2\u67E5\u8BE2" },
|
|
3166
|
+
{ action: "archive", command: "paper.archive-object", effect: "\u5BF9\u8C61\u4FDD\u7559\u5E76\u6807\u8BB0 archived\uFF1B\u8FFD\u52A0\u5F52\u6863\u4FEE\u8BA2\uFF1B\u4E0D\u5220\u9664\u4EFB\u52A1\u3001\u8BC1\u636E\u6216\u5386\u53F2\u5173\u7CFB" }
|
|
3167
|
+
]);
|
|
3168
|
+
var CLIP = Object.freeze({ question: 160, claim: 240, evidence: 120 });
|
|
3169
|
+
function objectRefToken(target) {
|
|
3170
|
+
if (!target) return "";
|
|
3171
|
+
const objectId = typeof target === "string" ? target : target.objectId || target.id;
|
|
3172
|
+
if (!objectId) return "";
|
|
3173
|
+
const revision = typeof target === "object" && target.revision != null ? ` revision=${Number(target.revision)}` : "";
|
|
3174
|
+
return `[[dsh-science-ref objectId=${objectId}${revision}]]`;
|
|
3175
|
+
}
|
|
3176
|
+
|
|
3177
|
+
// client-src/conversation/composer-handoff.js
|
|
3178
|
+
var SCIENCE_SKILL_TEXT = Object.freeze({
|
|
3179
|
+
explore: { skill: "sci-hypothesis", guide: "\u6211\u60F3\u7814\u7A76\u7684\u65B9\u5411\u662F\uFF1A" },
|
|
3180
|
+
results: { skill: null, prompt: "\u8BF7\u68C0\u67E5\u5E76\u6574\u7406\u6211\u5DF2\u6709\u7684\u79D1\u7814\u7ED3\u679C\uFF1A\u5148\u5217\u51FA\u53EF\u8FFD\u6EAF\u7684\u7ED3\u679C\u3001\u6765\u6E90\u548C\u4E0D\u786E\u5B9A\u9879\uFF0C\u4E0D\u8981\u8865\u9020\u7F3A\u5931\u6570\u636E\u3002" },
|
|
3181
|
+
literature: { skill: "sci-autoresearch", guide: "\u8BF7\u56F4\u7ED5\u6211\u7684\u7814\u7A76\u95EE\u9898\u505A\u6587\u732E\u63A2\u7D22\uFF1A" },
|
|
3182
|
+
draw: { skill: "sci-figures", guide: "\u8BF7\u4E3A\u4EE5\u4E0B\u7814\u7A76\u7ED3\u679C\u5EFA\u7ACB\u56FE\u4EF6\u65B9\u6848\uFF1A" },
|
|
3183
|
+
write: { skill: "sci-writing", guide: "\u8BF7\u57FA\u4E8E\u5F53\u524D\u8BBA\u6587\u4E3B\u7EBF\u8D77\u8349\uFF1A" },
|
|
3184
|
+
slides: { skill: "sci-slides", guide: "\u8BF7\u57FA\u4E8E\u5F53\u524D\u7814\u7A76\u8FDB\u5C55\u5236\u4F5C\u6C47\u62A5\uFF1A" },
|
|
3185
|
+
structure: { skill: null, prompt: "\u8BF7\u57FA\u4E8E\u5F53\u524D\u4F1A\u8BDD\u8BC1\u636E\u4E0E\u9879\u76EE\u72B6\u6001\u5EFA\u7ACB/\u8C03\u6574\u6587\u7AE0\u7ED3\u6784\u8349\u6848\uFF1A\u63D0\u51FA\u6838\u5FC3\u7ED3\u8BBA\u5019\u9009\u5E76\u62C6\u5206\u4E3A 3\u20135 \u4E2A\u53EF\u72EC\u7ACB\u6838\u9A8C\u7684 Result\uFF1B\u53EA\u751F\u6210\u5F85\u786E\u8BA4\u8349\u6848\uFF0C\u4E0D\u8981\u81EA\u52A8\u786E\u8BA4\u6216\u6D3E\u53D1\u4EFB\u52A1\u3002" }
|
|
3186
|
+
});
|
|
3187
|
+
function handoffTextFor(kind, target = null) {
|
|
3188
|
+
const entry = SCIENCE_SKILL_TEXT[kind];
|
|
3189
|
+
if (!entry) return null;
|
|
3190
|
+
const head = entry.skill ? `/${entry.skill}` : "";
|
|
3191
|
+
const body = entry.skill ? entry.guide : entry.prompt;
|
|
3192
|
+
const ref = target ? `
|
|
3193
|
+
\uFF08\u5BF9\u8C61\uFF1A${typeof target === "string" ? target : target.objectId || target.id || ""}\uFF09
|
|
3194
|
+
${objectRefToken(target)}` : "";
|
|
3195
|
+
return `${head ? head + "\n" : ""}${body}${ref}`;
|
|
3196
|
+
}
|
|
3197
|
+
async function handoffToComposer({ ctx, sessionId, kind, target = null, openConversation }) {
|
|
3198
|
+
const text = handoffTextFor(kind, target);
|
|
3199
|
+
if (!text) return { ok: false, code: "unknown-kind" };
|
|
3200
|
+
if (!sessionId) return { ok: false, code: "no-session" };
|
|
3201
|
+
let conversation = null;
|
|
3202
|
+
let sessions = null;
|
|
3203
|
+
try {
|
|
3204
|
+
conversation = ctx.get("conversation");
|
|
3205
|
+
sessions = ctx.get("sessions");
|
|
3206
|
+
} catch {
|
|
3207
|
+
try {
|
|
3208
|
+
conversation = ctx.conversation;
|
|
3209
|
+
sessions = ctx.sessions;
|
|
3210
|
+
} catch {
|
|
3211
|
+
}
|
|
3212
|
+
}
|
|
3213
|
+
const binding = sessions && typeof sessions.binding === "function" ? sessions.binding(sessionId) : void 0;
|
|
3214
|
+
if (conversation && conversation.input && binding && typeof conversation.input.requestDraftInitialization === "function") {
|
|
3215
|
+
try {
|
|
3216
|
+
const result = conversation.input.requestDraftInitialization(binding, { prompt: text, whenDraftExists: "append" });
|
|
3217
|
+
if (result === "applied" || result === "preserved") {
|
|
3218
|
+
if (typeof openConversation === "function") openConversation();
|
|
3219
|
+
return { ok: true };
|
|
3220
|
+
}
|
|
3221
|
+
return { ok: false, code: "blocked" };
|
|
3222
|
+
} catch {
|
|
3223
|
+
return { ok: false, code: "handoff-failed" };
|
|
3224
|
+
}
|
|
3225
|
+
}
|
|
3226
|
+
return { ok: false, code: "no-input-face" };
|
|
3227
|
+
}
|
|
3228
|
+
|
|
3229
|
+
// client-src/workbench/host-adapter.js
|
|
3230
|
+
var WORKBENCH_REQUIRED_SERVICES = Object.freeze([
|
|
3231
|
+
"slots",
|
|
3232
|
+
"sessions",
|
|
3233
|
+
"layout",
|
|
3234
|
+
"sidebarRightTabs",
|
|
3235
|
+
"uiWorkspace"
|
|
3236
|
+
]);
|
|
3237
|
+
function registerGuardedPart(mount, part, register) {
|
|
3238
|
+
const state = mount && typeof mount === "object" ? mount : {};
|
|
3239
|
+
if (state[part]) return () => {
|
|
3240
|
+
};
|
|
3241
|
+
const dispose = register();
|
|
3242
|
+
state[part] = true;
|
|
3243
|
+
return () => {
|
|
3244
|
+
state[part] = false;
|
|
3245
|
+
if (typeof dispose === "function") dispose();
|
|
3246
|
+
};
|
|
3247
|
+
}
|
|
3248
|
+
|
|
3249
|
+
// client-src/index.jsx
|
|
3250
|
+
var import_jsx_runtime14 = require("react/jsx-runtime");
|
|
3251
|
+
var inject = [...WORKBENCH_REQUIRED_SERVICES, "uiConversation", "conversation", "actionCards", "locale"];
|
|
3252
|
+
var PANEL_ID = "dsh-science/workbench";
|
|
3253
|
+
function service(ctx, name) {
|
|
3254
|
+
try {
|
|
3255
|
+
return ctx.get(name);
|
|
3256
|
+
} catch {
|
|
3257
|
+
return void 0;
|
|
3258
|
+
}
|
|
3259
|
+
}
|
|
3260
|
+
function currentSessionId(sessions) {
|
|
3261
|
+
try {
|
|
3262
|
+
const snapshot = sessions?.list?.getSnapshot?.();
|
|
3263
|
+
const main = Object.values(snapshot?.byId || {}).find((row) => row?.retainedBy && (row.retainedBy.mainView || 0) > 0);
|
|
3264
|
+
if (main?.id) return main.id;
|
|
3265
|
+
return typeof snapshot?.current === "string" ? snapshot.current : void 0;
|
|
3266
|
+
} catch {
|
|
3267
|
+
return void 0;
|
|
3268
|
+
}
|
|
3269
|
+
}
|
|
3270
|
+
function makeServices(ctx) {
|
|
3271
|
+
const sessionsOf = () => service(ctx, "sessions") || ctx.sessions;
|
|
3272
|
+
const getSessionId = () => currentSessionId(sessionsOf());
|
|
3273
|
+
const subscribeSession = (listener) => {
|
|
3274
|
+
const sessions = sessionsOf();
|
|
3275
|
+
for (const target of [sessions?.list, sessions]) {
|
|
3276
|
+
if (!target || typeof target.subscribe !== "function") continue;
|
|
3277
|
+
try {
|
|
3278
|
+
const dispose = target.subscribe(() => {
|
|
3279
|
+
try {
|
|
3280
|
+
listener();
|
|
3281
|
+
} catch {
|
|
3282
|
+
}
|
|
3283
|
+
});
|
|
3284
|
+
if (typeof dispose === "function") return dispose;
|
|
3285
|
+
} catch {
|
|
3286
|
+
}
|
|
3287
|
+
}
|
|
3288
|
+
return () => {
|
|
3289
|
+
};
|
|
3290
|
+
};
|
|
3291
|
+
const getCurrentSession = () => {
|
|
3292
|
+
const sessions = sessionsOf();
|
|
3293
|
+
const id = getSessionId();
|
|
3294
|
+
if (!id || typeof sessions?.binding !== "function") return void 0;
|
|
3295
|
+
try {
|
|
3296
|
+
return sessions.binding(id)?.session;
|
|
3297
|
+
} catch {
|
|
3298
|
+
return void 0;
|
|
3299
|
+
}
|
|
3300
|
+
};
|
|
3301
|
+
const openConversation = () => {
|
|
3302
|
+
const layout = service(ctx, "layout") || ctx.layout;
|
|
3303
|
+
if (typeof layout?.selectPanel !== "function") throw new Error("\u5F53\u524D DSH \u4E0D\u652F\u6301\u5207\u6362\u5230\u5BF9\u8BDD\u9762\u677F\u3002");
|
|
3304
|
+
layout.selectPanel(null);
|
|
3305
|
+
};
|
|
3306
|
+
const openWorkbench = (page) => {
|
|
3307
|
+
const layout = service(ctx, "layout") || ctx.layout;
|
|
3308
|
+
if (page) {
|
|
3309
|
+
try {
|
|
3310
|
+
window.__DSH_SCIENCE_OPEN_PAGE__ = page;
|
|
3311
|
+
} catch {
|
|
3312
|
+
}
|
|
3313
|
+
}
|
|
3314
|
+
layout?.selectPanel?.(PANEL_ID);
|
|
3315
|
+
};
|
|
3316
|
+
const openRootSession = (sessionId) => {
|
|
3317
|
+
const workspace = service(ctx, "uiWorkspace");
|
|
3318
|
+
if (typeof workspace?.openSession !== "function") throw new Error("\u5F53\u524D DSH \u4E0D\u652F\u6301\u6253\u5F00\u8BFE\u9898\u4F1A\u8BDD\u3002");
|
|
3319
|
+
if (!sessionId || typeof sessionId !== "string") throw new Error("\u8BE5\u8BFE\u9898\u6CA1\u6709\u53EF\u6253\u5F00\u7684\u539F\u4F1A\u8BDD\u3002");
|
|
3320
|
+
workspace.openSession(sessionId);
|
|
3321
|
+
};
|
|
3322
|
+
const openMemberSession = (member) => {
|
|
3323
|
+
const workspace = service(ctx, "uiWorkspace");
|
|
3324
|
+
if (typeof workspace?.openSession !== "function") throw new Error("\u5F53\u524D DSH \u4E0D\u652F\u6301\u6253\u5F00\u6210\u5458\u4F1A\u8BDD\u3002");
|
|
3325
|
+
if (!member?.childId) throw new Error("\u8BE5\u6210\u5458\u6CA1\u6709\u8BB0\u5F55\u53EF\u6253\u5F00\u7684\u4F1A\u8BDD\u3002");
|
|
3326
|
+
const sessions = sessionsOf();
|
|
3327
|
+
const parentSessionId = member.parentSessionId || currentSessionId(sessions);
|
|
3328
|
+
if (!parentSessionId) throw new Error("\u65E0\u6CD5\u786E\u5B9A\u6210\u5458\u4F1A\u8BDD\u6240\u5C5E\u7684\u9879\u76EE\u4F1A\u8BDD\u3002");
|
|
3329
|
+
workspace.openSession({ parentSessionId, childSessionId: member.childId, mode: "continuable" });
|
|
3330
|
+
};
|
|
3331
|
+
const memberOpenAvailable = (view) => {
|
|
3332
|
+
const workspace = service(ctx, "uiWorkspace");
|
|
3333
|
+
const sessions = sessionsOf();
|
|
3334
|
+
return typeof workspace?.openSession === "function" && Boolean(getSessionId() || view?.team?.members?.some((member) => member.parentSessionId && member.childId));
|
|
3335
|
+
};
|
|
3336
|
+
const prepareHandoff = async (kind, target = null) => {
|
|
3337
|
+
return handoffToComposer({ ctx, sessionId: getSessionId(), kind, target, openConversation });
|
|
3338
|
+
};
|
|
3339
|
+
return { getSessionId, subscribeSession, getCurrentSession, openConversation, openWorkbench, openRootSession, openMemberSession, memberOpenAvailable, prepareHandoff };
|
|
3340
|
+
}
|
|
3341
|
+
function WorkbenchIcon({ size = 22, active = false }) {
|
|
3342
|
+
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: [
|
|
3343
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("path", { d: "M4 5.5A1.5 1.5 0 0 1 5.5 4h13A1.5 1.5 0 0 1 20 5.5v13a1.5 1.5 0 0 1-1.5 1.5h-13A1.5 1.5 0 0 1 4 18.5z" }),
|
|
3344
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("path", { d: "M8 8h8M8 12h5M8 16h3" })
|
|
3345
|
+
] });
|
|
3346
|
+
}
|
|
3347
|
+
function apply(ctx) {
|
|
3348
|
+
let mount;
|
|
3349
|
+
try {
|
|
3350
|
+
mount = window.__DSH_SCIENCE_CLIENT_MOUNT__ || null;
|
|
3351
|
+
if (!mount) window.__DSH_SCIENCE_CLIENT_MOUNT__ = mount = { main: false, panelIcon: false, quick: false, tab: false, dock: false, turnCards: false };
|
|
3352
|
+
} catch {
|
|
3353
|
+
mount = { main: false, panelIcon: false, quick: false, tab: false, dock: false, turnCards: false };
|
|
3354
|
+
}
|
|
3355
|
+
const services = makeServices(ctx);
|
|
3356
|
+
try {
|
|
3357
|
+
window.__DSH_SCIENCE_DEBUG__ = { currentSessionId: () => currentSessionId(service(ctx, "sessions") || ctx.sessions) };
|
|
3358
|
+
} catch {
|
|
3359
|
+
}
|
|
3360
|
+
ctx.effect(() => registerGuardedPart(mount, "main", () => ctx.slots.inject("main", () => ctx.slots.register({
|
|
3361
|
+
name: "main",
|
|
3362
|
+
key: PANEL_ID,
|
|
3363
|
+
inject: () => ({ services })
|
|
3364
|
+
}, ResearchWorkbench))), "dsh-science main workbench");
|
|
3365
|
+
ctx.effect(() => registerGuardedPart(mount, "panelIcon", () => ctx.slots.inject("sidebar.panellist", () => ctx.slots.register({
|
|
3366
|
+
name: "sidebar.panellist",
|
|
3367
|
+
id: PANEL_ID,
|
|
3368
|
+
order: 40,
|
|
3369
|
+
label: () => "\u79D1\u7814\u5DE5\u4F5C\u53F0"
|
|
3370
|
+
}, WorkbenchIcon))), "dsh-science global panel entry");
|
|
3371
|
+
const tabs = service(ctx, "sidebarRightTabs") || ctx.sidebarRightTabs;
|
|
3372
|
+
if (tabs && typeof tabs.register === "function") {
|
|
3373
|
+
ctx.effect(() => registerGuardedPart(mount, "tab", () => tabs.register({
|
|
3374
|
+
id: PANEL_ID,
|
|
3375
|
+
kind: "workbench",
|
|
3376
|
+
title: () => "\u79D1\u7814\u5DE5\u4F5C\u53F0",
|
|
3377
|
+
guide: [{ id: "workbench", order: 10, title: () => "\u79D1\u7814\u5DE5\u4F5C\u53F0", description: () => "\u663E\u793A\u7814\u7A76\u9636\u6BB5\u3001\u4E0B\u4E00\u6B65\u5EFA\u8BAE\u548C\u56E2\u961F\u8FD0\u884C\u72B6\u6001\u3002\u6253\u5F00\u5B8C\u6574\u5DE5\u4F5C\u53F0\u53EF\u67E5\u770B\u8BBA\u6587\u4E3B\u7EBF\u3001\u56E2\u961F\u8FDB\u5C55\u3001\u56FE\u8868\u6210\u679C\u4E0E\u4E13\u5BB6\u914D\u7F6E\u3002" }]
|
|
3378
|
+
})), "dsh-science right-rail tab");
|
|
3379
|
+
ctx.effect(() => registerGuardedPart(mount, "quick", () => ctx.slots.inject("sidebar.right.pane.tab", () => ctx.slots.register({
|
|
3380
|
+
name: "sidebar.right.pane.tab",
|
|
3381
|
+
key: PANEL_ID,
|
|
3382
|
+
inject: () => ({ services })
|
|
3383
|
+
}, QuickWorkbench))), "dsh-science right-rail companion");
|
|
3384
|
+
}
|
|
3385
|
+
ctx.effect(() => registerGuardedPart(mount, "dock", () => ctx.slots.inject("conversation.input.dock", () => ctx.slots.register({
|
|
3386
|
+
name: "conversation.input.dock",
|
|
3387
|
+
id: "dsh-science/context",
|
|
3388
|
+
order: 30,
|
|
3389
|
+
inject: () => ({ services })
|
|
3390
|
+
}, ScienceDock))), "dsh-science composer dock");
|
|
3391
|
+
const locale = service(ctx, "locale") || ctx.locale;
|
|
3392
|
+
if (locale && typeof locale.register === "function") {
|
|
3393
|
+
ctx.effect(() => locale.register(SCIENCE_CONFIRM_LOCALE, scienceConfirmLocale()), "dsh-science confirm locale");
|
|
3394
|
+
}
|
|
3395
|
+
const actionCards = service(ctx, "actionCards") || ctx.actionCards;
|
|
3396
|
+
if (actionCards && typeof actionCards.register === "function") {
|
|
3397
|
+
ctx.effect(() => actionCards.register({
|
|
3398
|
+
action: SCIENCE_CONFIRM_ACTION,
|
|
3399
|
+
locale: SCIENCE_CONFIRM_LOCALE,
|
|
3400
|
+
Body: ScienceConfirmBody
|
|
3401
|
+
}), "dsh-science confirm card");
|
|
3402
|
+
}
|
|
3403
|
+
const uiConversation = service(ctx, "uiConversation") || ctx.uiConversation;
|
|
3404
|
+
if (uiConversation && uiConversation.events && typeof uiConversation.events.register === "function") {
|
|
3405
|
+
ctx.effect(() => registerGuardedPart(mount, "turnCards", () => {
|
|
3406
|
+
const disposeDefinition = uiConversation.events.register(scienceStateChangeDefinition);
|
|
3407
|
+
const disposeRenderer = ctx.slots.inject("conversation.chat.node", () => ctx.slots.register({
|
|
3408
|
+
name: "conversation.chat.node",
|
|
3409
|
+
key: "dsh-science/state-change",
|
|
3410
|
+
inject: () => ({})
|
|
3411
|
+
}, StateChangeCard));
|
|
3412
|
+
return () => {
|
|
3413
|
+
try {
|
|
3414
|
+
disposeRenderer();
|
|
3415
|
+
} catch {
|
|
3416
|
+
}
|
|
3417
|
+
try {
|
|
3418
|
+
disposeDefinition();
|
|
3419
|
+
} catch {
|
|
3420
|
+
}
|
|
3421
|
+
};
|
|
3422
|
+
}), "dsh-science turn cards");
|
|
3423
|
+
}
|
|
3424
|
+
}
|
|
3425
|
+
return module.exports; } });
|