Skip to content

✨ feat(onboarding): agent web onboarding, feature toggle, and lifecycle sync#13139

Merged
Innei merged 79 commits intocanaryfrom
feat/agent-onboarding
Mar 30, 2026
Merged

✨ feat(onboarding): agent web onboarding, feature toggle, and lifecycle sync#13139
Innei merged 79 commits intocanaryfrom
feat/agent-onboarding

Conversation

@Innei
Copy link
Copy Markdown
Member

@Innei Innei commented Mar 19, 2026

💻 Change Type

  • ✨ feat
  • 🐛 fix
  • ♻️ refactor
  • 💄 style
  • 👷 build
  • ⚡️ perf
  • ✅ test
  • 📝 docs
  • 🔨 chore

🔗 Related Issue

🔀 Description of Change

Introduces an agent-guided web onboarding path next to the classic flow, with server persistence, tooling, and tighter chat lifecycle behavior.

Product & routing

  • SPA onboarding routes for agent vs classic (/onboarding/agent, /onboarding/classic), mode selection, and onboarding helpers wired through the SPA router (desktop configs kept in sync).

Agent & tools

  • Builtin web-onboarding tool package and store executors (lobe-web-onboarding), plus utilities for normalizing tool results.
  • Stronger AskUserQuestion handling (validation schema) and related executor wiring.

State & persistence

  • User agent_onboarding state end-to-end: DB migration, types, user service updates, and a dedicated Zustand agentOnboarding slice (selectors, reset/finish flows, hydration from user payload).
  • Feature toggle for agent onboarding (including visibility in development mode) and ModeSwitch refinements for choosing the flow.

Runtime sync

  • Onboarding service updates to keep inbox and web-onboarding agents aligned when onboarding state or metadata changes.
  • Conversation lifecycle tweaks so onboarding stays in sync with the active agent; suppresses the default welcome message while the user is in the onboarding flow so the guided experience is not interrupted.

🧪 How to Test

  • Complete onboarding in agent and classic modes; confirm preference and agent_onboarding state persist after refresh.

  • Toggle agent onboarding availability (prod vs dev as applicable) and confirm routes/mode UI match expectations.

  • In agent onboarding, open a chat and confirm no duplicate or premature welcome message before the guided flow.

  • Apply/run DB migration that adds agent_onboarding storage if your env is not already migrated.

  • Tested locally

  • Added/updated tests

  • No tests needed

📸 Screenshots / Videos

Before After

📝 Additional Information

Expand screenshots row above if you attach UI captures for review.

@vercel
Copy link
Copy Markdown

vercel bot commented Mar 19, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
lobehub Error Error Mar 30, 2026 0:01am

Request Review

Copy link
Copy Markdown
Contributor

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry @Innei, you have reached your weekly rate limit of 500000 diff characters.

Please try again later or upgrade to continue using Sourcery

@lobehubbot
Copy link
Copy Markdown
Member

@ONLY-yours @nekomeowww - This PR adds an agent-guided web onboarding flow, including new SPA routes, onboarding feature UI, a new builtin agent/tool package, DB migration (0095), and server-side onboarding service. Please coordinate on the frontend/agent side (@ONLY-yours) and the database/backend side (@nekomeowww).

@codecov
Copy link
Copy Markdown

codecov bot commented Mar 19, 2026

Codecov Report

❌ Patch coverage is 75.24430% with 456 lines in your changes missing coverage. Please review.
✅ Project coverage is 66.96%. Comparing base (9c08fa5) to head (f1762a0).
⚠️ Report is 3 commits behind head on canary.

Additional details and impacted files
@@            Coverage Diff             @@
##           canary   #13139      +/-   ##
==========================================
+ Coverage   66.86%   66.96%   +0.10%     
==========================================
  Files        1906     1929      +23     
  Lines      154421   156439    +2018     
  Branches    15611    15123     -488     
==========================================
+ Hits       103250   104763    +1513     
- Misses      51051    51556     +505     
  Partials      120      120              
