🤯 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.
TypeScript agentagent-collaborationagent-harnessloop-engineeringmcppersonal-assistantproactive-agentskillssuper-agenttask-management
♻️ refactor(goals): drop topic goal tray and rename the lab to Goals (#20144)
Arvin Xud4b693450577
diff --git a/.agents/acceptance/probe-mock-patterns.md b/.agents/acceptance/probe-mock-patterns.mdindex 745b2d326a3..7875f92336a 100644--- a/.agents/acceptance/probe-mock-patterns.md+++ b/.agents/acceptance/probe-mock-patterns.md@@ -38,7 +38,7 @@ drive / probe / capture / publish. Skip a row only when its surface AND runtime| P14 | web, electron | hetero | fixture | Seed `agency_config.heterogeneousProvider` with SQL, then cold-load; the store write drops it || P15 | web | any | fixture | Derive day boundaries from the browser's `resolvedOptions().timeZone`, never an assumed zone || P16 | web, electron | any | fixture | Clear cache tiers in the NEW document via `addScriptToEvaluateOnNewDocument`; the outgoing page re-flushes on reload |-| P17 | web | any | drive | Goals live at `/agent/:aid/goals` behind the Labs toggle `enableTopicAcceptance` |+| P17 | web | any | drive | Goals live at `/agent/:aid/goals` behind the Labs toggle `enableGoals` || P18 | electron | hetero | fixture | Local-execution CC agent plus a four-table ledger fixture keyed to the live CLI identity || P19 | web | any | auth | Seed a second user and sign in from inside a run-specific session; a signed-out context hits `/signin` || P20 | cli | any | fixture | Strip ambient topic/agent/operation ids for a LOCAL ingest; keep them for the production publish |@@ -413,7 +413,7 @@ client view model has its own `DEFAULT_LEASE_TIMEOUT_MS = 15 min` and only honorgoal with an explicit `--operation-lease-timeout-ms`. Liveness = the newer of thenode row and `runHeartbeats` (the running operation's `updated_at` served by`goal.graph`), so the A/B is: node stale + op fresh → 运行中;both stale → 失联.-Restore the forced rows (node/task/task\_topics/operation status + timestamps) after+Restore the forced rows (node/task/task_topics/operation status + timestamps) aftercapturing.#### P13 · A CLI-created topic has no trigger/status and is filtered out of the Agent paged view@@ -542,7 +542,7 @@ the skeleton, the cache tier is proven to be what the render reads.**Doesn't work:** opening `/agent/goals` directly. The goals route is nested under`/agent/:aid/goals`, so `goals` is parsed as an agentId and the page reports"assistant unavailable". The page is also gated behind the Labs toggle-`enableTopicAcceptance`; while it is off, the route silently replaces back to+`enableGoals`; while it is off, the route silently replaces back to`/agent/:aid`.**Works:** look up the seeded user's agentId@@ -551,7 +551,7 @@ public store action (it persists to user preferences and applies for the wholesession):```js-window.__LOBE_STORES.user().updateLab({ enableTopicAcceptance: true });+window.__LOBE_STORES.user().updateLab({ enableGoals: true });```Then open `/agent/<agentId>/goals`. In the create-Goal dialog, "start from blank"@@ -1366,7 +1366,7 @@ second message AND ends on a tool round, so the first turn renders as an- Pointing the openai provider at the chat-completions `llm-stub.mjs`. The openaiprovider calls `/v1/responses` (the stub 404s and the turn dies with`ProviderBizError … retrying 4/6`). Side requests (topic title) hit the same endpoint- with `stream: false` and a `text.format` json\_schema — answer them with a JSON+ with `stream: false` and a `text.format` json_schema — answer them with a JSON`{"title":…}` string, never with SSE.- Setting `model: 'gpt-4o'` on the agent. Only models present in`aiInfra().enabledAiModels` for the provider carry `abilities.functionCall`; an@@ -1417,8 +1417,8 @@ for the `agencyConfig.heterogeneousProvider` SQL seed, and the Electron auth/porcommand: 'claude' }` and call `selectRuntimeType(ctx, { isDesktop: true })`.Line order that streams live: `system/init` → `stream_event message_start` → `assistant`-(tool\_use Bash) → `user` (tool\_result) → `stream_event message_start` → `content_block_delta`-text\_delta ×N → `assistant` (full text) → `result`. The op shows as `execHeterogeneousAgent`,+(tool_use Bash) → `user` (tool_result) → `stream_event message_start` → `content_block_delta`+text_delta ×N → `assistant` (full text) → `result`. The op shows as `execHeterogeneousAgent`,the bubble shows "Claude Code is running…", and the topic persists user → assistant(Bash) →tool → assistant(text) rows. Capture mid-turn by polling the top-level `[data-index]` rows,not `body.innerText`, and key turn-2 captures on the store/DOM state you assert rather than a@@ -2522,7 +2522,7 @@ rate-limit (429) or ship JSON-disabled (HTML back).`SEARCH_PROVIDERS=searxng SEARXNG_URL=http://localhost:8888`. It aggregates realengines, so the whole product path (server search impl → result cards → toolmessage persistence) is genuine. English queries return results more reliably-than Chinese ones. One trap when the model is a tool\_call-emitting stub AND a+than Chinese ones. One trap when the model is a tool_call-emitting stub AND asynthetic context injector is active (e.g. `getGoalContext`): "last message is atool result → answer" fires on the injected pair and skips the search — key thestub's answer-mode off the NAME of the last `function_call` instead.@@ -2581,7 +2581,7 @@ adapter's seeded CLI profile (§4 CLI) points at the wrong backend, and cloud's**Doesn't work:** `dev:runtime:auth` for the CLI (cookies, not a token); aninteractive device-code login (hijacks the user's browser and is forbidden).-**Works:** insert an api\_keys row into the runtime's main database and use it as+**Works:** insert an api_keys row into the runtime's main database and use it as`LOBEHUB_CLI_API_KEY`. `key_hash` is `HMAC-SHA256(key, KEY_VAULTS_SECRET)`;`key` is the same plaintext AES-GCM encrypted with that secret as`iv:authTag:ciphertext` hex — the shapes `init-dev-env.sh seed-user` uses. Read@@ -2683,7 +2683,7 @@ the code as the variable.Vite server, letting HMR settle between measurements — same route, same data,same viewport, same injected state. In a shared working tree take the "after"copy with `cp` first and restore from it (never `git stash`, see-\[\[feedback\_no\_git\_stash\_shared\_worktrees]] in the user memory); recover the+\[\[feedback_no_git_stash_shared_worktrees]] in the user memory); recover the"before" with `git show HEAD:<path>`. When the tree sits on an unrelated branch,write the PR branch's exact file content in for the capture and record thesha256 of both sides in the evidence.diff --git a/locales/en-US/labs.json b/locales/en-US/labs.jsonindex 6e1cdd2dc6f..e0843fef9bf 100644--- a/locales/en-US/labs.json+++ b/locales/en-US/labs.json@@ -18,6 +18,8 @@"features.deviceTunnel.title": "Remote Port Links","features.evalCapture.desc": "Adds a message action that captures a conversation turn — its prior context, input and the answer it produced — as an evaluation test case.","features.evalCapture.title": "Save a turn as an eval case",+ "features.goals.desc": "Hand the agent a goal: it breaks the goal into tasks, tracks progress, and delivers the result for you to review.",+ "features.goals.title": "Goals","features.groupChat.desc": "Enable multi-agent group chat coordination.","features.groupChat.title": "Group Chat (Multi-Agent)","features.heteroSessionImport.desc": "Add an \"Import Local Agent Sessions\" entry to the topic list menu: scan local Claude Code / Codex CLI transcripts and import them as topics, with incremental sync on re-import.",@@ -42,8 +44,6 @@"features.selfLearning.title": "Self-evolving","features.taskVerify.desc": "Add an Acceptance section to the task detail: describe acceptance in one sentence and let AI generate editable verify criteria.","features.taskVerify.title": "Acceptance",- "features.topicAcceptance.desc": "Author a delivery checklist for the current topic right above the composer, so the conversation is held to standards you can edit any time.",- "features.topicAcceptance.title": "Topic Acceptance","group.desktop": "Desktop","group.general": "General","stage.alpha.desc": "Internal testing only. Not recommended for daily use yet — it may change or break at any time.",diff --git a/locales/en-US/verify.json b/locales/en-US/verify.jsonindex 99be7362029..7085429c2a5 100644--- a/locales/en-US/verify.json+++ b/locales/en-US/verify.json@@ -315,7 +315,6 @@"acceptance.tabs.checks": "Checklist","acceptance.tabs.resources": "Files","acceptance.titleFallback": "Acceptance",- "acceptance.tray.addCheck": "Add tracking item","acceptance.tray.editModal.addTitle": "Add tracking item","acceptance.tray.editModal.editTitle": "Edit tracking item","acceptance.tray.editModal.methodLabel": "How to check (optional)",@@ -324,22 +323,12 @@"acceptance.tray.editModal.namePlaceholder": "e.g. covers the key points","acceptance.tray.editModal.remove": "Delete this item","acceptance.tray.editModal.save": "Save",- "acceptance.tray.goalArmedPlaceholder": "Describe your goal — define measurable outcomes for the best result",- "acceptance.tray.goalDisarm": "Cancel goal",- "acceptance.tray.goalLabel": "Goal","acceptance.tray.goalModal.delete": "Delete goal","acceptance.tray.goalModal.editTitle": "Edit goal","acceptance.tray.goalModal.hint": "One sentence describing what a good result for this conversation looks like. Everything is tracked against it.","acceptance.tray.goalModal.placeholder": "e.g. a clear 300-word intro to RAG a beginner can follow","acceptance.tray.goalModal.save": "Save goal","acceptance.tray.goalModal.setTitle": "Set the goal",- "acceptance.tray.goalSection": "Goal",- "acceptance.tray.saveFailed.network": "You appear to be offline — the change wasn’t saved.",- "acceptance.tray.saveFailed.server": "Couldn’t save the change. Please try again.",- "acceptance.tray.section.method": "How to check",- "acceptance.tray.section.methodEmpty": "No method described yet.",- "acceptance.tray.trackCount": "· {{count}} tracked",- "acceptance.tray.trackSection": "Tracking","acceptance.verdict.inProgress": "Acceptance in progress","acceptance.viewFullReport": "View full report","acceptance.workspace.actions.delete": "Delete",diff --git a/locales/zh-CN/labs.json b/locales/zh-CN/labs.jsonindex f7a0d6a8eca..ad3b3d728f5 100644--- a/locales/zh-CN/labs.json+++ b/locales/zh-CN/labs.json@@ -18,6 +18,8 @@"features.deviceTunnel.title": "远程端口链接","features.evalCapture.desc": "在消息动作里增加一项,把一轮对话(前置上下文、本轮输入与它产生的回答)捕获成评测用例。","features.evalCapture.title": "把对话保存为评测用例",+ "features.goals.desc": "把目标交给助手:它会拆解任务、跟进进度,并交付结果供你验收。",+ "features.goals.title": "目标","features.groupChat.desc": "启用多代理协同群聊功能。","features.groupChat.title": "群聊(多代理)","features.heteroSessionImport.desc": "在话题列表菜单中新增「导入本地 Agent 会话」入口:扫描本地 Claude Code / Codex CLI 的会话记录并导入为话题,重复导入时增量同步新消息。",@@ -42,8 +44,6 @@"features.selfLearning.title": "自进化","features.taskVerify.desc": "在任务详情里增加「交付验收」模块:一句话描述验收要求,AI 自动生成可编辑的验收项。","features.taskVerify.title": "任务交付验收",- "features.topicAcceptance.desc": "在输入框上方为当前话题编写一份交付验收清单,让对话对照你随时可编辑的标准来交付。",- "features.topicAcceptance.title": "话题验收","group.desktop": "桌面端","group.general": "通用","stage.alpha.desc": "仅供内部测试,暂不建议尝鲜,随时可能变动或损坏。",diff --git a/locales/zh-CN/verify.json b/locales/zh-CN/verify.jsonindex e36afb97570..76b94f59d2d 100644--- a/locales/zh-CN/verify.json+++ b/locales/zh-CN/verify.json@@ -315,7 +315,6 @@"acceptance.tabs.checks": "检查清单","acceptance.tabs.resources": "文件","acceptance.titleFallback": "交付验收",- "acceptance.tray.addCheck": "添加跟踪项","acceptance.tray.editModal.addTitle": "添加跟踪项","acceptance.tray.editModal.editTitle": "编辑跟踪项","acceptance.tray.editModal.methodLabel": "怎么看(可选)",@@ -324,22 +323,12 @@"acceptance.tray.editModal.namePlaceholder": "例:覆盖了关键要点","acceptance.tray.editModal.remove": "删除此项","acceptance.tray.editModal.save": "保存",- "acceptance.tray.goalArmedPlaceholder": "描述你的目标,定义可衡量的成果,以获得最佳效果",- "acceptance.tray.goalDisarm": "取消目标",- "acceptance.tray.goalLabel": "目标","acceptance.tray.goalModal.delete": "删除目标","acceptance.tray.goalModal.editTitle": "编辑目标","acceptance.tray.goalModal.hint": "用一句话描述这次对话「做成什么样算好」。所有跟踪项都对照它来看。","acceptance.tray.goalModal.placeholder": "例:写一篇 300 字、初学者能看懂的 RAG 介绍","acceptance.tray.goalModal.save": "保存目标","acceptance.tray.goalModal.setTitle": "设定目标",- "acceptance.tray.goalSection": "目标",- "acceptance.tray.saveFailed.network": "网络似乎离线,改动未保存。",- "acceptance.tray.saveFailed.server": "改动保存失败,请重试。",- "acceptance.tray.section.method": "怎么看",- "acceptance.tray.section.methodEmpty": "还没有描述怎么看。",- "acceptance.tray.trackCount": "· {{count}} 项跟踪",- "acceptance.tray.trackSection": "目标跟踪","acceptance.verdict.inProgress": "验收进行中","acceptance.viewFullReport": "查看完整报告","acceptance.workspace.actions.delete": "删除",diff --git a/packages/locales/src/default/labs.ts b/packages/locales/src/default/labs.tsindex 1c879910f1b..2673873575f 100644--- a/packages/locales/src/default/labs.ts+++ b/packages/locales/src/default/labs.ts@@ -31,6 +31,9 @@ export default {'Give a port on the working device a link, so a dev server running there can be opened from here. The link only works for people who can reach that device.','features.deviceTunnel.title': 'Remote Port Links','features.heteroSessionImport.title': 'Local Agent Session Import',+ 'features.goals.desc':+ 'Hand the agent a goal: it breaks the goal into tasks, tracks progress, and delivers the result for you to review.',+ 'features.goals.title': 'Goals','features.imessage.desc':'Connect agents to iMessage through the local LobeHub Desktop BlueBubbles bridge.','features.imessage.title': 'iMessage Channel',@@ -63,9 +66,6 @@ export default {'features.selfLearning.desc':'Show what each agent has learned from real practice — its rule base, which rules actually get used, and which layers are still blank.','features.selfLearning.title': 'Self-evolving',- 'features.topicAcceptance.desc':- 'Author a delivery checklist for the current topic right above the composer, so the conversation is held to standards you can edit any time.',- 'features.topicAcceptance.title': 'Topic Acceptance','group.desktop': 'Desktop','group.general': 'General','stage.alpha.desc':diff --git a/packages/locales/src/default/verify.ts b/packages/locales/src/default/verify.tsindex 292d1b12a3d..f637a695f3f 100644--- a/packages/locales/src/default/verify.ts+++ b/packages/locales/src/default/verify.ts@@ -440,7 +440,6 @@ export default {'acceptance.subject.standalone': 'Standalone','acceptance.subject.task': 'Task','acceptance.subject.topic': 'Topic',- 'acceptance.tray.addCheck': 'Add tracking item','acceptance.tray.editModal.addTitle': 'Add tracking item','acceptance.tray.editModal.editTitle': 'Edit tracking item','acceptance.tray.editModal.methodLabel': 'How to check (optional)',@@ -449,10 +448,6 @@ export default {'acceptance.tray.editModal.namePlaceholder': 'e.g. covers the key points','acceptance.tray.editModal.remove': 'Delete this item','acceptance.tray.editModal.save': 'Save',- 'acceptance.tray.goalArmedPlaceholder':- 'Describe your goal — define measurable outcomes for the best result',- 'acceptance.tray.goalDisarm': 'Cancel goal',- 'acceptance.tray.goalLabel': 'Goal','acceptance.tray.goalModal.delete': 'Delete goal','acceptance.tray.goalModal.editTitle': 'Edit goal','acceptance.tray.goalModal.hint':@@ -461,13 +456,6 @@ export default {'e.g. a clear 300-word intro to RAG a beginner can follow','acceptance.tray.goalModal.save': 'Save goal','acceptance.tray.goalModal.setTitle': 'Set the goal',- 'acceptance.tray.goalSection': 'Goal',- 'acceptance.tray.saveFailed.network': 'You appear to be offline — the change wasn’t saved.',- 'acceptance.tray.saveFailed.server': 'Couldn’t save the change. Please try again.',- 'acceptance.tray.section.method': 'How to check',- 'acceptance.tray.section.methodEmpty': 'No method described yet.',- 'acceptance.tray.trackCount': '· {{count}} tracked',- 'acceptance.tray.trackSection': 'Tracking','acceptance.surface.other': 'Other','acceptance.titleFallback': 'Acceptance','acceptance.verdict.inProgress': 'Acceptance in progress',diff --git a/packages/types/src/user/preference.ts b/packages/types/src/user/preference.tsindex 8f8baa60a06..77dd2e30370 100644--- a/packages/types/src/user/preference.ts+++ b/packages/types/src/user/preference.ts@@ -232,8 +232,13 @@ export const UserLabSchema = z.object({*/enableGatewayMux: z.boolean().optional(),/**- * enable the per-topic acceptance tray above the composer (author a topic's- * delivery checklist inline)+ * enable Goals: hand the agent a goal it plans into tasks, tracks and delivers+ */+ enableGoals: z.boolean().optional(),+ /**+ * @deprecated Renamed to `enableGoals`. Written alongside it, and read first,+ * while older clients that only know this key are still around: their writes+ * touch only this key, so it carries the latest choice.*/enableTopicAcceptance: z.boolean().optional(),/**diff --git a/src/features/AgentGoals/useAgentLabGate.test.ts b/src/features/AgentGoals/useAgentLabGate.test.tsindex a1c237ca453..4fa3469a338 100644--- a/src/features/AgentGoals/useAgentLabGate.test.ts+++ b/src/features/AgentGoals/useAgentLabGate.test.ts@@ -4,7 +4,7 @@ import { beforeEach, describe, expect, it, vi } from 'vitest';import { useAgentLabGate } from './useAgentLabGate';/**- * The lab gate reads `preference.lab.enableTopicAcceptance`, which is `false`+ * The lab gate reads `preference.lab.enableGoals`, which is `false`* until `useInitUserState` resolves. Before the gate split "still loading"* from "settled off" via `isPreferenceInit`, the initial `false` rendered* `null` (a white flash inside the agent layout) and the redirect effect@@ -13,7 +13,7 @@ import { useAgentLabGate } from './useAgentLabGate';const userStateMock: {initError?: unknown;isUserStateInit?: boolean;- preference: { lab?: { enableTopicAcceptance?: boolean } };+ preference: { lab?: { enableGoals?: boolean } };} = { preference: {} };vi.mock('@/store/user', () => ({@@ -42,7 +42,7 @@ describe('useAgentLabGate', () => {});it('opens the gate once preference settles with the lab enabled', () => {- userStateMock.preference = { lab: { enableTopicAcceptance: true } };+ userStateMock.preference = { lab: { enableGoals: true } };const { result } = renderHook(() => useAgentLabGate());@@ -55,7 +55,7 @@ describe('useAgentLabGate', () => {});it('redirects only after preference confirms the lab is off', () => {- userStateMock.preference = { lab: { enableTopicAcceptance: false } };+ userStateMock.preference = { lab: { enableGoals: false } };const { result } = renderHook(() => useAgentLabGate());diff --git a/src/features/AgentGoals/useAgentLabGate.ts b/src/features/AgentGoals/useAgentLabGate.tsindex 237ee6464e5..f7a63139305 100644--- a/src/features/AgentGoals/useAgentLabGate.ts+++ b/src/features/AgentGoals/useAgentLabGate.ts@@ -8,7 +8,7 @@ import { labPreferSelectors, preferenceSelectors } from '@/store/user/selectors'/*** The lab gate every `/agent/:aid/goal*` route sits behind.*- * `enableTopicAcceptance` reads `preference.lab`, which is `false` until+ * `enableGoals` reads `preference.lab`, which is `false` until* `useInitUserState` resolves. Judging the gate before that settles renders a* white flash (`null` for the whole pane) and the redirect effect kicks* cold-boot visitors back to chat before their preference ever arrived.@@ -18,7 +18,7 @@ import { labPreferSelectors, preferenceSelectors } from '@/store/user/selectors'export const useAgentLabGate = () => {const initError = useUserStore((s) => s.isUserStateInitError);const isPreferenceInit = useUserStore(preferenceSelectors.isPreferenceInit);- const enabled = useUserStore(labPreferSelectors.enableTopicAcceptance);+ const enabled = useUserStore(labPreferSelectors.enableGoals);const initFailed = !!initError;diff --git a/src/features/AgentSidebar/Header/Nav.test.tsx b/src/features/AgentSidebar/Header/Nav.test.tsxindex bca04dfc390..a3770306b7f 100644--- a/src/features/AgentSidebar/Header/Nav.test.tsx+++ b/src/features/AgentSidebar/Header/Nav.test.tsx@@ -20,7 +20,7 @@ const permissionMock = vi.hoisted(() => ({}));const labMock = vi.hoisted(() => ({enableSelfLearning: true,- enableTopicAcceptance: true,+ enableGoals: true,}));vi.mock('@/features/ResourcePermission/useResourceAccess', () => ({useResourceAccess: () => ({ canEditResource: true, isAccessResolved: true }),@@ -119,8 +119,8 @@ vi.mock('@/store/user/selectors', () => ({labPreferSelectors: {enableSelfLearning: (state: { preference: { lab?: { enableSelfLearning?: boolean } } }) =>state.preference.lab?.enableSelfLearning ?? false,- enableTopicAcceptance: (state: { preference: { lab?: { enableTopicAcceptance?: boolean } } }) =>- state.preference.lab?.enableTopicAcceptance ?? false,+ enableGoals: (state: { preference: { lab?: { enableGoals?: boolean } } }) =>+ state.preference.lab?.enableGoals ?? false,},}));@@ -136,7 +136,7 @@ describe('Agent sidebar header nav', () => {permissionMock.create_content = true;permissionMock.edit_own_content = true;labMock.enableSelfLearning = true;- labMock.enableTopicAcceptance = true;+ labMock.enableGoals = true;useParamsMock.mockReturnValue({ aid: 'agt_eH4zL98zBx5u', topicId: 'tpc_2FCHvjS7d4CA' });});diff --git a/src/features/AgentSidebar/Header/Nav.tsx b/src/features/AgentSidebar/Header/Nav.tsxindex 7e58a24e98b..324aec4051e 100644--- a/src/features/AgentSidebar/Header/Nav.tsx+++ b/src/features/AgentSidebar/Header/Nav.tsx@@ -60,7 +60,7 @@ const Nav = memo(() => {const switchTopic = useChatStore((s) => s.switchTopic);const [openNewTopicOrSaveTopic] = useChatStore((s) => [s.openNewTopicOrSaveTopic]);const isNewTopicSendInFlight = useChatStore(topicSelectors.isNewTopicSendInFlight);- const enableTopicAcceptance = useUserStore(labPreferSelectors.enableTopicAcceptance);+ const enableGoals = useUserStore(labPreferSelectors.enableGoals);const enableSelfLearning = useUserStore(labPreferSelectors.enableSelfLearning);const { mutate } = useActionSWR(topicActionKeys.openNewOrSave(), openNewTopicOrSaveTopic);@@ -121,7 +121,7 @@ const Nav = memo(() => {}}/>)}- {enableTopicAcceptance && (+ {enableGoals && (<NavItemactive={isGoalsActive}icon={TargetIcon}diff --git a/src/features/AgentTasks/AgentTaskList/CreateTaskInlineEntry.test.tsx b/src/features/AgentTasks/AgentTaskList/CreateTaskInlineEntry.test.tsxindex 7883d8566d2..2489ad0341c 100644--- a/src/features/AgentTasks/AgentTaskList/CreateTaskInlineEntry.test.tsx+++ b/src/features/AgentTasks/AgentTaskList/CreateTaskInlineEntry.test.tsx@@ -252,7 +252,7 @@ vi.mock('../shared/useAgentVisibility', () => ({}));/** Flips the Labs toggles the composer still reads. */-const setLabs = (lab: { enableTopicAcceptance?: boolean }) => {+const setLabs = (lab: { enableGoals?: boolean }) => {userStateMock.lab = lab as Record<string, boolean>;};@@ -496,7 +496,7 @@ describe('CreateTaskInlineEntry', () => {describe('intent recognition', () => {beforeEach(() => {- setLabs({ enableTopicAcceptance: true });+ setLabs({ enableGoals: true });editorMarkdownMock.value = 'Write a project plan';});diff --git a/src/features/AgentTasks/AgentTaskList/CreateTaskInlineEntry.tsx b/src/features/AgentTasks/AgentTaskList/CreateTaskInlineEntry.tsxindex 65cdfcc5fe4..e8efc66e73a 100644--- a/src/features/AgentTasks/AgentTaskList/CreateTaskInlineEntry.tsx+++ b/src/features/AgentTasks/AgentTaskList/CreateTaskInlineEntry.tsx@@ -124,7 +124,7 @@ const CreateTaskInlineEntry = memo<CreateTaskInlineEntryProps>((props) => {// Reading the draft is what submit does now. It only stops for confirmation// when it found something the user alone can settle, so the escape hatch is// the dropdown's "create directly" rather than a setting nobody would find.- const canCreateGoal = useUserStore(labPreferSelectors.enableTopicAcceptance);+ const canCreateGoal = useUserStore(labPreferSelectors.enableGoals);const [analysis, setAnalysis] = useState<TaskIntentAnalysis | null>(null);const [intentTitle, setIntentTitle] = useState('');const [intentAnswers, setIntentAnswers] = useState<ClarificationAnswers>({});diff --git a/src/features/ChatInput/ActionBar/Plus/index.tsx b/src/features/ChatInput/ActionBar/Plus/index.tsxindex d1db3e153c7..21b00d81c6c 100644--- a/src/features/ChatInput/ActionBar/Plus/index.tsx+++ b/src/features/ChatInput/ActionBar/Plus/index.tsx@@ -284,7 +284,7 @@ const usePlusMenuItems = ({ close }: { close: () => void }): ActionDropdownMenuIconst { updateAgentChatConfig } = useUpdateAgentConfig();// Goal creation is lab-gated while the product surface is being rolled out.- const enableTopicAcceptance = useUserStore(labPreferSelectors.enableTopicAcceptance);+ const enableGoals = useUserStore(labPreferSelectors.enableGoals);const upload = useFileStore((s) => s.uploadChatFiles);const { enableKnowledgeBase } = useServerConfigStore(featureFlagsSelectors);@@ -687,7 +687,7 @@ const usePlusMenuItems = ({ close }: { close: () => void }): ActionDropdownMenuI// Goal creation has one canonical entry: drop the goal chip at the head of// the composer. The agent then plans and calls lobe-goal.createGoal,// regardless of whether this conversation already has a topic.- const acceptanceItems: ActionDropdownMenuItems = enableTopicAcceptance+ const acceptanceItems: ActionDropdownMenuItems = enableGoals? [{icon: TargetIcon,@@ -717,7 +717,7 @@ const usePlusMenuItems = ({ close }: { close: () => void }): ActionDropdownMenuIagentId,activeSearchOption,canConfigureResource,- enableTopicAcceptance,+ enableGoals,canUploadImage,canUploadVideo,canUploadAudio,diff --git a/src/features/Conversation/ChatInput/LinkedGoalTray/index.tsx b/src/features/Conversation/ChatInput/LinkedGoalTray/index.tsxindex 185bdbb9db0..4ac00bb9bcb 100644--- a/src/features/Conversation/ChatInput/LinkedGoalTray/index.tsx+++ b/src/features/Conversation/ChatInput/LinkedGoalTray/index.tsx@@ -100,15 +100,12 @@ interface LinkedGoalTrayProps {/*** The goals this conversation planned, floating above the composer with their- * live status (behind the `enableTopicAcceptance` lab). The conversation is the+ * live status (behind the `enableGoals` lab). The conversation is the* goal's planning conversation, so its progress belongs here — clicking a row* opens the whole goal in the Portal, beside the chat that shaped it.- *- * Not the topic checklist (`VerifyTray/GoalTray`): that is a sentence and- * tracking checks stored on the topic; this points at real `goals` rows.*/const LinkedGoalTray = memo<LinkedGoalTrayProps>(({ topAttached }) => {- const enabled = useUserStore(labPreferSelectors.enableTopicAcceptance);+ const enabled = useUserStore(labPreferSelectors.enableGoals);const topicId = useConversationStore((s) => s.context.topicId);const displayMessages = useConversationStore(dataSelectors.displayMessages);const useFetchTopicGoals = useGoalStore((s) => s.useFetchTopicGoals);diff --git a/src/features/Conversation/ChatInput/VerifyTray/CheckItem.tsx b/src/features/Conversation/ChatInput/VerifyTray/CheckItem.tsxdeleted file mode 100644index 35c83d7e63a..00000000000--- a/src/features/Conversation/ChatInput/VerifyTray/CheckItem.tsx+++ /dev/null@@ -1,111 +0,0 @@-'use client';--import { Flexbox, Icon, Tooltip } from '@lobehub/ui';-import { ActionIcon, Text } from '@lobehub/ui/base-ui';-import { createStaticStyles, cssVar, cx } from 'antd-style';-import { ChevronDown, ChevronRight, CircleDashed, PencilIcon } from 'lucide-react';-import { memo, useState } from 'react';-import { useTranslation } from 'react-i18next';--import { openCheckEditModal } from './EditModal';-import type { TrayCheck } from './types';--const styles = createStaticStyles(({ css }) => ({- detail: css`- padding-block: 2px 4px;- padding-inline-start: 22px;- `,- head: css`- cursor: pointer;- user-select: none;- `,- method: css`- color: ${cssVar.colorTextSecondary};- `,- row: css`- padding-block: 6px;- padding-inline: 14px;- border-radius: ${cssVar.borderRadius};-- &:hover {- background: ${cssVar.colorFillQuaternary};- }-- &:hover .verify-tray-row-edit {- opacity: 1;- }- `,- rowEdit: css`- opacity: 0;- transition: opacity 0.15s;- `,- secLabel: css`- font-size: 10px;- color: ${cssVar.colorTextQuaternary};- text-transform: uppercase;- letter-spacing: 0.04em;- `,-}));--interface CheckItemProps {- check: TrayCheck;- onRemove: () => void;- onUpdate: (patch: Partial<Omit<TrayCheck, 'id'>>) => void;-}--const CheckItem = memo<CheckItemProps>(({ check, onRemove, onUpdate }) => {- const { t } = useTranslation('verify');- const [open, setOpen] = useState(false);-- return (- <Flexbox className={styles.row} gap={8}>- <Flexbox- horizontal- align={'center'}- className={styles.head}- gap={8}- justify={'space-between'}- onClick={() => setOpen(!open)}- >- <Flexbox horizontal align={'center'} flex={1} gap={8} style={{ minWidth: 0 }}>- {/* Draft item has no verdict yet — a neutral glyph, not a false pass/fail. */}- <Icon color={cssVar.colorTextQuaternary} icon={CircleDashed} size={14} />- <Text ellipsis fontSize={13}>- {check.name}- </Text>- </Flexbox>- <Flexbox horizontal align={'center'} gap={4} style={{ flexShrink: 0 }}>- <Tooltip title={t('acceptance.tray.editModal.editTitle')}>- <ActionIcon- className={cx('verify-tray-row-edit', styles.rowEdit)}- icon={PencilIcon}- size={'small'}- onClick={(e) => {- e.stopPropagation();- openCheckEditModal({ initial: check, onRemove, onSubmit: onUpdate });- }}- />- </Tooltip>- <Icon- color={cssVar.colorTextQuaternary}- icon={open ? ChevronDown : ChevronRight}- size={14}- />- </Flexbox>- </Flexbox>-- {open && (- <Flexbox className={styles.detail} gap={5}>- <Text className={styles.secLabel}>{t('acceptance.tray.section.method')}</Text>- <Text className={styles.method} fontSize={12}>- {check.method || t('acceptance.tray.section.methodEmpty')}- </Text>- </Flexbox>- )}- </Flexbox>- );-});--CheckItem.displayName = 'VerifyTrayCheckItem';--export default CheckItem;diff --git a/src/features/Conversation/ChatInput/VerifyTray/GoalArmedChip.tsx b/src/features/Conversation/ChatInput/VerifyTray/GoalArmedChip.tsxdeleted file mode 100644index 6679847eb1a..00000000000--- a/src/features/Conversation/ChatInput/VerifyTray/GoalArmedChip.tsx+++ /dev/null@@ -1,112 +0,0 @@-'use client';--import { Icon, Tooltip } from '@lobehub/ui';-import { createStaticStyles, cssVar, cx } from 'antd-style';-import { TargetIcon, XIcon } from 'lucide-react';-import { memo } from 'react';-import { useTranslation } from 'react-i18next';--import { useUserStore } from '@/store/user';-import { labPreferSelectors } from '@/store/user/selectors';--import { useConversationStore } from '../../store';-import { useGoalArmStore } from './goalArmStore';--const styles = createStaticStyles(({ css }) => ({- chip: css`- cursor: pointer;-- display: inline-flex;- gap: 4px;- align-items: center;-- height: 28px;- padding-inline: 8px;- border-radius: 8px;-- font-size: 12px;- color: ${cssVar.colorTextTertiary};-- transition:- color 0.2s,- background 0.2s;-- /* Reveal the "close" affordance on hover: the leading target icon crossfades- into an ✕, signalling the whole chip cancels the armed goal on click. */- &:hover {- color: ${cssVar.colorText};- background: ${cssVar.colorFillTertiary};- }-- &:hover .goal-armed-target {- opacity: 0;- }-- &:hover .goal-armed-close {- opacity: 1;- }- `,- iconClose: css`- position: absolute;- inset: 0;- opacity: 0;- transition: opacity 0.15s;- `,- iconSlot: css`- position: relative;-- display: inline-flex;- flex: none;-- width: 14px;- height: 14px;- `,- iconTarget: css`- transition: opacity 0.15s;- `,-}));--/**- * Pre-topic "armed goal" indicator — a Codex-style chip that sits inline in the- * composer action bar (next to `+`) once a goal has been armed from the `+`- * menu but no topic exists yet, i.e. the next message the user sends becomes the- * goal. Clicking it cancels the arm.- *- * It is only ever the pre-topic armed state: the moment a topic exists the goal- * earns its persistent home in the tray above the composer, so this chip hides.- * Self-gating (returns null unless armed) so it can be appended unconditionally- * to the action bar of every composer that renders the shared ChatInput.- *- * On hover the leading target icon crossfades into an ✕ so the "click to cancel"- * affordance is discoverable rather than hidden behind the tooltip alone.- */-const GoalArmedChip = memo(() => {- const { t } = useTranslation('verify');- const enabled = useUserStore(labPreferSelectors.enableTopicAcceptance);- const agentId = useConversationStore((s) => s.context.agentId);- const topicId = useConversationStore((s) => s.context.topicId);- const armedAt = useGoalArmStore((s) => (agentId ? s.armedAt[agentId] : undefined));- const disarm = useGoalArmStore((s) => s.disarm);-- if (!enabled || !agentId || topicId || armedAt === undefined) return null;-- return (- <Tooltip title={t('acceptance.tray.goalDisarm')}>- <div className={styles.chip} onClick={() => disarm(agentId)}>- <span className={styles.iconSlot}>- <Icon- className={cx('goal-armed-target', styles.iconTarget)}- icon={TargetIcon}- size={14}- />- <Icon className={cx('goal-armed-close', styles.iconClose)} icon={XIcon} size={14} />- </span>- <span>{t('acceptance.tray.goalLabel')}</span>- </div>- </Tooltip>- );-});--GoalArmedChip.displayName = 'GoalArmedChip';--export default GoalArmedChip;diff --git a/src/features/Conversation/ChatInput/VerifyTray/GoalTray.tsx b/src/features/Conversation/ChatInput/VerifyTray/GoalTray.tsxdeleted file mode 100644index 49fbabec8db..00000000000--- a/src/features/Conversation/ChatInput/VerifyTray/GoalTray.tsx+++ /dev/null@@ -1,216 +0,0 @@-'use client';--import { Flexbox, Icon, Tooltip } from '@lobehub/ui';-import { ActionIcon, Button, Text } from '@lobehub/ui/base-ui';-import { createStaticStyles, cssVar, cx } from 'antd-style';-import { ChevronDown, ChevronRight, PencilIcon, PlusIcon, TargetIcon } from 'lucide-react';-import { memo, useEffect, useState } from 'react';-import { useTranslation } from 'react-i18next';--import { useUserStore } from '@/store/user';-import { labPreferSelectors } from '@/store/user/selectors';--import { useConversationStore } from '../../store';-import { pickArmedMessage } from './armedMessage';-import CheckItem from './CheckItem';-import { openCheckEditModal } from './EditModal';-import { useGoalArmStore } from './goalArmStore';-import { openGoalModal } from './GoalModal';-import { useTopicGoal } from './useTopicChecklist';--const styles = createStaticStyles(({ css }) => ({- addRow: css`- padding-block: 4px;- padding-inline: 8px;- `,- container: css`- border: 1px solid ${cssVar.colorFillSecondary};- border-block-end: none;- border-start-start-radius: 12px;- border-start-end-radius: 12px;-- background: ${cssVar.colorBgElevated};- `,- containerTopAttached: css`- border-start-start-radius: 0;- border-start-end-radius: 0;- `,- goalRow: css`- padding-block: 6px 8px;- padding-inline: 12px;-- &:hover .verify-tray-goal-edit {- opacity: 1;- }- `,- goalText: css`- color: ${cssVar.colorTextSecondary};- `,- head: css`- cursor: pointer;- user-select: none;- padding-block: 6px;- padding-inline: 12px;-- &:hover {- background: ${cssVar.colorFillQuaternary};- }- `,- rowEdit: css`- opacity: 0;- transition: opacity 0.15s;- `,- secLabel: css`- font-size: 10px;- color: ${cssVar.colorTextQuaternary};- text-transform: uppercase;- letter-spacing: 0.04em;- `,- summary: css`- overflow: hidden;-- font-size: 12px;- color: ${cssVar.colorTextSecondary};- text-overflow: ellipsis;- white-space: nowrap;- `,-}));--interface GoalTrayProps {- topAttached?: boolean;-}--/**- * Topic Goal tray, floating just above the composer once a topic exists (behind- * the `enableTopicAcceptance` lab). Before a topic is created the goal entry- * lives in the composer "+" menu; the moment the conversation has a topic, the- * goal earns a persistent home above the input — the "sent" state the user- * asked for.- *- * When the user armed the goal from the "+" menu before sending, the first- * message they send becomes the goal (the message IS the goal); otherwise the- * goal is only ever set explicitly via the "+" menu / pencil. Tracking checks- * live under it.- */-const GoalTray = memo<GoalTrayProps>(({ topAttached }) => {- const { t } = useTranslation('verify');- const enabled = useUserStore(labPreferSelectors.enableTopicAcceptance);- const topicId = useConversationStore((s) => s.context.topicId);- const agentId = useConversationStore((s) => s.context.agentId);- const displayMessages = useConversationStore((s) => s.displayMessages);- const armedAt = useGoalArmStore((s) => (agentId ? s.armedAt[agentId] : undefined));- const disarm = useGoalArmStore((s) => s.disarm);- const { goal, checks, isLoading, setGoal, addCheck, updateCheck, removeCheck } = useTopicGoal(- topicId ?? undefined,- );- const [open, setOpen] = useState(false);-- // The armed goal only applies to the topic it was armed in. Once a topic- // becomes active while armed, adopt the message the user actually armed — the- // first user message sent at or after the arm — as the goal. Older messages- // carried over from the default conversation predate the arm, so they're- // skipped (which also stops switching into a pre-existing topic from hijacking- // the arm or clobbering its saved goal). Spend the arm either way, so it never- // leaks to the next topic.- useEffect(() => {- if (!enabled || !agentId || armedAt === undefined || !topicId || isLoading) return;- if (!goal) {- const armedMessage = pickArmedMessage(displayMessages, armedAt);- if (armedMessage?.content) void setGoal(armedMessage.content);- }- disarm(agentId);- }, [enabled, agentId, armedAt, topicId, isLoading, goal, displayMessages, setGoal, disarm]);-- // The pre-topic "armed" state is surfaced as a chip in the composer action bar- // (see GoalArmedChip), not as a tray here — the tray is only the "goal set"- // home once a topic exists.- if (!enabled || !topicId || !goal) return null;-- const openAddCheck = () => openCheckEditModal({ onSubmit: (v) => addCheck(v) });- const openEditGoal = () =>- openGoalModal({- initialGoal: goal,- // Clearing the goal writes an empty requirement — the tray hides itself- // once there's no goal (tracking checks are kept, so re-setting a goal- // brings them back).- onDelete: () => setGoal(''),- onSubmit: (v) => setGoal(v),- });-- return (- <Flexbox className={cx(styles.container, topAttached && styles.containerTopAttached)}>- <Flexbox- horizontal- align={'center'}- className={styles.head}- gap={8}- justify={'space-between'}- onClick={() => setOpen(!open)}- >- <Flexbox horizontal align={'center'} flex={1} gap={8} style={{ minWidth: 0 }}>- <Icon color={cssVar.colorTextSecondary} icon={TargetIcon} size={14} />- <Text strong fontSize={12} style={{ flexShrink: 0 }}>- {t('acceptance.tray.goalLabel')}- </Text>- {/* The goal sentence rides inline only while collapsed; expanded, the- "Goal" section below owns it, so showing it here too is redundant. */}- {!open && <span className={styles.summary}>{goal}</span>}- {checks.length > 0 && (- <Text fontSize={12} style={{ flexShrink: 0 }} type={'secondary'}>- {t('acceptance.tray.trackCount', { count: checks.length })}- </Text>- )}- </Flexbox>- <Icon- color={cssVar.colorTextQuaternary}- icon={open ? ChevronDown : ChevronRight}- size={14}- />- </Flexbox>-- {open && (- <>- <Flexbox className={styles.goalRow} gap={4}>- <Flexbox horizontal align={'center'} gap={8} justify={'space-between'}>- <Text className={styles.secLabel}>{t('acceptance.tray.goalSection')}</Text>- <Tooltip title={t('acceptance.tray.goalModal.editTitle')}>- <ActionIcon- className={cx('verify-tray-goal-edit', styles.rowEdit)}- icon={PencilIcon}- size={'small'}- onClick={openEditGoal}- />- </Tooltip>- </Flexbox>- <Text className={styles.goalText} fontSize={13}>- {goal}- </Text>- </Flexbox>-- {checks.length > 0 && (- <Flexbox className={styles.goalRow} gap={2} style={{ paddingBlock: 0 }}>- <Text className={styles.secLabel}>{t('acceptance.tray.trackSection')}</Text>- </Flexbox>- )}- {checks.map((check) => (- <CheckItem- check={check}- key={check.id}- onRemove={() => removeCheck(check.id)}- onUpdate={(patch) => updateCheck(check.id, patch)}- />- ))}- <Flexbox horizontal className={styles.addRow}>- <Button icon={PlusIcon} size={'small'} type={'text'} onClick={openAddCheck}>- {t('acceptance.tray.addCheck')}- </Button>- </Flexbox>- </>- )}- </Flexbox>- );-});--GoalTray.displayName = 'GoalTray';--export default GoalTray;diff --git a/src/features/Conversation/ChatInput/VerifyTray/armedMessage.test.ts b/src/features/Conversation/ChatInput/VerifyTray/armedMessage.test.tsdeleted file mode 100644index 2141f0471b4..00000000000--- a/src/features/Conversation/ChatInput/VerifyTray/armedMessage.test.ts+++ /dev/null@@ -1,37 +0,0 @@-import { describe, expect, it } from 'vitest';--import { pickArmedMessage } from './armedMessage';--const msg = (role: string, createdAt: number, content = `${role}@${createdAt}`) => ({- content,- createdAt,- role,-});--describe('pickArmedMessage', () => {- it('adopts the message sent after arming, not an older carried-over one', () => {- // Regression: a goal armed at t=100 after the default conversation already- // had a user message at t=10 must NOT skip to that older message.- const messages = [msg('user', 10, 'carried over'), msg('user', 150, 'the armed one')];- expect(pickArmedMessage(messages, 100)?.content).toBe('the armed one');- });-- it('returns the message exactly at armedAt (inclusive)', () => {- const messages = [msg('user', 100, 'exact')];- expect(pickArmedMessage(messages, 100)?.content).toBe('exact');- });-- it('ignores assistant/tool messages', () => {- const messages = [msg('assistant', 120), msg('tool', 130), msg('user', 140, 'mine')];- expect(pickArmedMessage(messages, 100)?.content).toBe('mine');- });-- it('returns undefined when every message predates the arm (stale arm on a pre-existing topic)', () => {- const messages = [msg('user', 10), msg('assistant', 20), msg('user', 30)];- expect(pickArmedMessage(messages, 100)).toBeUndefined();- });-- it('returns undefined for an empty conversation', () => {- expect(pickArmedMessage([], 100)).toBeUndefined();- });-});diff --git a/src/features/Conversation/ChatInput/VerifyTray/armedMessage.ts b/src/features/Conversation/ChatInput/VerifyTray/armedMessage.tsdeleted file mode 100644index 625c1be2498..00000000000--- a/src/features/Conversation/ChatInput/VerifyTray/armedMessage.ts+++ /dev/null@@ -1,22 +0,0 @@-interface ArmedMessageCandidate {- content: string;- createdAt: number;- role: string;-}--/**- * The message a pre-topic goal arm actually meant: the first user message sent- * at or after the arm.- *- * A conversation can already hold earlier user messages (e.g. the default/inbox- * conversation) that get carried into the new topic. Those predate `armedAt`, so- * picking the *oldest* user message would either adopt the wrong text or — when- * its timestamp is before the arm — skip adoption entirely and lose the goal.- * Selecting the first message at/after `armedAt` both preserves the armed- * message and keeps a stale arm from hijacking a pre-existing topic (whose- * messages all predate the arm → `undefined`).- */-export const pickArmedMessage = <T extends ArmedMessageCandidate>(- messages: T[],- armedAt: number,-): T | undefined => messages.find((m) => m.role === 'user' && m.createdAt >= armedAt);diff --git a/src/features/Conversation/ChatInput/VerifyTray/goalArmStore.ts b/src/features/Conversation/ChatInput/VerifyTray/goalArmStore.tsdeleted file mode 100644index 60ad6d62da0..00000000000--- a/src/features/Conversation/ChatInput/VerifyTray/goalArmStore.ts+++ /dev/null@@ -1,37 +0,0 @@-import { create } from 'zustand';--/**- * Pre-topic "arm the goal" intent, keyed by agentId and stamped with the arm- * time.- *- * Before a conversation has a topic there is nothing to persist a goal onto, so- * the composer "+" menu instead *arms* the goal: the next message the user sends- * (the one that creates the topic) becomes that topic's goal.- *- * The stamp scopes the intent to the topic it was armed in: the tray only adopts- * a first message that post-dates the arm (so switching into a pre-existing topic- * can't hijack the intent), and it spends the arm the moment any topic becomes- * active — so a goal only ever applies to the current topic and a stray arm never- * leaks to the next one.- *- * A tiny standalone store so the "+" menu (a different store scope than the tray)- * and the tray share the intent without threading it through the big stores.- */-interface GoalArmState {- arm: (agentId: string) => void;- /** agentId → arm timestamp (ms). Absent means not armed. */- armedAt: Record<string, number>;- disarm: (agentId: string) => void;-}--export const useGoalArmStore = create<GoalArmState>((set) => ({- arm: (agentId) => set((s) => ({ armedAt: { ...s.armedAt, [agentId]: Date.now() } })),- armedAt: {},- disarm: (agentId) =>- set((s) => {- if (s.armedAt[agentId] === undefined) return s;- const next = { ...s.armedAt };- delete next[agentId];- return { armedAt: next };- }),-}));diff --git a/src/features/Conversation/ChatInput/VerifyTray/useTopicChecklist.ts b/src/features/Conversation/ChatInput/VerifyTray/useTopicChecklist.tsdeleted file mode 100644index b6e5da057a6..00000000000--- a/src/features/Conversation/ChatInput/VerifyTray/useTopicChecklist.ts+++ /dev/null@@ -1,171 +0,0 @@-import { toast } from '@lobehub/ui/base-ui';-import { t } from 'i18next';-import { useCallback } from 'react';--import { useClientDataSWR } from '@/libs/swr';-import { verifyKeys } from '@/libs/swr/keys';-// Workspace-aware mutate: applies the same `augmentKey` treatment-// useClientDataSWR uses on its keys, so a mutate here actually matches the-// tray's subscription (a raw `swr` mutate would miss the augmented key).-import { mutate as scopedMutate } from '@/libs/swr/mutate';-import { verifyService } from '@/services/verify';--import { openGoalModal } from './GoalModal';-import type { TrayCheck } from './types';--/**- * A dropped/offline connection (`fetch` rejects with a TypeError, or the browser- * reports itself offline) versus a request the server actively rejected — the- * two call for different copy, so the user knows whether to retry or reconnect.- */-const isNetworkError = (error: unknown): boolean => {- if (typeof navigator !== 'undefined' && navigator.onLine === false) return true;- const message = error instanceof Error ? error.message : String(error);- return /fetch failed|failed to fetch|networkerror|load failed|err_(?:network|internet)/i.test(- message,- );-};--const genId = () => `chk_${Math.random().toString(36).slice(2, 10)}`;--/**- * A topic's acceptance state: the one-sentence Goal (the outcome the- * conversation is delivering, stored as `acceptance.requirement`) and the- * tracking checks under it (`config.checklist`).- */-interface TopicGoal {- checks: TrayCheck[];- goal: string;-}--const EMPTY: TopicGoal = { checks: [], goal: '' };--const swrKey = (topicId: string) =>- verifyKeys.acceptanceBySubject('topic', topicId) as unknown as string;--const read = async (topicId: string): Promise<TopicGoal> => {- const acceptance = await verifyService.getAcceptanceBySubject('topic', topicId);- return {- checks: (acceptance?.config?.checklist ?? []).map((c) => ({- id: c.id,- method: c.method ?? '',- name: c.name,- })),- goal: acceptance?.requirement ?? '',- };-};--// Optimistically publish `next` to the shared SWR key so every consumer (the-// tray + the "+" menu path) reflects it immediately, then run the write and-// revalidate. If the write fails (topic deleted mid-edit, offline, server-// error), roll the optimistic value back to the server truth and surface an-// error instead of leaving a phantom unsaved edit on screen; rethrow so the-// caller (e.g. the modal) can keep itself open rather than treating the edit as-// done.-const commit = async (topicId: string, next: TopicGoal, write: () => Promise<unknown>) => {- await scopedMutate(swrKey(topicId), next, { revalidate: false });- try {- await write();- } catch (error) {- await scopedMutate(swrKey(topicId));- toast.error(- isNetworkError(error)- ? t('acceptance.tray.saveFailed.network', { ns: 'verify' })- : t('acceptance.tray.saveFailed.server', { ns: 'verify' }),- );- throw error;- }- await scopedMutate(swrKey(topicId));-};--const persistChecks = (topicId: string, goal: string, checks: TrayCheck[]) =>- commit(topicId, { checks, goal }, () =>- verifyService.saveAcceptanceChecklist(- 'topic',- topicId,- checks.map((c) => ({ id: c.id, method: c.method || undefined, name: c.name })),- ),- );--const persistGoal = (topicId: string, goal: string, checks: TrayCheck[]) =>- commit(topicId, { checks, goal }, () => verifyService.saveAcceptanceGoal('topic', topicId, goal));--/**- * Set the topic's Goal without a mounted tray (used by the composer "+" →- * "Goal" entry). Reads the current state, writes the goal, and revalidates- * the shared SWR key so the tray reflects it.- */-export const setTopicGoal = async (topicId: string, goal: string) => {- const current = await read(topicId);- await persistGoal(topicId, goal, current.checks);-};--/**- * Open the "set goal" modal for a topic from outside a mounted tray (the- * composer "+" menu), prefilled with the current goal so an existing one is- * edited rather than silently overwritten.- */-export const openTopicGoalModal = async (topicId: string) => {- const current = await read(topicId);- openGoalModal({- initialGoal: current.goal || undefined,- // Only offer delete when there's an existing goal to clear. Clearing writes- // an empty requirement, which hides the tray (checks kept).- onDelete: current.goal ? () => setTopicGoal(topicId, '') : undefined,- onSubmit: (goal) => setTopicGoal(topicId, goal),- });-};--/**- * The topic's Goal + tracking checks, persisted on the verify aggregate — not- * client storage. Reads via SWR; mutations write through the acceptance router- * and revalidate.- */-export const useTopicGoal = (topicId: string | undefined) => {- const { data, isLoading } = useClientDataSWR(topicId ? swrKey(topicId) : null, () =>- read(topicId!),- );- const { checks, goal } = data ?? EMPTY;-- const setGoal = useCallback(- (next: string) => {- if (!topicId) return;- return persistGoal(topicId, next, checks);- },- [topicId, checks],- );-- const addCheck = useCallback(- (item: { method: string; name: string }) => {- if (!topicId) return;- return persistChecks(topicId, goal, [...checks, { ...item, id: genId() }]);- },- [topicId, goal, checks],- );-- const updateCheck = useCallback(- (id: string, patch: Partial<Omit<TrayCheck, 'id'>>) => {- if (!topicId) return;- return persistChecks(- topicId,- goal,- checks.map((c) => (c.id === id ? { ...c, ...patch } : c)),- );- },- [topicId, goal, checks],- );-- const removeCheck = useCallback(- (id: string) => {- if (!topicId) return;- return persistChecks(- topicId,- goal,- checks.filter((c) => c.id !== id),- );- },- [topicId, goal, checks],- );-- return { addCheck, checks, goal, isLoading, removeCheck, setGoal, updateCheck };-};diff --git a/src/features/Conversation/ChatInput/index.tsx b/src/features/Conversation/ChatInput/index.tsxindex 83805dd0c4a..440232c6068 100644--- a/src/features/Conversation/ChatInput/index.tsx+++ b/src/features/Conversation/ChatInput/index.tsx@@ -51,9 +51,6 @@ import {getConversationSendButtonProps,toChatInputMessages,} from './utils';-import GoalArmedChip from './VerifyTray/GoalArmedChip';-import { useGoalArmStore } from './VerifyTray/goalArmStore';-import GoalTray from './VerifyTray/GoalTray';import {canSendVoiceMessage,isVoiceMessageTranscribed,@@ -298,19 +295,12 @@ const ChatInput = memo<ChatInputProps>(const hasTodos = (selectCurrentTurnTodosFromMessages(dbMessages)?.items.length ?? 0) > 0;// Detect whether OpStatusTray will render (mirrors its own `!startTime`- // gate) so GoalTray — which sits flush below it — can square its top corners+ // gate) so LinkedGoalTray — which sits flush below it — can square its top corners// and merge with the status strip instead of showing a seam.const hasOpStatus = useChatStore((s) => operationSelectors.getVisibleAgentRuntimeStartTimeByContext(context)(s) !== undefined,);- // Pre-topic "armed goal" state (topic Goal lab). `armedAt` is only ever set- // by the lab-gated "+" → Goal entry, so its presence already implies the- // lab is on. While armed the goal chip rides the action bar and the composer- // placeholder prompts for the goal (the next message becomes it).- const goalArmedAt = useGoalArmStore((s) => (agentId ? s.armedAt[agentId] : undefined));- const goalArmed = !!agentId && !context.topicId && goalArmedAt !== undefined;-// Computed stateconst isInputEmpty = !inputMessage.trim() && fileList.length === 0 && contextList.length === 0;const { placeholderVariant, showSendMenu, showSendWhileGenerating, showStopButton } =@@ -502,34 +492,23 @@ const ChatInput = memo<ChatInputProps>({!disableQueue && hasQueuedMessages && <QueueTray />}<TodoProgress topAttached={!disableQueue && hasQueuedMessages} /><OpStatusTray topAttached={(!disableQueue && hasQueuedMessages) || hasTodos} />- <GoalTray- topAttached={(!disableQueue && hasQueuedMessages) || hasTodos || hasOpStatus}- />{/* Goals this conversation planned; sits last so it rides flush on the input. */}<LinkedGoalTraytopAttached={(!disableQueue && hasQueuedMessages) || hasTodos || hasOpStatus}/></Flexbox>- {/* Append the armed-goal chip to every composer's action bar. While armed,- the next message becomes the goal and the placeholder explains that state. */}<DesktopChatInputactionBarStyle={actionBarStyle}borderRadius={12}compact={compact}controlBarSlot={controlBarSlot}+ extraActionItems={extraActionItems}hidden={hasPendingInterventions}isConfigLoading={isConfigLoading}leftContent={leftContent}placeholderVariant={placeholderVariant}sendAreaPrefix={businessSendAreaPrefix}showControlBar={showControlBar}- extraActionItems={[- ...(extraActionItems ?? []),- { children: <GoalArmedChip />, key: 'goal-armed-chip' },- ]}- placeholder={- goalArmed ? t('acceptance.tray.goalArmedPlaceholder', { ns: 'verify' }) : undefined- }/></div></WideScreenContainer>diff --git a/src/features/HomeInbox/index.tsx b/src/features/HomeInbox/index.tsxindex 30e608cb27c..1c46af6ad75 100644--- a/src/features/HomeInbox/index.tsx+++ b/src/features/HomeInbox/index.tsx@@ -171,7 +171,7 @@ const HomeInbox = memo<HomeInboxProps>((props) => {// Goals are the one home feed that is not about today: they run for days, so// the dashboard is where you check on them. Behind the same lab toggle as the// goal pages themselves — without it a row would navigate to a redirect.- const goalsEnabled = useUserStore(labPreferSelectors.enableTopicAcceptance);+ const goalsEnabled = useUserStore(labPreferSelectors.enableGoals);const showGoals = isLogin === true && goalsEnabled && showRailSections;const useFetchHomeGoals = useGoalStore((s) => s.useFetchHomeGoals);const goalsSWR = useFetchHomeGoals(showGoals, cacheScope);diff --git a/src/features/Settings/labs/features.ts b/src/features/Settings/labs/features.tsindex 4982fe452c9..116826e3694 100644--- a/src/features/Settings/labs/features.ts+++ b/src/features/Settings/labs/features.ts@@ -19,6 +19,7 @@ type LabFeatureI18nKey =| 'desktopSplitView'| 'deviceTunnel'| 'evalCapture'+ | 'goals'| 'heteroSessionImport'| 'imessage'| 'inputMarkdown'@@ -27,8 +28,7 @@ type LabFeatureI18nKey =| 'messageTextSelectionActions'| 'oauthApps'| 'projects'- | 'selfLearning'- | 'topicAcceptance';+ | 'selfLearning';export interface LabFeatureItem {/** Only rendered (and searchable) in the Electron shell */@@ -86,10 +86,10 @@ export const LAB_FEATURES: LabFeatureItem[] = [stage: 'alpha',},{- flag: 'enableTopicAcceptance',- i18nKey: 'topicAcceptance',- searchKeywords: ['acceptance', 'checklist'],- stage: 'alpha',+ flag: 'enableGoals',+ i18nKey: 'goals',+ searchKeywords: ['goal', 'goals', 'objective'],+ stage: 'beta',},{flag: 'enableDeviceTunnel',diff --git a/src/features/Settings/labs/index.test.tsx b/src/features/Settings/labs/index.test.tsxindex 50b7a7d0d2d..8516782a020 100644--- a/src/features/Settings/labs/index.test.tsx+++ b/src/features/Settings/labs/index.test.tsx@@ -118,7 +118,7 @@ describe('Labs settings page', () => {it('renders the topic acceptance (tray) lab toggle', () => {renderPage();- expect(screen.getByText('features.topicAcceptance.title')).toBeDefined();+ expect(screen.getByText('features.goals.title')).toBeDefined();});it('does not render released task verify as a lab toggle', () => {diff --git a/src/routes/(main)/agent/features/Conversation/HeterogeneousChatInput/HeteroPlus.tsx b/src/routes/(main)/agent/features/Conversation/HeterogeneousChatInput/HeteroPlus.tsxindex 0c2967e4600..e482c253db4 100644--- a/src/routes/(main)/agent/features/Conversation/HeterogeneousChatInput/HeteroPlus.tsx+++ b/src/routes/(main)/agent/features/Conversation/HeterogeneousChatInput/HeteroPlus.tsx@@ -50,7 +50,7 @@ const HeteroPlus = memo(() => {const scheduledSendAt = useConversationStore((s) => s.scheduledSendAt);const setScheduledSendAt = useConversationStore((s) => s.setScheduledSendAt);- const enableTopicAcceptance = useUserStore(labPreferSelectors.enableTopicAcceptance);+ const enableGoals = useUserStore(labPreferSelectors.enableGoals);const armSchedule = useCallback((hours: number) => {@@ -102,7 +102,7 @@ const HeteroPlus = memo(() => {type: 'switch',},// Goal creation shares the standard input's goal chip.- ...(enableTopicAcceptance+ ...(enableGoals? ([{ type: 'divider' },{@@ -118,16 +118,7 @@ const HeteroPlus = memo(() => {] as ActionDropdownMenuItems): []),];- }, [- t,- tEditor,- showTypoBar,- setShowTypoBar,- armSchedule,- scheduledSendAt,- enableTopicAcceptance,- editor,- ]);+ }, [t, tEditor, showTypoBar, setShowTypoBar, armSchedule, scheduledSendAt, enableGoals, editor]);return (<ChatInputActiondiff --git a/src/store/user/slices/preference/action.test.ts b/src/store/user/slices/preference/action.test.tsindex 5f78c70329b..35c7cf8dca2 100644--- a/src/store/user/slices/preference/action.test.ts+++ b/src/store/user/slices/preference/action.test.ts@@ -29,6 +29,37 @@ describe('createPreferenceSlice', () => {});});+ describe('updateLab', () => {+ it('mirrors enableGoals into the legacy enableTopicAcceptance key for older clients', async () => {+ const updatePreferenceSpy = vi+ .spyOn(userService, 'updatePreference')+ .mockResolvedValue(undefined as any);++ act(() => {+ useUserStore.setState({+ preference: {+ ...useUserStore.getState().preference,+ lab: { enableTopicAcceptance: true },+ },+ });+ });++ await act(async () => {+ await useUserStore.getState().updateLab({ enableGoals: false });+ });++ expect(useUserStore.getState().preference.lab).toMatchObject({+ enableGoals: false,+ enableTopicAcceptance: false,+ });+ expect(updatePreferenceSpy).toHaveBeenCalledWith(+ expect.objectContaining({+ lab: expect.objectContaining({ enableGoals: false, enableTopicAcceptance: false }),+ }),+ );+ });+ });+describe('updatePreference', () => {it('should update preference', () => {const { result } = renderHook(() => useUserStore());diff --git a/src/store/user/slices/preference/action.ts b/src/store/user/slices/preference/action.tsindex 6206c9b653d..618a31c10da 100644--- a/src/store/user/slices/preference/action.ts+++ b/src/store/user/slices/preference/action.ts@@ -31,7 +31,11 @@ export class PreferenceActionImpl {updateLab = async (lab: Partial<UserLab>, action?: any): Promise<void> => {const { updatePreference } = this.#get();- const nextLab = merge(this.#get().preference.lab, lab);+ // Older clients still read the pre-rename `enableTopicAcceptance` key, so keep+ // it in step with `enableGoals` until they age out.+ const patch =+ lab.enableGoals === undefined ? lab : { ...lab, enableTopicAcceptance: lab.enableGoals };+ const nextLab = merge(this.#get().preference.lab, patch);await updatePreference({ lab: nextLab }, action || n('updateLab'));};diff --git a/src/store/user/slices/preference/selectors/labPrefer.test.ts b/src/store/user/slices/preference/selectors/labPrefer.test.tsnew file mode 100644index 00000000000..16dccbaaead--- /dev/null+++ b/src/store/user/slices/preference/selectors/labPrefer.test.ts@@ -0,0 +1,33 @@+import { describe, expect, it } from 'vitest';++import { type UserState } from '@/store/user/initialState';++import { labPreferSelectors } from './labPrefer';++const stateWithLab = (lab: Record<string, boolean>) => ({ preference: { lab } }) as UserState;++describe('labPreferSelectors.enableGoals', () => {+ it('is off by default', () => {+ expect(labPreferSelectors.enableGoals(stateWithLab({}))).toBe(false);+ });++ it('keeps users who opted in under the legacy enableTopicAcceptance key', () => {+ expect(labPreferSelectors.enableGoals(stateWithLab({ enableTopicAcceptance: true }))).toBe(+ true,+ );+ });++ // This client writes both keys, while older clients write only the legacy+ // one — so when they disagree, the legacy key holds the latest choice.+ it('honours an older client turning Goals off through the legacy key', () => {+ expect(+ labPreferSelectors.enableGoals(+ stateWithLab({ enableGoals: true, enableTopicAcceptance: false }),+ ),+ ).toBe(false);+ });++ it('reads the new key when the legacy one was never written', () => {+ expect(labPreferSelectors.enableGoals(stateWithLab({ enableGoals: true }))).toBe(true);+ });+});diff --git a/src/store/user/slices/preference/selectors/labPrefer.ts b/src/store/user/slices/preference/selectors/labPrefer.tsindex c266ab95df8..20a0113b129 100644--- a/src/store/user/slices/preference/selectors/labPrefer.ts+++ b/src/store/user/slices/preference/selectors/labPrefer.ts@@ -29,7 +29,9 @@ export const labPreferSelectors = {enableOAuthApps: (s: UserState): boolean => s.preference.lab?.enableOAuthApps ?? false,enableSelfLearning: (s: UserState): boolean => s.preference.lab?.enableSelfLearning ?? false,enableProjects: (s: UserState): boolean => s.preference.lab?.enableProjects ?? false,+ // `updateLab` writes both keys, but older clients only write the legacy+ // `enableTopicAcceptance` — so while both exist it holds the latest choice.+ enableGoals: (s: UserState): boolean =>+ s.preference.lab?.enableTopicAcceptance ?? s.preference.lab?.enableGoals ?? false,enableTaskVerify: (s: UserState): boolean => s.preference.lab?.enableTaskVerify ?? false,- enableTopicAcceptance: (s: UserState): boolean =>- s.preference.lab?.enableTopicAcceptance ?? false,};