Add capability-probed structured outputs and a prototype/instance creation graph.
Probe API profiles for json_schema/tools, flatten worker artifacts onto a strict schema, and let users spawn or revise graph nodes instead of a one-shot DAG. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
+816
-192
File diff suppressed because it is too large
Load Diff
+259
-65
@@ -1,7 +1,7 @@
|
||||
import { renderWorkspace, updateLiveStreamPanel, resetRailChrome } from "./agent-ui.js";
|
||||
import { renderWorkspace, updateLiveStreamPanel, resetRailChrome, fillStepArtifactDialog } from "./agent-ui.js";
|
||||
import { downloadMarkdown, sessionToMarkdown } from "./export.js";
|
||||
import { renderIntakePanel } from "./intake-ui.js";
|
||||
import { displaySkillPackLabel, reviewComposerCopy } from "./display-labels.js";
|
||||
import { displaySkillPackLabel, isFlowPlanReview, reviewComposerCopy } from "./display-labels.js";
|
||||
import {
|
||||
clearQuestionCardState,
|
||||
collectQuestionAnswers,
|
||||
@@ -17,9 +17,11 @@ let books = [];
|
||||
let composerForceInput = false;
|
||||
let pendingComposerDraft = "";
|
||||
let pendingComposerDraftSeq = 0;
|
||||
/** 正在提交底栏:重绘时不要把已捕获的正文再塞进 pending */
|
||||
let skipComposerStash = false;
|
||||
let sidebarNav = { level: "root" };
|
||||
let bookSelectMode = false;
|
||||
let selectedBookIds = new Set();
|
||||
const expandedBookIds = new Set();
|
||||
let activePlaySaveId = null;
|
||||
const playSavesByBook = new Map();
|
||||
const playSavesLoading = new Set();
|
||||
@@ -97,6 +99,15 @@ function resolveUserTask(view, loading) {
|
||||
};
|
||||
}
|
||||
|
||||
if (isFlowPlanReview(view) || wr?.kind === "pick_creation_step") {
|
||||
return {
|
||||
id: "speak",
|
||||
label: "选节点",
|
||||
title: "选要做的节点",
|
||||
hint: "点可进入的节点即确认并开始;要改排在底栏写意见再发。",
|
||||
};
|
||||
}
|
||||
|
||||
if (wr?.kind === "review_artifact") {
|
||||
const copy = reviewCopyFromView(view);
|
||||
return {
|
||||
@@ -388,6 +399,22 @@ function resolveComposer(view, loading) {
|
||||
const send = view.actions?.find((a) => a.type === "send_message");
|
||||
const hasQuestionsCard = Boolean(getActiveQuestions(view)?.questions?.length);
|
||||
|
||||
if (
|
||||
(view.waitingReason?.kind === "pick_creation_step" || isFlowPlanReview(view)) &&
|
||||
!composerForceInput
|
||||
) {
|
||||
return {
|
||||
mode: "pick_step",
|
||||
task,
|
||||
taskTitle: "选要做的节点",
|
||||
taskHint: "点可进入的节点即确认并开始;虚线原型点一下增殖。要改排在底栏写意见再发。",
|
||||
placeholder: send?.placeholder ?? "例如:补舞台骨架、把某步改到开场白之前…",
|
||||
hint: null,
|
||||
submitLabel: "发送",
|
||||
requiresText: true,
|
||||
};
|
||||
}
|
||||
|
||||
if (view.waitingReason?.kind === "review_artifact") {
|
||||
const parseBroken = Boolean(view.reviewArtifact?.workerSetView?.parseError);
|
||||
const copy = reviewCopyFromView(view);
|
||||
@@ -432,6 +459,7 @@ function resolveComposer(view, loading) {
|
||||
view.waitingReason?.kind === "worker_questions" ||
|
||||
view.waitingReason?.kind === "revision" ||
|
||||
view.waitingReason?.kind === "next_intent" ||
|
||||
view.waitingReason?.kind === "pick_creation_step" ||
|
||||
composerForceInput
|
||||
) {
|
||||
const wr = view.waitingReason;
|
||||
@@ -442,7 +470,7 @@ function resolveComposer(view, loading) {
|
||||
submitLabel = "继续";
|
||||
} else if (wr?.kind === "approve_step" && composerForceInput) {
|
||||
placeholder =
|
||||
"例如:改成丧尸怪物规则(后台 id 也换成 zombies)…";
|
||||
"例如:补开局 NPC、改成丧尸怪物规则(后台 id 也换成 zombies)…";
|
||||
submitLabel = "发送意见";
|
||||
} else if (wr?.kind === "revision") {
|
||||
placeholder = "说明要改哪里…";
|
||||
@@ -507,7 +535,38 @@ function composerInputShell(spec, { textareaHtml, trailing = "" } = {}) {
|
||||
</div>`;
|
||||
}
|
||||
|
||||
function leaveStepButtonHtml(spec) {
|
||||
if (!spec.leaveStep) return "";
|
||||
return `<button type="button" class="btn" data-act="leave_step" title="${esc(
|
||||
spec.leaveStep.title || "先不写这一步,回到节点选择",
|
||||
)}">${esc(spec.leaveStep.label)}</button>`;
|
||||
}
|
||||
|
||||
function stashComposerDraftFromDom() {
|
||||
if (skipComposerStash) return;
|
||||
const input = $("composer-input");
|
||||
if (!input) return;
|
||||
const v = String(input.value ?? "");
|
||||
if (v) {
|
||||
pendingComposerDraft = v;
|
||||
pendingComposerDraftSeq = 0;
|
||||
}
|
||||
}
|
||||
|
||||
function keepComposerDraft(text) {
|
||||
const v = String(text ?? "");
|
||||
if (!v) return;
|
||||
pendingComposerDraft = v;
|
||||
pendingComposerDraftSeq = 0;
|
||||
}
|
||||
|
||||
function dropComposerDraft() {
|
||||
pendingComposerDraft = "";
|
||||
pendingComposerDraftSeq = 0;
|
||||
}
|
||||
|
||||
function renderComposer(view, loading) {
|
||||
stashComposerDraftFromDom();
|
||||
if (pendingComposerDraft) composerForceInput = true;
|
||||
const host = $("composer");
|
||||
const root = $("composer-main") || host;
|
||||
@@ -517,6 +576,13 @@ function renderComposer(view, loading) {
|
||||
host._enterHandler = null;
|
||||
}
|
||||
const spec = resolveComposer(view, loading);
|
||||
const leaveAct = view.actions?.find((a) => a.type === "leave_step");
|
||||
if (leaveAct && spec.mode !== "waiting" && spec.mode !== "idle") {
|
||||
spec.leaveStep = {
|
||||
label: leaveAct.label || "返回节点",
|
||||
title: "先不写这一步,回到节点选择",
|
||||
};
|
||||
}
|
||||
|
||||
if (spec.mode === "waiting") {
|
||||
root.innerHTML = `<div class="composer-waiting">
|
||||
@@ -556,7 +622,7 @@ function renderComposer(view, loading) {
|
||||
|
||||
if (spec.mode === "action") {
|
||||
const reject = spec.showReject
|
||||
? `<button type="button" class="btn" data-act="reject">${spec.primaryType === "approve" ? "暂不" : "不接受"}</button>
|
||||
? `<button type="button" class="btn" data-act="reject">${spec.primaryType === "approve" ? "返回节点" : "不接受"}</button>
|
||||
<button type="button" class="btn" data-act="force-input">说明意见</button>`
|
||||
: "";
|
||||
const chip = composerModeChip(spec);
|
||||
@@ -611,6 +677,9 @@ function renderComposer(view, loading) {
|
||||
: "具体写什么在步骤内确定。"
|
||||
}</p>`
|
||||
: "";
|
||||
const closerHint = p.closer
|
||||
? `<p class="propose-plan-hint">这是收口步。若还没做 NPC 等前序节点,点「改意见」说明要补什么,会回到流程编排。</p>`
|
||||
: "";
|
||||
root.innerHTML = `
|
||||
<div class="propose-step" id="propose-step" data-step-id="${esc(p.stepId)}">
|
||||
<div class="propose-step-head">
|
||||
@@ -619,11 +688,12 @@ function renderComposer(view, loading) {
|
||||
</div>
|
||||
<p class="propose-output" data-propose-output>${esc(proposedOutputCopy(p))}</p>
|
||||
${planHint}
|
||||
${closerHint}
|
||||
${fields ? `<div class="propose-fields">${fields}</div>` : ""}
|
||||
${syncHint}
|
||||
<div class="composer-actions">
|
||||
<button type="button" class="btn btn-primary" data-act="approve">${esc(spec.primary.label)}</button>
|
||||
<button type="button" class="btn" data-act="reject">暂不</button>
|
||||
<button type="button" class="btn" data-act="reject" title="先不写这一步,回到节点选择">返回节点</button>
|
||||
<button type="button" class="btn" data-act="force-input">改意见</button>
|
||||
</div>
|
||||
</div>`;
|
||||
@@ -687,6 +757,17 @@ function renderComposer(view, loading) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (spec.mode === "pick_step") {
|
||||
const shell = composerInputShell(spec, {
|
||||
textareaHtml: `<textarea id="composer-input" rows="1" placeholder="${esc(spec.placeholder)}"></textarea>`,
|
||||
trailing: `<button type="submit" class="btn btn-primary composer-btn" data-act="pick-replan" disabled title="写下意见后再发;点图上节点即确认并进入">${esc(spec.submitLabel || "发送")}</button>`,
|
||||
});
|
||||
root.innerHTML = `<form class="composer-form" id="composer-form">${shell}</form>`;
|
||||
wireComposerForm({ requiresText: true });
|
||||
applyPendingComposerDraft();
|
||||
return;
|
||||
}
|
||||
|
||||
const acceptOnEmpty = Boolean(spec.acceptAction);
|
||||
const acceptTone = spec.acceptAction?.tone || "accept";
|
||||
const acceptBtn = spec.acceptAction
|
||||
@@ -705,7 +786,7 @@ function renderComposer(view, loading) {
|
||||
: spec.placeholder;
|
||||
const shell = composerInputShell(spec, {
|
||||
textareaHtml: `<textarea id="composer-input" rows="1" placeholder="${esc(placeholder)}"></textarea>`,
|
||||
trailing: `<button type="button" class="btn composer-btn${
|
||||
trailing: `${leaveStepButtonHtml(spec)}<button type="button" class="btn composer-btn${
|
||||
sendIsPrimary ? " btn-primary" : ""
|
||||
}" data-act="revise" title="${esc(
|
||||
acceptOnEmpty
|
||||
@@ -716,6 +797,7 @@ function renderComposer(view, loading) {
|
||||
root.innerHTML = `<form class="composer-form" id="composer-form">${shell}</form>`;
|
||||
wireComposerForm({ acceptOnEmpty });
|
||||
root.querySelector("[data-act=accept]")?.addEventListener("click", () => runAction("accept"));
|
||||
root.querySelector("[data-act=leave_step]")?.addEventListener("click", () => runAction("leave_step"));
|
||||
applyPendingComposerDraft();
|
||||
}
|
||||
|
||||
@@ -752,6 +834,7 @@ function applyPendingComposerDraft() {
|
||||
pendingComposerDraft = "";
|
||||
pendingComposerDraftSeq = 0;
|
||||
autosizeComposerInput(input);
|
||||
syncPickReplanButton(input);
|
||||
input.focus();
|
||||
refreshReviewComposerChrome();
|
||||
}
|
||||
@@ -804,10 +887,21 @@ function syncDualComposerPrimary(input, acceptBtn, sendBtn) {
|
||||
sendBtn.classList.toggle("btn-primary", revisePrimary);
|
||||
}
|
||||
|
||||
function syncPickReplanButton(input) {
|
||||
const btn = $("composer-form")?.querySelector("[data-act=pick-replan]");
|
||||
if (!btn) return;
|
||||
const hasText = Boolean(String(input?.value ?? "").trim());
|
||||
btn.disabled = !hasText;
|
||||
btn.title = hasText
|
||||
? "发送改编排意见"
|
||||
: "写下意见后再发;点图上节点即确认并进入";
|
||||
}
|
||||
|
||||
function wireComposerForm(opts = {}) {
|
||||
const form = $("composer-form");
|
||||
const input = $("composer-input");
|
||||
const acceptOnEmpty = opts.acceptOnEmpty === true;
|
||||
const requiresText = opts.requiresText === true;
|
||||
const sendBtn = form?.querySelector("[data-act=revise]");
|
||||
const root = $("composer");
|
||||
if (root?._enterHandler) {
|
||||
@@ -816,12 +910,12 @@ function wireComposerForm(opts = {}) {
|
||||
}
|
||||
form?.addEventListener("submit", async (e) => {
|
||||
e.preventDefault();
|
||||
await submitComposer(input?.value ?? "", { acceptOnEmpty });
|
||||
await submitComposer(input?.value ?? "", { acceptOnEmpty, requiresText });
|
||||
});
|
||||
input?.addEventListener("keydown", (e) => {
|
||||
if (e.key === "Enter" && !e.shiftKey && !e.isComposing) {
|
||||
e.preventDefault();
|
||||
void submitComposer(input?.value ?? "", { acceptOnEmpty });
|
||||
void submitComposer(input?.value ?? "", { acceptOnEmpty, requiresText });
|
||||
}
|
||||
});
|
||||
sendBtn?.addEventListener("click", () => {
|
||||
@@ -846,6 +940,7 @@ function wireComposerForm(opts = {}) {
|
||||
const grow = () => {
|
||||
autosizeComposerInput(input);
|
||||
if (acceptOnEmpty) refreshReviewComposerChrome();
|
||||
if (requiresText) syncPickReplanButton(input);
|
||||
};
|
||||
input?.addEventListener("input", grow);
|
||||
input?.addEventListener("change", grow);
|
||||
@@ -868,12 +963,6 @@ function bookPlayReady(bookId) {
|
||||
return saves.some((s) => s.kind === "instance" || s.kind === "run");
|
||||
}
|
||||
|
||||
function bookHasPlayBranch(bookId) {
|
||||
if (bookPlayReady(bookId)) return true;
|
||||
if (playSavesLoading.has(bookId) && !playSavesByBook.has(bookId)) return true;
|
||||
return playRunsForBook(bookId).length > 0;
|
||||
}
|
||||
|
||||
function formatSaveWhen(createdAt) {
|
||||
const when = new Date(createdAt);
|
||||
if (Number.isNaN(when.getTime())) return "";
|
||||
@@ -900,6 +989,7 @@ async function fetchPlaySavesForBook(bookId, force = false) {
|
||||
}
|
||||
|
||||
function setBookSelectMode(on, { keepSelection = false } = {}) {
|
||||
if (on && sidebarNav.level === "book") return;
|
||||
bookSelectMode = on;
|
||||
if (!on) selectedBookIds = new Set();
|
||||
else if (!keepSelection) selectedBookIds = new Set();
|
||||
@@ -962,8 +1052,50 @@ function showBookMenu(bookId, x, y) {
|
||||
}
|
||||
}
|
||||
|
||||
function expandBook(bookId) {
|
||||
if (bookId) expandedBookIds.add(bookId);
|
||||
function isCatalogNav() {
|
||||
return sidebarNav.level !== "book";
|
||||
}
|
||||
|
||||
function getNavBook() {
|
||||
if (sidebarNav.level !== "book") return null;
|
||||
return books.find((b) => b.id === sidebarNav.bookId) ?? null;
|
||||
}
|
||||
|
||||
function syncRailContext() {
|
||||
const el = $("rail-context");
|
||||
if (!el) return;
|
||||
const book = getNavBook();
|
||||
if (sidebarNav.level === "book" && book) {
|
||||
el.textContent = book.title;
|
||||
el.title = book.title;
|
||||
} else {
|
||||
el.textContent = "作品";
|
||||
el.removeAttribute("title");
|
||||
}
|
||||
$("rail-tabs")?.toggleAttribute("hidden", sidebarNav.level !== "book");
|
||||
}
|
||||
|
||||
function navigateToBook(bookId) {
|
||||
if (!bookId) return;
|
||||
sidebarNav = { level: "book", bookId };
|
||||
document.body.dataset.navLevel = "book";
|
||||
bookSelectMode = false;
|
||||
selectedBookIds = new Set();
|
||||
syncRailContext();
|
||||
renderBookList();
|
||||
void fetchPlaySavesForBook(bookId);
|
||||
}
|
||||
|
||||
function showCatalog() {
|
||||
beginUiRequest();
|
||||
stopLivePoll();
|
||||
sidebarNav = { level: "root" };
|
||||
document.body.dataset.navLevel = "root";
|
||||
bookSelectMode = false;
|
||||
selectedBookIds = new Set();
|
||||
closeWorkspace();
|
||||
syncRailContext();
|
||||
renderBookList();
|
||||
}
|
||||
|
||||
function renderExplorerRow({
|
||||
@@ -1025,7 +1157,7 @@ function renderExplorerRow({
|
||||
return row;
|
||||
}
|
||||
|
||||
function renderBookBranch(book, list) {
|
||||
function renderBookBranch(book, list, { nested = false } = {}) {
|
||||
const loading = playSavesLoading.has(book.id);
|
||||
const saves = playSavesByBook.get(book.id);
|
||||
const ready = bookPlayReady(book.id);
|
||||
@@ -1045,7 +1177,7 @@ function renderBookBranch(book, list) {
|
||||
name: "当前",
|
||||
meta: playHere && !activePlaySaveId ? "进行中" : "工作副本",
|
||||
active: playHere && !activePlaySaveId,
|
||||
child: true,
|
||||
child: nested,
|
||||
onClick: () => void openCurrentPlay(book.id),
|
||||
}),
|
||||
);
|
||||
@@ -1058,7 +1190,7 @@ function renderBookBranch(book, list) {
|
||||
name: s.label,
|
||||
meta: when ? `游玩 · ${when}` : "游玩进度",
|
||||
active: playHere && activePlaySaveId === s.id,
|
||||
child: true,
|
||||
child: nested,
|
||||
actionClass: "explorer-file",
|
||||
onClick: () => void loadPlaySave(book.id, s.id),
|
||||
onDelete: () => void deletePlaySave(book.id, s.id, s.label),
|
||||
@@ -1071,16 +1203,30 @@ function renderBookBranch(book, list) {
|
||||
renderExplorerRow({
|
||||
name: "+ 新开一局",
|
||||
actionClass: "explorer-action",
|
||||
child: true,
|
||||
child: nested,
|
||||
onClick: () => void startNewPlayForBook(book.id),
|
||||
}),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
function renderBookContents(book, list) {
|
||||
const skill = book.activeSkillName ?? book.activeSkillId ?? book.orchestratorName ?? "实例设计";
|
||||
list.appendChild(
|
||||
renderExplorerRow({
|
||||
name: "创作",
|
||||
meta: skill,
|
||||
active: book.id === activeBookId && !isPlayNow(),
|
||||
onClick: () => void openBookDesign(book.id),
|
||||
}),
|
||||
);
|
||||
renderBookBranch(book, list, { nested: false });
|
||||
}
|
||||
|
||||
function renderBookList() {
|
||||
const list = $("book-list");
|
||||
if (!list) return;
|
||||
syncRailContext();
|
||||
if (!books.length) {
|
||||
list.innerHTML = `<p class="sidebar-empty">暂无作品<br><button type="button" class="btn-sm" id="btn-new-inline">+ 新建</button></p>`;
|
||||
$("btn-new-inline")?.addEventListener("click", openNewBookDialog);
|
||||
@@ -1088,39 +1234,36 @@ function renderBookList() {
|
||||
}
|
||||
list.innerHTML = "";
|
||||
|
||||
if (sidebarNav.level === "book") {
|
||||
const book = getNavBook();
|
||||
if (book) {
|
||||
renderBookContents(book, list);
|
||||
return;
|
||||
}
|
||||
sidebarNav = { level: "root" };
|
||||
document.body.dataset.navLevel = "root";
|
||||
syncRailContext();
|
||||
}
|
||||
|
||||
for (const book of books) {
|
||||
const skill = book.activeSkillName ?? book.activeSkillId ?? book.orchestratorName ?? "实例设计";
|
||||
const selected = selectedBookIds.has(book.id);
|
||||
const expanded = expandedBookIds.has(book.id);
|
||||
const hasBranch = bookHasPlayBranch(book.id);
|
||||
const bookActive = book.id === activeBookId && !isPlayNow() && !selected;
|
||||
list.appendChild(
|
||||
renderExplorerRow({
|
||||
name: book.title,
|
||||
meta: skill,
|
||||
active: bookActive,
|
||||
selected,
|
||||
bookId: book.id,
|
||||
actionClass: "explorer-folder",
|
||||
twistie: hasBranch,
|
||||
expanded,
|
||||
onTwistie: () => {
|
||||
if (expandedBookIds.has(book.id)) expandedBookIds.delete(book.id);
|
||||
else expandedBookIds.add(book.id);
|
||||
renderBookList();
|
||||
if (!expandedBookIds.has(book.id)) return;
|
||||
void fetchPlaySavesForBook(book.id);
|
||||
},
|
||||
onClick: () => {
|
||||
if (bookSelectMode) {
|
||||
toggleBookSelection(book.id);
|
||||
return;
|
||||
}
|
||||
void openBookDesign(book.id);
|
||||
void openBook(book.id);
|
||||
},
|
||||
}),
|
||||
);
|
||||
if (expanded && hasBranch) renderBookBranch(book, list);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1200,7 +1343,7 @@ async function deleteSelectedBooks() {
|
||||
books = books.filter((b) => !deleted.has(b.id));
|
||||
setBookSelectMode(false);
|
||||
if (activeBookId && deleted.has(activeBookId)) {
|
||||
if (books.length) await openBook(books[0].id);
|
||||
if (books.length) showCatalog();
|
||||
else renderEmpty();
|
||||
} else {
|
||||
renderBookList();
|
||||
@@ -1229,9 +1372,9 @@ function setupBookBoxSelect() {
|
||||
};
|
||||
|
||||
list.addEventListener("mousedown", (e) => {
|
||||
if (e.button !== 0) return;
|
||||
if (sidebarNav.level !== "root" || e.button !== 0) return;
|
||||
if (e.target.closest("#book-action-menu")) return;
|
||||
if (e.target.closest(".explorer-row.child")) return;
|
||||
if (e.target.closest(".explorer-row")) return;
|
||||
dragging = true;
|
||||
start = { x: e.clientX, y: e.clientY };
|
||||
overlay.hidden = true;
|
||||
@@ -1282,8 +1425,8 @@ function setupBookBoxSelect() {
|
||||
|
||||
async function loadPlaySave(bookId, saveId) {
|
||||
try {
|
||||
expandBook(bookId);
|
||||
if (lastView) renderSession(lastView, true);
|
||||
navigateToBook(bookId);
|
||||
if (lastView?.bookId === bookId) renderSession(lastView, true);
|
||||
const data = await api(
|
||||
`/api/books/${encodeURIComponent(bookId)}/saves/${encodeURIComponent(saveId)}/load`,
|
||||
{ method: "POST" },
|
||||
@@ -1316,8 +1459,8 @@ async function startNewPlayForBook(bookId) {
|
||||
return;
|
||||
}
|
||||
try {
|
||||
expandBook(bookId);
|
||||
if (lastView) renderSession(lastView, true);
|
||||
navigateToBook(bookId);
|
||||
if (lastView?.bookId === bookId) renderSession(lastView, true);
|
||||
const data = await api(`/api/books/${encodeURIComponent(bookId)}/play/new`, { method: "POST" });
|
||||
activePlaySaveId = null;
|
||||
renderSession(data.session, false);
|
||||
@@ -1328,7 +1471,7 @@ async function startNewPlayForBook(bookId) {
|
||||
}
|
||||
|
||||
async function openBookDesign(bookId) {
|
||||
expandBook(bookId);
|
||||
navigateToBook(bookId);
|
||||
activePlaySaveId = null;
|
||||
if (activeBookId !== bookId || !sessionId) {
|
||||
await openBook(bookId);
|
||||
@@ -1341,7 +1484,7 @@ async function openBookDesign(bookId) {
|
||||
}
|
||||
|
||||
async function openCurrentPlay(bookId) {
|
||||
expandBook(bookId);
|
||||
navigateToBook(bookId);
|
||||
const alreadyHere =
|
||||
activeBookId === bookId &&
|
||||
isPlayNow() &&
|
||||
@@ -1390,12 +1533,12 @@ function renderHeader(view, loading) {
|
||||
if (btnExport) btnExport.disabled = !(view.messages?.length);
|
||||
}
|
||||
|
||||
function renderEmpty() {
|
||||
function closeWorkspace({ emptyCopy = "" } = {}) {
|
||||
stopLivePoll();
|
||||
sessionId = null;
|
||||
lastView = null;
|
||||
activeBookId = null;
|
||||
activePlaySaveId = null;
|
||||
setBookSelectMode(false);
|
||||
composerForceInput = false;
|
||||
document.title = "Writing Agent";
|
||||
$("status-dot").className = "status-dot";
|
||||
@@ -1406,7 +1549,7 @@ function renderEmpty() {
|
||||
if (btnInst) btnInst.hidden = true;
|
||||
const btnExport = $("btn-export");
|
||||
if (btnExport) btnExport.disabled = true;
|
||||
$("message-feed").innerHTML = `<p class="empty">点击左侧 + 新建作品</p>`;
|
||||
$("message-feed").innerHTML = emptyCopy ? `<p class="empty">${emptyCopy}</p>` : "";
|
||||
const stage = $("workspace-stage");
|
||||
if (stage) {
|
||||
stage.hidden = true;
|
||||
@@ -1439,6 +1582,14 @@ function renderEmpty() {
|
||||
document.body.dataset.lifecycle = "design";
|
||||
const composerMain = $("composer-main");
|
||||
if (composerMain) composerMain.innerHTML = `<div class="composer-idle">暂无打开的作品</div>`;
|
||||
}
|
||||
|
||||
function renderEmpty() {
|
||||
sidebarNav = { level: "root" };
|
||||
document.body.dataset.navLevel = "root";
|
||||
bookSelectMode = false;
|
||||
selectedBookIds = new Set();
|
||||
closeWorkspace({ emptyCopy: "点击左侧 + 新建作品" });
|
||||
renderBookList();
|
||||
}
|
||||
|
||||
@@ -1490,12 +1641,14 @@ function startLivePoll() {
|
||||
}
|
||||
|
||||
function renderSession(view, loading = false) {
|
||||
if (isCatalogNav()) return;
|
||||
lastView = view;
|
||||
sessionId = view.id;
|
||||
activeBookId = view.bookId ?? activeBookId;
|
||||
if (
|
||||
!loading &&
|
||||
view.waitingReason?.kind !== "approve_step" &&
|
||||
view.waitingReason?.kind !== "pick_creation_step" &&
|
||||
view.waitingReason?.kind !== "review_artifact" &&
|
||||
view.waitingReason?.kind !== "worker_questions" &&
|
||||
!(view.waitingReason?.kind === "input" && view.waitingReason?.questions?.length)
|
||||
@@ -1524,6 +1677,12 @@ function renderSession(view, loading = false) {
|
||||
onSwitchVariant: (messageId, direction) =>
|
||||
messageAction("variant", messageId, { direction }),
|
||||
onRetryRun: () => retryRun(),
|
||||
onPickCreationStep: (stepId) => runAction("pick_step", { stepId }),
|
||||
onReenterCreationStep: (stepId) =>
|
||||
runAction("pick_step", { stepId, reenter: true }),
|
||||
onViewStepArtifact: (stepId, name) => showStepArtifactDialog(stepId, name),
|
||||
onSpawnCreationStep: (moduleName) => runAction("spawn_step", { moduleName }),
|
||||
onLeaveCreationStep: () => runAction("leave_step"),
|
||||
});
|
||||
renderComposer(view, loading);
|
||||
if (loading) startLivePoll();
|
||||
@@ -1573,8 +1732,12 @@ function selectedQuestionAnswers(view) {
|
||||
}
|
||||
|
||||
/** 空 Enter=接受;有字或已选追问则按意见改。点「按意见修改」不走这条。 */
|
||||
async function submitComposer(text, { acceptOnEmpty } = {}) {
|
||||
async function submitComposer(text, { acceptOnEmpty, requiresText } = {}) {
|
||||
const trimmed = String(text ?? "").trim();
|
||||
if (requiresText && !trimmed) {
|
||||
alert("点图上节点即确认并进入;要改编排请先写下意见。");
|
||||
return;
|
||||
}
|
||||
if (acceptOnEmpty && !trimmed) {
|
||||
const { answered } = selectedQuestionAnswers(lastView);
|
||||
if (answered.length === 0) {
|
||||
@@ -1609,7 +1772,11 @@ async function sendText(text) {
|
||||
if (reviewing) {
|
||||
const { collected, answered } = selectedQuestionAnswers(lastView);
|
||||
if (!trimmed && answered.length === 0) {
|
||||
alert("请选择追问选项或填写修改意见;满意请点「接受」收下产物。");
|
||||
alert(
|
||||
isFlowPlanReview(lastView)
|
||||
? "点图上节点即确认并进入;要改编排请先写下意见。"
|
||||
: "请选择追问选项或填写修改意见;满意请点「接受」收下产物。",
|
||||
);
|
||||
return;
|
||||
}
|
||||
try {
|
||||
@@ -1681,6 +1848,13 @@ async function sendText(text) {
|
||||
}
|
||||
|
||||
if (!trimmed) {
|
||||
if (
|
||||
lastView?.waitingReason?.kind === "pick_creation_step" ||
|
||||
isFlowPlanReview(lastView)
|
||||
) {
|
||||
alert("点图上节点即确认并进入;要改编排请先写下意见。");
|
||||
return;
|
||||
}
|
||||
if (
|
||||
lastView?.waitingReason?.kind === "next_intent" ||
|
||||
resolveComposer(lastView, false)?.allowEmpty
|
||||
@@ -1789,7 +1963,6 @@ async function loadBooks() {
|
||||
const data = await api("/api/books");
|
||||
books = data.books ?? [];
|
||||
renderBookList();
|
||||
for (const book of books) void fetchPlaySavesForBook(book.id);
|
||||
}
|
||||
|
||||
function openNewBookDialog() {
|
||||
@@ -1865,7 +2038,7 @@ async function createBook() {
|
||||
$("dialog-new-book").close();
|
||||
if (data.book) books.unshift(data.book);
|
||||
activeBookId = data.book?.id;
|
||||
expandBook(data.book.id);
|
||||
navigateToBook(data.book.id);
|
||||
renderSession(data.session, false);
|
||||
} catch (err) {
|
||||
alert(err.message);
|
||||
@@ -1875,19 +2048,22 @@ async function createBook() {
|
||||
}
|
||||
|
||||
async function openBook(bookId) {
|
||||
const seq = beginUiRequest();
|
||||
activeBookId = bookId;
|
||||
expandBook(bookId);
|
||||
renderBookList();
|
||||
if (lastView) renderSession(lastView, true);
|
||||
navigateToBook(bookId);
|
||||
if (lastView?.bookId === bookId) renderSession(lastView, true);
|
||||
try {
|
||||
const data = await api(`/api/books/${encodeURIComponent(bookId)}/open`, { method: "POST" });
|
||||
if (isStaleUiRequest(seq)) return;
|
||||
if (data.book) {
|
||||
const i = books.findIndex((b) => b.id === bookId);
|
||||
if (i >= 0) books[i] = { ...books[i], ...data.book };
|
||||
}
|
||||
renderSession(data.session, false);
|
||||
} catch (err) {
|
||||
if (lastView) renderSession({ ...lastView, hints: [err.message] }, false);
|
||||
if (isStaleUiRequest(seq)) return;
|
||||
if (lastView?.bookId === bookId) renderSession({ ...lastView, hints: [err.message] }, false);
|
||||
else alert(err.message);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1899,16 +2075,13 @@ async function deleteBookById(bookId) {
|
||||
await api(`/api/books/${encodeURIComponent(bookId)}`, { method: "DELETE" });
|
||||
books = books.filter((b) => b.id !== bookId);
|
||||
playSavesByBook.delete(bookId);
|
||||
expandedBookIds.delete(bookId);
|
||||
selectedBookIds.delete(bookId);
|
||||
if (activeBookId === bookId) activePlaySaveId = null;
|
||||
hideBookMenu();
|
||||
if (activeBookId === bookId) {
|
||||
if (books.length) {
|
||||
await openBook(books[0].id);
|
||||
} else {
|
||||
renderEmpty();
|
||||
}
|
||||
const wasHere = activeBookId === bookId || sidebarNav.bookId === bookId;
|
||||
if (wasHere) {
|
||||
if (books.length) showCatalog();
|
||||
else renderEmpty();
|
||||
} else {
|
||||
renderBookList();
|
||||
}
|
||||
@@ -1952,6 +2125,21 @@ async function saveCurrentInstance() {
|
||||
}
|
||||
}
|
||||
|
||||
async function showStepArtifactDialog(stepId, name) {
|
||||
if (!sessionId || !stepId) return;
|
||||
try {
|
||||
const data = await api(
|
||||
`/api/sessions/${encodeURIComponent(sessionId)}/step-artifact?stepId=${encodeURIComponent(stepId)}`,
|
||||
);
|
||||
fillStepArtifactDialog({
|
||||
name: data.name || name,
|
||||
content: data.content,
|
||||
});
|
||||
} catch (err) {
|
||||
alert(err.message || "无法读取产物");
|
||||
}
|
||||
}
|
||||
|
||||
function showContextTraceDialog(messageId) {
|
||||
const msg = (lastView?.messages ?? []).find((m) => m.id === messageId);
|
||||
const review = lastView?.reviewArtifact;
|
||||
@@ -2102,7 +2290,13 @@ $("btn-save-instance")?.addEventListener("click", () => {
|
||||
|
||||
window.addEventListener("wa:session-updated", (e) => {
|
||||
const view = e.detail;
|
||||
if (view?.id) renderSession(view, false);
|
||||
if (!view?.id || isCatalogNav() || !sessionId) return;
|
||||
if (view.id !== sessionId) return;
|
||||
renderSession(view, false);
|
||||
});
|
||||
|
||||
window.addEventListener("wa:nav-root", () => {
|
||||
showCatalog();
|
||||
});
|
||||
|
||||
document.addEventListener("click", (e) => {
|
||||
@@ -2116,7 +2310,7 @@ async function init() {
|
||||
void populateDirectorSelect();
|
||||
await loadBooks();
|
||||
if (books.length) {
|
||||
await openBook(books[0].id);
|
||||
showCatalog();
|
||||
} else {
|
||||
renderEmpty();
|
||||
openNewBookDialog();
|
||||
|
||||
+10
-2
@@ -94,6 +94,14 @@ export function formatWorkerDisplayTitle(workerId, action = null) {
|
||||
return base;
|
||||
}
|
||||
|
||||
/** 流程编排产物待确认:图上点节点即确认,不走验收双按钮 */
|
||||
export function isFlowPlanReview(view) {
|
||||
return (
|
||||
view?.waitingReason?.kind === "review_artifact" &&
|
||||
view?.reviewArtifact?.workerId === "design-flow"
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* `review_artifact` 底栏 / 工作面文案。流程编排核对工作流计划,不是「验收通过」。
|
||||
* 须与 src/server/display-labels.ts `reviewComposerCopy` 保持一致。
|
||||
@@ -131,8 +139,8 @@ export function reviewComposerCopy(workerId, opts = {}) {
|
||||
taskLabel: "开场",
|
||||
taskTitle: "选定开场白",
|
||||
hint: hasQuestions
|
||||
? "同意就选定此开场;要改就写意见。下方追问可选答。"
|
||||
: "同意就选定此开场;要改就写意见。",
|
||||
? "同意就选定此开场;要改开场白就写意见。下方追问可选答。"
|
||||
: "同意就选定此开场;要改开场白就写意见。",
|
||||
submitLabel: "按意见修改",
|
||||
acceptLabel: "选定此开场",
|
||||
placeholder: "修改意见…",
|
||||
|
||||
+28
-12
@@ -12,25 +12,28 @@
|
||||
/>
|
||||
<link rel="stylesheet" href="/styles.css" />
|
||||
</head>
|
||||
<body data-lifecycle="design">
|
||||
<body data-lifecycle="design" data-nav-level="root">
|
||||
<div class="layout">
|
||||
<aside class="panel panel-rail" id="panel-books">
|
||||
<header class="panel-head rail-head">
|
||||
<button type="button" class="rail-toggle btn-sm" id="btn-rail-toggle" title="展开 / 收起侧栏" aria-label="展开或收起侧栏">‹</button>
|
||||
<nav class="rail-tabs" id="rail-tabs" role="tablist" aria-label="侧栏">
|
||||
<button type="button" class="rail-tab active" data-rail-tab="books" role="tab" aria-selected="true" title="作品">
|
||||
<div class="rail-head-row">
|
||||
<button type="button" class="rail-toggle btn-sm" id="btn-rail-toggle" title="返回作品目录" aria-label="返回作品目录">‹</button>
|
||||
<h1 class="rail-context" id="rail-context">作品</h1>
|
||||
<div class="panel-head-actions rail-head-actions">
|
||||
<button type="button" class="btn-sm" id="btn-new-book" title="新建">+</button>
|
||||
<span class="burst-badge" id="burst-badge" hidden></span>
|
||||
</div>
|
||||
</div>
|
||||
<nav class="rail-tabs" id="rail-tabs" role="tablist" aria-label="本书侧栏" hidden>
|
||||
<button type="button" class="rail-tab active" data-rail-tab="books" role="tab" aria-selected="true" title="本书">
|
||||
<span class="rail-tab-icon" aria-hidden="true">书</span>
|
||||
<span class="rail-tab-label">作品</span>
|
||||
<span class="rail-tab-label">本书</span>
|
||||
</button>
|
||||
<button type="button" class="rail-tab" data-rail-tab="log" role="tab" aria-selected="false" title="调度">
|
||||
<span class="rail-tab-icon" aria-hidden="true">志</span>
|
||||
<span class="rail-tab-label">调度</span>
|
||||
</button>
|
||||
</nav>
|
||||
<div class="panel-head-actions rail-head-actions">
|
||||
<button type="button" class="btn-sm" id="btn-new-book" title="新建">+</button>
|
||||
<span class="burst-badge" id="burst-badge" hidden></span>
|
||||
</div>
|
||||
</header>
|
||||
|
||||
<div class="rail-panels">
|
||||
@@ -50,9 +53,7 @@
|
||||
<div class="main-body">
|
||||
<section class="panel-feed" id="panel-feed">
|
||||
<div id="skill-picker" class="skill-picker" hidden></div>
|
||||
<div id="message-feed" class="message-feed">
|
||||
<p class="empty">正在打开作品…</p>
|
||||
</div>
|
||||
<div id="message-feed" class="message-feed"></div>
|
||||
<div id="workspace-stage" class="workspace-stage" hidden aria-label="验收工作面"></div>
|
||||
<div id="questions-card-host" class="questions-card-host" hidden></div>
|
||||
</section>
|
||||
@@ -138,6 +139,21 @@
|
||||
<button type="button" class="context-menu-item context-menu-danger" id="msg-menu-delete" data-msg-menu-action="delete">从这里重开</button>
|
||||
</menu>
|
||||
|
||||
<menu id="flow-node-menu" class="context-menu" hidden>
|
||||
<button type="button" class="context-menu-item" id="flow-menu-view" data-flow-menu-action="view">查看产物</button>
|
||||
<button type="button" class="context-menu-item" id="flow-menu-reenter" data-flow-menu-action="reenter">重新进入修改</button>
|
||||
</menu>
|
||||
|
||||
<dialog id="dialog-step-artifact" class="dialog dialog-wide" aria-labelledby="step-artifact-title">
|
||||
<form method="dialog" class="context-trace-form">
|
||||
<h2 id="step-artifact-title">产物</h2>
|
||||
<div id="step-artifact-body" class="step-artifact-body"></div>
|
||||
<div class="dialog-actions">
|
||||
<button type="submit" class="btn btn-primary" value="close">关闭</button>
|
||||
</div>
|
||||
</form>
|
||||
</dialog>
|
||||
|
||||
<dialog id="dialog-context-trace" class="dialog dialog-wide" aria-labelledby="context-trace-title">
|
||||
<form method="dialog" class="context-trace-form">
|
||||
<h2 id="context-trace-title">上下文调用日志</h2>
|
||||
|
||||
+178
@@ -0,0 +1,178 @@
|
||||
/** 剥 markdown 代码围栏,便于从验收正文里取出 JSON */
|
||||
export function stripCodeFences(text) {
|
||||
let t = String(text || "").trim();
|
||||
t = t.replace(/^```(?:json|yaml|yml)?\s*\r?\n?/i, "");
|
||||
t = t.replace(/\r?\n?```\s*$/i, "");
|
||||
const fenced = t.match(/```(?:json|yaml|yml)?\s*\r?\n([\s\S]*?)\r?\n```/i);
|
||||
if (fenced) t = fenced[1].trim();
|
||||
return t.trim();
|
||||
}
|
||||
|
||||
/** 字符串字面量里的裸换行/制表 → 转义(模型常犯) */
|
||||
export function escapeRawControlsInJsonStrings(s) {
|
||||
let out = "";
|
||||
let inString = false;
|
||||
let escaped = false;
|
||||
for (let i = 0; i < s.length; i++) {
|
||||
const c = s[i];
|
||||
if (inString) {
|
||||
if (escaped) {
|
||||
out += c;
|
||||
escaped = false;
|
||||
continue;
|
||||
}
|
||||
if (c === "\\") {
|
||||
out += c;
|
||||
escaped = true;
|
||||
continue;
|
||||
}
|
||||
if (c === '"') {
|
||||
out += c;
|
||||
inString = false;
|
||||
continue;
|
||||
}
|
||||
if (c === "\n") {
|
||||
out += "\\n";
|
||||
continue;
|
||||
}
|
||||
if (c === "\r") {
|
||||
out += "\\r";
|
||||
continue;
|
||||
}
|
||||
if (c === "\t") {
|
||||
out += "\\t";
|
||||
continue;
|
||||
}
|
||||
out += c;
|
||||
continue;
|
||||
}
|
||||
if (c === '"') {
|
||||
inString = true;
|
||||
out += c;
|
||||
continue;
|
||||
}
|
||||
out += c;
|
||||
}
|
||||
return out;
|
||||
}
|
||||
|
||||
/**
|
||||
* 只把「像 JSON 定界符」的弯引号换成 ASCII。
|
||||
* 字符串内部的 “对话/强调” 必须保留,否则会把合法 JSON 撕开。
|
||||
*/
|
||||
export function convertStructuralSmartQuotes(s) {
|
||||
const text = String(s || "");
|
||||
let out = "";
|
||||
for (let i = 0; i < text.length; i++) {
|
||||
const c = text[i];
|
||||
const isOpen = c === "\u201C" || c === "\u201E" || c === "\u201F";
|
||||
const isClose = c === "\u201D" || c === "\u2033" || c === "\u2036";
|
||||
if (!isOpen && !isClose) {
|
||||
out += c;
|
||||
continue;
|
||||
}
|
||||
let prev = i - 1;
|
||||
while (prev >= 0 && /\s/.test(text[prev])) prev -= 1;
|
||||
let next = i + 1;
|
||||
while (next < text.length && /\s/.test(text[next])) next += 1;
|
||||
const prevCh = prev >= 0 ? text[prev] : "";
|
||||
const nextCh = next < text.length ? text[next] : "";
|
||||
const afterOpen = !prevCh || "{[:,[".includes(prevCh);
|
||||
const beforeClose = !nextCh || ":,}]".includes(nextCh);
|
||||
if (isOpen && afterOpen) out += '"';
|
||||
else if (isClose && beforeClose) out += '"';
|
||||
else out += c;
|
||||
}
|
||||
return out;
|
||||
}
|
||||
|
||||
/** 轻度修复模型常出的尾逗号 / 裸换行;不要全局替换弯引号 */
|
||||
export function softenJsonText(s) {
|
||||
let t = String(s || "")
|
||||
.replace(/^\uFEFF/, "")
|
||||
.replace(/\u2026/g, "")
|
||||
.replace(/[\u0000-\u0008\u000B\u000C\u000E-\u001F]/g, "");
|
||||
t = t.replace(/^\s*\/\/.*$/gm, "");
|
||||
t = t.replace(/\/\*[\s\S]*?\*\//g, "");
|
||||
t = escapeRawControlsInJsonStrings(t);
|
||||
t = t.replace(/,\s*([\]}])/g, "$1");
|
||||
return t;
|
||||
}
|
||||
|
||||
/** 截断的 {… 补齐引号/括号,便于验收卡仍能出 mosaic */
|
||||
export function repairTruncatedJsonObject(slice) {
|
||||
let s = String(slice || "").trim();
|
||||
if (!s.startsWith("{")) return s;
|
||||
s = s.replace(/,\s*"[^"]*$/u, "");
|
||||
s = s.replace(/,\s*$/u, "");
|
||||
const opens = (s.match(/\{/g) || []).length;
|
||||
const closes = (s.match(/\}/g) || []).length;
|
||||
const openBrackets = (s.match(/\[/g) || []).length;
|
||||
const closeBrackets = (s.match(/\]/g) || []).length;
|
||||
const quoteCount = (s.match(/(?<!\\)"/g) || []).length;
|
||||
if (quoteCount % 2 === 1) s += '"';
|
||||
if (openBrackets > closeBrackets) s += "]".repeat(openBrackets - closeBrackets);
|
||||
if (opens > closes) s += "}".repeat(opens - closes);
|
||||
return s;
|
||||
}
|
||||
|
||||
function tryParse(s) {
|
||||
try {
|
||||
return JSON.parse(s);
|
||||
} catch {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/** 模型常把弯引号写进字符串;必须先按原文 parse,再做宽松修复 */
|
||||
export function tryParseJsonDoc(text) {
|
||||
const stripped = stripCodeFences(text);
|
||||
const attempts = [
|
||||
stripped,
|
||||
softenJsonText(stripped),
|
||||
softenJsonText(convertStructuralSmartQuotes(stripped)),
|
||||
];
|
||||
for (const candidate of attempts) {
|
||||
const parsed = tryParse(candidate);
|
||||
if (parsed != null) return parsed;
|
||||
}
|
||||
|
||||
const cleaned = softenJsonText(convertStructuralSmartQuotes(stripped));
|
||||
if (
|
||||
(cleaned.startsWith('"') && cleaned.endsWith('"')) ||
|
||||
(cleaned.startsWith("'") && cleaned.endsWith("'"))
|
||||
) {
|
||||
const inner = tryParse(cleaned);
|
||||
if (typeof inner === "string") {
|
||||
const parsed = tryParse(softenJsonText(inner)) ?? tryParse(inner);
|
||||
if (parsed != null) return parsed;
|
||||
}
|
||||
}
|
||||
|
||||
const objStart = cleaned.indexOf("{");
|
||||
const objEnd = cleaned.lastIndexOf("}");
|
||||
if (objStart >= 0 && objEnd > objStart) {
|
||||
const slice = cleaned.slice(objStart, objEnd + 1);
|
||||
const parsed =
|
||||
tryParse(slice) ??
|
||||
tryParse(softenJsonText(slice)) ??
|
||||
tryParse(repairTruncatedJsonObject(slice)) ??
|
||||
tryParse(softenJsonText(repairTruncatedJsonObject(cleaned.slice(objStart))));
|
||||
if (parsed != null) return parsed;
|
||||
|
||||
const rawSlice = stripped.slice(
|
||||
stripped.indexOf("{"),
|
||||
stripped.lastIndexOf("}") + 1,
|
||||
);
|
||||
const fromRaw = tryParse(rawSlice) ?? tryParse(repairTruncatedJsonObject(rawSlice));
|
||||
if (fromRaw != null) return fromRaw;
|
||||
}
|
||||
|
||||
const arrStart = cleaned.indexOf("[");
|
||||
const arrEnd = cleaned.lastIndexOf("]");
|
||||
if (arrStart >= 0 && arrEnd > arrStart) {
|
||||
const parsed = tryParse(cleaned.slice(arrStart, arrEnd + 1));
|
||||
if (parsed != null) return parsed;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
+47
-2
@@ -432,6 +432,37 @@ code {
|
||||
color: var(--st-danger);
|
||||
}
|
||||
|
||||
.cap-row {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 6px;
|
||||
align-items: center;
|
||||
margin-top: 4px;
|
||||
}
|
||||
.cap-unknown {
|
||||
color: var(--muted, #888);
|
||||
}
|
||||
.cap-chip {
|
||||
font-size: 11px;
|
||||
padding: 1px 6px;
|
||||
border-radius: 4px;
|
||||
border: 1px solid var(--border, #ddd);
|
||||
}
|
||||
.cap-chip.cap-ok {
|
||||
color: #067647;
|
||||
background: #ecfdf3;
|
||||
border-color: #abefc6;
|
||||
}
|
||||
.cap-chip.cap-fail {
|
||||
color: #b42318;
|
||||
background: #fef3f2;
|
||||
border-color: #fecdca;
|
||||
}
|
||||
.cap-chip.cap-unk {
|
||||
color: #667085;
|
||||
background: #f9fafb;
|
||||
}
|
||||
|
||||
/* —— Toast —— */
|
||||
.settings-toast {
|
||||
margin: 10px 28px 0;
|
||||
@@ -1042,7 +1073,8 @@ code {
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
.profile-dialog input {
|
||||
.profile-dialog input,
|
||||
.profile-dialog select {
|
||||
padding: 9px 12px;
|
||||
border-radius: 6px;
|
||||
border: 1px solid var(--st-border-strong);
|
||||
@@ -1051,12 +1083,25 @@ code {
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
.profile-dialog input:focus {
|
||||
.profile-dialog select {
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.profile-dialog input:focus,
|
||||
.profile-dialog select:focus {
|
||||
outline: none;
|
||||
border-color: #93c5fd;
|
||||
box-shadow: 0 0 0 3px var(--st-accent-soft);
|
||||
}
|
||||
|
||||
.profile-dialog .field-hint {
|
||||
margin-top: 2px;
|
||||
font-size: 11px;
|
||||
font-weight: 400;
|
||||
color: var(--st-muted);
|
||||
line-height: 1.35;
|
||||
}
|
||||
|
||||
.dialog-actions {
|
||||
display: flex;
|
||||
justify-content: flex-end;
|
||||
|
||||
@@ -148,6 +148,17 @@
|
||||
Model
|
||||
<input name="model" required placeholder="deepseek-chat" />
|
||||
</label>
|
||||
<label>
|
||||
思考强度
|
||||
<select name="reasoningEffort">
|
||||
<option value="">默认(不发送)</option>
|
||||
<option value="low">low · 轻量</option>
|
||||
<option value="medium">medium</option>
|
||||
<option value="high">high · 增强</option>
|
||||
<option value="max">max · 深度</option>
|
||||
</select>
|
||||
<span class="field-hint">写入 reasoning_effort;「探测」始终用 low,与此项无关。GLM 建议 low / high / max。</span>
|
||||
</label>
|
||||
<div class="dialog-actions">
|
||||
<button type="button" id="profile-cancel" class="btn-secondary">取消</button>
|
||||
<button type="button" id="profile-save" class="btn-secondary">仅保存</button>
|
||||
|
||||
+53
-7
@@ -150,6 +150,31 @@ function activateButtonHtml(active, id, action) {
|
||||
return `<button type="button" class="btn-activate" data-action="${action}" data-id="${id}">选用并生效</button>`;
|
||||
}
|
||||
|
||||
function capabilityBadge(caps) {
|
||||
if (!caps || !caps.testedAt) {
|
||||
return `<div class="config-card-meta cap-unknown">能力:未探测(选用前建议点「探测」)</div>`;
|
||||
}
|
||||
const bit = (label, status) => {
|
||||
const cls =
|
||||
status === "ok" ? "cap-ok" : status === "fail" ? "cap-fail" : "cap-unk";
|
||||
return `<span class="cap-chip ${cls}">${escapeHtml(label)}:${escapeHtml(status)}</span>`;
|
||||
};
|
||||
const mode =
|
||||
caps.jsonSchema === "ok"
|
||||
? "JSON Schema"
|
||||
: caps.forcedTool === "ok"
|
||||
? "强制 Tool"
|
||||
: caps.jsonObject === "ok"
|
||||
? "JSON Object"
|
||||
: "纯文本";
|
||||
return `<div class="config-card-meta cap-row">
|
||||
投递:<strong>${escapeHtml(mode)}</strong>
|
||||
${bit("schema", caps.jsonSchema)}
|
||||
${bit("tool", caps.forcedTool)}
|
||||
${bit("json", caps.jsonObject)}
|
||||
</div>`;
|
||||
}
|
||||
|
||||
function renderProfiles() {
|
||||
profilesListEl.innerHTML = "";
|
||||
if (!state.profiles.length) {
|
||||
@@ -171,13 +196,18 @@ function renderProfiles() {
|
||||
${active ? '<span class="badge">当前</span>' : ""}
|
||||
</div>
|
||||
<div class="config-card-meta">${escapeHtml(p.model)} · ${escapeHtml(p.baseUrl)}</div>
|
||||
<div class="config-card-meta">Key: ${escapeHtml(maskKey(p.apiKey))}</div>
|
||||
<div class="config-card-meta">Key: ${escapeHtml(maskKey(p.apiKey))}${
|
||||
p.reasoningEffort
|
||||
? ` · 思考: ${escapeHtml(p.reasoningEffort)}`
|
||||
: ""
|
||||
}</div>
|
||||
${capabilityBadge(p.capabilities)}
|
||||
</div>
|
||||
</div>
|
||||
<div class="config-card-actions">
|
||||
${activateButtonHtml(active, p.id, "activate-profile")}
|
||||
<button type="button" data-action="edit-profile" data-id="${p.id}">编辑</button>
|
||||
<button type="button" data-action="test-profile" data-id="${p.id}">测试连接</button>
|
||||
<button type="button" data-action="probe-capabilities" data-id="${p.id}">探测</button>
|
||||
<button type="button" class="btn-danger" data-action="delete-profile" data-id="${p.id}">删除</button>
|
||||
</div>
|
||||
<div class="test-result" id="test-${p.id}"></div>`;
|
||||
@@ -367,6 +397,7 @@ function openProfileDialog(profile = null) {
|
||||
profileForm.baseUrl.value = profile?.baseUrl ?? "https://api.deepseek.com";
|
||||
profileForm.apiKey.value = profile?.apiKey ?? "";
|
||||
profileForm.model.value = profile?.model ?? "deepseek-v4-pro";
|
||||
profileForm.reasoningEffort.value = profile?.reasoningEffort ?? "";
|
||||
profileDialog.showModal();
|
||||
}
|
||||
|
||||
@@ -375,6 +406,7 @@ async function saveProfile(activate) {
|
||||
name: profileForm.name.value,
|
||||
baseUrl: profileForm.baseUrl.value,
|
||||
model: profileForm.model.value,
|
||||
reasoningEffort: profileForm.reasoningEffort.value,
|
||||
activate,
|
||||
};
|
||||
const apiKey = profileForm.apiKey.value.trim();
|
||||
@@ -457,13 +489,27 @@ profilesListEl.addEventListener("click", async (e) => {
|
||||
await activateProfile(id);
|
||||
} else if (action === "edit-profile") {
|
||||
openProfileDialog(state.profiles.find((p) => p.id === id));
|
||||
} else if (action === "test-profile") {
|
||||
} else if (action === "probe-capabilities") {
|
||||
const el = document.getElementById(`test-${id}`);
|
||||
el.textContent = "测试中…";
|
||||
el.textContent = "探测中(含连通性,会打几次短请求)…";
|
||||
el.className = "test-result";
|
||||
const result = await api(`/api/profiles/${id}/test`, { method: "POST" });
|
||||
el.textContent = result.message;
|
||||
el.className = `test-result ${result.ok ? "ok" : "fail"}`;
|
||||
const result = await api(`/api/profiles/${id}/probe-capabilities`, {
|
||||
method: "POST",
|
||||
});
|
||||
await loadAll();
|
||||
const caps = result.profile?.capabilities;
|
||||
const chatOk = caps?.chat === "ok";
|
||||
const note = !chatOk
|
||||
? `连接失败${caps?.notes?.[0] ? `:${caps.notes[0]}` : ""}`
|
||||
: result.deliveryModeLabel
|
||||
? `连接正常 · 投递将用:${result.deliveryModeLabel}`
|
||||
: "探测完成";
|
||||
const refreshed = document.getElementById(`test-${id}`);
|
||||
if (refreshed) {
|
||||
refreshed.textContent = note;
|
||||
refreshed.className = `test-result ${chatOk ? "ok" : "fail"}`;
|
||||
}
|
||||
showToast(note, !chatOk);
|
||||
} else if (action === "delete-profile") {
|
||||
if (!confirm("确定删除此 API 配置?")) return;
|
||||
await api(`/api/profiles/${id}`, { method: "DELETE" });
|
||||
|
||||
+736
-29
@@ -69,12 +69,35 @@ a.link:hover { text-decoration: underline; }
|
||||
flex-shrink: 0;
|
||||
}
|
||||
.rail-head {
|
||||
gap: 4px;
|
||||
padding: 6px;
|
||||
flex-wrap: nowrap;
|
||||
align-items: center;
|
||||
flex-direction: column;
|
||||
align-items: stretch;
|
||||
justify-content: flex-start;
|
||||
gap: 0;
|
||||
padding: 0;
|
||||
min-width: 0;
|
||||
}
|
||||
.rail-head-row {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 2px;
|
||||
min-width: 0;
|
||||
min-height: 40px;
|
||||
padding: 6px 8px 6px 6px;
|
||||
}
|
||||
body[data-nav-level="root"] .rail-head-row {
|
||||
padding-left: 10px;
|
||||
}
|
||||
.rail-context {
|
||||
flex: 1 1 auto;
|
||||
min-width: 0;
|
||||
margin: 0;
|
||||
font-size: 13px;
|
||||
font-weight: 600;
|
||||
line-height: 1.3;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
.rail-toggle {
|
||||
flex-shrink: 0;
|
||||
width: 28px;
|
||||
@@ -87,12 +110,19 @@ a.link:hover { text-decoration: underline; }
|
||||
line-height: 1;
|
||||
}
|
||||
body.rail-collapsed .rail-toggle { transform: rotate(180deg); }
|
||||
body[data-nav-level="root"] .rail-toggle { display: none; }
|
||||
body[data-nav-level="book"] .rail-head-actions #btn-new-book,
|
||||
body[data-nav-level="root"] .burst-badge { display: none; }
|
||||
.rail-tabs {
|
||||
display: flex;
|
||||
flex: 1 1 auto;
|
||||
gap: 2px;
|
||||
display: none;
|
||||
gap: 0;
|
||||
min-width: 0;
|
||||
padding: 0 8px;
|
||||
}
|
||||
body[data-nav-level="book"] .rail-tabs {
|
||||
display: flex;
|
||||
}
|
||||
.rail-tabs[hidden] { display: none !important; }
|
||||
.rail-tab {
|
||||
flex: 1 1 0;
|
||||
display: inline-flex;
|
||||
@@ -102,21 +132,28 @@ body.rail-collapsed .rail-toggle { transform: rotate(180deg); }
|
||||
min-width: 0;
|
||||
height: 28px;
|
||||
border: none;
|
||||
border-bottom: 2px solid transparent;
|
||||
background: transparent;
|
||||
border-radius: 6px;
|
||||
border-radius: 0;
|
||||
padding: 0 6px;
|
||||
cursor: pointer;
|
||||
color: var(--muted);
|
||||
font-size: 12px;
|
||||
font-weight: 600;
|
||||
font-weight: 500;
|
||||
line-height: 1.2;
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
}
|
||||
.rail-tab:hover { background: var(--bg); color: var(--text); }
|
||||
.rail-tab:hover { color: var(--text); }
|
||||
.rail-tab.active {
|
||||
background: var(--accent-soft);
|
||||
color: var(--accent);
|
||||
background: transparent;
|
||||
color: var(--text);
|
||||
font-weight: 600;
|
||||
border-bottom-color: var(--text);
|
||||
}
|
||||
.rail-tab:focus-visible {
|
||||
outline: 2px solid color-mix(in srgb, var(--accent) 55%, transparent);
|
||||
outline-offset: -2px;
|
||||
}
|
||||
.rail-tab-icon {
|
||||
display: none;
|
||||
@@ -177,8 +214,8 @@ body.rail-collapsed .rail-toggle { transform: rotate(180deg); }
|
||||
.rail-tab-panel[hidden] { display: none !important; }
|
||||
|
||||
body.rail-collapsed .rail-tab-label,
|
||||
body.rail-collapsed .path-bar,
|
||||
body.rail-collapsed .rail-head-actions #btn-new-book,
|
||||
body.rail-collapsed .rail-context,
|
||||
body.rail-collapsed .rail-head-actions,
|
||||
body.rail-collapsed .burst-badge { display: none !important; }
|
||||
body.rail-collapsed .rail-tab-icon { display: block; }
|
||||
body.rail-collapsed .rail-head {
|
||||
@@ -187,14 +224,27 @@ body.rail-collapsed .rail-head {
|
||||
padding: 6px 4px;
|
||||
gap: 4px;
|
||||
}
|
||||
body.rail-collapsed .rail-tabs {
|
||||
body.rail-collapsed .rail-head-row {
|
||||
justify-content: center;
|
||||
padding: 0;
|
||||
min-height: 0;
|
||||
}
|
||||
body.rail-collapsed[data-nav-level="book"] .rail-tabs:not([hidden]) {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
padding: 0;
|
||||
}
|
||||
body.rail-collapsed .rail-tab {
|
||||
flex: 0 0 auto;
|
||||
width: 100%;
|
||||
height: 32px;
|
||||
padding: 0;
|
||||
border-bottom: none;
|
||||
border-radius: 6px;
|
||||
}
|
||||
body.rail-collapsed .rail-tab.active {
|
||||
background: var(--accent-soft);
|
||||
color: var(--accent);
|
||||
}
|
||||
body.rail-collapsed .rail-panels { display: none; }
|
||||
body.rail-collapsed .panel-rail { align-items: stretch; }
|
||||
@@ -734,6 +784,39 @@ body.design-workspace .review-worker-set {
|
||||
color: var(--accent);
|
||||
margin-bottom: 8px;
|
||||
}
|
||||
.workspace-intent-head {
|
||||
display: flex;
|
||||
align-items: baseline;
|
||||
justify-content: space-between;
|
||||
gap: 12px;
|
||||
margin-bottom: 8px;
|
||||
max-width: 46rem;
|
||||
}
|
||||
.workspace-intent-head .workspace-surface-kicker {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
.workspace-leave-step {
|
||||
appearance: none;
|
||||
border: none;
|
||||
background: transparent;
|
||||
padding: 0;
|
||||
font-size: 13px;
|
||||
font-weight: 500;
|
||||
color: var(--muted);
|
||||
cursor: pointer;
|
||||
font-family: var(--font-ui);
|
||||
flex-shrink: 0;
|
||||
}
|
||||
.workspace-leave-step:hover {
|
||||
color: var(--text);
|
||||
}
|
||||
.workspace-leave-step:focus-visible {
|
||||
outline: 2px solid var(--accent);
|
||||
outline-offset: 2px;
|
||||
}
|
||||
.workspace-answer-head--slim .workspace-leave-step {
|
||||
margin-left: auto;
|
||||
}
|
||||
.workspace-intent,
|
||||
.workspace-answer {
|
||||
flex: 1 1 auto;
|
||||
@@ -884,6 +967,406 @@ body.design-workspace .flow-status {
|
||||
font-size: 12px;
|
||||
color: var(--muted);
|
||||
}
|
||||
body.design-workspace .flow-dag {
|
||||
position: relative;
|
||||
overflow: auto;
|
||||
padding: 4px 2px 8px;
|
||||
}
|
||||
body.design-workspace .flow-dag-edges {
|
||||
position: absolute;
|
||||
inset: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
pointer-events: none;
|
||||
z-index: 0;
|
||||
overflow: visible;
|
||||
}
|
||||
body.design-workspace .flow-dag-edge {
|
||||
stroke: color-mix(in srgb, var(--border) 80%, var(--muted));
|
||||
stroke-width: 1.5;
|
||||
opacity: 0.85;
|
||||
}
|
||||
body.design-workspace .flow-dag-edge.is-lit {
|
||||
stroke: color-mix(in srgb, var(--accent) 55%, var(--border));
|
||||
opacity: 1;
|
||||
}
|
||||
body.design-workspace .flow-dag-arrowhead {
|
||||
fill: color-mix(in srgb, var(--accent) 50%, var(--border));
|
||||
}
|
||||
body.design-workspace .flow-dag-rows {
|
||||
position: relative;
|
||||
z-index: 1;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 28px;
|
||||
min-width: 0;
|
||||
}
|
||||
body.design-workspace .flow-dag-row {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 8px;
|
||||
align-items: stretch;
|
||||
}
|
||||
body.design-workspace .flow-dag-row-label {
|
||||
font-size: 11px;
|
||||
font-weight: 650;
|
||||
letter-spacing: 0.04em;
|
||||
color: var(--muted);
|
||||
text-align: center;
|
||||
}
|
||||
body.design-workspace .flow-dag-row-nodes {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
justify-content: center;
|
||||
align-items: flex-start;
|
||||
gap: 12px;
|
||||
min-width: 0;
|
||||
}
|
||||
body.design-workspace .flow-node {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
gap: 10px;
|
||||
width: min(100%, 280px);
|
||||
margin: 0;
|
||||
padding: 12px 14px;
|
||||
border: 1px solid var(--border);
|
||||
border-radius: 10px;
|
||||
background: var(--bg);
|
||||
color: inherit;
|
||||
text-align: left;
|
||||
font: inherit;
|
||||
min-width: 0;
|
||||
box-shadow: 0 1px 0 color-mix(in srgb, var(--border) 70%, transparent);
|
||||
transition:
|
||||
transform 0.12s ease,
|
||||
box-shadow 0.12s ease,
|
||||
border-color 0.12s ease,
|
||||
background 0.12s ease;
|
||||
}
|
||||
body.design-workspace .flow-node-main {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: flex-start;
|
||||
gap: 2px;
|
||||
min-width: 0;
|
||||
flex: 1;
|
||||
}
|
||||
body.design-workspace .flow-node.is-done-menu {
|
||||
cursor: context-menu;
|
||||
opacity: 0.92;
|
||||
}
|
||||
body.design-workspace .flow-node.is-done-menu:hover {
|
||||
opacity: 1;
|
||||
border-color: color-mix(in srgb, var(--border) 40%, var(--text) 20%);
|
||||
background: var(--surface);
|
||||
}
|
||||
body.design-workspace .flow-node.is-done-menu:focus-visible {
|
||||
outline: 2px solid var(--accent);
|
||||
outline-offset: 2px;
|
||||
}
|
||||
body.design-workspace .flow-node-menu-btn {
|
||||
flex: 0 0 auto;
|
||||
align-self: center;
|
||||
width: 22px;
|
||||
height: 22px;
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
font-size: 14px;
|
||||
line-height: 1;
|
||||
color: var(--muted);
|
||||
opacity: 0.55;
|
||||
pointer-events: none;
|
||||
}
|
||||
body.design-workspace .flow-node.is-done-menu:hover .flow-node-menu-btn,
|
||||
body.design-workspace .flow-node.is-done-menu:focus-visible .flow-node-menu-btn {
|
||||
opacity: 1;
|
||||
}
|
||||
.step-artifact-body {
|
||||
max-height: min(70vh, 560px);
|
||||
overflow: auto;
|
||||
margin: 8px 0 0;
|
||||
}
|
||||
body.design-workspace .flow-node[data-run="current"] {
|
||||
border-color: var(--accent);
|
||||
background: var(--surface);
|
||||
}
|
||||
body.design-workspace .flow-node.is-locked {
|
||||
opacity: 0.55;
|
||||
}
|
||||
body.design-workspace .flow-node.is-selectable {
|
||||
cursor: pointer;
|
||||
border-color: var(--accent);
|
||||
border-width: 1.5px;
|
||||
background: var(--surface);
|
||||
box-shadow:
|
||||
0 0 0 1px color-mix(in srgb, var(--accent) 18%, transparent),
|
||||
0 4px 12px color-mix(in srgb, var(--accent) 12%, transparent);
|
||||
}
|
||||
body.design-workspace .flow-node.is-selectable:hover {
|
||||
transform: translateY(-2px);
|
||||
background: color-mix(in srgb, var(--accent) 10%, var(--surface));
|
||||
box-shadow:
|
||||
0 0 0 1px color-mix(in srgb, var(--accent) 28%, transparent),
|
||||
0 8px 18px color-mix(in srgb, var(--accent) 16%, transparent);
|
||||
}
|
||||
body.design-workspace .flow-node.is-selectable:active {
|
||||
transform: translateY(0) scale(0.98);
|
||||
box-shadow:
|
||||
0 0 0 1px color-mix(in srgb, var(--accent) 35%, transparent),
|
||||
0 2px 6px color-mix(in srgb, var(--accent) 12%, transparent);
|
||||
}
|
||||
body.design-workspace .flow-node.is-selectable:focus-visible {
|
||||
outline: 2px solid var(--accent);
|
||||
outline-offset: 2px;
|
||||
}
|
||||
body.design-workspace .flow-action {
|
||||
flex-shrink: 0;
|
||||
font-size: 12px;
|
||||
font-weight: 600;
|
||||
letter-spacing: 0.02em;
|
||||
color: var(--accent);
|
||||
pointer-events: none;
|
||||
}
|
||||
body.design-workspace .flow-node.is-selectable:hover .flow-action {
|
||||
color: color-mix(in srgb, var(--accent) 80%, #000);
|
||||
}
|
||||
body.design-workspace .flow-node--prototype {
|
||||
border-style: dashed;
|
||||
border-color: color-mix(in srgb, var(--accent) 45%, var(--border));
|
||||
background: color-mix(in srgb, var(--accent) 6%, var(--bg));
|
||||
}
|
||||
body.design-workspace .flow-node--prototype.is-selectable {
|
||||
border-style: dashed;
|
||||
border-color: var(--accent);
|
||||
}
|
||||
body.design-workspace .flow-node--prototype.is-selectable:hover {
|
||||
border-color: var(--accent);
|
||||
}
|
||||
body.design-workspace .flow-occ-prototype {
|
||||
color: var(--accent);
|
||||
}
|
||||
body.design-workspace .flow-family {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: stretch;
|
||||
width: min(100%, 280px);
|
||||
min-width: 0;
|
||||
}
|
||||
body.design-workspace .flow-family > .flow-node {
|
||||
width: 100%;
|
||||
}
|
||||
body.design-workspace .flow-family-spawns {
|
||||
position: relative;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 6px;
|
||||
margin: 0;
|
||||
padding: 8px 0 0 22px;
|
||||
list-style: none;
|
||||
}
|
||||
body.design-workspace .flow-family-spawns::before {
|
||||
content: "";
|
||||
position: absolute;
|
||||
left: 12px;
|
||||
top: 0;
|
||||
bottom: 14px;
|
||||
width: 1px;
|
||||
background: color-mix(in srgb, var(--accent) 32%, var(--border));
|
||||
}
|
||||
body.design-workspace .flow-family-spawn {
|
||||
position: relative;
|
||||
min-width: 0;
|
||||
}
|
||||
body.design-workspace .flow-family-spawn::before {
|
||||
content: "";
|
||||
position: absolute;
|
||||
left: -10px;
|
||||
top: 50%;
|
||||
width: 10px;
|
||||
height: 1px;
|
||||
background: color-mix(in srgb, var(--accent) 32%, var(--border));
|
||||
}
|
||||
body.design-workspace .flow-node--spawn {
|
||||
width: 100%;
|
||||
min-width: 0;
|
||||
padding: 8px 10px;
|
||||
gap: 8px;
|
||||
border-radius: 8px;
|
||||
box-shadow: none;
|
||||
background: var(--surface);
|
||||
}
|
||||
body.design-workspace .flow-node--spawn .flow-name {
|
||||
font-size: 13px;
|
||||
font-weight: 600;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
max-width: 100%;
|
||||
}
|
||||
body.design-workspace .flow-node--spawn .flow-params,
|
||||
body.design-workspace .flow-node--spawn .flow-params-missing {
|
||||
font-size: 11px;
|
||||
}
|
||||
body.design-workspace .flow-node--spawn.is-selectable {
|
||||
border-width: 1px;
|
||||
box-shadow: 0 0 0 1px color-mix(in srgb, var(--accent) 14%, transparent);
|
||||
}
|
||||
body.design-workspace .flow-node--spawn.is-selectable:hover {
|
||||
transform: none;
|
||||
box-shadow: 0 0 0 1px color-mix(in srgb, var(--accent) 28%, transparent);
|
||||
}
|
||||
body.design-workspace .flow-spawn-meta {
|
||||
flex-shrink: 0;
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
}
|
||||
body.design-workspace .flow-spawn-meta .flow-action {
|
||||
min-height: 24px;
|
||||
padding: 0 8px;
|
||||
font-size: 11px;
|
||||
}
|
||||
body.design-workspace .flow-spawn-count {
|
||||
font-size: 11px;
|
||||
color: var(--muted);
|
||||
line-height: 1.3;
|
||||
}
|
||||
body.design-workspace .flow-origin {
|
||||
display: block;
|
||||
max-width: 100%;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
font-size: 11px;
|
||||
color: var(--muted);
|
||||
line-height: 1.3;
|
||||
}
|
||||
body.design-workspace .flow-origin-rule {
|
||||
font-weight: 650;
|
||||
color: var(--text);
|
||||
}
|
||||
body.design-workspace .flow-dag-edge--belong {
|
||||
stroke-dasharray: 3 4;
|
||||
stroke-width: 1.25;
|
||||
}
|
||||
body.design-workspace .flow-dag-arrowhead--belong {
|
||||
fill: color-mix(in srgb, var(--accent) 38%, var(--border));
|
||||
}
|
||||
body.design-workspace .flow-suggestion-inline {
|
||||
font-size: 12px;
|
||||
color: var(--muted);
|
||||
line-height: 1.35;
|
||||
}
|
||||
body.design-workspace .flow-suggestions {
|
||||
margin-top: 12px;
|
||||
padding: 10px 12px;
|
||||
border: 1px dashed var(--border);
|
||||
border-radius: 8px;
|
||||
background: var(--surface);
|
||||
}
|
||||
body.design-workspace .flow-suggestions-title {
|
||||
font-size: 12px;
|
||||
font-weight: 600;
|
||||
margin-bottom: 8px;
|
||||
color: var(--muted);
|
||||
}
|
||||
body.design-workspace .flow-suggestion {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 2px;
|
||||
font-size: 12px;
|
||||
padding: 6px 0;
|
||||
border-top: 1px solid var(--border);
|
||||
}
|
||||
body.design-workspace .flow-suggestion:first-of-type {
|
||||
border-top: none;
|
||||
padding-top: 0;
|
||||
}
|
||||
body.design-workspace .flow-suggestion-name {
|
||||
font-weight: 600;
|
||||
}
|
||||
body.design-workspace .flow-suggestion-text {
|
||||
color: var(--muted);
|
||||
}
|
||||
body.design-workspace .flow-node .flow-run {
|
||||
font-size: 11px;
|
||||
font-weight: 650;
|
||||
letter-spacing: 0.04em;
|
||||
color: var(--muted);
|
||||
}
|
||||
body.design-workspace .flow-node[data-run="done"] .flow-run {
|
||||
color: #15803d;
|
||||
}
|
||||
body.design-workspace .flow-node.is-selectable .flow-run {
|
||||
color: var(--accent);
|
||||
}
|
||||
body.design-workspace .flow-node .flow-name {
|
||||
font-weight: 600;
|
||||
font-size: 14px;
|
||||
line-height: 1.35;
|
||||
}
|
||||
body.design-workspace .flow-title {
|
||||
font-size: 13px;
|
||||
font-weight: 650;
|
||||
line-height: 1.35;
|
||||
color: var(--text);
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
max-width: 100%;
|
||||
}
|
||||
body.design-workspace .flow-node .flow-params,
|
||||
body.design-workspace .flow-node .flow-params-missing {
|
||||
font-size: 12px;
|
||||
color: var(--muted);
|
||||
line-height: 1.35;
|
||||
}
|
||||
body.design-workspace .flow-spawns {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 8px;
|
||||
margin-top: 14px;
|
||||
}
|
||||
body.design-workspace .flow-spawn {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
min-height: 32px;
|
||||
padding: 0 10px;
|
||||
border: 1px dashed var(--border);
|
||||
border-radius: 8px;
|
||||
background: transparent;
|
||||
color: var(--muted);
|
||||
font: inherit;
|
||||
font-size: 13px;
|
||||
}
|
||||
body.design-workspace .flow-spawn.is-ready {
|
||||
cursor: pointer;
|
||||
border-style: solid;
|
||||
border-color: var(--accent);
|
||||
color: var(--text);
|
||||
}
|
||||
body.design-workspace .flow-spawn.is-ready:hover {
|
||||
background: color-mix(in srgb, var(--accent) 8%, var(--surface));
|
||||
}
|
||||
body.design-workspace .flow-spawn.is-ready:focus-visible {
|
||||
outline: 2px solid var(--accent);
|
||||
outline-offset: 2px;
|
||||
}
|
||||
body.design-workspace .flow-spawn.is-blocked {
|
||||
opacity: 0.65;
|
||||
}
|
||||
@media (max-width: 720px) {
|
||||
body.design-workspace .flow-dag-row-nodes {
|
||||
flex-direction: column;
|
||||
align-items: stretch;
|
||||
}
|
||||
body.design-workspace .flow-node,
|
||||
body.design-workspace .flow-family {
|
||||
width: 100%;
|
||||
}
|
||||
}
|
||||
body.design-workspace .flow-steps {
|
||||
list-style: none;
|
||||
margin: 0;
|
||||
@@ -1004,8 +1487,20 @@ body.design-workspace .flow-step[data-run="done"] .flow-name {
|
||||
cursor: pointer;
|
||||
padding: 6px 10px;
|
||||
}
|
||||
.btn:focus,
|
||||
.btn-sm:focus {
|
||||
outline: none;
|
||||
}
|
||||
.btn:focus-visible,
|
||||
.btn-sm:focus-visible {
|
||||
outline: 2px solid var(--accent);
|
||||
outline-offset: 2px;
|
||||
}
|
||||
.btn-sm { padding: 4px 8px; font-size: 12px; }
|
||||
.btn-primary { background: var(--accent); color: #fff; border-color: var(--accent); }
|
||||
.btn-primary:focus-visible {
|
||||
outline-color: color-mix(in srgb, var(--accent) 50%, #fff);
|
||||
}
|
||||
.btn-danger { color: var(--danger); border-color: #fecaca; }
|
||||
.btn:disabled, .btn-sm:disabled { opacity: 0.5; cursor: not-allowed; }
|
||||
|
||||
@@ -1950,7 +2445,7 @@ body.design-workspace .af-mosaic {
|
||||
grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr));
|
||||
}
|
||||
|
||||
/* 美学验收:左契约 / 右诊断(整体样式约定) */
|
||||
/* 美学验收:左契约 / 右诊断 */
|
||||
.af-split {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
@@ -2002,13 +2497,13 @@ body.design-workspace .af-mosaic {
|
||||
background: var(--bg);
|
||||
}
|
||||
.af-block-head {
|
||||
margin-bottom: 10px;
|
||||
margin-bottom: 8px;
|
||||
}
|
||||
.af-block-title {
|
||||
margin: 0 0 4px;
|
||||
margin: 0;
|
||||
font-family: var(--font-ui);
|
||||
font-size: 15px;
|
||||
font-weight: 700;
|
||||
font-size: 14px;
|
||||
font-weight: 650;
|
||||
color: var(--text);
|
||||
letter-spacing: 0.01em;
|
||||
display: flex;
|
||||
@@ -2032,20 +2527,80 @@ body.design-workspace .af-mosaic {
|
||||
.af-block-body {
|
||||
min-width: 0;
|
||||
}
|
||||
.af-block--product .af-block-body .artifact-kernel .artifact-prose,
|
||||
.af-block--product .af-block-body .artifact-prose {
|
||||
font-family: var(--font-read);
|
||||
font-size: 15.5px;
|
||||
line-height: 1.75;
|
||||
max-width: 42rem;
|
||||
|
||||
/* 美学卡:阅读层级 — 内核最大,范式次之,右栏更密更沉 */
|
||||
.af-split--aesthetics .af-split-product {
|
||||
gap: 22px;
|
||||
}
|
||||
.af-block--eval .af-block-title {
|
||||
.af-split--aesthetics .af-block--product .af-block-title {
|
||||
font-size: 13px;
|
||||
font-weight: 600;
|
||||
color: var(--muted);
|
||||
text-transform: none;
|
||||
letter-spacing: 0.02em;
|
||||
}
|
||||
.af-split--aesthetics .af-block--product .af-block-head {
|
||||
margin-bottom: 6px;
|
||||
}
|
||||
.af-split--aesthetics .artifact-kernel.qcard-assessment,
|
||||
.af-split--aesthetics .artifact-kernel {
|
||||
margin: 0 0 14px;
|
||||
padding: 12px 14px;
|
||||
border-radius: 8px;
|
||||
border: 1px solid color-mix(in srgb, var(--border) 80%, transparent);
|
||||
background: color-mix(in srgb, var(--surface) 88%, var(--bg));
|
||||
}
|
||||
.af-split--aesthetics .artifact-kernel .artifact-aside-label {
|
||||
margin: 0 0 6px;
|
||||
font-size: 11px;
|
||||
font-weight: 650;
|
||||
letter-spacing: 0.04em;
|
||||
color: var(--muted);
|
||||
}
|
||||
.af-split--aesthetics .artifact-kernel .artifact-prose,
|
||||
.af-split--aesthetics .artifact-kernel .artifact-inline {
|
||||
font-family: var(--font-read);
|
||||
font-size: 16px;
|
||||
line-height: 1.75;
|
||||
max-width: 40rem;
|
||||
}
|
||||
.af-split--aesthetics .af-block--product .af-group-title,
|
||||
.af-split--aesthetics .af-block--product .af-section-title {
|
||||
font-size: 12px;
|
||||
font-weight: 650;
|
||||
color: var(--muted);
|
||||
margin: 0 0 6px;
|
||||
}
|
||||
.af-split--aesthetics .af-block--product .af-stack,
|
||||
.af-split--aesthetics .af-block--product .af-def-list {
|
||||
gap: 12px;
|
||||
}
|
||||
.af-split--aesthetics .af-block--product .af-def-v,
|
||||
.af-split--aesthetics .af-block--product .artifact-prose {
|
||||
font-family: var(--font-read);
|
||||
font-size: 14.5px;
|
||||
line-height: 1.65;
|
||||
max-width: 40rem;
|
||||
}
|
||||
.af-split--aesthetics .af-split-eval {
|
||||
gap: 12px;
|
||||
font-size: 13px;
|
||||
}
|
||||
.af-block--extra .af-block-title {
|
||||
.af-split--aesthetics .af-block--eval .af-block-title,
|
||||
.af-split--aesthetics .af-block--extra .af-block-title {
|
||||
font-size: 12px;
|
||||
font-weight: 650;
|
||||
color: var(--muted);
|
||||
}
|
||||
.af-split--aesthetics .af-block--eval .af-block-body,
|
||||
.af-split--aesthetics .af-block--extra .af-block-body {
|
||||
font-size: 13px;
|
||||
line-height: 1.5;
|
||||
color: color-mix(in srgb, var(--text) 92%, var(--muted));
|
||||
}
|
||||
.af-split--aesthetics .af-dim-title {
|
||||
font-size: 12px;
|
||||
}
|
||||
@media (max-width: 900px) {
|
||||
.af-split-grid {
|
||||
grid-template-columns: 1fr;
|
||||
@@ -2368,6 +2923,145 @@ body.design-workspace .af-mosaic {
|
||||
flex-direction: column;
|
||||
gap: 14px;
|
||||
}
|
||||
|
||||
/* 美学纲领:主栏契约 / 辅栏诊断(无第二层盒子) */
|
||||
.skill-view.skill-view-aesthetics {
|
||||
display: grid;
|
||||
grid-template-columns: minmax(0, 1.55fr) minmax(15.5rem, 0.88fr);
|
||||
gap: 8px 36px;
|
||||
align-items: start;
|
||||
}
|
||||
.skill-view-aesthetics.af-aes--solo {
|
||||
grid-template-columns: 1fr;
|
||||
}
|
||||
.af-aes-main,
|
||||
.af-aes-diag {
|
||||
min-width: 0;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 16px;
|
||||
}
|
||||
.af-aes-diag {
|
||||
padding-left: 22px;
|
||||
border-left: 1px solid var(--border);
|
||||
}
|
||||
.af-aes-kernel .artifact-aside-label {
|
||||
display: block;
|
||||
margin: 0 0 8px;
|
||||
font-size: 11px;
|
||||
font-weight: 700;
|
||||
letter-spacing: 0.08em;
|
||||
color: var(--muted);
|
||||
}
|
||||
.af-aes-kernel .artifact-prose,
|
||||
.af-aes-kernel .artifact-inline {
|
||||
font-family: var(--font-read);
|
||||
font-size: 15.5px;
|
||||
line-height: 1.78;
|
||||
max-width: 42rem;
|
||||
margin: 0;
|
||||
color: var(--text);
|
||||
}
|
||||
.af-aes-paradigm {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 14px;
|
||||
}
|
||||
.af-aes-main > .skill-card-section > h4,
|
||||
.af-aes-paradigm > .skill-card-section > h4 {
|
||||
margin: 0 0 8px;
|
||||
font-size: 12px;
|
||||
font-weight: 700;
|
||||
letter-spacing: 0.04em;
|
||||
color: var(--muted);
|
||||
}
|
||||
.af-aes-diag > .skill-card-section > h4 {
|
||||
margin: 0 0 8px;
|
||||
font-size: 11px;
|
||||
font-weight: 700;
|
||||
letter-spacing: 0.06em;
|
||||
color: var(--muted);
|
||||
}
|
||||
.af-aes-diag .af-dim-stack { gap: 10px; }
|
||||
.af-aes-diag .af-dim { padding-bottom: 10px; }
|
||||
.af-aes-diag .af-dim-title { font-size: 13px; }
|
||||
.af-aes-twist {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 8px;
|
||||
}
|
||||
.af-aes-twist-row {
|
||||
display: grid;
|
||||
grid-template-columns: 2.5rem minmax(0, 1fr);
|
||||
gap: 8px 10px;
|
||||
align-items: start;
|
||||
}
|
||||
.af-aes-twist-k {
|
||||
font-size: 11px;
|
||||
font-weight: 600;
|
||||
color: var(--muted);
|
||||
padding-top: 2px;
|
||||
}
|
||||
.af-aes-twist-v {
|
||||
font-size: 13px;
|
||||
line-height: 1.5;
|
||||
word-break: break-word;
|
||||
}
|
||||
.af-aes-twist-infer {
|
||||
margin: 2px 0 0;
|
||||
font-family: var(--font-read);
|
||||
font-size: 13.5px;
|
||||
line-height: 1.55;
|
||||
color: var(--text);
|
||||
}
|
||||
.af-dim-row.is-pending .af-dim-k {
|
||||
color: #a16207;
|
||||
font-weight: 650;
|
||||
}
|
||||
.af-dim-row.is-pending .af-dim-v { color: #854d0e; }
|
||||
@media (max-width: 860px) {
|
||||
.skill-view.skill-view-aesthetics {
|
||||
grid-template-columns: 1fr;
|
||||
gap: 20px;
|
||||
}
|
||||
.af-aes-diag {
|
||||
padding-left: 0;
|
||||
border-left: none;
|
||||
padding-top: 16px;
|
||||
border-top: 1px solid var(--border);
|
||||
}
|
||||
}
|
||||
.artifact-compact-body .skill-view.skill-view-aesthetics {
|
||||
grid-template-columns: 1fr;
|
||||
gap: 16px;
|
||||
}
|
||||
.artifact-compact-body .af-aes-diag {
|
||||
padding-left: 0;
|
||||
border-left: none;
|
||||
padding-top: 12px;
|
||||
border-top: 1px solid var(--border);
|
||||
}
|
||||
.ws-focus-body .skill-view.skill-view-aesthetics {
|
||||
grid-template-columns: minmax(0, 1.55fr) minmax(15.5rem, 0.88fr);
|
||||
}
|
||||
.ws-focus-body .af-aes-diag {
|
||||
padding-left: 22px;
|
||||
border-left: 1px solid var(--border);
|
||||
padding-top: 0;
|
||||
border-top: none;
|
||||
}
|
||||
@media (max-width: 860px) {
|
||||
.ws-focus-body .skill-view.skill-view-aesthetics {
|
||||
grid-template-columns: 1fr;
|
||||
}
|
||||
.ws-focus-body .af-aes-diag {
|
||||
padding-left: 0;
|
||||
border-left: none;
|
||||
padding-top: 16px;
|
||||
border-top: 1px solid var(--border);
|
||||
}
|
||||
}
|
||||
|
||||
.skill-card-section > h4 {
|
||||
margin: 0 0 8px;
|
||||
font-size: 13px;
|
||||
@@ -2395,6 +3089,14 @@ body.design-workspace .af-mosaic {
|
||||
font-size: 13px;
|
||||
line-height: 1.45;
|
||||
}
|
||||
.af-aes-main .skill-kv-row,
|
||||
.af-aes-paradigm .skill-kv-row {
|
||||
grid-template-columns: minmax(4.75rem, 7.25rem) 1fr;
|
||||
}
|
||||
.af-aes-main .skill-kv-val,
|
||||
.af-aes-paradigm .skill-kv-val {
|
||||
line-height: 1.55;
|
||||
}
|
||||
@media (max-width: 640px) {
|
||||
.skill-kv-row { grid-template-columns: 1fr; gap: 2px; }
|
||||
}
|
||||
@@ -3688,6 +4390,11 @@ body.design-workspace .af-mosaic {
|
||||
}
|
||||
.context-menu-item[hidden] { display: none; }
|
||||
.context-menu-item:hover { background: var(--bg); }
|
||||
.context-menu-item:disabled {
|
||||
opacity: 0.45;
|
||||
cursor: not-allowed;
|
||||
}
|
||||
.context-menu-item:disabled:hover { background: transparent; }
|
||||
.context-menu-separator-before { border-top: 1px solid var(--border); }
|
||||
.context-menu-danger { color: var(--danger); }
|
||||
.context-menu-danger:hover { background: #fef2f2; }
|
||||
@@ -3976,7 +4683,7 @@ body.design-workspace .af-mosaic {
|
||||
.layout { grid-template-columns: var(--books-w-collapsed) 1fr; }
|
||||
body:not(.rail-collapsed) { --books-w: var(--books-w-collapsed); }
|
||||
body:not(.rail-collapsed) .rail-tab-label,
|
||||
body:not(.rail-collapsed) .path-bar { display: none !important; }
|
||||
body:not(.rail-collapsed) .rail-context { display: none !important; }
|
||||
body:not(.rail-collapsed) .rail-panels { display: none; }
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user