Flag Coverage Δ
app 58.74% <75.25%> (+0.30%) ⬆️
database 96.66% <100.00%> (+<0.01%) ⬆️
packages/agent-runtime 89.11% <66.66%> (-0.16%) ⬇️
packages/context-engine 86.51% <ø> (ø)
packages/conversation-flow 92.36% <ø> (ø)
packages/file-loaders 87.02% <ø> (ø)
packages/memory-user-memory 66.68% <ø> (ø)
packages/model-bank 99.85% <ø> (ø)
packages/model-runtime 84.48% <ø> (ø)
packages/prompts 67.76% <ø> (ø)
packages/python-interpreter 92.90% <ø> (ø)
packages/ssrf-safe-fetch 0.00% <ø> (ø)
packages/utils 90.41% <ø> (ø)
packages/web-crawler 88.82% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

Components Coverage Δ
Store 67.08% <70.17%> (+0.05%) ⬆️
Services 49.21% <49.01%> (-0.10%) ⬇️
Server 67.41% <77.44%> (+0.25%) ⬆️
Libs 51.03% <ø> (ø)
Utils 89.08% <75.53%> (-1.94%) ⬇️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Co-authored-by: Codex <noreply@openai.com>
Innei added 2 commits March 23, 2026 23:19
… and refined rules

- Updated onboarding structure to include new nodes: agentIdentity, userIdentity, workStyle, workContext, and painPoints.
- Revised system role instructions to emphasize a conversational approach and concise interactions.
- Adjusted manifest and type definitions to reflect the new onboarding schema.
- Implemented tests to ensure proper functionality of the onboarding context and flow.

This update aims to improve user experience during onboarding by making it more engaging and structured.

Signed-off-by: Innei <tukon479@gmail.com>
…ome messages and interaction hints

- Added localized welcome messages for onboarding in English and Chinese.
- Refactored system role handling to support dynamic interaction hints based on user locale.
- Updated onboarding context to include interaction hints for improved user engagement.
- Implemented tests to validate the new interaction hint functionality.

This update aims to create a more personalized and engaging onboarding experience for users across different languages.

Signed-off-by: Innei <tukon479@gmail.com>
…ure and refined interaction rules

- Replaced existing interaction hints with a focused question structure to enhance user engagement.
- Updated system role instructions to clarify onboarding protocols and improve conversational flow.
- Refactored type definitions and manifest to align with the new onboarding schema.
- Removed deprecated interaction hint components and tests to streamline the codebase.

This update aims to create a more structured and engaging onboarding experience for users, ensuring clarity and efficiency in interactions.

Signed-off-by: Innei <tukon479@gmail.com>
…tructured roles and prompts

- Added a new package for agent onboarding, including a package.json configuration and initial TypeScript files.
- Implemented system role templates and tool prompts to guide the onboarding process.
- Established a client interface for rendering questions and handling user interactions.
- Updated dependencies in related packages to integrate the new onboarding functionality.

This update aims to enhance the onboarding experience by providing a structured approach for agents, ensuring clarity and efficiency in user interactions.

Signed-off-by: Innei <tukon479@gmail.com>
…er and refined interaction logic

- Introduced a new `QuestionRendererView` component to streamline the rendering of onboarding questions.
- Refactored the `QuestionRenderer` to utilize a runtime hook for improved state management and separation of concerns.
- Updated the onboarding context to fallback to stored questions when the current question is empty, enhancing user experience.
- Simplified the onboarding API by removing unnecessary read token requirements from various endpoints.
- Added tests to validate the new question rendering logic and ensure proper functionality.

This update aims to create a more efficient and user-friendly onboarding experience by improving the question handling and rendering process.

Signed-off-by: Innei <tukon479@gmail.com>
Signed-off-by: Innei <tukon479@gmail.com>
…hema

- Introduced Zod validation for askUserQuestion arguments to ensure correct structure.
- Updated test to reflect new question format with fields.
- Added error handling in AskUserQuestion component to log submission errors.

This improves the robustness of user interactions by enforcing schema validation and enhancing error reporting.

