Skip to content

🤯 LobeHub - Super-Agents on Your Team. Add super-agents to the chats your team already uses.They take on work by themselves and get better every week.

💄 style(agent-goals): move the goal mechanism explainer into a how-it-works modal (#18166)

Arvin Xub046d606e431
diff --git a/.agents/acceptance/probe-mock-patterns.md b/.agents/acceptance/probe-mock-patterns.md
index 85db7b1950c..7b61bda3925 100644
--- a/.agents/acceptance/probe-mock-patterns.md
+++ b/.agents/acceptance/probe-mock-patterns.md
@@ -1149,6 +1149,24 @@ and re-tag rather than assuming the control vanished), and a `Tooltip`-wrapped c
needs a real pointer move (`Input.dispatchMouseEvent` over several coordinates, or a
dispatched `pointerover`+`mouseover` pair) before its content mounts.
+### A pool instance seeded from the login snapshot can boot signed out — `safeStorage` cannot decrypt the copied token
+
+**Situation:** `electron-dev.sh start <id>` in a worktree; the helper reports the
+renderer ready and the seeded login is present on disk.
+
+**Doesn't work:** trusting `login-status`'s "refresh token PRESENT" as proof the
+instance will come up authenticated. The pool's copied userData can fail to decrypt
+its access token — `/tmp/lobe-electron-pool/instance-<id>.log` repeats
+`Failed to decrypt access token: Error while decrypting the ciphertext provided to
+safeStorage.decryptString` — and the app boots signed out (`app-probe.sh auth` →
+`isSignedIn: false`) with a near-blank shell that reads like a broken route tree.
+Cause not established; re-seeding and restarting the same pool id does not help.
+
+**Works:** fall back to the legacy single instance (`electron-dev.sh start`, no id),
+which runs on the golden profile in place and decrypts normally. It boots on the
+loading shell once, so reload once before probing (see L-S0b). Gate on
+`app-probe.sh auth` AND `server-auth`, never on the helper's "Ready" line.
+
## Detailed references
- [Probe field notes](./references/probe-field-notes.md) — all historical
diff --git a/locales/en-US/chat.json b/locales/en-US/chat.json
index a55876eafaf..dfa5322873f 100644
--- a/locales/en-US/chat.json
+++ b/locales/en-US/chat.json
@@ -387,9 +387,8 @@
"goalEmpty.examples.metric.requirement": "At least 20 ideas, each with a headline, an angle and a target reader, deduped and excluding anything already published.",
"goalEmpty.examples.metric.tag": "Reach a target count",
"goalEmpty.examples.metric.title": "Build up 20 workable article ideas for the newsletter",
- "goalEmpty.examples.requirementPrefix": "Done when: {{requirement}}",
- "goalEmpty.examplesHint": "Click to prefill",
- "goalEmpty.examplesTitle": "Start from an example",
+ "goalEmpty.examplesTitle": "Examples",
+ "goalEmpty.howHint": "How it works",
"goalEmpty.howTitle": "What happens after you create one",
"goalEmpty.judge.bad": "“Keep an eye on competitors” — that is an activity, not an outcome. The agent can never tell when it is done.",
"goalEmpty.judge.good": "“Ship a weekly digest covering 5 named products, each with a source link” — a deliverable, a boundary, a verdict.",
diff --git a/locales/zh-CN/chat.json b/locales/zh-CN/chat.json
index 377f3c135bd..b87599c6675 100644
--- a/locales/zh-CN/chat.json
+++ b/locales/zh-CN/chat.json
@@ -387,9 +387,8 @@
"goalEmpty.examples.metric.requirement": "不少于 20 个选题,每个含标题、切入点和目标读者,去重并排除已发布过的。",
"goalEmpty.examples.metric.tag": "攒到目标量",
"goalEmpty.examples.metric.title": "为公众号攒够 20 个能写的选题",
- "goalEmpty.examples.requirementPrefix": "验收:{{requirement}}",
- "goalEmpty.examplesHint": "点击即可预填",
- "goalEmpty.examplesTitle": "从一个例子开始",
+ "goalEmpty.examplesTitle": "参考示例",
+ "goalEmpty.howHint": "如何工作",
"goalEmpty.howTitle": "创建之后会发生什么",
"goalEmpty.judge.bad": "「帮我盯一下竞品」—— 这是一件事,不是一个结果,Agent 无法判断什么时候算做完。",
"goalEmpty.judge.good": "「每周产出竞品汇总,覆盖 5 个指定产品,每条带原始链接」—— 有交付物、有边界、可判定。",
diff --git a/packages/locales/src/default/chat.ts b/packages/locales/src/default/chat.ts
index 51aa469c72c..cdf1bcbce7b 100644
--- a/packages/locales/src/default/chat.ts
+++ b/packages/locales/src/default/chat.ts
@@ -1557,9 +1557,8 @@ export default {
'At least 20 ideas, each with a headline, an angle and a target reader, deduped and excluding anything already published.',
'goalEmpty.examples.metric.tag': 'Reach a target count',
'goalEmpty.examples.metric.title': 'Build up 20 workable article ideas for the newsletter',
- 'goalEmpty.examples.requirementPrefix': 'Done when: {{requirement}}',
- 'goalEmpty.examplesHint': 'Click to prefill',
- 'goalEmpty.examplesTitle': 'Start from an example',
+ 'goalEmpty.examplesTitle': 'Examples',
+ 'goalEmpty.howHint': 'How it works',
'goalEmpty.howTitle': 'What happens after you create one',
'goalEmpty.judge.bad':
'“Keep an eye on competitors” — that is an activity, not an outcome. The agent can never tell when it is done.',
diff --git a/src/features/AgentGoals/GoalEmptyState.tsx b/src/features/AgentGoals/GoalEmptyState.tsx
index ff715735b86..a705bb9c8f7 100644
--- a/src/features/AgentGoals/GoalEmptyState.tsx
+++ b/src/features/AgentGoals/GoalEmptyState.tsx
@@ -3,17 +3,15 @@
import { Block, Flexbox, Icon, Text } from '@lobehub/ui';
import { Button } from '@lobehub/ui/base-ui';
import { createStaticStyles, cssVar } from 'antd-style';
+import type { TargetIcon } from 'lucide-react';
import {
CalendarClockIcon,
CheckIcon,
- CircleCheckBigIcon,
+ CircleHelpIcon,
InfinityIcon,
Layers3Icon,
- PlayIcon,
PlusIcon,
- RotateCcwIcon,
TablePropertiesIcon,
- TargetIcon,
XIcon,
} from 'lucide-react';
import { memo } from 'react';
@@ -21,6 +19,7 @@ import { useTranslation } from 'react-i18next';
import type { GoalExampleKey, GoalExampleSeed } from './goalExamples';
import { buildGoalExampleSeed, GOAL_EXAMPLE_KEYS } from './goalExamples';
+import { createGoalHowItWorksModal } from './GoalHowItWorksModal';
const styles = createStaticStyles(({ css }) => ({
example: css`
@@ -38,6 +37,20 @@ const styles = createStaticStyles(({ css }) => ({
background: ${cssVar.colorFillQuaternary};
}
`,
+ exampleIconBox: css`
+ display: flex;
+ flex: none;
+ align-items: center;
+ justify-content: center;
+
+ width: 32px;
+ height: 32px;
+ border-radius: ${cssVar.borderRadius};
+
+ color: ${cssVar.colorTextTertiary};
+
+ background: ${cssVar.colorFillQuaternary};
+ `,
exampleGrid: css`
display: grid;
grid-template-columns: repeat(3, minmax(0, 1fr));
@@ -47,10 +60,6 @@ const styles = createStaticStyles(({ css }) => ({
grid-template-columns: minmax(0, 1fr);
}
`,
- exampleIcon: css`
- flex: none;
- color: ${cssVar.colorTextTertiary};
- `,
hero: css`
isolation: isolate;
position: relative;
@@ -80,67 +89,30 @@ const styles = createStaticStyles(({ css }) => ({
max-width: 560px;
line-height: 1.7;
`,
+ /* Doubled selectors on purpose: base-ui's text variant pins the colour through
+ `&, &:hover, &:active`, so a single-class rule here loses the cascade and the
+ hint renders at full text weight. */
+ howHint: css`
+ margin-inline-end: -8px;
+
+ &&,
+ &&:active {
+ color: ${cssVar.colorTextTertiary};
+ }
+
+ &&:hover {
+ color: ${cssVar.colorTextSecondary};
+ }
+ `,
judge: css`
padding-block: 10px;
padding-inline: 14px;
border-radius: ${cssVar.borderRadius};
background: ${cssVar.colorFillQuaternary};
`,
- loopBack: css`
- padding-block: 10px;
- padding-inline: 12px;
- border: 1px dashed ${cssVar.colorBorderSecondary};
- border-radius: ${cssVar.borderRadius};
- `,
- loopIcon: css`
- flex: none;
- margin-block-start: 1px;
- color: ${cssVar.colorTextQuaternary};
- `,
section: css`
padding-block: 24px;
padding-inline: 40px;
- border-block-start: 1px solid ${cssVar.colorBorderSecondary};
- `,
- step: css`
- min-width: 0;
- height: 100%;
- padding-block: 14px;
- padding-inline: 16px;
- border-radius: ${cssVar.borderRadius};
-
- background: ${cssVar.colorFillQuaternary};
- `,
- stepHead: css`
- /* Reserve a stable header height so the descriptions below start on the same
- line across all three cards, even if one title wraps. */
- min-height: 20px;
- `,
- stepIndex: css`
- display: flex;
- flex: none;
- align-items: center;
- justify-content: center;
-
- width: 18px;
- height: 18px;
- border-radius: 999px;
-
- font-size: 11px;
- font-variant-numeric: tabular-nums;
- color: ${cssVar.colorTextSecondary};
-
- background: ${cssVar.colorFillSecondary};
- `,
- steps: css`
- display: grid;
- grid-template-columns: repeat(3, minmax(0, 1fr));
- gap: 10px;
- align-items: stretch;
-
- @media (width <= 860px) {
- grid-template-columns: minmax(0, 1fr);
- }
`,
}));
@@ -150,30 +122,6 @@ const EXAMPLE_ICONS: Record<GoalExampleKey, typeof TargetIcon> = {
metric: Layers3Icon,
};
-interface StepProps {
- desc: string;
- icon: typeof TargetIcon;
- index: number;
- title: string;
-}
-
-const Step = memo<StepProps>(({ desc, icon, index, title }) => (
- <Flexbox className={styles.step} gap={8}>
- <Flexbox horizontal align={'center'} className={styles.stepHead} gap={8}>
- <span className={styles.stepIndex}>{index}</span>
- <Icon icon={icon} size={14} style={{ flexShrink: 0 }} />
- <Text fontSize={13} weight={600}>
- {title}
- </Text>
- </Flexbox>
- <Text fontSize={12} style={{ lineHeight: 1.65 }} type={'secondary'}>
- {desc}
- </Text>
- </Flexbox>
-));
-
-Step.displayName = 'GoalEmptyStateStep';
-
interface GoalEmptyStateProps {
onCreate: (seed?: GoalExampleSeed) => void;
}
@@ -184,9 +132,10 @@ interface GoalEmptyStateProps {
* A goal only pays off if the user understands the bargain before making one:
* it runs autonomously, judges itself each round, and spends budget doing it.
* "Goals will appear here" taught none of that, so this screen carries the
- * concept (what a goal is), the mechanism (what happens after you create one),
- * and three seeded examples that demonstrate what a *judgeable* outcome reads
- * like.
+ * concept (what a goal is) and three seeded examples that demonstrate what a
+ * *judgeable* outcome reads like. The mechanism — what happens round after
+ * round — is one level down, behind the hint sitting opposite the examples
+ * heading, so the two things that actually start a goal stay above the fold.
*/
const GoalEmptyState = memo<GoalEmptyStateProps>(({ onCreate }) => {
const { t } = useTranslation('chat');
@@ -212,46 +161,20 @@ const GoalEmptyState = memo<GoalEmptyStateProps>(({ onCreate }) => {
</Flexbox>
</Flexbox>
- <Flexbox className={styles.section} gap={14}>
- <Text fontSize={13} type={'secondary'} weight={600}>
- {t('goalEmpty.howTitle')}
- </Text>
- <div className={styles.steps}>
- <Step
- desc={t('goalEmpty.step1.desc')}
- icon={TargetIcon}
- index={1}
- title={t('goalEmpty.step1.title')}
- />
- <Step
- desc={t('goalEmpty.step2.desc')}
- icon={PlayIcon}
- index={2}
- title={t('goalEmpty.step2.title')}
- />
- <Step
- desc={t('goalEmpty.step3.desc')}
- icon={CircleCheckBigIcon}
- index={3}
- title={t('goalEmpty.step3.title')}
- />
- </div>
- <Flexbox horizontal align={'flex-start'} className={styles.loopBack} gap={8}>
- <Icon className={styles.loopIcon} icon={RotateCcwIcon} size={13} />
- <Text fontSize={12} style={{ lineHeight: 1.6 }} type={'secondary'}>
- {t('goalEmpty.loop')}
- </Text>
- </Flexbox>
- </Flexbox>
-
<Flexbox className={styles.section} gap={12}>
<Flexbox horizontal align={'center'} justify={'space-between'}>
<Text fontSize={13} type={'secondary'} weight={600}>
{t('goalEmpty.examplesTitle')}
</Text>
- <Text fontSize={12} type={'secondary'}>
- {t('goalEmpty.examplesHint')}
- </Text>
+ <Button
+ className={styles.howHint}
+ icon={CircleHelpIcon}
+ size={'small'}
+ type={'text'}
+ onClick={() => createGoalHowItWorksModal()}
+ >
+ {t('goalEmpty.howHint')}
+ </Button>
</Flexbox>
<div className={styles.exampleGrid}>
{GOAL_EXAMPLE_KEYS.map((key) => {
@@ -259,8 +182,10 @@ const GoalEmptyState = memo<GoalEmptyStateProps>(({ onCreate }) => {
return (
<Flexbox
+ horizontal
+ align={'center'}
className={styles.example}
- gap={6}
+ gap={12}
key={key}
role={'button'}
tabIndex={0}
@@ -271,18 +196,17 @@ const GoalEmptyState = memo<GoalEmptyStateProps>(({ onCreate }) => {
onCreate(seed);
}}
>
- <Flexbox horizontal align={'center'} justify={'space-between'}>
+ <div className={styles.exampleIconBox}>
+ <Icon icon={EXAMPLE_ICONS[key]} size={16} />
+ </div>
+ <Flexbox flex={1} gap={2} style={{ minWidth: 0 }}>
<Text fontSize={11} type={'secondary'}>
{t(`goalEmpty.examples.${key}.tag` as never)}
</Text>
- <Icon className={styles.exampleIcon} icon={EXAMPLE_ICONS[key]} size={16} />
+ <Text ellipsis={{ rows: 2 }} fontSize={13} weight={500}>
+ {seed.title}
+ </Text>
</Flexbox>
- <Text fontSize={13} weight={500}>
- {seed.title}
- </Text>
- <Text ellipsis={{ rows: 2 }} fontSize={12} type={'secondary'}>
- {t('goalEmpty.examples.requirementPrefix', { requirement: seed.requirement })}
- </Text>
</Flexbox>
);
})}
diff --git a/src/features/AgentGoals/GoalHowItWorksModal/HowItWorksContent.tsx b/src/features/AgentGoals/GoalHowItWorksModal/HowItWorksContent.tsx
new file mode 100644
index 00000000000..5e23f442f24
--- /dev/null
+++ b/src/features/AgentGoals/GoalHowItWorksModal/HowItWorksContent.tsx
@@ -0,0 +1,76 @@
+'use client';
+
+import { Flexbox, Icon, Text } from '@lobehub/ui';
+import { Steps } from 'antd';
+import { createStaticStyles, cssVar } from 'antd-style';
+import { RotateCcwIcon } from 'lucide-react';
+import { memo } from 'react';
+import { useTranslation } from 'react-i18next';
+
+const styles = createStaticStyles(({ css }) => ({
+ loopBack: css`
+ padding-block: 10px;
+ padding-inline: 12px;
+ border: 1px dashed ${cssVar.colorBorderSecondary};
+ border-radius: ${cssVar.borderRadius};
+ `,
+ loopIcon: css`
+ flex: none;
+ margin-block-start: 1px;
+ color: ${cssVar.colorTextQuaternary};
+ `,
+ steps: css`
+ .ant-steps-item-title {
+ font-size: 13px;
+ font-weight: 600;
+ }
+
+ .ant-steps-item-description {
+ font-size: 12px;
+ line-height: 1.65;
+ }
+ `,
+}));
+
+/**
+ * The mechanism behind a goal: what each round does and how it ends.
+ *
+ * This used to sit inline on the empty state, where it pushed the actual
+ * starting points (the create button and the seeded examples) below the fold
+ * on every visit — including the tenth one, when the user already knows how it
+ * works. It now lives behind a hint at the bottom of the empty state, so the
+ * explanation is one click away instead of a permanent tax.
+ *
+ * The three steps run as a vertical `Steps`: they are a sequence, and the rail
+ * that connects them carries that ordering better than three separate cards.
+ * `current={-1}` leaves every step in its neutral state — this explains the
+ * loop, it does not track a run's progress.
+ */
+const HowItWorksContent = memo(() => {
+ const { t } = useTranslation('chat');
+
+ return (
+ <Flexbox gap={12}>
+ <Steps
+ className={styles.steps}
+ current={-1}
+ direction={'vertical'}
+ size={'small'}
+ items={[1, 2, 3].map((index) => ({
+ description: t(`goalEmpty.step${index}.desc` as never),
+ title: t(`goalEmpty.step${index}.title` as never),
+ }))}
+ />
+ <Flexbox horizontal align={'flex-start'} className={styles.loopBack} gap={8}>
+ <Icon className={styles.loopIcon} icon={RotateCcwIcon} size={13} />
+ <Text fontSize={12} style={{ lineHeight: 1.6 }} type={'secondary'}>
+ {t('goalEmpty.loop')}
+ </Text>
+ </Flexbox>
+ </Flexbox>
+ );
+});
+
+HowItWorksContent.displayName = 'GoalHowItWorksContent';
+
+export default HowItWorksContent;
diff --git a/src/features/AgentGoals/GoalHowItWorksModal/index.tsx b/src/features/AgentGoals/GoalHowItWorksModal/index.tsx
new file mode 100644
index 00000000000..0d00be96d5e
--- /dev/null
+++ b/src/features/AgentGoals/GoalHowItWorksModal/index.tsx
@@ -0,0 +1,15 @@
+'use client';
+
+import { createModal, type ModalInstance } from '@lobehub/ui/base-ui';
+import { t } from 'i18next';
+
+import HowItWorksContent from './HowItWorksContent';
+
+export const createGoalHowItWorksModal = (): ModalInstance =>
+ createModal({
+ content: <HowItWorksContent />,
+ footer: null,
+ maskClosable: true,
+ title: t('goalEmpty.howTitle', { ns: 'chat' }),
+ width: 'min(88vw, 520px)',
+ });