Skip to content

A team of long-lived bots for DeepSeek Harness, with main bots, bot-to-bot messages and group chats.

Focus the goal panel on one stage

Fei2411ef0be9dd6119
diff --git a/ds-bot/client.js b/ds-bot/client.js
index 73c1e626..28ad3953 100644
--- a/ds-bot/client.js
+++ b/ds-bot/client.js
@@ -678,35 +678,28 @@ var ZH = {
"This group has no admin": "这个群没有管理员",
"What should this group achieve?": "这个群要达成什么?",
Start: "开始",
- Drafting: "对齐中",
- Active: "进行中",
- Collapse: "收起",
Resume: "继续",
"Stop the goal?": "确认终止?",
"Aligning the goal with you": "正在和你对齐目标",
- "{admin} is aligning the goal with you in the chat.": "{admin} 正在聊天里和你对齐目标。",
"{admin} asks what is still open, then writes the goal with its checks and stages.": "{admin} 会先问清还没定的地方,再写出带验收方法和阶段的目标。",
Objective: "目标",
"Done when": "验收方法",
Rules: "约束",
- "Stage {n}/{count}": "阶段 {n}/{count}",
- "Stage {n}/{count} · {title}": "阶段 {n}/{count} · {title}",
- "Stage {n} · {title}": "阶段 {n} · {title}",
"Final check": "总验收",
"Waiting for you": "等你",
"Goal reached": "已达成",
- Passed: "已通过",
- Current: "当前",
- Checking: "验收中",
- Upcoming: "未开始",
- "Sent back ×{n}": "返工 ×{n}",
- "Not started": "未开始",
- Reported: "已交回",
+ "Stages": "阶段",
+ "Stage {n}: {title}": "第 {n} 阶段:{title}",
+ "Paused · {title}": "已暂停 · {title}",
+ "Waiting for you · {title}": "等你 · {title}",
+ "Checking · {title}": "验收中 · {title}",
+ "Sent back: {feedback}": "返工:{feedback}",
+ "Sent back ×{n}: {feedback}": "返工 ×{n}:{feedback}",
+ "Back to current stage": "回到当前阶段",
+ "Goal and checks": "目标与验收",
Summary: "总结",
Evidence: "证据",
- "Paused. Write in the group to correct the direction; the admin updates the goal.": "已暂停。在群里说出要调整的地方,管理员会更新目标。",
"Stop current work too": "同时停止当前工作",
- "{admin} is waiting for you.": "{admin} 在等你回复。",
"Setting a goal": "正在设定目标",
"Goal set: {title} · {count} stages": "已设定目标:{title} · {count} 个阶段",
"Stage {n} passed · now stage {m}: {next}": "阶段 {n} 已通过 · 进入阶段 {m}:{next}",
@@ -4016,7 +4009,6 @@ var RUNNING = /* @__PURE__ */ new Set(["active", "paused"]);
var FACES_MAX = 4;
var hasGoalAdmin = (room2, roster) => room2 !== void 0 && room2.members?.includes(room2.admin) === true && roster.byId?.[room2.admin] !== void 0;
var canSetGoal = (room2, roster) => hasGoalAdmin(room2, roster) && room2.goal?.status !== "active" && room2.goal?.status !== "paused";
-var stageRef = (n, count) => t("Stage {n}/{count}", { n, count });
function goalView(goal, { roster = {}, roomWork = [] } = {}) {
if (goal === null || goal === void 0) return null;
const stages = goal.stages ?? [];
@@ -4024,7 +4016,8 @@ function goalView(goal, { roster = {}, roomWork = [] } = {}) {
const at = goal.current;
const current = RUNNING.has(goal.status) ? stages[at] : void 0;
const checking = current !== void 0 && (current.tasks ?? []).every((task) => REPORTED.has(task.status));
- const barLabel = goal.status === "drafting" ? t("Aligning the goal with you") : goal.status === "stopped" ? t("Stopped") : goal.status === "complete" ? `${t("Goal reached")} · ${count}/${count}` : goal.status === "paused" ? current ? `${t("Paused")} · ${stageRef(at + 1, count)}` : t("Paused") : goal.idle === true ? current ? `${t("Waiting for you")} · ${stageRef(at + 1, count)}` : t("Waiting for you") : current ? t("Stage {n}/{count} · {title}", { n: at + 1, count, title: current.title }) : t("Final check");
+ const number = goal.status === "drafting" ? void 0 : goal.status === "stopped" ? stages.filter((stage) => stage.status === "passed").length : current !== void 0 ? at + 1 : count;
+ const barLabel = goal.status === "drafting" ? t("Aligning the goal with you") : goal.status === "stopped" ? t("Stopped") : goal.status === "complete" ? t("Goal reached") : goal.status === "paused" ? current ? t("Paused · {title}", { title: current.title }) : t("Paused") : goal.idle === true ? current ? t("Waiting for you · {title}", { title: current.title }) : t("Waiting for you") : current === void 0 ? t("Final check") : checking ? t("Checking · {title}", { title: current.title }) : current.title;
const segments = stages.map((stage, i) => stage.status === "passed" ? "done" : i === at && goal.status === "paused" ? "paused" : i === at && goal.status === "active" ? checking ? "checking" : "current" : "todo");
const working = new Set((roomWork ?? []).map((entry) => entry.botId));
const seen = /* @__PURE__ */ new Set();
@@ -4038,8 +4031,8 @@ function goalView(goal, { roster = {}, roomWork = [] } = {}) {
title: stage.title,
acceptance: stage.acceptance,
status: stage.status,
- chip: stage.status === "passed" ? "passed" : i === at && RUNNING.has(goal.status) ? checking && goal.status === "active" ? "checking" : "current" : "upcoming",
- tasks: (stage.tasks ?? []).map((task) => ({ bot: roster.byId?.[task.botId], task: task.task, status: task.status, note: task.note })),
+ kind: stage.status === "passed" ? "passed" : i === at && RUNNING.has(goal.status) ? "current" : "upcoming",
+ tasks: (stage.tasks ?? []).map((task) => ({ bot: roster.byId?.[task.botId], task: task.task, status: task.status })),
evidence: stage.evidence,
reworks: stage.reworks ?? 0,
feedback: stage.feedback
@@ -4048,7 +4041,7 @@ function goalView(goal, { roster = {}, roomWork = [] } = {}) {
status: goal.status,
idle: goal.idle === true,
title: goal.title ?? "",
- done: stages.filter((stage) => stage.status === "passed").length,
+ number,
count,
segments,
barLabel,
@@ -4115,84 +4108,132 @@ function GoalBar({ view, open, room: room2, actions }) {
(0, import_react5.createElement)("span", { className: "bt-goal-chev", "aria-hidden": true }, (0, import_react5.createElement)(ChevronDownIcon))
);
}
-var STAGE_CHIP = { passed: "Passed", current: "Current", checking: "Checking", upcoming: "Upcoming" };
-var TASK_CHIP = { pending: "Not started", working: "Working", reported: "Reported", done: "Done" };
function TaskRow({ task, working }) {
const live = working.has(task.bot?.id) || task.status === "working";
+ const returned = REPORTED.has(task.status);
return (0, import_react5.createElement)(
"div",
- { className: "bt-goal-task" },
- task.bot ? (0, import_react5.createElement)(BotAvatar, { bot: task.bot, size: 20, state: live ? "working" : "idle" }) : null,
+ { className: "bt-goal-task", "data-task": task.status === "pending" ? "pending" : void 0 },
(0, import_react5.createElement)(
"span",
- { className: "bt-goal-task-body" },
- (0, import_react5.createElement)(
- "span",
- { className: "bt-goal-task-line" },
- (0, import_react5.createElement)("span", { className: "bt-goal-task-name", style: task.bot ? { color: inkText(colorOf(task.bot)) } : void 0 }, task.bot?.name ?? t("a Bot"))
- ),
- (0, import_react5.createElement)("span", { className: "bt-goal-task-text" }, task.task),
- task.note ? (0, import_react5.createElement)("span", { className: "bt-goal-task-note" }, task.note) : null
+ { className: "bt-goal-tav" },
+ task.bot ? (0, import_react5.createElement)(BotAvatar, { bot: task.bot, size: 20, state: live ? "working" : "idle" }) : null,
+ returned ? (0, import_react5.createElement)("span", { className: "bt-goal-tdone", "aria-hidden": true }, (0, import_react5.createElement)(CheckIcon)) : null
),
- (0, import_react5.createElement)("span", { className: "bt-goal-chip", "data-chip": task.status }, t(TASK_CHIP[task.status] ?? "Not started"))
- );
-}
-function GoalStage({ stage, open, working, onToggle }) {
- return (0, import_react5.createElement)(
- "div",
- { className: "bt-goal-stage" },
(0, import_react5.createElement)(
- "button",
- { type: "button", className: "bt-goal-sh", "aria-expanded": open, onClick: onToggle },
- (0, import_react5.createElement)("span", { className: "bt-goal-sg", "data-sg": stage.chip === "checking" ? "current" : stage.chip, "aria-hidden": true }),
- (0, import_react5.createElement)("span", { className: "bt-goal-st" }, t("Stage {n} · {title}", { n: stage.n, title: stage.title })),
- (0, import_react5.createElement)("span", { className: "bt-goal-chip", "data-chip": stage.chip }, t(STAGE_CHIP[stage.chip])),
- stage.reworks > 0 ? (0, import_react5.createElement)("span", { className: "bt-goal-chip", "data-chip": "rework" }, t("Sent back ×{n}", { n: stage.reworks })) : null
- ),
- open ? (0, import_react5.createElement)(
- "div",
- { className: "bt-goal-sbody" },
- stage.acceptance ? (0, import_react5.createElement)("div", { className: "bt-goal-line" }, (0, import_react5.createElement)("span", { className: "bt-goal-sub" }, t("Done when")), stage.acceptance) : null,
- stage.evidence !== void 0 && stage.status === "passed" ? (0, import_react5.createElement)("div", { className: "bt-goal-evi" }, stage.evidence) : null,
- stage.feedback ? (0, import_react5.createElement)("div", { className: "bt-goal-line" }, (0, import_react5.createElement)("span", { className: "bt-goal-sub" }, t("Sent back ×{n}", { n: stage.reworks })), stage.feedback) : null,
- stage.tasks.map((task, i) => (0, import_react5.createElement)(TaskRow, { key: i, task, working }))
- ) : null
+ "span",
+ { className: "bt-goal-ttext" },
+ (0, import_react5.createElement)("span", { className: "bt-goal-tname", style: task.bot ? { color: inkText(colorOf(task.bot)) } : void 0 }, task.bot?.name ?? t("a Bot")),
+ " ",
+ task.task
+ )
);
}
var STOP_ARM_MS = 3e3;
-function GoalPanel({ goal, view, room: room2, roster, actions, working }) {
- const [expanded, setExpanded] = (0, import_react5.useState)(goal.current);
+function GoalPanel({ goal, view, room: room2, actions, working }) {
+ const at = RUNNING.has(view.status) && goal.current < view.stages.length ? goal.current : -1;
+ const [selected, setSelected] = (0, import_react5.useState)(at);
+ const [checks, setChecks] = (0, import_react5.useState)(false);
const [armed, setArmed] = (0, import_react5.useState)(false);
- (0, import_react5.useEffect)(() => setExpanded(goal.current), [goal.current]);
+ (0, import_react5.useEffect)(() => setSelected(RUNNING.has(view.status) && goal.current < view.stages.length ? goal.current : -1), [view.status, goal.current]);
(0, import_react5.useEffect)(() => {
if (!armed) return void 0;
const timer = setTimeout(() => setArmed(false), STOP_ARM_MS);
return () => clearTimeout(timer);
}, [armed]);
+ const stepper = (0, import_react5.useRef)(null);
+ (0, import_react5.useEffect)(() => {
+ const box = stepper.current;
+ if (box === null || typeof ResizeObserver !== "function") return void 0;
+ const measure = () => box.querySelectorAll(".bt-goal-step").forEach((node) => node.classList.toggle("bt-goal-mini", node.clientWidth < 14));
+ const observer = new ResizeObserver(measure);
+ observer.observe(box);
+ measure();
+ return () => observer.disconnect();
+ }, [view.stages.length]);
const control = (action) => void Promise.resolve(actions.goalControl(room2.id, goal.id, action)).catch((error) => actions.reportError(error, "goal"));
- const admin = roster.byId?.[room2.admin]?.name ?? t("a Bot");
- const live = view.status === "active" || view.status === "paused";
- const statusChip = view.status === "drafting" ? t("Drafting") : view.status === "paused" ? t("Paused") : view.status === "complete" ? t("Goal reached") : view.status === "stopped" ? t("Stopped") : view.idle ? t("Waiting for you") : t("Active");
+ const stage = selected >= 0 ? view.stages[selected] : void 0;
const sec = (key, label, ...body) => (0, import_react5.createElement)(
"div",
{ key, className: "bt-goal-sec" },
(0, import_react5.createElement)("div", { className: "bt-goal-sub" }, label),
...body.map((line, i) => (0, import_react5.createElement)("div", { key: i, className: "bt-goal-text" }, line))
);
+ const hasChecks = goal.objective !== void 0 || goal.acceptance !== void 0 || goal.constraints?.length > 0;
+ const stopWork = () => void Promise.resolve(actions.stopRoomWork(room2.id)).catch((error) => actions.reportError(error, "stop"));
return (0, import_react5.createElement)(
"div",
{ className: "bt-goal-panel", role: "region", "aria-label": view.title },
(0, import_react5.createElement)(
"div",
- { className: "bt-goal-head" },
- (0, import_react5.createElement)("div", { className: "bt-goal-title" }, view.title),
- (0, import_react5.createElement)("span", { className: "bt-goal-chip", "data-chip": view.status }, statusChip),
+ { className: "bt-goal-body" },
+ view.status === "drafting" ? null : (0, import_react5.createElement)(
+ "div",
+ { ref: stepper, className: "bt-goal-steps", role: "group", "aria-label": t("Stages") },
+ view.stages.map((stageView, i) => (0, import_react5.createElement)("button", {
+ key: stageView.n,
+ type: "button",
+ className: "bt-goal-step",
+ "data-step": stageView.kind === "current" && (view.status === "paused" || view.idle === true) ? "waiting" : stageView.kind,
+ "data-sel": i === selected || void 0,
+ title: t("Stage {n}: {title}", { n: stageView.n, title: stageView.title }),
+ "aria-label": t("Stage {n}: {title}", { n: stageView.n, title: stageView.title }),
+ "aria-current": i === at ? "step" : void 0,
+ onClick: () => setSelected(i)
+ }, (0, import_react5.createElement)("span", { className: "bt-goal-node" }, stageView.status === "passed" ? (0, import_react5.createElement)(CheckIcon) : stageView.n)))
+ ),
(0, import_react5.createElement)(
"div",
- { className: "bt-goal-acts" },
+ { key: `s${selected}`, className: "bt-goal-bstage" },
+ view.status === "drafting" ? goal.brief ? (0, import_react5.createElement)("div", { className: "bt-goal-btext" }, goal.brief) : null : stage === void 0 ? (0, import_react5.createElement)(
+ import_react5.Fragment,
+ null,
+ goal.summary ? (0, import_react5.createElement)("div", { className: "bt-goal-btext" }, goal.summary) : null,
+ goal.evidence ? (0, import_react5.createElement)("div", { className: "bt-goal-evi" }, goal.evidence) : null,
+ view.status === "stopped" && goal.reason ? (0, import_react5.createElement)("div", { className: "bt-goal-evi" }, goal.reason) : null
+ ) : (0, import_react5.createElement)(
+ import_react5.Fragment,
+ null,
+ selected !== at ? (0, import_react5.createElement)(
+ "div",
+ { className: "bt-goal-bline" },
+ (0, import_react5.createElement)("span", { className: "bt-goal-btitle" }, t("Stage {n}: {title}", { n: stage.n, title: stage.title })),
+ at >= 0 ? (0, import_react5.createElement)("button", { type: "button", className: "bt-goal-back", onClick: () => setSelected(at) }, t("Back to current stage")) : null
+ ) : null,
+ stage.acceptance ? (0, import_react5.createElement)("div", { className: "bt-goal-line" }, (0, import_react5.createElement)("span", { className: "bt-goal-sub" }, t("Done when")), (0, import_react5.createElement)("span", { className: "bt-goal-acc" }, stage.acceptance)) : null,
+ selected === at && stage.reworks > 0 && stage.feedback ? (0, import_react5.createElement)("div", { className: "bt-goal-rw" }, stage.reworks > 1 ? t("Sent back ×{n}: {feedback}", { n: stage.reworks, feedback: stage.feedback }) : t("Sent back: {feedback}", { feedback: stage.feedback })) : null,
+ stage.evidence !== void 0 && stage.status === "passed" ? (0, import_react5.createElement)("div", { className: "bt-goal-evi" }, stage.evidence) : null,
+ stage.tasks.map((task, i) => (0, import_react5.createElement)(TaskRow, { key: i, task, working }))
+ )
+ ),
+ checks && hasChecks ? (0, import_react5.createElement)(
+ "div",
+ { className: "bt-goal-ckbody" },
+ goal.objective ? sec("objective", t("Objective"), goal.objective) : null,
+ goal.acceptance ? sec("acceptance", t("Done when"), goal.acceptance) : null,
+ goal.constraints?.length > 0 ? sec("rules", t("Rules"), (0, import_react5.createElement)(
+ "ul",
+ { className: "bt-goal-rules" },
+ goal.constraints.map((rule, i) => (0, import_react5.createElement)("li", { key: i }, rule))
+ )) : null
+ ) : null
+ ),
+ (0, import_react5.createElement)(
+ "div",
+ { className: "bt-goal-foot" },
+ hasChecks ? (0, import_react5.createElement)("button", {
+ type: "button",
+ className: "bt-goal-checks",
+ "aria-expanded": checks,
+ onClick: () => setChecks(!checks)
+ }, (0, import_react5.createElement)("span", { className: "bt-goal-mchev", "aria-hidden": true }, (0, import_react5.createElement)(ChevronDownIcon)), t("Goal and checks")) : (0, import_react5.createElement)("span"),
+ (0, import_react5.createElement)(
+ "span",
+ { className: "bt-goal-facts" },
+ view.status === "paused" && working.size > 0 ? (0, import_react5.createElement)("button", { type: "button", className: "bt-goal-back", onClick: stopWork }, t("Stop current work too")) : null,
view.status === "active" ? (0, import_react5.createElement)("button", { type: "button", className: "bt-soft bt-soft-sm", onClick: () => control("pause") }, t("Pause")) : null,
view.status === "paused" ? (0, import_react5.createElement)("button", { type: "button", className: "bt-soft bt-soft-sm", onClick: () => control("resume") }, t("Resume")) : null,
- live ? (0, import_react5.createElement)("button", {
+ view.status === "active" || view.status === "paused" ? (0, import_react5.createElement)("button", {
type: "button",
className: "bt-soft bt-soft-sm bt-goal-danger",
"data-armed": armed || void 0,
@@ -4201,52 +4242,6 @@ function GoalPanel({ goal, view, room: room2, roster, actions, working }) {
view.status === "complete" || view.status === "stopped" ? (0, import_react5.createElement)("button", { type: "button", className: "bt-soft bt-soft-sm", onClick: () => control("clear") }, t("Clear")) : null,
view.status === "drafting" ? (0, import_react5.createElement)("button", { type: "button", className: "bt-soft bt-soft-sm", onClick: () => control("clear") }, t("Cancel")) : null
)
- ),
- (0, import_react5.createElement)(
- "div",
- { className: "bt-goal-body" },
- view.status === "drafting" ? (0, import_react5.createElement)(
- "div",
- { key: "draft", className: "bt-goal-sec" },
- (0, import_react5.createElement)("div", { className: "bt-goal-text" }, t("{admin} is aligning the goal with you in the chat.", { admin })),
- goal.brief ? (0, import_react5.createElement)("div", { className: "bt-goal-text" }, goal.brief) : null
- ) : null,
- goal.objective ? sec("objective", t("Objective"), goal.objective) : null,
- goal.acceptance ? sec("acceptance", t("Done when"), goal.acceptance) : null,
- goal.constraints?.length > 0 ? sec("rules", t("Rules"), (0, import_react5.createElement)(
- "ul",
- { className: "bt-goal-rules" },
- goal.constraints.map((rule, i) => (0, import_react5.createElement)("li", { key: i }, rule))
- )) : null,
- view.stages.length > 0 ? (0, import_react5.createElement)(
- "div",
- { key: "stages", className: "bt-goal-stages" },
- view.stages.map((stage, i) => (0, import_react5.createElement)(GoalStage, {
- key: stage.n,
- stage,
- open: expanded === i,
- working,
- onToggle: () => setExpanded(expanded === i ? -1 : i)
- }))
- ) : null,
- view.status === "paused" ? (0, import_react5.createElement)(
- "div",
- { key: "paused", className: "bt-goal-sec" },
- (0, import_react5.createElement)("div", { className: "bt-goal-text" }, t("Paused. Write in the group to correct the direction; the admin updates the goal.")),
- working.size > 0 ? (0, import_react5.createElement)("button", {
- type: "button",
- className: "bt-soft bt-soft-sm",
- onClick: () => void Promise.resolve(actions.stopRoomWork(room2.id)).catch((error) => actions.reportError(error, "stop"))
- }, t("Stop current work too")) : null
- ) : null,
- view.idle === true && view.status === "active" ? (0, import_react5.createElement)("div", { key: "idle", className: "bt-goal-text" }, t("{admin} is waiting for you.", { admin })) : null,
- view.status === "complete" ? (0, import_react5.createElement)(
- import_react5.Fragment,
- { key: "done" },
- goal.summary ? sec("summary", t("Summary"), goal.summary) : null,
- goal.evidence ? sec("evidence", t("Evidence"), goal.evidence) : null
- ) : null,
- view.status === "stopped" && goal.reason ? (0, import_react5.createElement)("div", { key: "reason", className: "bt-goal-text" }, goal.reason) : null
)
);
}
@@ -4336,7 +4331,7 @@ function GoalIsland({ room: room2, goal, view, open, composing, roomWork, roster
import_react5.Fragment,
null,
(0, import_react5.createElement)(GoalBar, { view, open, room: room2, actions }),
- open ? (0, import_react5.createElement)(GoalPanel, { goal, view, room: room2, roster, actions, working }) : null
+ open ? (0, import_react5.createElement)(GoalPanel, { goal, view, room: room2, actions, working }) : null
)
)
);
@@ -4390,42 +4385,54 @@ var GOAL_CSS = `
.bt-goal-chev{flex:none;display:inline-flex;color:var(--bt-ink-3)}
.bt-goal-chev svg{width:14px;height:14px;transition:${spring(SPRING_SHAPE, "transform")}}
.bt-goal-bar[aria-expanded=true] .bt-goal-chev svg{transform:rotate(180deg)}
-.bt-goal-panel{display:flex;flex-direction:column;max-height:min(62vh,520px);overflow-y:auto;overflow-x:hidden;border-radius:0 0 18px 18px;animation:bt-veil-in .22s ease-out backwards}
-.bt-goal-head{display:flex;align-items:flex-start;gap:8px;padding:12px 14px 0}
-.bt-goal-title{flex:0 1 auto;min-width:0;font-size:15px;line-height:20px;font-weight:600;overflow-wrap:anywhere}
-.bt-goal-acts{display:flex;align-items:center;gap:6px;flex:none;margin-left:auto}
-.bt-goal-acts .bt-icon-btn{margin:-4px -6px -4px 0}
-.bt-goal-body{display:flex;flex-direction:column;gap:10px;padding:10px 14px 14px;font-size:13px;line-height:18px;color:var(--bt-ink)}
+/* The bar's extras hand off to the open panel and give their room to the label. */
+.bt-island[data-open] .bt-goal-segs,.bt-island[data-open] .bt-goal-faces{display:none}
+.bt-island[data-open] .bt-goal-chev{margin-left:auto}
+.bt-goal-panel{display:flex;flex-direction:column;max-height:min(62vh,520px);overflow:hidden;border-radius:0 0 18px 18px;animation:bt-veil-in .22s ease-out backwards}
+.bt-goal-body{flex:1 1 auto;min-height:0;overflow-y:auto;overflow-x:hidden}
+/* The stepper: one shrinking node per stage on a hairline. */
+.bt-goal-steps{display:flex;align-items:center;gap:6px;padding:10px 14px 0}
+.bt-goal-step{position:relative;flex:0 1 20px;min-width:8px;height:20px;display:flex;align-items:center;justify-content:center;border:0;background:none;cursor:pointer;padding:0}
+.bt-goal-step::before{content:"";position:absolute;left:-3px;right:-3px;top:50%;height:1px;background:var(--bt-line-2)}
+.bt-goal-step:first-child::before{left:50%}
+.bt-goal-step:last-child::before{right:50%}
+.bt-goal-node{position:relative;z-index:1;box-sizing:border-box;width:min(20px,100%);aspect-ratio:1;border-radius:50%;display:flex;align-items:center;justify-content:center;overflow:hidden;background:var(--bt-main);border:1.5px solid var(--bt-line-2);color:var(--bt-ink-3);font-size:10px;line-height:1;font-variant-numeric:tabular-nums}
+.bt-goal-node>svg{width:12px;height:12px}
+.bt-goal-step[data-step=passed]>.bt-goal-node{background:var(--bt-green);border-color:var(--bt-green);color:var(--bt-main)}
+.bt-goal-step[data-step=current]>.bt-goal-node{border-color:var(--bt-accent);color:var(--bt-accent);font-weight:600}
+.bt-goal-step[data-step=waiting]>.bt-goal-node{border-color:var(--bt-star);color:var(--bt-star);font-weight:600}
+.bt-goal-step[data-sel]:not([aria-current])>.bt-goal-node{box-shadow:0 0 0 1.5px var(--bt-ink)}
+.bt-goal-step.bt-goal-mini .bt-goal-node{font-size:0}
+/* The selected stage below the stepper. */
+.bt-goal-bstage{display:flex;flex-direction:column;gap:8px;padding:10px 14px;font-size:13px;line-height:18px;animation:bt-veil-in .22s ease-out backwards}
+.bt-goal-bline{display:flex;align-items:baseline;gap:8px}
+.bt-goal-btitle{flex:1 1 auto;font-weight:600}
+.bt-goal-back{flex:none;border:0;background:none;padding:0;font:inherit;font-size:12px;line-height:16px;color:var(--bt-accent);cursor:pointer}
+.bt-goal-btext{overflow-wrap:anywhere}
+.bt-goal-line{display:flex;gap:6px;min-width:0;font-size:12px;line-height:16px}
.bt-goal-sec{display:flex;flex-direction:column;gap:4px;min-width:0}
-.bt-goal-sub{font-size:12px;line-height:16px;font-weight:600;color:var(--bt-ink-2)}
+.bt-goal-sub{flex:none;font-size:12px;line-height:16px;font-weight:600;color:var(--bt-ink-2)}
+.bt-goal-acc{color:var(--bt-ink-2);overflow-wrap:anywhere}
+.bt-goal-rw{font-size:12px;line-height:16px;color:var(--bt-ink-2);overflow-wrap:anywhere}
.bt-goal-text{overflow-wrap:anywhere}
.bt-goal-rules{margin:0;padding-left:18px}
-.bt-goal-line{display:flex;gap:6px;min-width:0;overflow-wrap:anywhere}
-.bt-goal-line .bt-goal-sub{flex:none}
-.bt-goal-evi{font-size:12px;line-height:16px;color:var(--bt-ink-3);overflow-wrap:anywhere;display:-webkit-box;-webkit-line-clamp:3;-webkit-box-orient:vertical;overflow:hidden}
-.bt-goal-stages{display:flex;flex-direction:column;gap:6px}
-.bt-goal-stage{border:1px solid var(--bt-line);border-radius:10px;overflow:hidden}
-.bt-goal-sh{display:flex;align-items:center;gap:8px;width:100%;min-width:0;box-sizing:border-box;padding:8px 10px;border:0;background:none;color:var(--bt-ink);font:inherit;font-size:13px;line-height:18px;cursor:pointer;text-align:left;transition:background-color .12s ease}
-.bt-goal-sh:hover{background:var(--bt-hover)}
-.bt-goal-sh[aria-expanded=true]{border-bottom:.5px solid var(--bt-line)}
-.bt-goal-sg{flex:none;width:14px;height:14px;display:inline-flex;align-items:center;justify-content:center;color:var(--bt-ink-3)}
-.bt-goal-sg::before{content:"○";font-size:12px;line-height:1}
-.bt-goal-sg[data-sg=passed]::before{content:"✓";color:var(--bt-green)}
-.bt-goal-sg[data-sg=current]::before{content:"●";color:var(--bt-accent);font-size:9px}
-.bt-goal-st{flex:0 1 auto;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
-.bt-goal-chip{flex:none;max-width:120px;font-size:11px;line-height:15px;padding:1px 6px;border-radius:4px;background:var(--bt-tag-bg);color:var(--bt-tag-ink);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
-.bt-goal-chip[data-chip=current],.bt-goal-chip[data-chip=checking]{background:color-mix(in srgb,var(--bt-accent) 12%,transparent);color:var(--bt-accent)}
-.bt-goal-chip[data-chip=passed],.bt-goal-chip[data-chip=done]{background:color-mix(in srgb,var(--bt-green) 14%,transparent);color:var(--bt-green)}
-.bt-goal-chip[data-chip=rework]{background:color-mix(in srgb,var(--bt-star) 14%,transparent);color:var(--bt-ink-2)}
-.bt-goal-sbody{display:flex;flex-direction:column;gap:8px;padding:8px 10px 10px}
+.bt-goal-evi{font-size:12px;line-height:16px;color:var(--bt-ink-2);overflow-wrap:anywhere;display:-webkit-box;-webkit-line-clamp:3;-webkit-box-orient:vertical;overflow:hidden}
.bt-goal-task{display:flex;align-items:flex-start;gap:8px;min-width:0}
-.bt-goal-task .bt-mark{margin-top:1px}
-.bt-goal-task-body{flex:0 1 auto;min-width:0;display:flex;flex-direction:column}
-.bt-goal-task-line{display:flex;min-width:0}
-.bt-goal-task-name{font-weight:500;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
-.bt-goal-task-text{overflow-wrap:anywhere}
-.bt-goal-task-note{font-size:12px;line-height:16px;color:var(--bt-ink-3);overflow-wrap:anywhere}
-.bt-goal-task>.bt-goal-chip{margin-left:auto}
+.bt-goal-task[data-task=pending]{opacity:.55}
+.bt-goal-tav{position:relative;flex:none;display:inline-flex;margin-top:1px}
+.bt-goal-tdone{position:absolute;right:-2px;bottom:-2px;width:12px;height:12px;border-radius:50%;background:var(--bt-green);color:var(--bt-main);display:inline-flex;align-items:center;justify-content:center;box-shadow:0 0 0 1.5px var(--bt-main)}
+.bt-goal-tdone svg{width:9px;height:9px}
+.bt-goal-ttext{flex:0 1 auto;min-width:0;overflow-wrap:anywhere}
+.bt-goal-tname{font-weight:500}
+.bt-goal-ckbody{display:flex;flex-direction:column;gap:10px;padding:0 14px 10px;font-size:13px;line-height:18px;text-align:left}
+/* The bottom row: disclosure on the left, controls on the right. */
+.bt-goal-foot{display:flex;align-items:center;gap:8px;height:40px;flex:none;padding:0 8px 0 14px;border-top:.5px solid var(--bt-line)}
+.bt-goal-checks{display:inline-flex;align-items:center;gap:4px;border:0;background:none;padding:4px 6px;margin-left:-6px;border-radius:6px;font:inherit;font-size:12px;line-height:16px;color:var(--bt-ink-2);cursor:pointer}
+.bt-goal-checks:hover{background:var(--bt-hover)}
+.bt-goal-mchev{display:inline-flex;width:14px;height:14px;color:var(--bt-ink-3)}
+.bt-goal-mchev svg{width:14px;height:14px;transition:${spring(SPRING_SHAPE, "transform")}}
+.bt-goal-checks[aria-expanded=true] .bt-goal-mchev svg{transform:rotate(180deg)}
+.bt-goal-facts{display:flex;align-items:center;gap:6px;flex:none;margin-left:auto}
.bt-goal-danger{color:var(--bt-danger)}
.bt-goal-danger[data-armed]{background:color-mix(in srgb,var(--bt-danger) 10%,transparent)}
.bt-goal-compose{display:flex;flex-direction:column;gap:8px;padding:12px 14px}
@@ -10829,7 +10836,7 @@ function HeaderPill({ sessionId, useRoster, useSessions, useSessionStatus, useSe
(0, import_react21.createElement)("span", { className: "bt-pill-goal" }, (0, import_react21.createElement)("span", { className: "bt-pill-ico", "aria-hidden": true }, (0, import_react21.createElement)(GoalIcon)), (0, import_react21.createElement)("span", { className: "bt-pill-title" }, view.title)),
(0, import_react21.createElement)("span", { className: "bt-pill-name" }, name)
) : (0, import_react21.createElement)("span", { className: "bt-pill-name" }, away ? t("Back to chat") : bot?.name ?? room2?.name ?? (title || t("New chat"))),
- goalShown && goal.status !== "drafting" ? (0, import_react21.createElement)("span", { className: "bt-pill-count" }, `${view.done}/${view.count}`) : null,
+ goalShown && view?.number !== void 0 ? (0, import_react21.createElement)("span", { className: "bt-pill-count" }, `${view.number}/${view.count}`) : null,
(0, import_react21.createElement)(MemoryNotice, { shown: memoryNotice }),
(0, import_react21.createElement)("span", { className: "bt-pill-go", "aria-hidden": true }, (0, import_react21.createElement)(GoArrow))
);
diff --git a/ds-bot/src/client/goal.js b/ds-bot/src/client/goal.js
index 70e5c2e5..56e55963 100644
--- a/ds-bot/src/client/goal.js
+++ b/ds-bot/src/client/goal.js
@@ -24,10 +24,9 @@ export const hasGoalAdmin = (room, roster) => room !== undefined
export const canSetGoal = (room, roster) => hasGoalAdmin(room, roster)
&& room.goal?.status !== 'active' && room.goal?.status !== 'paused'
-const stageRef = (n, count) => t('Stage {n}/{count}', { n, count })
-
// What the island and panel draw, as plain data: goal + live room work in, the
-// bar's label, the stage segments, the faces and the panel's stage rows out.
+// capsule number, the bar's label, the stage segments, the faces and the
+// panel's stage rows out.
export function goalView(goal, { roster = {}, roomWork = [] } = {}) {
if (goal === null || goal === undefined) return null
const stages = goal.stages ?? []
@@ -35,14 +34,20 @@ export function goalView(goal, { roster = {}, roomWork = [] } = {}) {
const at = goal.current
const current = RUNNING.has(goal.status) ? stages[at] : undefined
const checking = current !== undefined && (current.tasks ?? []).every(task => REPORTED.has(task.status))
+ // The capsule counts the stage the goal is at, not the stages done.
+ const number = goal.status === 'drafting' ? undefined
+ : goal.status === 'stopped' ? stages.filter(stage => stage.status === 'passed').length
+ : current !== undefined ? at + 1
+ : count
const barLabel =
goal.status === 'drafting' ? t('Aligning the goal with you')
: goal.status === 'stopped' ? t('Stopped')
- : goal.status === 'complete' ? `${t('Goal reached')} · ${count}/${count}`
- : goal.status === 'paused' ? (current ? `${t('Paused')} · ${stageRef(at + 1, count)}` : t('Paused'))
- : goal.idle === true ? (current ? `${t('Waiting for you')} · ${stageRef(at + 1, count)}` : t('Waiting for you'))
- : current ? t('Stage {n}/{count} · {title}', { n: at + 1, count, title: current.title })
- : t('Final check')
+ : goal.status === 'complete' ? t('Goal reached')
+ : goal.status === 'paused' ? (current ? t('Paused · {title}', { title: current.title }) : t('Paused'))
+ : goal.idle === true ? (current ? t('Waiting for you · {title}', { title: current.title }) : t('Waiting for you'))
+ : current === undefined ? t('Final check')
+ : checking ? t('Checking · {title}', { title: current.title })
+ : current.title
const segments = stages.map((stage, i) => (stage.status === 'passed' ? 'done'
: i === at && goal.status === 'paused' ? 'paused'
: i === at && goal.status === 'active' ? (checking ? 'checking' : 'current')
@@ -62,18 +67,17 @@ export function goalView(goal, { roster = {}, roomWork = [] } = {}) {
title: stage.title,
acceptance: stage.acceptance,
status: stage.status,
- chip: stage.status === 'passed' ? 'passed'
- : i === at && RUNNING.has(goal.status) ? (checking && goal.status === 'active' ? 'checking' : 'current')
+ kind: stage.status === 'passed' ? 'passed'
+ : i === at && RUNNING.has(goal.status) ? 'current'
: 'upcoming',
- tasks: (stage.tasks ?? []).map(task => ({ bot: roster.byId?.[task.botId], task: task.task, status: task.status, note: task.note })),
+ tasks: (stage.tasks ?? []).map(task => ({ bot: roster.byId?.[task.botId], task: task.task, status: task.status })),
evidence: stage.evidence,
reworks: stage.reworks ?? 0,
feedback: stage.feedback,
}))
return {
status: goal.status, idle: goal.idle === true, title: goal.title ?? '',
- done: stages.filter(stage => stage.status === 'passed').length, count,
- segments, barLabel, faces, stages: stageViews,
+ number, count, segments, barLabel, faces, stages: stageViews,
}
}
@@ -124,100 +128,103 @@ function GoalBar({ view, open, room, actions }) {
h('span', { className: 'bt-goal-chev', 'aria-hidden': true }, h(ChevronDownIcon)))
}
-const STAGE_CHIP = { passed: 'Passed', current: 'Current', checking: 'Checking', upcoming: 'Upcoming' }
-const TASK_CHIP = { pending: 'Not started', working: 'Working', reported: 'Reported', done: 'Done' }
-
+// One task in the selected stage: avatar carries the state (pulse while it
+// works, a small check once reported or done, dimmed before it starts).
function TaskRow({ task, working }) {
const live = working.has(task.bot?.id) || task.status === 'working'
- return h('div', { className: 'bt-goal-task' },
- task.bot ? h(BotAvatar, { bot: task.bot, size: 20, state: live ? 'working' : 'idle' }) : null,
- h('span', { className: 'bt-goal-task-body' },
- h('span', { className: 'bt-goal-task-line' },
- h('span', { className: 'bt-goal-task-name', style: task.bot ? { color: inkText(colorOf(task.bot)) } : undefined }, task.bot?.name ?? t('a Bot'))),
- h('span', { className: 'bt-goal-task-text' }, task.task),
- task.note ? h('span', { className: 'bt-goal-task-note' }, task.note) : null),
- h('span', { className: 'bt-goal-chip', 'data-chip': task.status }, t(TASK_CHIP[task.status] ?? 'Not started')))
-}
-
-function GoalStage({ stage, open, working, onToggle }) {
- return h('div', { className: 'bt-goal-stage' },
- h('button', { type: 'button', className: 'bt-goal-sh', 'aria-expanded': open, onClick: onToggle },
- h('span', { className: 'bt-goal-sg', 'data-sg': stage.chip === 'checking' ? 'current' : stage.chip, 'aria-hidden': true }),
- h('span', { className: 'bt-goal-st' }, t('Stage {n} · {title}', { n: stage.n, title: stage.title })),
- h('span', { className: 'bt-goal-chip', 'data-chip': stage.chip }, t(STAGE_CHIP[stage.chip])),
- stage.reworks > 0 ? h('span', { className: 'bt-goal-chip', 'data-chip': 'rework' }, t('Sent back ×{n}', { n: stage.reworks })) : null),
- open ? h('div', { className: 'bt-goal-sbody' },
- stage.acceptance ? h('div', { className: 'bt-goal-line' }, h('span', { className: 'bt-goal-sub' }, t('Done when')), stage.acceptance) : null,
- stage.evidence !== undefined && stage.status === 'passed'
- ? h('div', { className: 'bt-goal-evi' }, stage.evidence) : null,
- stage.feedback ? h('div', { className: 'bt-goal-line' }, h('span', { className: 'bt-goal-sub' }, t('Sent back ×{n}', { n: stage.reworks })), stage.feedback) : null,
- stage.tasks.map((task, i) => h(TaskRow, { key: i, task, working }))) : null)
+ const returned = REPORTED.has(task.status)
+ return h('div', { className: 'bt-goal-task', 'data-task': task.status === 'pending' ? 'pending' : undefined },
+ h('span', { className: 'bt-goal-tav' },
+ task.bot ? h(BotAvatar, { bot: task.bot, size: 20, state: live ? 'working' : 'idle' }) : null,
+ returned ? h('span', { className: 'bt-goal-tdone', 'aria-hidden': true }, h(CheckIcon)) : null),
+ h('span', { className: 'bt-goal-ttext' },
+ h('span', { className: 'bt-goal-tname', style: task.bot ? { color: inkText(colorOf(task.bot)) } : undefined }, task.bot?.name ?? t('a Bot')),
+ ' ', task.task))
}
const STOP_ARM_MS = 3000
-// The open pod: the whole plan — objective, checks, rules, stages with their
-// tasks — plus the controls the bar hides.
-function GoalPanel({ goal, view, room, roster, actions, working }) {
- const [expanded, setExpanded] = useState(goal.current)
+// The open pod focuses one stage: a stepper across the top, the selected
+// stage's checks and tasks under it, and a bottom row with the rest.
+function GoalPanel({ goal, view, room, actions, working }) {
+ const at = RUNNING.has(view.status) && goal.current < view.stages.length ? goal.current : -1
+ const [selected, setSelected] = useState(at)
+ const [checks, setChecks] = useState(false)
const [armed, setArmed] = useState(false)
- // The open stage follows the goal's current one as stages pass.
- useEffect(() => setExpanded(goal.current), [goal.current])
+ // The selected stage follows the goal's current one as stages pass.
+ useEffect(() => setSelected(RUNNING.has(view.status) && goal.current < view.stages.length ? goal.current : -1), [view.status, goal.current])
useEffect(() => {
if (!armed) return undefined
const timer = setTimeout(() => setArmed(false), STOP_ARM_MS)
return () => clearTimeout(timer)
}, [armed])
+ // Nodes under 14px drop their number so the stepper still fits.
+ const stepper = useRef(null)
+ useEffect(() => {
+ const box = stepper.current
+ if (box === null || typeof ResizeObserver !== 'function') return undefined
+ const measure = () => box.querySelectorAll('.bt-goal-step').forEach(node => node.classList.toggle('bt-goal-mini', node.clientWidth < 14))
+ const observer = new ResizeObserver(measure)
+ observer.observe(box)
+ measure()
+ return () => observer.disconnect()
+ }, [view.stages.length])
const control = action => void Promise.resolve(actions.goalControl(room.id, goal.id, action))
.catch(error => actions.reportError(error, 'goal'))
- const admin = roster.byId?.[room.admin]?.name ?? t('a Bot')
- const live = view.status === 'active' || view.status === 'paused'
- const statusChip = view.status === 'drafting' ? t('Drafting')
- : view.status === 'paused' ? t('Paused')
- : view.status === 'complete' ? t('Goal reached')
- : view.status === 'stopped' ? t('Stopped')
- : view.idle ? t('Waiting for you') : t('Active')
+ const stage = selected >= 0 ? view.stages[selected] : undefined
const sec = (key, label, ...body) => h('div', { key, className: 'bt-goal-sec' },
h('div', { className: 'bt-goal-sub' }, label), ...body.map((line, i) => h('div', { key: i, className: 'bt-goal-text' }, line)))
+ const hasChecks = goal.objective !== undefined || goal.acceptance !== undefined || goal.constraints?.length > 0
+ const stopWork = () => void Promise.resolve(actions.stopRoomWork(room.id)).catch(error => actions.reportError(error, 'stop'))
return h('div', { className: 'bt-goal-panel', role: 'region', 'aria-label': view.title },
- h('div', { className: 'bt-goal-head' },
- h('div', { className: 'bt-goal-title' }, view.title),
- h('span', { className: 'bt-goal-chip', 'data-chip': view.status }, statusChip),
- h('div', { className: 'bt-goal-acts' },
+ h('div', { className: 'bt-goal-body' },
+ view.status === 'drafting' ? null : h('div', { ref: stepper, className: 'bt-goal-steps', role: 'group', 'aria-label': t('Stages') },
+ view.stages.map((stageView, i) => h('button', {
+ key: stageView.n, type: 'button',
+ className: 'bt-goal-step', 'data-step': stageView.kind === 'current' && (view.status === 'paused' || view.idle === true) ? 'waiting' : stageView.kind,
+ 'data-sel': i === selected || undefined,
+ title: t('Stage {n}: {title}', { n: stageView.n, title: stageView.title }),
+ 'aria-label': t('Stage {n}: {title}', { n: stageView.n, title: stageView.title }),
+ 'aria-current': i === at ? 'step' : undefined,
+ onClick: () => setSelected(i),
+ }, h('span', { className: 'bt-goal-node' }, stageView.status === 'passed' ? h(CheckIcon) : stageView.n)))),
+ h('div', { key: `s${selected}`, className: 'bt-goal-bstage' },
+ view.status === 'drafting' ? (goal.brief ? h('div', { className: 'bt-goal-btext' }, goal.brief) : null)
+ : stage === undefined
+ ? h(Fragment, null,
+ goal.summary ? h('div', { className: 'bt-goal-btext' }, goal.summary) : null,
+ goal.evidence ? h('div', { className: 'bt-goal-evi' }, goal.evidence) : null,
+ view.status === 'stopped' && goal.reason ? h('div', { className: 'bt-goal-evi' }, goal.reason) : null)
+ : h(Fragment, null,
+ selected !== at ? h('div', { className: 'bt-goal-bline' },
+ h('span', { className: 'bt-goal-btitle' }, t('Stage {n}: {title}', { n: stage.n, title: stage.title })),
+ at >= 0 ? h('button', { type: 'button', className: 'bt-goal-back', onClick: () => setSelected(at) }, t('Back to current stage')) : null) : null,
+ stage.acceptance ? h('div', { className: 'bt-goal-line' }, h('span', { className: 'bt-goal-sub' }, t('Done when')), h('span', { className: 'bt-goal-acc' }, stage.acceptance)) : null,
+ selected === at && stage.reworks > 0 && stage.feedback
+ ? h('div', { className: 'bt-goal-rw' }, stage.reworks > 1 ? t('Sent back ×{n}: {feedback}', { n: stage.reworks, feedback: stage.feedback }) : t('Sent back: {feedback}', { feedback: stage.feedback })) : null,
+ stage.evidence !== undefined && stage.status === 'passed' ? h('div', { className: 'bt-goal-evi' }, stage.evidence) : null,
+ stage.tasks.map((task, i) => h(TaskRow, { key: i, task, working })))),
+ checks && hasChecks ? h('div', { className: 'bt-goal-ckbody' },
+ goal.objective ? sec('objective', t('Objective'), goal.objective) : null,
+ goal.acceptance ? sec('acceptance', t('Done when'), goal.acceptance) : null,
+ goal.constraints?.length > 0 ? sec('rules', t('Rules'), h('ul', { className: 'bt-goal-rules' },
+ goal.constraints.map((rule, i) => h('li', { key: i }, rule)))) : null) : null),
+ h('div', { className: 'bt-goal-foot' },
+ hasChecks ? h('button', {
+ type: 'button', className: 'bt-goal-checks', 'aria-expanded': checks, onClick: () => setChecks(!checks),
+ }, h('span', { className: 'bt-goal-mchev', 'aria-hidden': true }, h(ChevronDownIcon)), t('Goal and checks')) : h('span'),
+ h('span', { className: 'bt-goal-facts' },
+ view.status === 'paused' && working.size > 0 ? h('button', { type: 'button', className: 'bt-goal-back', onClick: stopWork }, t('Stop current work too')) : null,
view.status === 'active' ? h('button', { type: 'button', className: 'bt-soft bt-soft-sm', onClick: () => control('pause') }, t('Pause')) : null,
view.status === 'paused' ? h('button', { type: 'button', className: 'bt-soft bt-soft-sm', onClick: () => control('resume') }, t('Resume')) : null,
- live ? h('button', {
+ view.status === 'active' || view.status === 'paused' ? h('button', {
type: 'button', className: 'bt-soft bt-soft-sm bt-goal-danger', 'data-armed': armed || undefined,
onClick: () => (armed ? control('stop') : setArmed(true)),
}, armed ? t('Stop the goal?') : t('Stop')) : null,
view.status === 'complete' || view.status === 'stopped'
? h('button', { type: 'button', className: 'bt-soft bt-soft-sm', onClick: () => control('clear') }, t('Clear')) : null,
view.status === 'drafting'
- ? h('button', { type: 'button', className: 'bt-soft bt-soft-sm', onClick: () => control('clear') }, t('Cancel')) : null)),
- h('div', { className: 'bt-goal-body' },
- view.status === 'drafting' ? h('div', { key: 'draft', className: 'bt-goal-sec' },
- h('div', { className: 'bt-goal-text' }, t('{admin} is aligning the goal with you in the chat.', { admin })),
- goal.brief ? h('div', { className: 'bt-goal-text' }, goal.brief) : null) : null,
- goal.objective ? sec('objective', t('Objective'), goal.objective) : null,
- goal.acceptance ? sec('acceptance', t('Done when'), goal.acceptance) : null,
- goal.constraints?.length > 0 ? sec('rules', t('Rules'), h('ul', { className: 'bt-goal-rules' },
- goal.constraints.map((rule, i) => h('li', { key: i }, rule)))) : null,
- view.stages.length > 0 ? h('div', { key: 'stages', className: 'bt-goal-stages' },
- view.stages.map((stage, i) => h(GoalStage, {
- key: stage.n, stage, open: expanded === i, working,
- onToggle: () => setExpanded(expanded === i ? -1 : i),
- }))) : null,
- view.status === 'paused' ? h('div', { key: 'paused', className: 'bt-goal-sec' },
- h('div', { className: 'bt-goal-text' }, t('Paused. Write in the group to correct the direction; the admin updates the goal.')),
- working.size > 0 ? h('button', {
- type: 'button', className: 'bt-soft bt-soft-sm',
- onClick: () => void Promise.resolve(actions.stopRoomWork(room.id)).catch(error => actions.reportError(error, 'stop')),
- }, t('Stop current work too')) : null) : null,
- view.idle === true && view.status === 'active' ? h('div', { key: 'idle', className: 'bt-goal-text' }, t('{admin} is waiting for you.', { admin })) : null,
- view.status === 'complete' ? h(Fragment, { key: 'done' },
- goal.summary ? sec('summary', t('Summary'), goal.summary) : null,
- goal.evidence ? sec('evidence', t('Evidence'), goal.evidence) : null) : null,
- view.status === 'stopped' && goal.reason ? h('div', { key: 'reason', className: 'bt-goal-text' }, goal.reason) : null))
+ ? h('button', { type: 'button', className: 'bt-soft bt-soft-sm', onClick: () => control('clear') }, t('Cancel')) : null)))
}
// The pod while the user writes the brief: the message goes to the admin, who
@@ -279,7 +286,7 @@ export function GoalIsland({ room, goal, view, open, composing, roomWork, roster
: view === null ? null
: h(Fragment, null,
h(GoalBar, { view, open, room, actions }),
- open ? h(GoalPanel, { goal, view, room, roster, actions, working }) : null)))
+ open ? h(GoalPanel, { goal, view, room, actions, working }) : null)))
}
export const GOAL_CSS = `
@@ -331,42 +338,54 @@ export const GOAL_CSS = `
.bt-goal-chev{flex:none;display:inline-flex;color:var(--bt-ink-3)}
.bt-goal-chev svg{width:14px;height:14px;transition:${spring(SPRING_SHAPE, 'transform')}}
.bt-goal-bar[aria-expanded=true] .bt-goal-chev svg{transform:rotate(180deg)}
-.bt-goal-panel{display:flex;flex-direction:column;max-height:min(62vh,520px);overflow-y:auto;overflow-x:hidden;border-radius:0 0 18px 18px;animation:bt-veil-in .22s ease-out backwards}
-.bt-goal-head{display:flex;align-items:flex-start;gap:8px;padding:12px 14px 0}
-.bt-goal-title{flex:0 1 auto;min-width:0;font-size:15px;line-height:20px;font-weight:600;overflow-wrap:anywhere}
-.bt-goal-acts{display:flex;align-items:center;gap:6px;flex:none;margin-left:auto}
-.bt-goal-acts .bt-icon-btn{margin:-4px -6px -4px 0}
-.bt-goal-body{display:flex;flex-direction:column;gap:10px;padding:10px 14px 14px;font-size:13px;line-height:18px;color:var(--bt-ink)}
+/* The bar's extras hand off to the open panel and give their room to the label. */
+.bt-island[data-open] .bt-goal-segs,.bt-island[data-open] .bt-goal-faces{display:none}
+.bt-island[data-open] .bt-goal-chev{margin-left:auto}
+.bt-goal-panel{display:flex;flex-direction:column;max-height:min(62vh,520px);overflow:hidden;border-radius:0 0 18px 18px;animation:bt-veil-in .22s ease-out backwards}
+.bt-goal-body{flex:1 1 auto;min-height:0;overflow-y:auto;overflow-x:hidden}
+/* The stepper: one shrinking node per stage on a hairline. */
+.bt-goal-steps{display:flex;align-items:center;gap:6px;padding:10px 14px 0}
+.bt-goal-step{position:relative;flex:0 1 20px;min-width:8px;height:20px;display:flex;align-items:center;justify-content:center;border:0;background:none;cursor:pointer;padding:0}
+.bt-goal-step::before{content:"";position:absolute;left:-3px;right:-3px;top:50%;height:1px;background:var(--bt-line-2)}
+.bt-goal-step:first-child::before{left:50%}
+.bt-goal-step:last-child::before{right:50%}
+.bt-goal-node{position:relative;z-index:1;box-sizing:border-box;width:min(20px,100%);aspect-ratio:1;border-radius:50%;display:flex;align-items:center;justify-content:center;overflow:hidden;background:var(--bt-main);border:1.5px solid var(--bt-line-2);color:var(--bt-ink-3);font-size:10px;line-height:1;font-variant-numeric:tabular-nums}
+.bt-goal-node>svg{width:12px;height:12px}
+.bt-goal-step[data-step=passed]>.bt-goal-node{background:var(--bt-green);border-color:var(--bt-green);color:var(--bt-main)}
+.bt-goal-step[data-step=current]>.bt-goal-node{border-color:var(--bt-accent);color:var(--bt-accent);font-weight:600}
+.bt-goal-step[data-step=waiting]>.bt-goal-node{border-color:var(--bt-star);color:var(--bt-star);font-weight:600}
+.bt-goal-step[data-sel]:not([aria-current])>.bt-goal-node{box-shadow:0 0 0 1.5px var(--bt-ink)}
+.bt-goal-step.bt-goal-mini .bt-goal-node{font-size:0}
+/* The selected stage below the stepper. */
+.bt-goal-bstage{display:flex;flex-direction:column;gap:8px;padding:10px 14px;font-size:13px;line-height:18px;animation:bt-veil-in .22s ease-out backwards}
+.bt-goal-bline{display:flex;align-items:baseline;gap:8px}
+.bt-goal-btitle{flex:1 1 auto;font-weight:600}
+.bt-goal-back{flex:none;border:0;background:none;padding:0;font:inherit;font-size:12px;line-height:16px;color:var(--bt-accent);cursor:pointer}
+.bt-goal-btext{overflow-wrap:anywhere}
+.bt-goal-line{display:flex;gap:6px;min-width:0;font-size:12px;line-height:16px}
.bt-goal-sec{display:flex;flex-direction:column;gap:4px;min-width:0}
-.bt-goal-sub{font-size:12px;line-height:16px;font-weight:600;color:var(--bt-ink-2)}
+.bt-goal-sub{flex:none;font-size:12px;line-height:16px;font-weight:600;color:var(--bt-ink-2)}
+.bt-goal-acc{color:var(--bt-ink-2);overflow-wrap:anywhere}
+.bt-goal-rw{font-size:12px;line-height:16px;color:var(--bt-ink-2);overflow-wrap:anywhere}
.bt-goal-text{overflow-wrap:anywhere}
.bt-goal-rules{margin:0;padding-left:18px}
-.bt-goal-line{display:flex;gap:6px;min-width:0;overflow-wrap:anywhere}
-.bt-goal-line .bt-goal-sub{flex:none}
-.bt-goal-evi{font-size:12px;line-height:16px;color:var(--bt-ink-3);overflow-wrap:anywhere;display:-webkit-box;-webkit-line-clamp:3;-webkit-box-orient:vertical;overflow:hidden}
-.bt-goal-stages{display:flex;flex-direction:column;gap:6px}
-.bt-goal-stage{border:1px solid var(--bt-line);border-radius:10px;overflow:hidden}
-.bt-goal-sh{display:flex;align-items:center;gap:8px;width:100%;min-width:0;box-sizing:border-box;padding:8px 10px;border:0;background:none;color:var(--bt-ink);font:inherit;font-size:13px;line-height:18px;cursor:pointer;text-align:left;transition:background-color .12s ease}
-.bt-goal-sh:hover{background:var(--bt-hover)}
-.bt-goal-sh[aria-expanded=true]{border-bottom:.5px solid var(--bt-line)}
-.bt-goal-sg{flex:none;width:14px;height:14px;display:inline-flex;align-items:center;justify-content:center;color:var(--bt-ink-3)}
-.bt-goal-sg::before{content:"○";font-size:12px;line-height:1}
-.bt-goal-sg[data-sg=passed]::before{content:"✓";color:var(--bt-green)}
-.bt-goal-sg[data-sg=current]::before{content:"●";color:var(--bt-accent);font-size:9px}
-.bt-goal-st{flex:0 1 auto;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
-.bt-goal-chip{flex:none;max-width:120px;font-size:11px;line-height:15px;padding:1px 6px;border-radius:4px;background:var(--bt-tag-bg);color:var(--bt-tag-ink);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
-.bt-goal-chip[data-chip=current],.bt-goal-chip[data-chip=checking]{background:color-mix(in srgb,var(--bt-accent) 12%,transparent);color:var(--bt-accent)}
-.bt-goal-chip[data-chip=passed],.bt-goal-chip[data-chip=done]{background:color-mix(in srgb,var(--bt-green) 14%,transparent);color:var(--bt-green)}
-.bt-goal-chip[data-chip=rework]{background:color-mix(in srgb,var(--bt-star) 14%,transparent);color:var(--bt-ink-2)}
-.bt-goal-sbody{display:flex;flex-direction:column;gap:8px;padding:8px 10px 10px}
+.bt-goal-evi{font-size:12px;line-height:16px;color:var(--bt-ink-2);overflow-wrap:anywhere;display:-webkit-box;-webkit-line-clamp:3;-webkit-box-orient:vertical;overflow:hidden}
.bt-goal-task{display:flex;align-items:flex-start;gap:8px;min-width:0}
-.bt-goal-task .bt-mark{margin-top:1px}
-.bt-goal-task-body{flex:0 1 auto;min-width:0;display:flex;flex-direction:column}
-.bt-goal-task-line{display:flex;min-width:0}
-.bt-goal-task-name{font-weight:500;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
-.bt-goal-task-text{overflow-wrap:anywhere}
-.bt-goal-task-note{font-size:12px;line-height:16px;color:var(--bt-ink-3);overflow-wrap:anywhere}
-.bt-goal-task>.bt-goal-chip{margin-left:auto}
+.bt-goal-task[data-task=pending]{opacity:.55}
+.bt-goal-tav{position:relative;flex:none;display:inline-flex;margin-top:1px}
+.bt-goal-tdone{position:absolute;right:-2px;bottom:-2px;width:12px;height:12px;border-radius:50%;background:var(--bt-green);color:var(--bt-main);display:inline-flex;align-items:center;justify-content:center;box-shadow:0 0 0 1.5px var(--bt-main)}
+.bt-goal-tdone svg{width:9px;height:9px}
+.bt-goal-ttext{flex:0 1 auto;min-width:0;overflow-wrap:anywhere}
+.bt-goal-tname{font-weight:500}
+.bt-goal-ckbody{display:flex;flex-direction:column;gap:10px;padding:0 14px 10px;font-size:13px;line-height:18px;text-align:left}
+/* The bottom row: disclosure on the left, controls on the right. */
+.bt-goal-foot{display:flex;align-items:center;gap:8px;height:40px;flex:none;padding:0 8px 0 14px;border-top:.5px solid var(--bt-line)}
+.bt-goal-checks{display:inline-flex;align-items:center;gap:4px;border:0;background:none;padding:4px 6px;margin-left:-6px;border-radius:6px;font:inherit;font-size:12px;line-height:16px;color:var(--bt-ink-2);cursor:pointer}
+.bt-goal-checks:hover{background:var(--bt-hover)}
+.bt-goal-mchev{display:inline-flex;width:14px;height:14px;color:var(--bt-ink-3)}
+.bt-goal-mchev svg{width:14px;height:14px;transition:${spring(SPRING_SHAPE, 'transform')}}
+.bt-goal-checks[aria-expanded=true] .bt-goal-mchev svg{transform:rotate(180deg)}
+.bt-goal-facts{display:flex;align-items:center;gap:6px;flex:none;margin-left:auto}
.bt-goal-danger{color:var(--bt-danger)}
.bt-goal-danger[data-armed]{background:color-mix(in srgb,var(--bt-danger) 10%,transparent)}
.bt-goal-compose{display:flex;flex-direction:column;gap:8px;padding:12px 14px}
diff --git a/ds-bot/src/client/header.js b/ds-bot/src/client/header.js
index 1dcc394f..038592a3 100644
--- a/ds-bot/src/client/header.js
+++ b/ds-bot/src/client/header.js
@@ -127,7 +127,7 @@ export function HeaderPill({ sessionId, useRoster, useSessions, useSessionStatus
h('span', { className: 'bt-pill-goal' }, h('span', { className: 'bt-pill-ico', 'aria-hidden': true }, h(GoalIcon)), h('span', { className: 'bt-pill-title' }, view.title)),
h('span', { className: 'bt-pill-name' }, name))
: h('span', { className: 'bt-pill-name' }, away ? t('Back to chat') : bot?.name ?? room?.name ?? (title || t('New chat'))),
- goalShown && goal.status !== 'drafting' ? h('span', { className: 'bt-pill-count' }, `${view.done}/${view.count}`) : null,
+ goalShown && view?.number !== undefined ? h('span', { className: 'bt-pill-count' }, `${view.number}/${view.count}`) : null,
h(MemoryNotice, { shown: memoryNotice }),
h('span', { className: 'bt-pill-go', 'aria-hidden': true }, h(GoArrow)))
return h('div', { className: 'bt-head' },
diff --git a/ds-bot/src/client/i18n.js b/ds-bot/src/client/i18n.js
index 7dd8c1fc..ab8767b1 100644
--- a/ds-bot/src/client/i18n.js
+++ b/ds-bot/src/client/i18n.js
@@ -624,35 +624,28 @@ const ZH = {
'This group has no admin': '这个群没有管理员',
'What should this group achieve?': '这个群要达成什么?',
Start: '开始',
- Drafting: '对齐中',
- Active: '进行中',
- Collapse: '收起',
Resume: '继续',
'Stop the goal?': '确认终止?',
'Aligning the goal with you': '正在和你对齐目标',
- '{admin} is aligning the goal with you in the chat.': '{admin} 正在聊天里和你对齐目标。',
'{admin} asks what is still open, then writes the goal with its checks and stages.': '{admin} 会先问清还没定的地方,再写出带验收方法和阶段的目标。',
Objective: '目标',
'Done when': '验收方法',
Rules: '约束',
- 'Stage {n}/{count}': '阶段 {n}/{count}',
- 'Stage {n}/{count} · {title}': '阶段 {n}/{count} · {title}',
- 'Stage {n} · {title}': '阶段 {n} · {title}',
'Final check': '总验收',
'Waiting for you': '等你',
'Goal reached': '已达成',
- Passed: '已通过',
- Current: '当前',
- Checking: '验收中',
- Upcoming: '未开始',
- 'Sent back ×{n}': '返工 ×{n}',
- 'Not started': '未开始',
- Reported: '已交回',
+ 'Stages': '阶段',
+ 'Stage {n}: {title}': '第 {n} 阶段:{title}',
+ 'Paused · {title}': '已暂停 · {title}',
+ 'Waiting for you · {title}': '等你 · {title}',
+ 'Checking · {title}': '验收中 · {title}',
+ 'Sent back: {feedback}': '返工:{feedback}',
+ 'Sent back ×{n}: {feedback}': '返工 ×{n}:{feedback}',
+ 'Back to current stage': '回到当前阶段',
+ 'Goal and checks': '目标与验收',
Summary: '总结',
Evidence: '证据',
- 'Paused. Write in the group to correct the direction; the admin updates the goal.': '已暂停。在群里说出要调整的地方,管理员会更新目标。',
'Stop current work too': '同时停止当前工作',
- '{admin} is waiting for you.': '{admin} 在等你回复。',
'Setting a goal': '正在设定目标',
'Goal set: {title} · {count} stages': '已设定目标:{title} · {count} 个阶段',
'Stage {n} passed · now stage {m}: {next}': '阶段 {n} 已通过 · 进入阶段 {m}:{next}',
diff --git a/ds-bot/test/goal-client.test.js b/ds-bot/test/goal-client.test.js
index 0eaabcc0..6497d17f 100644
--- a/ds-bot/test/goal-client.test.js
+++ b/ds-bot/test/goal-client.test.js
@@ -38,6 +38,13 @@ const { TriggerCell } = cells
const plain = value => JSON.parse(JSON.stringify(value))
const hook = value => select => select(value)
+const all = (node, cls, out = []) => {
+ if (node === null || node === undefined || typeof node !== 'object') return out
+ if (typeof node.type === 'function') return all(node.type(node.props), cls, out)
+ if ((node.props?.className ?? '').split(' ').includes(cls)) out.push(node)
+ for (const child of node.children ?? []) all(child, cls, out)
+ return out
+}
const find = (node, cls) => {
if (node === null || node === undefined || typeof node !== 'object') return null
if (typeof node.type === 'function') return find(node.type(node.props), cls)
@@ -78,17 +85,17 @@ const running = (over = {}) => ({
test('goalView reads an active goal into bar label, segments, faces and stage rows', () => {
const view = goalView(running(), { roster: team(), roomWork: [{ botId: 'c', since: 1 }] })
assert.equal(view.status, 'active')
- assert.equal(view.barLabel, 'Stage 2/4 · Second')
- assert.equal(view.done, 1)
+ assert.equal(view.barLabel, 'Second')
+ assert.equal(view.number, 2)
assert.equal(view.count, 4)
assert.deepEqual(view.segments, ['done', 'current', 'todo', 'todo'])
// c is reported pending but at work in this room, so its face animates.
assert.deepEqual(plain(view.faces.map(face => [face.bot.name, face.working])), [['Flint', true], ['Prism', true]])
- assert.equal(view.stages[1].chip, 'current')
+ assert.equal(view.stages[1].kind, 'current')
assert.equal(view.stages[1].reworks, 1)
assert.equal(view.stages[1].feedback, 'tighten the scope')
assert.equal(view.stages[0].evidence, 'first evidence')
- assert.deepEqual(plain(view.stages[1].tasks[1]), { bot: { id: 'c', name: 'Prism', sessionId: 'c' }, task: 'do c', status: 'pending', note: 'needs the plan first' })
+ assert.deepEqual(plain(view.stages[1].tasks[1]), { bot: { id: 'c', name: 'Prism', sessionId: 'c' }, task: 'do c', status: 'pending' })
})
test('goalView covers every status the bar can hold', () => {
@@ -97,15 +104,24 @@ test('goalView covers every status the bar can hold', () => {
const checking = running({ stages: stages({ status: 'active', tasks: [{ botId: 'b', task: 'do b', status: 'reported' }, { botId: 'c', task: 'do c', status: 'done' }] }) })
const checkingView = goalView(checking, { roster })
assert.deepEqual(checkingView.segments, ['done', 'checking', 'todo', 'todo'])
- assert.equal(checkingView.stages[1].chip, 'checking')
+ assert.equal(checkingView.stages[1].kind, 'current')
+ assert.equal(checkingView.barLabel, 'Checking · Second')
const passed = running({ stages: stages().map(stage => ({ ...stage, status: 'passed' })), current: 4 })
- assert.equal(goalView(passed, { roster }).barLabel, 'Final check')
- assert.equal(goalView(running({ idle: true }), { roster }).barLabel, 'Waiting for you · Stage 2/4')
+ const passedView = goalView(passed, { roster })
+ assert.equal(passedView.barLabel, 'Final check')
+ assert.equal(passedView.number, 4)
+ const idleView = goalView(running({ idle: true }), { roster })
+ assert.equal(idleView.barLabel, 'Waiting for you · Second')
const paused = goalView(running({ status: 'paused' }), { roster })
- assert.equal(paused.barLabel, 'Paused · Stage 2/4')
+ assert.equal(paused.barLabel, 'Paused · Second')
+ assert.equal(paused.number, 2)
assert.deepEqual(paused.segments, ['done', 'paused', 'todo', 'todo'])
const complete = goalView(running({ status: 'complete', stages: stages().map(stage => ({ ...stage, status: 'passed' })), current: 4 }), { roster })
- assert.equal(complete.barLabel, 'Goal reached · 4/4')
+ assert.equal(complete.barLabel, 'Goal reached')
+ assert.equal(complete.number, 4)
+ const stoppedView = goalView(running({ status: 'stopped' }), { roster })
+ assert.equal(stoppedView.number, 1)
+ assert.equal(goalView(running({ status: 'drafting', stages: [], current: -1 }), { roster }).number, undefined)
assert.deepEqual(complete.segments, ['done', 'done', 'done', 'done'])
const stopped = goalView(running({ status: 'stopped' }), { roster })
assert.equal(stopped.barLabel, 'Stopped')
@@ -163,32 +179,78 @@ test('an active goal wraps the pill in the island: title, count and the stage ba
assert.equal(island.props['data-goal'], 'active')
assert.equal(find(island, 'bt-pill-swap') !== null, true)
assert.equal(text(find(island, 'bt-pill-title')), 'Ship it')
- assert.equal(text(find(island, 'bt-pill-count')), '1/4')
+ assert.equal(text(find(island, 'bt-pill-count')), '2/4')
const bar = find(island, 'bt-goal-bar')
assert.ok(bar)
- assert.equal(text(bar).includes('Stage 2/4 · Second'), true)
+ assert.equal(text(bar).includes('Second'), true)
assert.equal(find(island, 'bt-goal-panel'), null)
})
-test('the open island draws the panel with stages, task rows and the goal controls', () => {
+test('the open island draws a stepper, the current stage and the goal controls, no chips', () => {
const node = renderHeader(team(running()), { goalOpen: 'r1' })
const panel = find(node, 'bt-goal-panel')
assert.ok(panel)
+ assert.equal(find(panel, 'bt-goal-chip'), null)
+ assert.equal(all(panel, 'bt-goal-step').length, 4)
const content = text(panel)
assert.equal(content.includes('Pause'), true)
assert.equal(content.includes('Stop'), true)
- assert.equal(content.includes('Stage 2 · Second'), true)
- assert.equal(content.includes('Sent back ×1'), true)
- assert.equal(content.includes('tighten the scope'), true)
+ // The selected (current) stage needs no title line or back button.
+ assert.equal(find(panel, 'bt-goal-btitle'), null)
+ assert.equal(content.includes('Sent back: tighten the scope'), true)
assert.equal(content.includes('do b'), true)
- assert.equal(content.includes('Working'), true)
assert.equal(content.includes('Done when'), true)
+ assert.equal(content.includes('Goal and checks'), true)
+})
+
+test('a stage other than the current one gets a title line and a way back', () => {
+ // The realm's useState is inert, so the selection hook is seeded to stage 3
+ // while the goal's current stays at 1 — the panel renders the non-current case.
+ const original = react.useState
+ react.useState = initial => [initial === 1 ? 2 : initial, () => {}]
+ try {
+ const node = renderHeader(team(running()), { goalOpen: 'r1' })
+ const panel = find(node, 'bt-goal-panel')
+ assert.equal(text(find(panel, 'bt-goal-btitle')), 'Stage 3: Third')
+ assert.equal(text(find(panel, 'bt-goal-back')), 'Back to current stage')
+ const rows = all(panel, 'bt-goal-task')
+ assert.equal(rows.length, 1)
+ assert.equal(rows[0].props['data-task'], 'pending')
+ } finally { react.useState = original }
+})
+
+test('task rows carry their state on the avatar: pulse, check badge, dimmed', () => {
+ const node = renderHeader(team(running({ stages: stages({ status: 'active', tasks: [
+ { botId: 'b', task: 'do b', status: 'working' },
+ { botId: 'c', task: 'do c', status: 'reported' },
+ { botId: 'd', task: 'do d', status: 'pending' },
+ ] }) })), { goalOpen: 'r1' })
+ const rows = all(find(node, 'bt-goal-panel'), 'bt-goal-task')
+ assert.equal(rows.length, 3)
+ assert.equal(rows[0].props['data-task'], undefined)
+ assert.equal(find(rows[0], 'bt-goal-tdone'), null)
+ assert.ok(find(rows[1], 'bt-goal-tdone'))
+ assert.equal(rows[2].props['data-task'], 'pending')
+})
+
+test('the bottom row offers the right controls per goal state', () => {
+ const panel = state => find(renderHeader(team(running(state)), { goalOpen: 'r1' }), 'bt-goal-panel')
+ const active = text(panel({}))
+ assert.equal(active.includes('Pause'), true)
+ assert.equal(active.includes('Resume'), false)
+ const complete = text(panel({ status: 'complete', stages: stages().map(stage => ({ ...stage, status: 'passed' })), current: 4, summary: 'all done', evidence: 'ev' }))
+ assert.equal(complete.includes('Clear'), true)
+ assert.equal(complete.includes('all done'), true)
+ assert.equal(complete.includes('Pause'), false)
+ const drafting = text(panel({ status: 'drafting', stages: [], current: -1, brief: 'ship v2' }))
+ assert.equal(drafting.includes('Cancel'), true)
+ assert.equal(drafting.includes('ship v2'), true)
+ assert.equal(all(panel({ status: 'drafting', stages: [], current: -1 }), 'bt-goal-step').length, 0)
})
test('a paused goal offers Resume in the panel and a stopped one Clear', () => {
const paused = find(renderHeader(team(running({ status: 'paused' })), { goalOpen: 'r1' }), 'bt-goal-panel')
assert.equal(text(paused).includes('Resume'), true)
- assert.equal(text(paused).includes('Paused. Write in the group'), true)
assert.equal(text(paused).includes('Stop current work too'), false)
const stopped = find(renderHeader(team(running({ status: 'stopped' })), { goalOpen: 'r1' }), 'bt-goal-panel')
assert.equal(text(stopped).includes('Clear'), true)