Signed-off-by: Innei <tukon479@gmail.com>
Innei added 2 commits March 30, 2026 15:26
- Updated `useAgentMeta` to prioritize custom titles from the database, falling back to the default Lobe AI title if none exists.
- Integrated `refreshBuiltinAgent` into the onboarding process to ensure the latest agent data is reflected during user interactions.
- Adjusted the `InboxItem` component to display the correct agent title and avatar based on the updated metadata.
- Refactored optimistic update actions to improve message handling and synchronization across components.

This improves the user experience by ensuring that the most relevant agent information is displayed and updated in real-time during onboarding and conversation flows.

Signed-off-by: Innei <tukon479@gmail.com>
…zation

- Updated `ConversationLifecycleActionImpl` to include additional context parameters (agentId, groupId, threadId, topicId) when updating message plugins for aborted interactions.
- Integrated `refreshBuiltinAgent` for the inbox during the onboarding process to ensure the latest agent data is synchronized.

These changes improve the handling of conversation lifecycle events and ensure that onboarding reflects the most current agent information, enhancing user experience during interactions.

Signed-off-by: Innei <tukon479@gmail.com>
Innei added 2 commits March 30, 2026 15:45
…tch component

- Introduced `AGENT_ONBOARDING_ENABLED` configuration to control the visibility of the agent onboarding options.
- Updated `ModeSwitch` component to conditionally render onboarding options based on the feature toggle.
- Enhanced tests for `ModeSwitch` to cover scenarios for both enabled and disabled states of agent onboarding.
- Refactored `AgentOnboardingRoute` to navigate to the classic onboarding if the agent onboarding feature is disabled.

These changes improve the onboarding experience by allowing dynamic control over the agent onboarding feature, ensuring that users only see relevant options based on the configuration.

Signed-off-by: Innei <tukon479@gmail.com>
… mode

- Modified `AGENT_ONBOARDING_ENABLED` to also activate in development mode using `isDev`.
- This change allows for easier testing and development of the agent onboarding feature without needing to alter production configurations.

Signed-off-by: Innei <tukon479@gmail.com>
@Innei Innei changed the title ✨ feat(onboarding): agent-guided web onboarding flow ✨ feat(onboarding): agent web onboarding, feature toggle, and lifecycle sync Mar 30, 2026
@Innei Innei merged commit 0e57fd9 into canary Mar 30, 2026
33 of 34 checks passed
@Innei Innei deleted the feat/agent-onboarding branch March 30, 2026 12:28
@lobehubbot
Copy link
Copy Markdown
Member

❤️ Great PR @Innei ❤️

The growth of project is inseparable from user feedback and contribution, thanks for your contribution! If you are interesting with the lobehub developer community, please join our discord and then dm @arvinxx or @canisminor1990. They will invite you to our private developer channel. We are talking about the lobe-chat development or sharing ai newsletter around the world.

