mirror of
https://github.com/lobehub/lobehub
synced 2026-04-21 09:37:28 +00:00
3365 commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
038070285a | resolve merge conflicts | ||
|
|
a0303b7c18 | chore: merge main into canary (has conflicts to resolve) | ||
|
|
5dd7cd7408
|
✨ feat: add x ads tracking entry points (#13986)
* ✨ feat: add x ads tracking entry points * 🔨 chore: bump analytics to v1.6.2 * 🐛 fix: add auth analytics provider entry |
||
|
|
fb471123fc
|
✨ feat: support model alias mapping for image and video runtimes (#13896) | ||
|
|
03d2068a5d
|
✨ feat(onboarding): add feature flags and footer promotion pipeline (#13853)
* ✨ feat(onboarding): enhance agent onboarding experience and add feature flags - Added new promotional messages for agent onboarding in both Chinese and default locales. - Updated HighlightNotification component to support action handling and target attributes. - Introduced feature flags for agent onboarding in the configuration schema and tests. - Implemented logic to conditionally display onboarding options based on feature flags and user state. - Added tests for the onboarding flow and promotional notifications in the footer. This update aims to improve the user experience during the onboarding process and ensure proper feature management through flags. Signed-off-by: Innei <tukon479@gmail.com> * ✨ feat(home): add footer promotion pipeline with feature-flag gating Extract resolveFooterPromotionState for agent onboarding vs Product Hunt promos. Normalize isMobile boolean, refine HighlightNotification CTA layout, extend tests. Made-with: Cursor * ✨ feat(locales): add agent onboarding promotional messages in multiple languages Added new promotional messages for agent onboarding across various locales, enhancing the user experience with localized action labels, descriptions, and titles. This update supports a more engaging onboarding process for users globally. Signed-off-by: Innei <tukon479@gmail.com> * 💄 chore: refresh quick wizard onboarding promo * 🐛 fix(chat): keep long mixed assistant content outside workflow fold * ✨ feat(onboarding): add agent onboarding feedback panel and service LOBE-7210 Made-with: Cursor * ✨ feat(markdown-patch): add shared markdown patch tool with SEARCH/REPLACE hunks Introduce @lobechat/markdown-patch util and expose patchDocument API on the web-onboarding and agent-documents builtin tools so agents can apply byte-exact SEARCH/REPLACE hunks instead of resending full document content. * ✨ feat(onboarding): prefer patchDocument for non-empty documents Teach the onboarding agent (systemRole) and context engine (OnboardingActionHintInjector) to prefer patchDocument over updateDocument when SOUL.md or User Persona already has content, keeping updateDocument reserved for the initial seed write or full rewrites. * 🐛 fix(conversation): add rightActions to ChatInput component Updated the AgentOnboardingConversation component to include rightActions in the ChatInput, enhancing the functionality of the onboarding conversation interface. Signed-off-by: Innei <tukon479@gmail.com> * Add specialized onboarding approval UI * 🐛 fix(serverConfig): handle fetch errors in server config actions Updated the server configuration action to include error handling for fetch failures, ensuring that the server config is marked as initialized when an error occurs. Additionally, modified the SWR mock to simulate error scenarios in tests. Signed-off-by: Innei <tukon479@gmail.com> * 🐛 fix(tests): update Group component tests with new data-testid attributes Added data-testid attributes for workflow and answer segments in the Group component tests to improve test targeting. Adjusted the isFirstBlock property for consistency and ensured the component renders correctly with the provided props. Signed-off-by: Innei <tukon479@gmail.com> --------- Signed-off-by: Innei <tukon479@gmail.com> |
||
|
|
2298ad8ce1
|
✨ chore(heterogeneous-agent): integrate heterogeneous agents with claude code (#13754)
* ♻️ refactor(acp): move agent provider to agencyConfig + restore creation entry - Move AgentProviderConfig from chatConfig to agencyConfig.heterogeneousProvider - Rename type from 'acp' to 'claudecode' for clarity - Restore Claude Code agent creation entry in sidebar + menu - Prioritize heterogeneousProvider check over gateway mode in execution flow - Remove ACP settings from AgentChat form (provider is set at creation time) - Add getAgencyConfigById selector for cleaner access - Use existing agent workingDirectory instead of duplicating in provider config Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> ✨ feat(acp): defer terminal events + extract model/usage per turn Three improvements to ACP stream handling: 1. Defer agent_runtime_end/error: Previously the adapter emitted terminal events from result.type directly into the Gateway handler. The handler immediately fires fetchAndReplaceMessages which reads stale DB state (before we persist final content/tools). Fix: intercept terminal events in the executor's event loop and forward them only AFTER content + metadata has been written to DB. 2. Extract model/usage per assistant event: Claude Code sets model name and token usage on every assistant event. Adapter now emits a 'step_complete' event with phase='turn_metadata' carrying these. Executor accumulates input/output/cache tokens across turns and persists them onto the assistant message (model + metadata.totalTokens). 3. Missing final text fix: The accumulated assistant text was being written AFTER agent_runtime_end triggered fetchAndReplaceMessages, so the UI rendered stale (empty) content. Deferred terminals solve this. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> 🐛 fix(acp): eliminate orphan-tool warning flicker during streaming Root cause: LobeHub's conversation-flow parser (collectToolMessages) filters tool messages by matching `tool_call_id` against `assistant.tools[].id`. The previous flow created tool messages FIRST, then updated assistant.tools[], which opened a brief window where the UI saw tool messages that had no matching entry in the parent's tools array — rendering them as "orphan" with a scary "请删除" warning to the user. Fix: Reorder persistNewToolCalls into three phases: 1. Pre-register tool entries in assistant.tools[] (id only, no result_msg_id) 2. Create the tool messages in DB (tool_call_id matches pre-registered ids) 3. Back-fill result_msg_id and re-write assistant.tools[] Between phase 1 and phase 3 the UI always sees consistent state: every tool message in DB has a matching entry in the parent's tools array. Verified: orphan count stays at 0 across all sampled timepoints during streaming (vs 1+ before fix). Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> 🐛 fix(acp): dedupe tool_use + capture tool_result + persist result_msg_id Three critical fixes to ACP tool-call handling, discovered via live testing: 1. **tool_use dedupe** — Claude Code stream-json previously produced 15+ duplicate tool messages per tool_call_id. The adapter now tracks emitted ids so each tool_use → exactly one tool message. 2. **tool_result content capture** — tool_result blocks live in `type: 'user'` events in Claude Code's stream-json, not in assistant events. The adapter now handles the 'user' event type and emits a new `tool_result` HeterogeneousAgentEvent which the executor consumes to call messageService.updateToolMessage() with the actual result content. Previously all tool messages had empty content. 3. **result_msg_id on assistant.tools[]** — LobeHub's parse() step links tool messages to their parent assistant turn via tools[].result_msg_id. Without it, the UI renders orphan-message warnings. The executor now captures the tool message id returned by messageService.createMessage and writes it back into the assistant.tools[] JSONB. Also adds vitest config + 9 unit tests for the adapter covering lifecycle, content mapping, and tool_result handling. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> ✨ feat(acp): integrate external AI agents via ACP protocol Adds support for connecting external AI agents (Claude Code and future agents like Codex, Kimi CLI) into LobeHub Desktop via a new heterogeneous agent layer that adapts agent-specific protocols to the unified Gateway event stream. Architecture: - New @lobechat/heterogeneous-agents package: pluggable adapters that convert agent-specific outputs to AgentStreamEvent - AcpCtr (Electron main): agent-agnostic process manager with CLI presets registry, broadcasts raw stdout lines to renderer - acpExecutor (renderer): subscribes to broadcasts, runs events through adapter, feeds into existing createGatewayEventHandler - Tool call persistence: creates role='tool' messages via messageService before emitting tool_start/tool_end to the handler Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * ♻️ refactor: rename acpExecutor to heterogeneousAgentExecutor - Rename file acpExecutor.ts → heterogeneousAgentExecutor.ts - Rename ACPExecutorParams → HeterogeneousAgentExecutorParams - Rename executeACPAgent → executeHeterogeneousAgent - Change operation type from execAgentRuntime to execHeterogeneousAgent - Change operation label to "Heterogeneous Agent Execution" - Change error type from ACPError to HeterogeneousAgentError - Rename acpData/acpContext variables to heteroData/heteroContext Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * ♻️ refactor: rename AcpCtr and acp service to heterogeneousAgent Desktop side: - AcpCtr.ts → HeterogeneousAgentCtr.ts - groupName 'acp' → 'heterogeneousAgent' - IPC channels: acpRawLine → heteroAgentRawLine, etc. Renderer side: - services/electron/acp.ts → heterogeneousAgent.ts - ACPService → HeterogeneousAgentService - acpService → heterogeneousAgentService - Update all IPC channel references in executor Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * 🔧 chore: switch CC permission mode to bypassPermissions Use bypassPermissions to allow Bash and other tool execution. Previously acceptEdits only allowed file edits, causing Bash tool calls to fail during CC execution. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * 🐛 fix: don't fallback activeAgentId to empty string in AgentIdSync Empty string '' causes chat store to have a truthy but invalid activeAgentId, breaking message routing. Pass undefined instead. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * 🐛 fix: use AI_RUNTIME_OPERATION_TYPES for loading and cancel states stopGenerateMessage and cancelOperation were hardcoding ['execAgentRuntime', 'execServerAgentRuntime'], missing execHeterogeneousAgent. This caused: - CC execution couldn't be cancelled via stop button - isAborting flag wasn't set for heterogeneous agent operations Now uses AI_RUNTIME_OPERATION_TYPES constant everywhere to ensure all AI runtime operation types are handled consistently. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * ✨ feat: split multi-step CC execution into separate assistant messages Claude Code's multi-turn execution (thinking → tool → final text) was accumulating everything onto a single assistant message, causing the final text response to appear inside the tool call message. Changes: - ClaudeCodeAdapter: detect message.id changes and emit stream_end + stream_start with newStep flag at step boundaries - heterogeneousAgentExecutor: on newStep stream_start, persist previous step's content, create a new assistant message, reset accumulators, and forward the new message ID to the gateway handler This ensures each LLM turn gets its own assistant message, matching how Gateway mode handles multi-step agent execution. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * 🐛 fix: fix multi-step CC execution and add DB persistence tests Adapter fixes: - Fix false step boundary on first assistant after init (ghost empty message) Executor fixes: - Fix parentId chain: new-step assistant points to last tool message - Fix content contamination: sync snapshot of content accumulators on step boundary - Fix type errors (import path, ChatToolPayload casts, sessionId guard) Tests: - Add ClaudeCodeAdapter unit tests (multi-step, usage, flush, edge cases) - Add ClaudeCodeAdapter E2E test (full multi-step session simulation) - Add registry tests - Add executor DB persistence tests covering: - Tool 3-phase write (pre-register → create → backfill) - Tool result content + error persistence - Multi-step parentId chain (assistant → tool → assistant) - Final content/reasoning/model/usage writes - Sync snapshot preventing cross-step contamination - Error handling with partial content persistence - Full multi-step E2E (Read → Write → text) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * 🔧 chore: add orphan tool regression tests and debug trace - Add orphan tool regression tests for multi-turn tool execution - Add __HETERO_AGENT_TRACE debug instrumentation for event flow capture Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * ✨ feat: support image attachments in CC via stream-json stdin - Main process downloads files by ID from cloud (GET {domain}/f/{fileId}) - Local disk cache at lobehub-storage/heteroAgent/files/ (by fileId) - When fileIds present, switches to --input-format stream-json + stdin pipe - Constructs user message with text + image content blocks (base64) - Pass fileIds through executor → service → IPC → controller Closes LOBE-7254 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * ♻️ refactor: pass imageList instead of fileIds for CC vision support - Use imageList (with url) instead of fileIds — Main downloads from URL directly - Cache by image id at lobehub-storage/heteroAgent/files/ - Only images (not arbitrary files) are sent to CC via stream-json stdin Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * 🐛 fix: read imageList from persisted DB message instead of chatUploadFileList chatUploadFileList is cleared after sendMessageInServer, so tempImages was empty by the time the executor ran. Now reads imageList from the persisted user message in heteroData.messages instead. Also removes debug console.log/console.error statements. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * update i18n * 🐛 fix: prevent orphan tool UI by deferring handler events during step transition Root cause: when a CC step boundary occurs, the adapter produces [stream_end, stream_start(newStep), stream_chunk(tools_calling)] in one batch. The executor deferred stream_start via persistQueue but forwarded stream_chunk synchronously — handler received tools_calling BEFORE stream_start, dispatching tools to the OLD assistant message → UI showed orphan tool warning. Fix: add pendingStepTransition flag that defers ALL handler-bound events through persistQueue until stream_start is forwarded, guaranteeing correct event ordering. Also adds: - Minimal regression test in gatewayEventHandler confirming correct ordering - Multi-tool per turn regression test from real LOBE-7240 trace - Data-driven regression replaying 133 real CC events from regression.json Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * ✨ feat: add lab toggle for heterogeneous agent (Claude Code) - Add enableHeterogeneousAgent to UserLabSchema + defaults (off by default) - Add selector + settings UI toggle (desktop only) - Gate "Claude Code Agent" sidebar menu item behind the lab setting - Remove regression.json (no longer needed) - Add i18n keys for the lab feature Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * 🐛 fix: gate heterogeneous agent execution behind isDesktop check Without this, web users with an agent that has heterogeneousProvider config would hit the CC execution path and fail (no Electron IPC). Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * ♻️ refactor: rename tool identifier from acp-agent to claude-code Also update operation label to "External agent running". Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * ✨ feat: add CLI agent detectors for system tools settings Detect agentic coding CLIs installed on the system: - Claude Code, Codex, Gemini CLI, Qwen Code, Kimi CLI, Aider - Uses validated detection (which + --version keyword matching) - New "CLI Agents" category in System Tools settings - i18n for en-US and zh-CN Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * 🐛 fix: fix token usage over-counting in CC execution Two bugs fixed: 1. Adapter: same message.id emitted duplicate step_complete(turn_metadata) for each content block (thinking/text/tool_use) — all carry identical usage. Now deduped by message.id, only emits once per turn. 2. Executor: CC result event contains authoritative session-wide usage totals but was ignored. Now adapter emits step_complete(result_usage) from the result event, executor uses it to override accumulated values. Fixes LOBE-7261 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * 🔧 chore: gitignore cc-stream.json and .heterogeneous-tracing/ Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * 🔧 chore: untrack .heerogeneous-tracing/ Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * ✨ feat: wire CC session resume for multi-turn conversations Reads `ccSessionId` from topic metadata and passes it as `resumeSessionId` into the heterogeneous-agent executor, which forwards it into the Electron main-process controller. `sendPrompt` then appends `--resume <id>` so the next turn continues the same Claude Code session instead of starting fresh. After each run, the CC init-event session_id (captured by the adapter) is persisted back onto the topic so the chain survives page reloads. Also stops killing the session in `finally` — it needs to stay alive for subsequent turns; cleanup happens on topic deletion or app quit. * 🐛 fix: record cache token breakdown in CC execution metadata The prior token-usage fix only wrote totals — `inputCachedTokens`, `inputWriteCacheTokens` and `inputCacheMissTokens` were dropped, so the pricing card rendered zero cached/write-cache tokens even though CC had reported them. Map the accumulated Anthropic-shape usage to the same breakdown the anthropic usage converter emits, so CC turns display consistently with Gateway turns. Refs LOBE-7261 * ♻️ refactor: write CC usage under metadata.usage instead of flat fields Flat `inputCachedTokens / totalInputTokens / ...` on `MessageMetadata` are the legacy shape; new code should put usage under `metadata.usage`. Move the CC executor to the nested shape so it matches the convention the rest of the runtime is migrating to. Refs LOBE-7261 * ♻️ refactor(types): mark flat usage fields on MessageMetadata as deprecated Stop extending `ModelUsage` and redeclare each token field inline with a `@deprecated` JSDoc pointing to `metadata.usage` (nested). Existing readers still type-check, but IDEs now surface the deprecation so writers migrate to the nested shape. * ♻️ refactor(types): mark flat performance fields on MessageMetadata as deprecated Stop extending `ModelPerformance` and redeclare `duration` / `latency` / `tps` / `ttft` inline with `@deprecated`, pointing at `metadata.performance`. Mirrors the same treatment just done for the token usage fields. * ✨ feat: CC agent gets claude avatar + lands on chat page directly Skip the shared createAgent hook's /profile redirect for the Claude Code variant — its config is fixed so the profile editor would be noise — and preseed the Claude avatar from @lobehub/icons-static-avatar so new CC agents aren't blank. * 🐛 fix(conversation-flow): read usage/performance from nested metadata `splitMetadata` only scraped the legacy flat token/perf fields, so messages written under the new canonical shape (`metadata.usage`, `metadata.performance`) never populated `UIChatMessage.usage` and the Extras panel rendered blank. - Prefer nested `metadata.usage` / `metadata.performance` when present; keep flat scraping as fallback for pre-migration rows. - Add `usage` / `performance` to FlatListBuilder's filter sets so the nested blobs don't leak into `otherMetadata`. - Drop the stale `usage! || metadata` fallback in the Assistant / CouncilMember Extra renders — with splitMetadata fixed, `item.usage` is always populated when usage data exists, and passing raw metadata as ModelUsage is wrong now that the flat fields are gone. * 🐛 fix: skip stores.reset on initial dataSyncConfig hydration `useDataSyncConfig`'s SWR onSuccess called `refreshUserData` (which runs `stores.reset()`) whenever the freshly-fetched config didn't deep-equal the hard-coded initial `{ storageMode: 'cloud' }` — which happens on every first load. The reset would wipe `chat.activeAgentId` just after `AgentIdSync` set it from the URL, and because `AgentIdSync`'s sync effects are keyed on `params.aid` (which hasn't changed), they never re-fire to restore it. Result: topic SWR saw `activeAgentId === ''`, treated the container as invalid, and left the sidebar stuck on the loading skeleton. Gate the reset on `isInitRemoteServerConfig` so it only runs when the user actually switches sync modes, not on the first hydration. * ✨ feat(claude-code): wire Inspector layer for CC tool calls Mirrors local-system: each CC tool now has an inspector rendered above the tool-call output instead of an opaque default row. - `Inspector.tsx` — registry that passes the CC tool name itself as the shared factories' `translationKey`. react-i18next's missing-key fallback surfaces the literal name (Bash / Edit / Glob / Grep / Read / Write), so we don't add CC-specific entries to the plugin locale. - `ReadInspector.tsx` / `WriteInspector.tsx` — thin adapters that map Anthropic-native args (`file_path` / `offset` / `limit`) onto the shared inspectors' shape (`path` / `startLine` / `endLine`), so shared stays pure. Bash / Edit / Glob / Grep reuse shared factories directly. - Register `ClaudeCodeInspectors` under `claude-code` in the builtin-tools inspector dispatch. Also drops the redundant `Render/Bash/index.tsx` wrapper and pipes the shared `RunCommandRender` straight into the registry. * ♻️ refactor: use agentSelectors.isCurrentAgentHeterogeneous Two callsites (ConversationArea / useActionsBarConfig) were reaching into `currentAgentConfig(...)?.agencyConfig?.heterogeneousProvider` inline. Switch them to the existing `isCurrentAgentHeterogeneous` selector so the predicate lives in one place. * update * ♻️ refactor: drop no-op useCallback wrapper in AgentChat form `handleFinish` just called `updateConfig(values)` with no extra logic; the zustand action is already a stable reference so the wrapper added no memoization value. Leftover from the ACP refactor (930ba41fe3) where the handler once did more work — hand the action straight to `onFinish`. * update * ⏪ revert: roll back conversation-flow nested-shape reads Unwind the `splitMetadata` nested-preference + `FlatListBuilder` filter additions from 306fd6561f. The nested `metadata.usage` / `metadata.performance` promotion now happens in `parse.ts` (and a `?? metadata?.usage` fallback at the UI callsites), so conversation-flow's transformer layer goes back to its original flat-field-only behavior. * update * 🐛 fix(cc): wire Stop to cancel the external Claude Code process Previously hitting Stop only flipped the `execHeterogeneousAgent` operation to `cancelled` in the store — the spawned `claude -p` process kept running and kept streaming/persisting output for the user. The op's abort signal had no listeners and no `onCancelHandler` was registered. - On session start, register an `onCancelHandler` that calls `heterogeneousAgentService.cancelSession(sessionId)` (SIGINT to the CLI). - Read the op's `abortController.signal` and short-circuit `onRawLine` so late events the CLI emits between SIGINT and exit don't leak into DB writes. - Skip the error-event forward in `onError` / the outer catch when the abort came from the user, so the UI doesn't surface a misleading error toast on top of the already-cancelled operation. Verified end-to-end: prompt that runs a long sequence of Reads → click Stop → `claude -p` process is gone within 2s, op status = cancelled, no error message written to the conversation. * ✨ feat(sidebar): mark heterogeneous agents with an "External" tag Pipes the agent's `agencyConfig.heterogeneousProvider.type` through the sidebar data flow and renders a `<Tag>` next to the title for any agent driven by an external CLI runtime (Claude Code today, more later). Mirrors the group-member External pattern so future provider types just need a label swap — the field is a string, not a boolean. - `SidebarAgentItem.heterogeneousType?: string | null` on the shared type - `HomeRepository.getSidebarAgentList` selects `agents.agencyConfig` and derives the field via `cleanObject` - `AgentItem` shows `<Tag>{t('group.profile.external')}</Tag>` when the field is present Verified client-side by injecting `heterogeneousType: 'claudecode'` into a sidebar item at runtime — the "外部" tag renders next to the title in the zh-CN locale. * ♻️ refactor(i18n): dedicated key for the sidebar external-agent tag Instead of reusing `group.profile.external` (which is about group members that are user-linked rather than virtual), add `agentSidebar.externalTag` specifically for the heterogeneous-runtime tag. Keeps the two concepts separate so we can swap this one to "Claude Code" / provider-specific labels later without touching the group UI copy. Remember to run `pnpm i18n` before the PR so the remaining locales pick up the new key. * 🐛 fix: clear remaining CI type errors Three small fixes so `tsgo --noEmit` exits clean: - `AgentIdSync`: `useChatStoreUpdater` is typed off the chat-store key, whose `activeAgentId` is `string` (initial ''). Coerce the optional URL param to `''` so the store key type matches; `createStoreUpdater` still skips the setState when the value is undefined-ish. - `heterogeneousAgentExecutor.test.ts`: `scope: 'session'` isn't a valid `MessageMapScope` (the union dropped that variant); switch the fixture to `'main'`, which is the correct scope for agent main conversations. - Same test file: `Array.at(-1)` is `T | undefined`; non-null assert since the preceding calls guarantee the slot is populated. * 🐛 fix: loosen createStoreUpdater signature to accept nullable values Upstream `createStoreUpdater` types `value` as exactly `T[Key]`, so any call site feeding an optional source (URL param, selector that may return undefined) fails type-check — even though the runtime already guards `typeof value !== 'undefined'` and no-ops in that case. Wrap it once in `store/utils/createStoreUpdater.ts` with a `T[Key] | null | undefined` value type so callers can pass `params.aid` directly, instead of the lossy `?? ''` fallback the previous commit used (which would have written an empty-string sentinel into the chat store). Swap the import in `AgentIdSync.tsx`. --------- Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com> |
||
|
|
3fb6b0d8e1
|
🐛 fix(app): right panel should use stableLayout, bump @lobehub/ui to 5.9.0 (#13920)
🐛 fix(app): right panel should use stableLayout, bump @lobehub/ui to 5.9.0
|
||
|
|
3471d2bf74
|
🚀 release: sync main branch to canary (#13900)
* 🔖 chore(release): release version v2.1.50 [skip ci] * 📝 docs: Update changelog docs and release skills (#13897) * 🔨 chore: update .vscode/settings.json (#13894) * 🐛 fix(builtin-tool-local-system): honor glob scope in local system tool (#13875) Made-with: Cursor * 📝 docs: Update changelog docs and release skills (#13897) - Update changelog documentation format across all historical changelog files - Merge release-changelog-style skill into version-release skill - Update changelog examples with improved formatting and structure Made-with: Cursor --------- Co-authored-by: YuTengjing <ytj2713151713@gmail.com> Co-authored-by: Innei <i@innei.in> * 🐛 fix: resolve merge conflicts in sync main to canary Restore canary versions of skill docs that were overwritten during main-to-canary sync, keeping #13899 improvements intact. --------- Co-authored-by: CanisMinor <i@canisminor.cc> Co-authored-by: YuTengjing <ytj2713151713@gmail.com> Co-authored-by: Innei <i@innei.in> Co-authored-by: Innei <tukon479@gmail.com> |
||
|
|
93603ae83b | 🔖 chore(release): release version v2.1.51 [skip ci] | ||
|
|
d87094236a
|
🚀 release: 20260416 (#13895)
# 🚀 LobeHub v2.1.50 (20260416) **Release Date:** April 16, 2026\ **Since v2.1.49:** 107 commits · 101 merged PRs · 13 contributors > This weekly release focuses on improving runtime stability and gateway execution consistency, while making Home/Recents workflows faster to navigate and easier to manage in daily use. --- ## ✨ Highlights - **Server-side Human Approval Flow** — Agent runtime now supports more reliable approve/reject/reject-continue handling in gateway mode, reducing stalled execution paths in long-running tasks. (#13829, #13863, #13873) - **Message Gateway End-to-End Hardening** — Gateway message flow, queue handling, tool callback routing, and stop interruption behavior were strengthened for better execution continuity. (#13761, #13816, #13820, #13815) - **Client Tool Execution in Gateway Mode** — Client-executor tools now run more predictably across gateway and desktop callers, with improved executor dispatch behavior. (#13792, #13790) - **Home / Recents / Sidebar Upgrade** — Sidebar layout, custom sort, recents operations, and profile actions were improved to reduce navigation friction in active sessions. (#13719, #13812, #13723, #13739, #13878, #13734) - **Agent Workspace and Documents Expansion** — Working panel and agent document workflows were expanded and polished for better day-to-day agent operations. (#13766, #13857) - **Provider and Model Compatibility Improvements** — Added GLM-5.1 support and refined model/provider edge-case handling, including schema and error-path fixes. (#13757, #13806, #13736, #13740) --- ## 🏗️ Core Agent & Architecture ### Agent runtime and intervention lifecycle - Added server-side human approval and improved runtime coordination across approve/reject decision paths. (#13829, #13863) - Improved interrupted-task handling and operation lifecycle consistency to reduce half-finished runtime states. (#13714) - Refined error classification and payload propagation so downstream surfaces receive clearer actionable errors. (#13736, #13740) ### Execution model and dispatch behavior - Introduced executor-aware runtime behavior to better separate client/server tool execution semantics. (#13758) - Improved tool/plugin resolution and manifest handling to avoid runtime failures on malformed inputs. (#13856, #13840, #13807) --- ## 📱 Gateway & Platform Integrations - Added message gateway support and strengthened queue/error behavior for more stable cross-channel execution. (#13761, #13816, #13820) - Improved gateway callback pipeline with protocol and API additions for `tool_execute` / `tool_result`. (#13762, #13764, #13765) - Improved bot/channel reliability and DM/slash handling in Discord-related paths. (#13805, #13724) --- ## 🖥️ CLI & User Experience - Improved CLI reliability across message/topic operations and build/minify-related paths. (#13731, #13888) - Added image-to-video options and improved command behavior for generation workflows. (#13788) - Improved desktop runtime behavior for remote fetch and Linux notification urgency handling. (#13789, #13782) --- ## 🔧 Tooling - Extracted gateway stream client into `@lobechat/agent-gateway-client` to centralize protocol usage and reduce duplication. (#13866) - Improved built-in tool coverage and runtime support, including GTD server runtime and missing lobe-kb tools. (#13854, #13876) - Updated skill and frontmatter consistency in workflow tooling. (#13730) --- ## 🔒 Security & Reliability - **Security:** Strengthened API key WS auth behavior and safer serverUrl forwarding in gateway-related auth paths. (#13824) - **Reliability:** Reduced runtime stalls by improving gateway stop/interrupt and approval-state routing behavior. (#13815, #13863, #13873) - **Reliability:** Added defensive guards for malformed tool manifests and non-string content edge cases. (#13856, #13753) --- ## 👥 Contributors **101 merged PRs** from **13 contributors** across **107 commits**. ### Community Contributors - @arvinxx - Runtime, gateway, and execution reliability improvements - @Innei - Navigation, workflow UX, and desktop/CLI refinements - @rdmclin2 - Sidebar, recents, and channel behavior updates - @ONLY-yours - Tooling/runtime fixes and model execution compatibility - @tjx666 - Model support and release/tooling maintenance - @nekomeowww - Memory and search-path stability fixes - @cy948 - CLI indexing and command flow fixes - @octo-patch - Local system runtime edge-case fixes - @djthread - Desktop runtime request reliability improvements - @rivertwilight - Documentation and changelog updates - @sudongyuer - Subscription/mobile support improvements - @Zhouguanyang - Provider/model configuration correctness fixes - @lobehubbot - Translation and maintenance automation support --- **Full Changelog**: v2.1.49...v2.1.50 |
||
|
|
f1d615fa9f
|
✨ feat(document): add history management and compare workflow (#13725)
* Add document history versioning and TRPC APIs * 🩹 Improve document history patching for rekeyed editor nodes * Refine PageEditor history timeline UI * Enhance modal API documentation and update modal implementation guidelines. Introduce new modal components and migration notes for transitioning from legacy `@lobehub/ui` to `@lobehub/ui/base-ui`. Update version history localization for improved clarity in UI. Add new CompareModal components for document history comparison. Signed-off-by: Innei <tukon479@gmail.com> * 🔥 chore(docs): remove document history tech spec Made-with: Cursor * Enhance document history management by introducing a 30-day limit for history queries and updating related APIs. Refactor history service methods to support new options for filtering history based on the saved date. Improve UI elements in the PageEditor history timeline for better user experience. Signed-off-by: Innei <tukon479@gmail.com> * Add document history management features and improve API integration - Introduced constants for document history retention and limits. - Updated document history service to compact history based on new retention limits. - Refactored PageEditor to utilize constants for document history limits. - Added new TRPC router for document history management. - Enhanced JSON diffing capabilities for better patching of document history. Signed-off-by: Innei <tukon479@gmail.com> * ♻️ refactor: sync document history schema and simplify history service - Sync simplified document_history table from feat/document-history-db - Remove version/storage_kind/payload/base_version, use editor_data + saved_at - Rewrite pagination with composite (savedAt, id) cursor - Update TRPC APIs from version-based to historyId-based - Replace DocumentVersionControl with AutoSaveHint - Add integration tests for history service * ✨ feat: add per-source document history retention limits - autosave / manual: retain 20 entries each - restore / system: retain 5 entries each - trimHistoryBySource now deletes in batches of 100 to avoid unbounded overflow - removed obsolete constants: PATCH_THRESHOLD, RETENTION_LIMIT, SNAPSHOT_INTERVAL - added integration tests for large overflow trimming * ✨ add llm_call history source and queue-based snapshot for page agent * 💄 restyle document history list to Notion timeline * 💄 fix history timeline alignment, unify fonts and highlight current * ✨ feat(PageEditor): refine document history compare UI and date formatting Made-with: Cursor * ✨ feat(editor): add validation for editor data and update related interfaces - Introduced `isValidEditorData` function to validate editor data structure. - Updated `GetHistoryItemOutput` and `DocumentHistoryItemResult` interfaces to allow `editorData` to be `null`. - Modified `getDocumentEditorData` to return `null` for invalid editor data. - Added integration tests to ensure proper handling of invalid editor data in document history service. - Enhanced editor actions to prevent saving of invalid editor data. Signed-off-by: Innei <tukon479@gmail.com> * 💾 chore(database): split document history indexes * Fix manual saves and optimize history item rendering * 🌐 locale: add missing llm_call translation key in en-US file.json Add pageEditor.history.saveSource.llm_call = \"AI Edit\" to match the default locale and prevent raw i18n key from showing in the history panel. --------- Signed-off-by: Innei <tukon479@gmail.com> |
||
|
|
282415b886 | 🔖 chore(release): release version v2.1.50 [skip ci] | ||
|
|
d526b40b78
|
🐛 fix(deps): pin @react-pdf/image to 3.0.4 to avoid privatized @react-pdf/svg
Picked from canary commit
|
||
|
|
dd81642d83
|
♻️ refactor: extract agent-stream into @lobechat/agent-gateway-client package (#13866)
* ♻️ refactor: extract agent-stream into @lobechat/agent-gateway-client package
Move the Agent Gateway WebSocket client from src/libs/agent-stream/ into
a standalone workspace package at packages/agent-gateway-client/. This
eliminates the duplicate AgentStreamEvent type in apps/cli and provides
a single source of truth for the Gateway WS protocol types shared by
SPA, server, and CLI consumers.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* add agent-gateway-client
---------
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
|
||
|
|
ad634daf32
|
🧹 chore(onboarding): remove builtin-agent-onboarding and consolidate prompts (#13825)
* 🧹 chore: remove builtin-agent-onboarding and consolidate web onboarding - Merge agent system role into builtin-agents; colocate toolSystemPrompt in builtin-tool-web-onboarding - Drop unused QuestionRenderer client bundle - Gate onboarding footer switch/skip on AGENT_ONBOARDING_ENABLED for agent route Made-with: Cursor * 🧪 test: fix onboarding layout translation mock * 🧪 test: align onboarding layout test with feature flag * 🧪 test: type onboarding business const mock |
||
|
|
9f61b58a29
|
✨ feat(agent-runtime): server-side human approval flow (#13829)
* ✨ feat(agent-runtime): implement server-side human approval flow Port the client-mode human approval executors (request_human_approve, call_tool resumption, handleHumanIntervention) to the server agent runtime so that execServerAgentRuntime can correctly pause on waiting_for_human and resume on approve / reject / reject_continue. - request_human_approve now creates one `role='tool'` message per pending tool call with `pluginIntervention: { status: 'pending' }` and ships the `{ toolCallId → toolMessageId }` mapping on the `tools_calling` stream chunk. - call_tool gains a `skipCreateToolMessage` branch that updates the pre-existing tool message in-place (prevents duplicate rows / parent_id FK violations that show up as LOBE-7154 errors). - AgentRuntimeService.handleHumanIntervention implements all three paths: approve → `phase: 'human_approved_tool'`; reject → interrupted with `reason: 'human_rejected'`; reject_continue → `phase: 'user_input'`. - ProcessHumanIntervention schema carries `toolMessageId` and a new `reject_continue` action; schema remains permissive (handler no-ops on missing toolMessageId) to keep legacy callers working. Fixes LOBE-7151 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * 🐛 fix(agent-runtime): address LOBE-7151 review (P1 reject_continue, P2 duplicate tool msg) P1 — reject_continue with remaining pending tools must NOT resume the LLM. Previously `handleHumanIntervention` kept `status='waiting_for_human'` but returned `nextContext: { phase: 'user_input' }`, which `executeStep` would hand to `runtime.step` immediately, breaking batch semantics. Now when other tools are still pending, the rejection is persisted but no context is returned; the `user_input` continuation only fires when this is the last pending tool. P2 — request_human_approve was pushing an empty placeholder `{ role: 'tool', tool_call_id, content: '' }` into `newState.messages` to "reflect" the newly-created pending DB row. On resume, the `call_tool` skip-create path appends the real tool result, leaving two entries for the same `tool_call_id` in runtime state. The downstream short-circuit (`phase=human_approved_tool` → `call_tool`) doesn't consult state.messages, so the placeholder was unused cost. Removed. Also fixes a TS 2339 in the skipCreateToolMessage test where `nextContext.payload` is typed `{}` and needed an explicit cast. Tests: 99 pass (82 RuntimeExecutors + 17 handleHumanIntervention), type-check clean. Verified end-to-end via the human-approval eval — it now exercises a multi-turn retry path (LLM calls the gated tool twice) and both approvals resolve cleanly through to `completionReason=done`. Relates to LOBE-7151 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * pin @react-pdf/renderer * 🐛 fix(deps): pin @react-pdf/image to 3.0.4 to avoid privatized @react-pdf/svg @react-pdf/image@3.1.0 (auto-resolved via layout@4.6.0 ← renderer@4.4.1) declares `@react-pdf/svg@^1.1.0` as a dependency, but the svg package was unpublished/made private on npm (returns 404). CI installs blow up with ERR_PNPM_FETCH_404. Upstream issue: https://github.com/diegomura/react-pdf/issues/3377 Pin image to 3.0.4 (the last release before the broken svg dep was introduced) via pnpm.overrides until react-pdf publishes a fix. --------- Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com> |
||
|
|
b4fc85b57b
|
💄 style(proxy-settings): sticky pill SaveBar + instant enable toggle (#13821)
* 🔖 chore(release): release version v2.1.49 [skip ci] * 💄 style(proxy-settings): sticky pill SaveBar + instant enable toggle - Split enableProxy into instant-apply (no save required) - Floating pill SaveBar fixed bottom-center, visible only when dirty - Test connection feedback moved to toast (@lobehub/ui) - Refresh style guidance: prefer createStaticStyles + cssVar Fixes LOBE-7071 * 🐛 fix(proxy-settings): rollback enable toggle on save failure, preserve in-progress edits --------- Co-authored-by: lobehubbot <i@lobehub.com> |
||
|
|
fd0d846975
|
✨ feat: support layout custom sort and fix copy (#13812)
* fix: menu locale keys * feat: support resort sidebar * feat: add lock to middle messages * feat: add memory menu and default hidden * fix: lint error * fix: legacy secion order * chore: add test cases * chore: remove top zone * feat: custom sidebar reorder * chore: fix sidebar items |
||
|
|
f439fb913a
|
🐛 fix(editor): bump @lobehub/editor to 4.8.1 (#13756)
🐛 fix: bump @lobehub/editor to 4.8.1
|
||
|
|
4feafb3fcb
|
♻️ refactor: migrate memory-user-memory workflows to Hono (#13768)
Replace 6 per-path Next.js `route.ts` handlers (using `@upstash/workflow/nextjs` serve) with a single Hono app mounted at `[[...route]]`. Workflow logic moves to `src/server/workflows-hono/memory-user-memory/`; all public URLs remain unchanged so existing `MemoryExtractionWorkflowService.triggerXxx` callers need no update. Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com> |
||
|
|
73be58ba12
|
✨ feat: support message gateway (#13761)
* feat: support message gateway * feat: sync message gateway connections * chore: add cloudflare http v2 * fix: typing interval * feat: add connnectionMode to gateway * chore: add applicationId when connect * fix: judge typing supoort by triggerTyping implementation * fix: skip message gateway & start connnections * fix: qq platform hint * chore: skip webhook mode in gateway connection * fix: test case * fix: message gateway check * chore: add failaure case post * fix: test case * feat: add GatewayManager for webhook-mode platforms |
||
|
|
cd49e98936
|
chore: bump lucide-react to v1.8.0 (#13703)
* chore: bump lucide-react from ^0.577.0 to ^1.8.0 Breaking change: Github icon was removed from lucide-react v1.x (brand icons removed). Replaced with Github from @lobehub/icons in 5 affected files. * fix: use GithubIcon from @lobehub/ui/icons instead of @lobehub/icons |
||
|
|
d47f4fec76 | 🔖 chore(release): release version v2.1.49 [skip ci] | ||
|
|
9088a074e2
|
🚀 release: 20260410 (#13716)
## 📦 Weekly Release 20260410
This release includes **67 commits**. Key user-facing updates below.
### New Features and Enhancements
- Introduced **Prompt Rewrite & Translate** feature for assisted input
editing.
- Added **Skill Panel** with dedicated skills tab in the skill store and
fixed skill icon rendering.
- Introduced `lh notify` CLI command for external agent callbacks.
- Added `migrate openclaw` CLI command.
- Added **GraphAgent** and `agentFactory` for graph-driven agent
execution (experimental).
- New topic auto-creation every 4 hours for long-running sessions.
### Models and Provider Expansion
- Added a new provider: **StreamLake (快手万擎)**.
- Added **GLM-5.1** model support with Kimi CodingPlan fixes.
- Added **Seedance 2.0** & **Seedance 2.0 Fast** video generation models
(pricing adjusted with 20% service fee).
- Expanded AIGC parameter support for image and video generation.
- Improved model type normalization for better provider compatibility.
- Multi-media and multiple connection mode support for ComfyUI
integration.
### Desktop Improvements
- **Embedded CLI** in the desktop app with PATH installation support.
- Added Electron version display in system tools settings.
- Fixed RuntimeConfig instant-apply working directory with recent list.
- Fixed desktop locale restore — now uses stored URL parameter instead
of system locale.
- Improved remote re-auth for batched tRPC and clean OIDC on gateway
disconnect.
### Stability, Security, and UX Fixes
- **Security**: prevented path traversal in
`TempFileManager.writeTempFile`; patched IDOR in
`addFilesToKnowledgeBase`; upgraded `better-auth` with hardened
`humanIntervention` requirement in builtin-tool-activator.
- **Context engine**: added `typeof` guard before `.trim()` calls to
prevent runtime crashes.
- **Agent runtime**: preserved reasoning state across OpenAI providers;
fixed service error serialization producing `[object Object]`; surfaced
error `reasonDetail` in `agent_runtime_end` events.
- **Knowledge Base**: cleaned up vector storage when deleting knowledge
bases.
- **Templates**: allow templates to specify `policyLoad` so default docs
are fully injected.
- **Skills**: inject current agents information when `lobehub_skill` is
activated; filter current agent out of available agents list; fix
`agents_documents` overriding `systemRole`.
- **Google Tools**: use `parametersJsonSchema` for Google tool schemas.
- **Web Crawler**: prevent happy-dom CSS parsing crash in
`htmlToMarkdown`.
- **Mobile/UI**: fixed video page icon collision, missing locale keys,
model query param; hidden LocalFile actions on topic share page; allow
manual close of hidden builtin tools.
- **Auth**: `ENABLE_MOCK_DEV_USER` now supported in `checkAuth` and
openapi auth middleware.
- **Sandbox**: stopped using `sanitizeHTMLContent` to block scripts &
sandbox styles.
### Refactors
- Library/resource tree store for hierarchy and move sync.
- Removed legacy `messageLoadingIds` from chat store.
- Removed promptfoo configs and dependencies.
- `OnboardingContextInjector` wired into context engine.
### Credits
Huge thanks to these contributors (alphabetical):
@arvinxx @canisminor1990 @cy948 @hardy-one @hezhijie0327 @Innei
@MarcellGu @ONLY-yours @rdmclin2 @rivertwilight @sxjeru @tjx666
|
||
|
|
475622a4b9
|
✨ feat: support multi media and multiple connection mode (#13624)
* test: add feishu and qq test cases * feat: support qq websocket mode * feat: support slack websocket mode * feat: feishu/lark support websocket connectMode * chore: add default connection mode * fix: discord 401 sign error * fix: feishu websocket need verification token * fix: heartbeate interval * fix: get effective connnection mode * chore: extract getEffectiveConnectionMode utils * chore: merge with default settings * chore: add connectionMode fallback * fix: file extract error * fix: list platforms by connectionMode * fix: qq bot gateway * fix: support fileList * feat: support video list * chore: migrate local testing to references * chore: add bot skill * fix: telegram file serialize error * feat: extract file extract logic to platform client * fix: wechat file read * feat: skip no metion in thread and set default message mode to queue * chore: refact download resources * fix: feishu adapter mention and dm error * fix: feishu thread id * fix: slack remove action * fix: bot resovle files |
||
|
|
84eff30be1
|
Update dependency lucide-react to ^0.577.0 (#13580)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> |
||
|
|
7d599a980f | 🔖 chore(release): release version v2.1.48 [skip ci] | ||
|
|
918e4a8fa1 | Merge remote-tracking branch 'origin/main' into canary | ||
|
|
aec2d30506
|
♻️ refactor: add the cronjob tools executiors (#13536)
* fix: add the cronjob tools executiors * fix: should use mutate to refresh the cronjob when it changes && add it into backend runtime * fix: add the lost deps * fix: should await the delete servers |
||
|
|
3415df3715
|
♻️ refactor: remove chat-plugin-sdk (#13512)
* ♻️ refactor: remove @lobehub/chat-plugin-sdk dependency Plugins have been deprecated. This removes the SDK entirely: - Define built-in ToolManifest, ToolManifestSettings, ToolErrorType types - Delete src/features/PluginsUI/ (plugin iframe rendering) - Delete src/store/tool/slices/oldStore/ (deprecated plugin store) - Delete src/server/services/pluginGateway/ (plugin gateway) - Delete src/app/(backend)/webapi/plugin/gateway/ (plugin API route) - Migrate all ~50 files from SDK imports to @lobechat/types - Remove @lobehub/chat-plugin-sdk, @lobehub/chat-plugins-gateway deps - Remove @swagger-api/apidom-reference override and patch Fixes LOBE-6655 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * 🐛 fix: add missing getInstalledPlugins mock in customPlugin test Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * 🔧 chore: increase Vercel build memory limit to 8192MB The 6144MB limit was causing OOM during Vite SPA chunk rendering. Aligned with other build commands that already use 8192MB. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * ♻️ refactor: unify default tool type to builtin and fix CustomRender - Remove `invokeDefaultTypePlugin` — default type now falls through to builtin in both server and client execution paths - Fix `CustomRender` to actually render builtin tool components via `getBuiltinRender` instead of always returning null - Increase SPA build memory limit from 7168MB to 8192MB to fix OOM Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * ♻️ refactor: remove legacy plugin gateway and type-specific invocations - Delete `runPluginApi`, `internal_callPluginApi`, `invokeMarkdownTypePlugin`, `invokeStandaloneTypePlugin` - Remove plugin gateway endpoint (`/webapi/plugin/gateway`) from URL config - Remove special `builtin → default` runtimeType mapping in plugin model - Clean up unused imports and related tests Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * 🐛 fix: add 'builtin' to runtimeType union to fix type error Use ToolManifestType instead of inline union for runtimeType fields so that 'builtin' is included as a valid type. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com> |
||
|
|
9f2d7daa17
|
💄 style: add more videoGen provider support (#13428)
Co-authored-by: YuTengjing <ytj2713151713@gmail.com> |
||
|
|
be99aaebd0
|
♻️ refactor: unify tool content formatting with ComputerRuntime and shared UI (#13470)
* ♻️ refactor: unify tool content formatting with ComputerRuntime and shared UI components Introduce `@lobechat/tool-runtime` with `ComputerRuntime` abstract class to ensure consistent content formatting (via `formatCommandResult`, `formatFileContent`, etc.) across local-system, cloud-sandbox, and skills packages. Create `@lobechat/shared-tool-ui` to share Render and Inspector components, eliminating duplicated UI code across tool packages. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * 🐛 fix: address review issues — state mapping for renders and IPC param denormalization - Add legacy state field mappings in local-system executor (listResults, fileContent, searchResults) for backward compatibility with existing render components - Add denormalizeParams in LocalSystemExecutionRuntime to map ComputerRuntime params back to IPC-expected field names (file_path, items, shell_id, etc.) - Fix i18n type casting for dynamic translation keys in shared-tool-ui inspectors Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * ♻️ refactor: inject render capabilities via context, unify state shape for cross-package render reuse - Add ToolRenderContext with injectable capabilities (openFile, openFolder, isLoading, displayRelativePath) to shared-tool-ui - Update local-system render components (ReadLocalFile, ListFiles, SearchFiles, MoveLocalFiles, FileItem) to use context instead of direct Electron imports - Enrich ReadFileState with render-compatible fields (filename, fileType, charCount, loc, totalCharCount) - Cloud-sandbox now fully reuses local-system renders — renders degrade gracefully when capabilities are not provided (no open file buttons in sandbox) - Remove executor-level state mapping hacks Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * 🐛 fix: fix sandbox render bugs — SearchFiles, GrepContent, MoveFiles, GlobFiles - SearchFiles: ensure results is always an array (not object passthrough) - GrepContent: update formatGrepResults to support object matches `{path, content, lineNumber}` alongside string matches - MoveFiles: render now handles both IPC format (items/oldPath/newPath) and ComputerRuntime format (operations/source/destination) - GlobFiles: fallback totalCount to files.length when API returns 0 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * 🐛 fix: unify SearchLocalFiles inspector with shared factory SearchLocalFiles inspector now supports all keyword field variants (keyword, keywords, query) and reads from unified state (results/totalCount). Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * 🐛 fix: handle missing path in grep matches to avoid undefined display Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * 🐛 fix: improve render field compatibility for sandbox - EditLocalFile render: support both file_path (IPC) and path (sandbox) args - SearchFiles render: support keyword/keywords/query arg variants - FileItem: derive name from path when not provided Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * 🐛 fix: add missing cloud-sandbox i18n key for noResults Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com> |
||
|
|
df6d8f19f8
|
🔒 fix: upgrade nodemailer to v8 to fix SMTP command injection (#13479) | ||
|
|
19f90e3d9a
|
♻️ refactor: change the klavis github tools into lobehub skill & add vercel skills (#13442)
* refactor: change the klavis github tools into lobehub skill & add the vercel skill * fix: slove the test & topicid parse |
||
|
|
aaefe6c0d2
|
👷 chore(ci): unify CI package manager from bun to pnpm (#13464)
* 👷 chore(ci): unify CI package manager from bun to pnpm Replace bun with pnpm across all GitHub Actions workflows to ensure lockfile consistency with pnpm-lock.yaml as single source of truth. * 👷 chore(ci): replace bun run with pnpm run in package.json scripts Fix build failure in CI where bun is not installed. Replace bun run references in root and e2e package.json scripts with pnpm run. * 👷 chore(e2e): replace bunx with npx in e2e server startup * 👷 chore(ci): create unified setup-env action, use pnpm install + bun run - Add .github/actions/setup-env composite action (pnpm + bun + node) - Refactor desktop-build-setup to use setup-env internally - All workflows: pnpm install for deps, bun run for scripts - Revert package.json/e2e scripts back to bun run - Remove all direct pnpm/action-setup and oven-sh/setup-bun from workflows * 🐛 fix(test): inline lexical ESM deps for vitest under pnpm pnpm's strict node_modules layout causes vitest ESM resolution to fail for lexical's named exports. Add lexical and @lexical/* to inline deps. |
||
|
|
393653e20c
|
⬆️ chore: bump Lexical to 0.42 and align editor imports (#13440)
* ⬆️ chore: bump Lexical to 0.42 and align editor imports - Bump lexical and @lexical/utils; pin lexical in pnpm overrides - Return serialized nodes from ActionTag/ReferTopic XML readers (no INodeHelper require) - Drop IEditorPlugin implements; import MenuRenderProps and IEditor from @lobehub/editor barrel Made-with: Cursor * ✨ chore: add lexical dependency version 0.42.0 to package.json Signed-off-by: Innei <tukon479@gmail.com> * ✨ test: enhance MCPClient Stdio Transport tests with local stdio entry - Updated the test configuration to use a local stdio entry instead of `npx`, improving test reliability in CI environments. - Added necessary imports for path resolution to support the new configuration. Signed-off-by: Innei <tukon479@gmail.com> --------- Signed-off-by: Innei <tukon479@gmail.com> |
||
|
|
965fc929e1
|
feat: add unified messaging tool for cross-platform communication (#13296)
* ✨ feat: add cross-platform message tool for AI bot channel operations Implement a unified message tool (`lobe-message`) that provides AI with messaging capabilities across Discord, Telegram, Slack, Google Chat, and IRC through a single interface with platform-specific extensions. Core APIs: sendMessage, readMessages, editMessage, deleteMessage, searchMessages, reactToMessage, getReactions, pin/unpin management, channel/member info, thread operations, and polls. Architecture follows the established builtin-tool pattern: - Package: @lobechat/builtin-tool-message (manifest, types, executor, ExecutionRuntime, client components) - Registry: registered in builtin-tools (renders, inspectors, interventions, streamings) - Server runtime: stub service ready for platform adapter integration https://claude.ai/code/session_011sHc6R7V4cSYKere9RY1QM * feat: implement platform specific message service * chore: add wechat platform * chore: update wechat api service * chore: update protocol implementation * chore: optimize platform api test * fix: lark domain error * feat: support bot message cli * chore: refactor adapter to service * chore: optimize bot status fetch * fix: bot status * fix: channel nav ignore * feat: message tool support bot manage * feat: add lobe-message runtime * feat: support direct message * feat: add history limit * chore: update const limit * feat: optimize server id message history limit * chore: optimize system role & inject platform environment info * chore: update readMessages vibe * fix: form body width 50% * chore: optimize tool prompt * chore: update i18n files * chore: optimize read message system role and update bot message lh * updage readMessage api rate limit * chore: comatible for readMessages * fix: feishu readMessage implementation error * fix: test case * chore: update i18n files * fix: lint error * chore: add timeout for conversaction case * fix: message test case * fix: vite gzip error --------- Co-authored-by: Claude <noreply@anthropic.com> |
||
|
|
f6314cc673
|
♻️ refactor: serve Vite SPA static assets under /_spa (#13409)
Made-with: Cursor |
||
|
|
0e57fd9955
|
✨ feat(onboarding): agent web onboarding, feature toggle, and lifecycle sync (#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> |
||
|
|
11318f8ab9 | 🔖 chore(release): release version v2.1.47 [skip ci] | ||
|
|
aaff9af3b7 | Merge remote-tracking branch 'origin/main' into canary | ||
|
|
feb50e7007
|
🚀 release: 20260327 (#13330)
# 🚀 release: 20260326 This release includes **91 commits**. Key updates are below. - **Agent can now execute background tasks** — Agents can perform long-running operations without blocking your conversation. [#13289](https://github.com/lobehub/lobe-chat/pull/13289) - **Better error messages** — Redesigned error UI across chat and image generation with clearer explanations and recovery options. [#13302](https://github.com/lobehub/lobe-chat/pull/13302) - **Smoother topic switching** — No more full page reloads when switching topics while an agent is responding. [#13309](https://github.com/lobehub/lobe-chat/pull/13309) - **Faster image uploads** — Large images are now automatically compressed to 1920px before upload, reducing wait times. [#13224](https://github.com/lobehub/lobe-chat/pull/13224) - **Improved knowledge base** — Documents are now properly parsed before chunking, improving retrieval accuracy. [#13221](https://github.com/lobehub/lobe-chat/pull/13221) ### Bot Platform - **WeChat Bot support** — You can now connect LobeChat to WeChat, in addition to Discord. [#13191](https://github.com/lobehub/lobe-chat/pull/13191) - **Richer bot responses** — Bots now support custom markdown rendering and context injection. [#13294](https://github.com/lobehub/lobe-chat/pull/13294) - **New bot commands** — Added `/new` to start fresh conversations and `/stop` to halt generation. [#13194](https://github.com/lobehub/lobe-chat/pull/13194) - **Discord stability fixes** — Fixed thread creation issues and Redis connection drops. [#13228](https://github.com/lobehub/lobe-chat/pull/13228) [#13205](https://github.com/lobehub/lobe-chat/pull/13205) ### Models & Providers - **GLM-5** is now available in the LobeHub model list. [#13189](https://github.com/lobehub/lobe-chat/pull/13189) - **Coding Plan providers** — Added support for code planning assistant providers. [#13203](https://github.com/lobehub/lobe-chat/pull/13203) - **Tencent Hunyuan 3.0 ImageGen** — New image generation model from Tencent. [#13166](https://github.com/lobehub/lobe-chat/pull/13166) - **Gemini content handling** — Better handling when Gemini blocks content due to safety filters. [#13270](https://github.com/lobehub/lobe-chat/pull/13270) - **Claude token limits fixed** — Corrected max window tokens for Anthropic Claude models. [#13206](https://github.com/lobehub/lobe-chat/pull/13206) ### Skills & Tools - **Auto credential injection** — Skills can now automatically request and use required credentials. [#13124](https://github.com/lobehub/lobe-chat/pull/13124) - **Smarter tool permissions** — Built-in tools skip confirmation for safe paths like `/tmp`. [#13232](https://github.com/lobehub/lobe-chat/pull/13232) - **Model switcher improvements** — Quick access to provider settings and visual highlight for default model. [#13220](https://github.com/lobehub/lobe-chat/pull/13220) ### Memory - **Bulk delete memories** — You can now delete all memory entries at once. [#13161](https://github.com/lobehub/lobe-chat/pull/13161) - **Per-agent memory control** — Memory injection now respects individual agent settings. [#13265](https://github.com/lobehub/lobe-chat/pull/13265) ### Desktop App - **Gateway connection** — Desktop app can now connect to LobeHub Gateway for enhanced features. [#13234](https://github.com/lobehub/lobe-chat/pull/13234) - **Connection status indicator** — See gateway connection status in the titlebar. [#13260](https://github.com/lobehub/lobe-chat/pull/13260) - **Settings persistence** — Gateway toggle state now persists across app restarts. [#13300](https://github.com/lobehub/lobe-chat/pull/13300) ### CLI - **API key authentication** — CLI now supports API key auth for programmatic access. [#13190](https://github.com/lobehub/lobe-chat/pull/13190) - **Shell completion** — Tab completion for bash/zsh/fish shells. [#13164](https://github.com/lobehub/lobe-chat/pull/13164) - **Man pages** — Built-in manual pages for CLI commands. [#13200](https://github.com/lobehub/lobe-chat/pull/13200) ### Security - **XSS protection** — Sanitized search result image titles to prevent script injection. [#13303](https://github.com/lobehub/lobe-chat/pull/13303) - **Workflow hardening** — Fixed potential shell injection in release automation. [#13319](https://github.com/lobehub/lobe-chat/pull/13319) - **Dependency update** — Updated nodemailer to address security advisory. [#13326](https://github.com/lobehub/lobe-chat/pull/13326) ### Bug Fixes - Fixed skill page not redirecting correctly after import. [#13255](https://github.com/lobehub/lobe-chat/pull/13255) [#13261](https://github.com/lobehub/lobe-chat/pull/13261) - Fixed token counting in group chats. [#13247](https://github.com/lobehub/lobe-chat/pull/13247) - Fixed editor not resetting when switching to empty pages. [#13229](https://github.com/lobehub/lobe-chat/pull/13229) - Fixed manual tool toggle not working. [#13218](https://github.com/lobehub/lobe-chat/pull/13218) - Fixed Search1API response parsing. [#13207](https://github.com/lobehub/lobe-chat/pull/13207) [#13208](https://github.com/lobehub/lobe-chat/pull/13208) - Fixed mobile topic menus rendering issues. [#12477](https://github.com/lobehub/lobe-chat/pull/12477) - Fixed history count calculation for accurate context. [#13051](https://github.com/lobehub/lobe-chat/pull/13051) - Added missing Turkish translations. [#13196](https://github.com/lobehub/lobe-chat/pull/13196) ### Credits Huge thanks to these contributors: @bakiburakogun @hardy-one @Zhouguanyang @sxjeru @hezhijie0327 @arvinxx @cy948 @CanisMinor @Innei @LiJian @lobehubbot @Neko @rdmclin2 @rivertwilight @tjx666 |
||
|
|
953033355b
|
🔨 chore: optimize bot platform ux (#13262)
* chore: remove typing interval * chore: optimize wechat media problem * chore: add webhook helpers * chore: update telegram docs * chore: extract wechat credentials to custom render form * feat: support wechat file upload * feat: support concurrency mode and debounceMs * chore: add locales * chore: support visible then * chore: support auto disapear save result info * chore: default debounce mode * chore: optimize doc position * chore: adjust ack message logic * fix: aes throw |
||
|
|
6e86912e7f
|
Update dependency nodemailer to ^7.0.13 [SECURITY] (#13326)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> |
||
|
|
4576059f4f
|
♻️ refactor: implement SkillResolver, BaseSystemRoleProvider, and agent document injection pipeline (#13315)
* ♻️ refactor: implement SkillResolver to replace ad-hoc skill assembly Introduces a two-layer skill resolution architecture mirroring ToolsEngine + ToolResolver: - SkillEngine (assembly layer): accepts raw skills + enableChecker, outputs OperationSkillSet - SkillResolver (resolution layer): merges operation + step delta + accumulated activations Key changes: - Add SkillResolver, OperationSkillSet, StepSkillDelta, ActivatedStepSkill types - Enhance SkillEngine with enableChecker and generate() method - Wire SkillResolver into RuntimeExecutors call_llm - Replace manual skillMetas assembly in aiAgent with SkillEngine.generate() - Update client-side skillEngineering to use SkillEngine + enableChecker - Add activatedStepSkills to AgentState for step-level skill accumulation Fixes: agent-browser content injected into non-desktop scenarios (Discord bot) due to missing filterBuiltinSkills call in aiAgent LOBE-6410 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * ♻️ refactor: extract agent-templates to standalone package and inject documents server-side - Create @lobechat/agent-templates package with types, templates, and registry - Move DocumentLoadPosition, DocumentLoadFormat, DocumentLoadRule, etc. to new package - Move claw templates (AGENTS, BOOTSTRAP, IDENTITY, SOUL) with .md file imports - Add BOOTSTRAP.md as new onboarding template (priority 1, system-append) - Fix template positions: AGENTS→before-system, IDENTITY/SOUL→system-append - Update database package to re-export from @lobechat/agent-templates - Migrate all consumers to import directly from @lobechat/agent-templates - Add agent documents injection in server-side RuntimeExecutors (was missing) - Support -p CLI flag in devStartupSequence for port configuration Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * 🐛 fix: correct import statement for non-type exports from agent-templates Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * 📦 build: add @lobechat/agent-templates to root dependencies Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * ♻️ refactor: remove template proxy files from database package Stop re-exporting template/templates from database — consumers import directly from @lobechat/agent-templates. Keep types.ts re-exports for internal database code only. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * ♻️ refactor: create BaseSystemRoleProvider to unify system message append pattern All providers that append to the system message now inherit from BaseSystemRoleProvider and only implement buildSystemRoleContent(). The base class handles find-or-create and join logic. Migrated providers: - EvalContextSystemInjector - BotPlatformContextInjector - SystemDateProvider - ToolSystemRoleProvider - HistorySummaryProvider - SkillContextProvider Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * 🐛 fix: restore metadata tracking in BaseSystemRoleProvider via onInjected hook Add onInjected() callback to BaseSystemRoleProvider so subclasses can update pipeline metadata after successful injection. Also add raw-md plugin to context-engine vitest config for .md imports. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * ✨ feat: add enabled field to AgentDocumentInjector config Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * ♻️ refactor: add enabled field to all providers, remove spread conditionals in MessagesEngine All providers now accept an `enabled` config field. MessagesEngine pipeline is a flat array with no spread conditionals — each provider is always instantiated and uses `enabled` to skip internally. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * 💄 style: clean up MessagesEngine pipeline comments Remove numbered prefixes, keep descriptive comments for each provider. Only phase headers use separator blocks. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * ♻️ refactor: reorganize MessagesEngine pipeline phases by injection target Phase 1: History Truncation Phase 2: System Message Assembly (all BaseSystemRoleProvider) Phase 3: Context Injection (before first user message, BaseFirstUserContentProvider) Phase 4: User Message Augmentation (last user message injections) Phase 5: Message Transformation (flatten, template, variables) Phase 6: Content Processing & Cleanup (multimodal, tool calls, cleanup) Moved SkillContext, ToolSystemRole, HistorySummary from Phase 3 to Phase 2 since they append to system message, not user context. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * 💄 style: split Phase 6 into Content Processing (6) and Cleanup (7) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * ♻️ refactor: split AgentDocumentInjector into three position-based injectors - AgentDocumentSystemInjector (Phase 2): before-system, system-append, system-replace - AgentDocumentContextInjector (Phase 3): before-first-user - AgentDocumentMessageInjector (Phase 4): after-first-user, context-end Shared utilities (filterByRules, formatDocument, sortByPriority) extracted to AgentDocumentInjector/shared.ts. Old monolithic injector removed. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * ♻️ refactor: split AgentDocumentSystemInjector into three separate injectors - AgentDocumentBeforeSystemInjector: prepends as separate system message (before-system) - AgentDocumentSystemAppendInjector: appends to system message (system-append) - AgentDocumentSystemReplaceInjector: replaces entire system message (system-replace) Each has distinct semantics and correct pipeline placement: - BeforeSystem → before SystemRoleInjector - SystemAppend → after HistorySummary (end of Phase 2) - SystemReplace → last in Phase 2 (destructive) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * ✨ feat: auto-enable agent-documents tool when agent has documents - Add AgentDocumentsManifest to defaultToolIds - Add hasAgentDocuments rule in server createServerAgentToolsEngine - Query agent documents in AiAgentService.execAgent to determine flag - Pattern matches KnowledgeBase auto-enable via enableChecker rules Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * 🔨 chore: add agent documents status to execAgent operation log Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * update content * fix tests * 🐛 fix: add raw-md plugin to database vitest configs Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com> |
||
|
|
3f148005e4
|
♻️ refactor: remove langchain dependency, use direct document loaders (#13304)
* ♻️ refactor: remove langchain dependency, use direct document loaders Replace langchain and @langchain/community with self-implemented text splitters and direct usage of underlying libraries (pdf-parse, d3-dsv, mammoth, officeparser, epub2). This eliminates unnecessary dependency bloat and addresses CVE-2026-26019 in @langchain/community. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * 🐛 fix: add missing @types/html-to-text and @types/pdf-parse Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com> |
||
|
|
4e60d87514
|
🔒 refactor: remove deprecated SystemJS plugin renderer (#13305)
🔒 fix: remove SystemJS plugin renderer to eliminate arbitrary JS execution risk
The old plugin render system (ui.mode === 'module') that used SystemJS
to dynamically load and execute JS from untrusted URLs has been fully
retired. Remove SystemJsRender and systemjs dependency entirely.
Ref: GHSA-46v7-wvmj-6vf7
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
|
||
|
|
093fa7bcae
|
✨ feat: support agent tasks system (#13289)
* ✨ feat: agent task system — CLI, review rubrics, workspace, comments, brief tool split support import md Major changes: - Split task CLI into modular files (task/, lifecycle, topic, doc, review, checkpoint, dep) - Split builtin-tool-task into task + brief tools (conditional injection) - Task review uses EvalBenchmarkRubric from @lobechat/eval-rubric - Task workspace: documents auto-pin via Notebook, tree view with folders - Task comments system (task_comments table) - Task topics: dedicated TaskTopicModel with userId, handoff fields, review results - Heartbeat timeout auto-detection in detail API - Run idempotency (reject duplicate runs) + error rollback - Topic cancel/delete by topicId only (no taskId needed) - Integration tests for task router (13 tests) - interruptOperation fix (string param, not object) - Global TRPC error handler in CLI Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> task document workflow task handoff loop 🗃️ chore: consolidate task system migrations into single 0095 Merged 7 separate migrations (0095-0101) into one: - tasks, briefs, task_comments, task_dependencies, task_documents, task_topics tables - All fields including sort_order, resolved_action/comment, review fields - Idempotent CREATE TABLE IF NOT EXISTS, DROP/ADD CONSTRAINT, CREATE INDEX IF NOT EXISTS Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> fix interruptOperation topic auto review workflow topic handoff workflow finish run topic and brief workflow support task tool improve task schema update ✨ feat: add onComplete hook to task.run for completion callbacks When agent execution completes, the hook: - Updates task heartbeat - Creates a result Brief (on success) with assistant content summary - Creates an error Brief (on failure) with error message - Supports both local (handler) and production (webhook) modes Uses the new Agent Runtime Hooks system instead of raw stepCallbacks. LOBE-6160 LOBE-6208 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> ✨ feat: add Review system — LLM-as-Judge automated review Task review uses an independent LLM call to evaluate topic output quality against configurable criteria with pass/fail thresholds. - TaskReviewService: structured LLM review via generateObject, auto-resolves model/provider from user's system agent defaults - Model: getReviewConfig, updateReviewConfig on TaskModel - Router: getReview, updateReview, runReview procedures - CLI: `task review set/view/run` commands - Auto-creates Brief with review results LOBE-6165 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> ✨ feat: add TaskScheduler, multi-topic execution, and handoff context - TaskScheduler: interface + Local implementation (setTimeout-based), following QueueService dual-mode pattern - Multi-topic execution: `task run --topics N --delay S` runs N topics in sequence with optional delay between them - Handoff context: buildTaskPrompt() queries previous topics by metadata.taskId and injects handoff summaries into the next topic's prompt (sliding window: latest full, older summaries only) - Heartbeat auto-update between topics LOBE-6161 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> ✨ feat: add Heartbeat watchdog + heartbeat CLI Watchdog scans running tasks with expired heartbeats, marks them as failed, and creates urgent error Briefs. Heartbeat CLI allows manual heartbeat reporting for testing. - Model: refactored to use Drizzle operators (isNull, isNotNull, ne) instead of raw SQL where possible; fixed findStuckTasks to skip tasks without heartbeat data - Router: heartbeat (manual report), watchdog (scan + fail + brief) - Router: updateSchema now includes heartbeatInterval, heartbeatTimeout - CLI: `task heartbeat <id>`, `task watchdog`, `task edit` with --heartbeat-timeout, --heartbeat-interval, --description LOBE-6161 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> ♻️ refactor: move CheckpointConfig to @lobechat/types Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> ✨ feat: add task run — trigger agent execution for tasks Task.run creates a topic, triggers AiAgentService.execAgent with task context, and streams results via SSE. Supports both agentId and slug. - Service: added taskId to ExecAgentParams, included in topic metadata - Router: task.run procedure — resolves agent, builds prompt, calls execAgent, updates topic count and heartbeat - CLI: `task run <id>` command with SSE streaming, --prompt, --verbose LOBE-6160 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> ✨ feat: add Checkpoint system for task review gates Checkpoint allows configuring pause points in task execution flow. Supports beforeIds (pause before subtask starts) and afterIds (pause after subtask completes) on parent tasks. - Model: CheckpointConfig type, getCheckpointConfig, updateCheckpointConfig, shouldPauseBeforeStart, shouldPauseAfterComplete - Router: getCheckpoint, updateCheckpoint procedures; integrated with updateStatus for automatic checkpoint triggering - CLI: `task checkpoint view/set` commands with --before, --after, --topic-before, --topic-after, --on-agent-request options - Tests: 3 new checkpoint tests (37 total) LOBE-6162 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> ✨ feat: add dependency unlocking on task completion When a task completes, automatically check and unlock blocked tasks whose dependencies are all satisfied (backlog → running). Also notify when all subtasks of a parent are completed. - Model: getUnlockedTasks, areAllSubtasksCompleted (Drizzle, no raw SQL) - Router: updateStatus hook triggers unlocking on completion - CLI: shows unlocked tasks and parent completion notification - Tests: 3 new tests (34 total) LOBE-6164 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> ✨ feat: add Brief system — schema, model, router, CLI Brief is a universal Agent-to-User reporting mechanism, not limited to Tasks. CronJobs, Agents, and future systems can all produce Briefs. - Schema: briefs table with polymorphic source (taskId, cronJobId, agentId) - Model: BriefModel with CRUD, listUnresolved (Daily Brief), markRead, resolve - Router: TRPC brief router with taskId identifier resolution - CLI: `lh brief` command (list/view/read/resolve) - Tests: 11 model tests - Migration: 0096_add_briefs_table.sql LOBE-6163 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> ✨ feat: add Task system — schema, model, router, CLI Implement the foundational Task system for managing long-running, multi-topic agent tasks with subtask trees and dependency chains. - Schema: tasks, task_dependencies, task_documents tables - Model: TaskModel with CRUD, tree queries, heartbeat, dependencies, document pinning - Router: TRPC task router with identifier/id resolution - CLI: `lh task` command (list/view/create/edit/delete/start/pause/resume/complete/cancel/tree/dep) - Tests: 31 model tests - Migration: 0095_add_task_tables.sql LOBE-6036 LOBE-6054 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * update * 🐛 fix: update brief model import path and add raw-md vitest plugin Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * 🐛 fix: eslint import sort in vitest config Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * 🐛 fix: brief ID validation, auto-review retry, and continueTopicId operationId Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * 🐛 fix: task integration tests — create test agent for FK, fix children spread Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * 🐛 fix: task integration tests — correct identifier prefix and agent ID Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * 🐛 fix: remove unused toolsActivatorRuntime import Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * 🐛 fix: create real topic in task integration tests to satisfy FK constraint Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * 🐛 fix: type errors in task prompt tests, handoff schema, and activity mapping Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * 🐛 fix: create real agent/topic/brief records in database model tests for FK constraints Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com> |
||
|
|
ac8a9ec0f8 | 🔖 chore(release): release version v2.1.46 [skip ci] | ||
|
|
ca16a40a44 |
Merge remote-tracking branch 'origin/main' into sync/main-to-canary-20260326-v2
# Conflicts: # src/routes/(main)/agent/channel/detail/Body.tsx |