cy948 pushed a commit to cy948/lobe-chat that referenced this pull request Mar 31, 2026
…le sync (lobehub#13139)

* ✨ feat(onboarding): add agent-guided web onboarding flow

Made-with: Cursor

* Update onboarding prompts

Co-authored-by: Codex <noreply@openai.com>

* 🐛 fix web onboarding builtin tool flow

* ✨ feat(onboarding): enhance agent onboarding flow with new dimensions and refined rules

- Updated onboarding structure to include new nodes: agentIdentity, userIdentity, workStyle, workContext, and painPoints.
- Revised system role instructions to emphasize a conversational approach and concise interactions.
- Adjusted manifest and type definitions to reflect the new onboarding schema.
- Implemented tests to ensure proper functionality of the onboarding context and flow.

This update aims to improve user experience during onboarding by making it more engaging and structured.

Signed-off-by: Innei <tukon479@gmail.com>

* ✨ feat(onboarding): enhance onboarding experience with localized welcome messages and interaction hints

- Added localized welcome messages for onboarding in English and Chinese.
- Refactored system role handling to support dynamic interaction hints based on user locale.
- Updated onboarding context to include interaction hints for improved user engagement.
- Implemented tests to validate the new interaction hint functionality.

This update aims to create a more personalized and engaging onboarding experience for users across different languages.

Signed-off-by: Innei <tukon479@gmail.com>

* ✨ feat(onboarding): overhaul onboarding flow with new question structure and refined interaction rules

- Replaced existing interaction hints with a focused question structure to enhance user engagement.
- Updated system role instructions to clarify onboarding protocols and improve conversational flow.
- Refactored type definitions and manifest to align with the new onboarding schema.
- Removed deprecated interaction hint components and tests to streamline the codebase.

This update aims to create a more structured and engaging onboarding experience for users, ensuring clarity and efficiency in interactions.

Signed-off-by: Innei <tukon479@gmail.com>

* ✨ feat(onboarding): introduce builtin agent onboarding package with structured roles and prompts

- Added a new package for agent onboarding, including a package.json configuration and initial TypeScript files.
- Implemented system role templates and tool prompts to guide the onboarding process.
- Established a client interface for rendering questions and handling user interactions.
- Updated dependencies in related packages to integrate the new onboarding functionality.

This update aims to enhance the onboarding experience by providing a structured approach for agents, ensuring clarity and efficiency in user interactions.

Signed-off-by: Innei <tukon479@gmail.com>

* ✨ feat(onboarding): enhance agent onboarding with new question renderer and refined interaction logic

- Introduced a new `QuestionRendererView` component to streamline the rendering of onboarding questions.
- Refactored the `QuestionRenderer` to utilize a runtime hook for improved state management and separation of concerns.
- Updated the onboarding context to fallback to stored questions when the current question is empty, enhancing user experience.
- Simplified the onboarding API by removing unnecessary read token requirements from various endpoints.
- Added tests to validate the new question rendering logic and ensure proper functionality.

This update aims to create a more efficient and user-friendly onboarding experience by improving the question handling and rendering process.

Signed-off-by: Innei <tukon479@gmail.com>

* Add dev history view for onboarding

* remove: prosetting

Signed-off-by: Innei <tukon479@gmail.com>

* ✨ feat(onboarding): inline response language step in agent conversation

- Add ResponseLanguageInlineStep and wire into Conversation flow
- Extend agent onboarding context and update ResponseLanguageStep route
- Add tests and onboarding agent document design spec

Made-with: Cursor

* ✨ feat(onboarding): enhance onboarding flow with inbox integration and schema refactor

- Updated onboarding process to migrate conversation topics to the inbox upon completion, ensuring users can revisit their onboarding discussions.
- Introduced a new schema-driven normalizer and node handler registry to streamline onboarding data handling, reducing code duplication and improving maintainability.
- Added comprehensive tests for new document builders and onboarding service methods to ensure functionality and reliability.
- Refactored existing components to support the new onboarding structure and improve user experience.

This update aims to create a more cohesive onboarding experience by integrating user identity data into the inbox and simplifying the underlying code structure.

Signed-off-by: Innei <tukon479@gmail.com>

* ✨ feat(agent-documents): add listDocuments, readDocumentByFilename, upsertDocumentByFilename APIs

* ✨ feat(onboarding): add generic user interaction builtin tool

* ✨ feat(onboarding): wire generic tool interaction semantics

Register user-interaction tool in builtin-tools registry with manifest,
intervention components, client executor, and server runtime. Extend
BuiltinInterventionProps with interactionMode and onInteractionAction
to support custom (non-approval) interaction UIs. Add submit/skip/cancel
actions to conversation store with full operation lifecycle management.

* 🔧 fix: add builtin-tool-user-interaction to root workspace dependencies

* ♻️ refactor(onboarding): remove onboarding-owned question persistence

Drop askUserQuestion from the web-onboarding tool and remove
questionSurface from persisted state. Question presentation is now
delegated to the generic lobe-user-interaction tool.

* ♻️ refactor(onboarding): switch UI to generic interaction tool

Enable UserInteraction and AgentDocuments tools in web-onboarding and
inbox agent configs. Remove obsolete inline question renderers
(QuestionRenderer, QuestionRendererView, questionRendererRuntime,
questionRendererSchema, ResponseLanguageInlineStep) and simplify
Conversation component to only render summary CTA.

* 🔥 refactor(onboarding): remove identity doc and rewrite soul sync

* 🐛 fix(user-interaction): add humanIntervention to manifest and implement form UI

* 🐛 fix(onboarding): create user message on interaction submit instead of re-executing tool

* ♻️ refactor(onboarding): rebuild generic interaction flow

Align agent/tool roles and onboarding UI/runtime around the generic interaction rebuild.

Made-with: Cursor

* ✨ feat(onboarding): implement onboarding document and persona management

Introduce a new onboarding document structure that separates agent identity and user persona data. Replace existing `readSoulDocument` and `updateSoulDocument` APIs with `readDocument` and `updateDocument` to handle both SOUL.md and user persona documents. Update related services, client executors, and localization keys to reflect these changes. Ensure document updates are driven by the agent, allowing for incremental updates and improved content management.

Signed-off-by: Innei <tukon479@gmail.com>

* refactor

Signed-off-by: Innei <tukon479@gmail.com>

* ✨ feat(workflow): introduce unified tool call collapse UI and supporting components

Add a new workflow collapse feature that groups tool calls and reasoning into a single collapsible unit, enhancing the user interface for tool call progress. This includes the creation of several components: `WorkflowCollapse`, `WorkflowSummary`, `WorkflowExpandedList`, `WorkflowToolLine`, and `WorkflowReasoningLine`. Update the design specifications and implementation plans to reflect this new structure, aiming for a more cohesive and user-friendly experience.

Signed-off-by: Innei <tukon479@gmail.com>

* feat(types): add discovery pacing types and constant

* feat(onboarding): add countTopicUserMessages and pacing gate to derivePhase

* feat(onboarding): capture discovery baseline and return pacing data in getState

* ✨ feat(onboarding): add pacing hints to discovery phase tool result

* test(onboarding): add discovery pacing gate tests

* ♻️ refactor(onboarding): soften discovery pacing gate and add early exit exception

- MIN_DISCOVERY_USER_MESSAGES lowered from 4 to 2 (hard floor)
- RECOMMENDED_DISCOVERY_USER_MESSAGES = 4 (advisory hint)
- Tool protocol rule 2 now has explicit early exit exception
- Pacing hint text changed from imperative to advisory

* ✨ feat(onboarding): update .gitignore and remove outdated onboarding plans

- Added `docs/superpowers` to .gitignore to exclude documentation files from version control.
- Deleted several outdated onboarding implementation plans, including those for onboarding inbox integration, generic interaction rebuild, and user question simplification, to streamline project documentation.

Signed-off-by: Innei <tukon479@gmail.com>

* ✨ feat(onboarding): refine agent onboarding, streaming, and AskUserQuestion

Made-with: Cursor

* ✨ feat(store): add pending interventions selector

* 🐛 fix(store): handle standalone tool messages and structural children traversal in pending interventions selector

* ✨ feat(conversation): create InterventionBar component

Add InterventionBar UI component with tab bar for multiple pending
interventions, reusing the existing Intervention detail component.

* 🐛 fix(conversation): use stable toolCallId for active tab state and add min-height: 0

Track active intervention by toolCallId instead of array index to prevent
stale selection when interventions are resolved. Add min-height: 0 to
scrollable content for correct overflow in flex column layout.

* feat(chatinput): show InterventionBar when pending interventions exist

* feat(tool): collapse inline intervention to one-line summary with scroll-to-bottom

* feat(i18n): add intervention bar translation keys

* 🐛 fix(chatinput): prevent infinite render loop from pendingInterventions selector

* 🐛 fix(chatinput): use equality function for pendingInterventions to break render loop

* refactor(tool): remove CollapsedIntervention, return null for pending inline

* feat(i18n): add form.other translation key

* feat(tool): add styles for select field with Other option

* feat(tool): add SelectFieldInput with Other option row

* feat(tool): wire SelectFieldInput and update validation in AskUserQuestion

* fix(tool): add keyboard handler to Other row, fix label flex

* refactor(tool): restore Select dropdown, add Other toggle row below

* refactor(tool): change Other to form-level escape hatch, restore antd Select

* refactor(tool): replace checkbox toggle with minimal text link escape hatch

* feat(tool): use lucide icons, auto-focus on escape toggle, createStaticStyles

* refactor(onboarding): update onboarding model references and improve styling in ModeSwitch component

Signed-off-by: Innei <tukon479@gmail.com>

* ✨ feat(onboarding): add greeting entry animation keyframes and card styles

* ✨ feat(onboarding): add LogoThree and entry animations to greeting card

* ✨ feat(onboarding): add View Transition morph from greeting to conversation

* refactor(onboarding): simplify ModeSwitch component by removing segmentedGlass styling

Signed-off-by: Innei <tukon479@gmail.com>

* ✨ feat(onboarding): increase maximum onboarding steps to 5 and add ProSettingsStep component

Signed-off-by: Innei <tukon479@gmail.com>

* ✨ feat: enhance user interaction question handling with validation schema

- Introduced Zod validation for askUserQuestion arguments to ensure correct structure.
- Updated test to reflect new question format with fields.
- Added error handling in AskUserQuestion component to log submission errors.

This improves the robustness of user interactions by enforcing schema validation and enhancing error reporting.

Signed-off-by: Innei <tukon479@gmail.com>

* ✨ feat: enhance agent metadata handling and onboarding synchronization

- Updated `useAgentMeta` to prioritize custom titles from the database, falling back to the default Lobe AI title if none exists.
- Integrated `refreshBuiltinAgent` into the onboarding process to ensure the latest agent data is reflected during user interactions.
- Adjusted the `InboxItem` component to display the correct agent title and avatar based on the updated metadata.
- Refactored optimistic update actions to improve message handling and synchronization across components.

This improves the user experience by ensuring that the most relevant agent information is displayed and updated in real-time during onboarding and conversation flows.

Signed-off-by: Innei <tukon479@gmail.com>

* ✨ feat: enhance conversation lifecycle and onboarding agent synchronization

- Updated `ConversationLifecycleActionImpl` to include additional context parameters (agentId, groupId, threadId, topicId) when updating message plugins for aborted interactions.
- Integrated `refreshBuiltinAgent` for the inbox during the onboarding process to ensure the latest agent data is synchronized.

These changes improve the handling of conversation lifecycle events and ensure that onboarding reflects the most current agent information, enhancing user experience during interactions.

Signed-off-by: Innei <tukon479@gmail.com>

* ✨ feat: implement agent onboarding feature toggle and enhance ModeSwitch component

- Introduced `AGENT_ONBOARDING_ENABLED` configuration to control the visibility of the agent onboarding options.
- Updated `ModeSwitch` component to conditionally render onboarding options based on the feature toggle.
- Enhanced tests for `ModeSwitch` to cover scenarios for both enabled and disabled states of agent onboarding.
- Refactored `AgentOnboardingRoute` to navigate to the classic onboarding if the agent onboarding feature is disabled.

These changes improve the onboarding experience by allowing dynamic control over the agent onboarding feature, ensuring that users only see relevant options based on the configuration.

Signed-off-by: Innei <tukon479@gmail.com>

* ✨ feat: update agent onboarding feature toggle to include development mode

- Modified `AGENT_ONBOARDING_ENABLED` to also activate in development mode using `isDev`.
- This change allows for easier testing and development of the agent onboarding feature without needing to alter production configurations.

Signed-off-by: Innei <tukon479@gmail.com>

* Prevent welcome message when onboard

* 🐛 fix: satisfy ToolExecutionContext and updateMessageTools typings

Made-with: Cursor

* 🐛 fix: update tests for custom builtin agent title and discovery phase constants

* 🐛 fix: use custom inbox agent title and avatar in InboxWelcome

* 🧹 chore(onboarding): remove HistoryPanel unit test

Made-with: Cursor

* 🐛 fix: add missing onboarding/agent and onboarding/classic routes to desktop config

* ✅ test: fix failing tests for onboarding container, document helpers, and executor

* ✅ test: mock LogoThree to prevent Spline runtime fetch errors in CI

---------

Signed-off-by: Innei <tukon479@gmail.com>
Co-authored-by: Codex <noreply@openai.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants