Commit graph

9784 commits

Author SHA1 Message Date
LobeHub Bot
f804d0fc7c
🌐 chore: translate non-English comments to English in scripts (#13690)
Co-authored-by: claude[bot] <41898282+claude[bot]@users.noreply.github.com>
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-09 14:38:29 +08:00
Arvin Xu
b268f44f06
🐛 fix(server): prevent path traversal in TempFileManager.writeTempFile (#13684)
🐛 fix(server): prevent path traversal in TempFileManager.writeTempFile

Use path.basename() to strip directory components from user-supplied
filenames before writing temp files, preventing arbitrary file write
via crafted filenames like "../../app/startServer.js".

Fixes LOBE-6904

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-09 14:35:20 +08:00
Rdmclin2
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
2026-04-09 14:16:03 +08:00
René Wang
7b40538486
feat: add iamge (#13688) 2026-04-09 10:33:08 +08:00
Arvin Xu
5531ff7907
🔨 chore: Gateway reconnect after page reload (#13685)
*  feat: persist runningOperation to topic metadata for gateway reconnect

- Add runningOperation field to ChatTopicMetadata type
- execAgent writes { operationId, assistantMessageId } to topic metadata
  after creating the operation
- onSessionComplete clears runningOperation from metadata (best-effort)
- Extend updateTopicMetadata tRPC schema + service to support the field

Fixes LOBE-6905

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

*  feat: add refreshGatewayToken tRPC endpoint

Signs a fresh JWT for Gateway WebSocket reconnection after page reload.
The token is scoped to the authenticated user via signUserJWT.

Fixes LOBE-6906

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

*  feat: auto-reconnect to running Gateway operation on topic load

- Add reconnectToGatewayOperation to GatewayActionImpl — refreshes JWT,
  creates local operation, and connects WebSocket with event replay
- Add useGatewayReconnect hook — checks topic metadata.runningOperation
  when entering a topic and triggers reconnection
- Wire hook into ConversationArea

Fixes LOBE-6907

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* 🐛 fix: preserve thread scope in reconnect context and subscribe to topic metadata

- Store scope + threadId in topic metadata.runningOperation
- reconnectToGatewayOperation uses stored scope/threadId instead of
  hardcoded main/null
- useGatewayReconnect subscribes to runningOperation via useChatStore
  selector so it triggers when topic data arrives from SWR (not just
  on mount when data may be empty)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* 🐛 fix: update device tests to allow runningOperation metadata writes

The tests asserted updateMetadata was never called, but now execAgent
persists runningOperation. Changed to assert no device-binding metadata
was written (boundDeviceId), which is the actual intent.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* ♻️ refactor: use SWR for gateway reconnect lifecycle

Replace useEffect + ref with useSWR keyed by operationId. SWR
naturally deduplicates (same key = no re-fetch), handles the async
reconnect, and doesn't fire when key is null (no runningOperation).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* 🐛 fix: validate topic has running operation before issuing gateway token

refreshGatewayToken now requires topicId, verifies the topic belongs to
the user and has a runningOperation in metadata before signing a JWT.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* 💄 style: break signin title into two lines

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* Fix signin.title formatting in auth.json

---------

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-09 10:23:57 +08:00
Arvin Xu
4f56868545
🐛 fix: allow templates to specify policyLoad so default docs are fully injected (#13672)
* 🐛 fix: allow templates to specify policyLoad so default docs are fully injected

All documents were hardcoded to PolicyLoad.PROGRESSIVE on creation,
causing CLAW template docs (IDENTITY, SOUL, BOOTSTRAP, AGENTS) to be
progressively disclosed instead of fully injected into context.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* 🐛 fix: forward policyLoad through upsertDocument and persist on update

- Add policyLoad to UpsertDocumentParams and pass it through to model
- Add policyLoad param to update() so upsert's existing-document path
  writes the value instead of silently discarding it
- Ensures re-running template init migrates pre-existing docs to ALWAYS

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* ♻️ refactor: change update() to use named params object instead of positional args

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* ♻️ refactor: change create() and upsert() to use named params object

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

*  test: improve agentDocuments test coverage to 99%

Add tests for uncovered branches:
- normalizeLoadRule default branch (unknown rule)
- explicit 'always' rule match
- by-time-range with NaN dates
- resolveDocumentLoadPosition fallback paths
- composeToolPolicyUpdate with existing context values
- upsert create path for new filenames
- getAgentContext empty docs path

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* 🐛 fix: preserve policyLoad when copying documents

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

*  fix: align test assertion with refactored create() params object signature

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-09 10:09:05 +08:00
Arvin Xu
dc1b43d86c
🐛 fix(database): prevent IDOR in addFilesToKnowledgeBase (#13683)
🐛 fix(database): add ownership check in addFilesToKnowledgeBase to prevent IDOR

Verify that the target knowledge base belongs to the authenticated user
before inserting files, preventing unauthorized file injection into
other users' knowledge bases.

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-09 01:36:51 +08:00
Arvin Xu
4d7cbfea8e
🐛 fix: skip sendMessageInServer in Gateway mode + NavItem loading fix + i18n (#13681)
* 🐛 fix: reuse existing messages in execAgent when existingMessageIds provided

When existingMessageIds contains [userMsgId, assistantMsgId], skip
creating new messages and reuse the existing ones. This fixes duplicate
messages in Gateway mode where sendMessageInServer already created
the messages before execAgentTask is called.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* 🐛 fix: allow clicking NavItem while loading

Loading state should only show a visual indicator, not block onClick.
This fixes topic sidebar items being unclickable during agent execution.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* Revert "🐛 fix: reuse existing messages in execAgent when existingMessageIds provided"

This reverts commit 43b808024d5c4a0074b692a85083a72046ab47e0.

* 🐛 fix: skip sendMessageInServer in Gateway mode to avoid duplicate messages

Gateway mode now calls execAgentTask directly instead of going through
sendMessageInServer first. The backend creates user + assistant messages
and topic in one call. executeGatewayAgent handles topic switching
internally after receiving the server response.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* 🌐 chore: add i18n for execServerAgentRuntime operation

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* 🐛 fix: move temp message cleanup after executeGatewayAgent succeeds

Keep temp messages visible during the gateway call so the UI isn't
blank. On failure, mark the operation as failed instead of silently
returning — temp messages remain so the user sees something went wrong.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* ♻️ refactor: remove manual temp message cleanup in gateway mode

switchTopic handles new topic navigation, and fetchAndReplaceMessages
replaces the message list from DB — no need to manually delete temp
messages.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* 🐛 fix: clear _new key temp messages when gateway creates new topic

Pass clearNewKey: true to switchTopic so temp messages from the
optimistic create don't persist in the _new key after switching
to the server-created topic.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* ♻️ refactor: import ExecAgentResult from @lobechat/types

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-09 01:33:54 +08:00
Innei
e65e2c3628
feat(desktop): embed CLI in app and PATH install (#13669)
*  feat(desktop): embed CLI in app and PATH install

Made-with: Cursor

*  feat(desktop): add CLI command execution feature and UI integration

- Implemented `runCliCommand` method in `ElectronSystemService` to execute CLI commands.
- Added `CliTestSection` component for testing CLI commands within the app.
- Updated `SystemCtr` to include CLI command execution functionality.
- Enhanced `generateCliWrapper` to create short aliases for CLI commands.
- Integrated CLI testing UI in the system tools settings page.

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

*  feat: enhance working directory handling for desktop

- Updated working directory logic to prioritize topic-level settings over agent-level.
- Introduced local storage management for agent working directories.
- Modified tests to reflect changes in working directory behavior.
- Added checks to ensure working directory retrieval is only performed on desktop environments.

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

*  feat(desktop): implement CLI command routing and cleanup

- Introduced `CliCtr` for executing CLI commands, enhancing the desktop application with CLI capabilities.
- Updated `ShellCommandCtr` to route specific commands to `CliCtr`, improving command handling.
- Removed legacy CLI path installation methods from `SystemCtr` and related services.
- Cleaned up localization files by removing obsolete entries related to CLI path installation.

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

* 🚸 settings(system-tools): show CLI embedded test only in dev mode

Made-with: Cursor

---------

Signed-off-by: Innei <tukon479@gmail.com>
2026-04-09 00:53:49 +08:00
Arvin Xu
eebf9cb056
chore: add gatewayMode translations for labs (#13680)
* 🌐 i18n: add gatewayMode translations for labs

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* Update labs.json

---------

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-08 23:49:32 +08:00
Arvin Xu
3e7ee1fbfc
🔨 chore: integrate Gateway connection management into chat store (#13636)
*  feat: integrate Gateway connection management into chat store

Add GatewayActionImpl to aiChat slice for managing Agent Gateway
WebSocket connections per operationId. Includes connect, disconnect,
interrupt, and status tracking. Also type the execAgentTask return value.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

*  feat: add Gateway mode branch in sendMessage for server-side agent execution

When agentGatewayUrl is set in server config (enableQueueAgentRuntime),
sendMessage now triggers server-side agent execution via execAgentTask
and receives events through the Agent Gateway WebSocket, instead of
running the agent loop client-side.

Includes:
- Expose agentGatewayUrl in GlobalServerConfig when queue mode is enabled
- Gateway event handler mapping stream events to UI message updates
- Fallback to client-side agent loop when Gateway is not configured

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* 🐛 fix: emit disconnected event on intentional disconnect

disconnect() was only calling setStatus('disconnected') but not emitting
the 'disconnected' event. This caused the store's cleanup listener to
never fire after terminal events (agent_runtime_end), leaving stale
connections in gatewayConnections.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

*  feat: enhance Gateway event handler for multi-step agent streaming

Support multi-step agent execution display (LLM → tool calls → next LLM)
using hybrid approach: real-time streaming for current step, DB refresh at
step transitions.

Fixes LOBE-6874

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

*  feat: wire up Gateway JWT token from execAgent to connectToGateway

Pass the RS256 JWT token returned by execAgentTask to connectToGateway
for WebSocket authentication. Also use ExecAgentResult from @lobechat/types
instead of local duplicate definition.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* 🐛 fix: handle wss:// protocol in AgentStreamClient buildWsUrl

When gatewayUrl already uses ws:// or wss:// protocol, use it directly
instead of stripping and re-adding the protocol prefix. Previously,
wss://host would become ws://wss://host (double protocol).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* 🐛 fix: queue gateway events to ensure stream_chunk waits for refreshMessages

Use a sequential Promise chain to process gateway events, so that
stream_chunk dispatches only run after stream_start's refreshMessages
resolves. Previously, chunks arrived before the new assistant message
existed in dbMessagesMap, causing updates to be silently dropped.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* 🐛 fix: pass operationId context to internal_dispatchMessage in gateway handler

Without operationId, internal_dispatchMessage falls back to global state
to compute the messageMapKey, which may differ from the key where
refreshMessages stored the server-created messages. Passing operationId
ensures the correct conversation context is resolved.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* 🐛 fix: resolve gateway streaming display issues

- Use fetchAndReplaceMessages (direct DB fetch + replaceMessages) instead
  of refreshMessages which mutates an orphaned SWR key
- Create dedicated execServerAgentRuntime operation with correct topicId
  context for internal_dispatchMessage to resolve the right messageMapKey
- Complete operation on agent_runtime_end instead of relying on
  onSessionComplete callback
- Keep loading state active between steps (only clear on agent_runtime_end)
  so users don't think the session ended during tool execution gaps

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* 🐛 fix: maintain loading state across gateway step transitions

- Create dedicated execServerAgentRuntime operation with correct topicId
- Use fetchAndReplaceMessages instead of orphaned refreshMessages SWR key
- Re-apply loading after tool_end refresh so UI stays active between steps
- Complete operation on agent_runtime_end
- Add record-app-screen.sh for automated screen recording
- Output recordings to .records/ (gitignored)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* 🐛 fix: show loading on assistant message immediately in stream_start

Set loading on the current assistant message BEFORE awaiting
fetchAndReplaceMessages, so the UI shows a loading indicator while
waiting for the DB response instead of appearing frozen.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* 🐛 fix: drive gateway loading state via operation system instead of messageLoadingIds

Associate the assistant message with the gateway operation via
associateMessageWithOperation so the Conversation store's operation-based
loading detection (isGenerating) works correctly. This shows the proper
loading skeleton on the assistant message while waiting for gateway events.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* ♻️ refactor: remove unused internal_toggleMessageLoading from gateway handler

Loading state is now fully driven by the operation system via
associateMessageWithOperation + completeOperation. The old
messageLoadingIds-based approach is no longer needed.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* 🐛 fix: rewrite record-app-screen.sh to use CDP screenshot assembly

Replace broken ffmpeg avfoundation live recording (corrupts on kill) with
agent-browser CDP screenshot capture + ffmpeg assembly on stop. This works
reliably on any screen including external monitors.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

*  feat: add Gateway Mode lab toggle and fix CI type error

- Add enableGatewayMode to UserLabSchema as experimental feature
- Add lab selector and settings UI toggle in Advanced > Labs
- Gateway mode now requires both server config (agentGatewayUrl) AND
  user opt-in via Labs toggle
- Fix TS2322: result.token (string | undefined) → fallback to ''
- Add i18n keys for gateway mode feature

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

*  feat: hide Gateway Mode toggle when agentGatewayUrl is not configured

Only show the lab toggle when the server has AGENT_GATEWAY_URL set,
so users without gateway infrastructure don't see the option.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* 💄 style: move Gateway Mode toggle below Input Markdown in labs section

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* 🐛 fix: remove default AGENT_GATEWAY_URL value and make schema optional

Without an explicit env var, the gateway URL should be undefined so the
lab toggle and gateway mode are not available.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* 📝 docs: update SKILL.md to reference record-app-screen.sh

Replace outdated record-gateway-demo.sh references with the renamed
record-app-screen.sh and its start/stop lifecycle documentation.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* 📝 docs: add record-app-screen reference doc and slim down SKILL.md

Move detailed recording documentation to references/record-app-screen.md
and keep SKILL.md concise with a link to the full reference.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* 🐛 fix: guard GatewayStreamNotifier with AGENT_GATEWAY_URL check

AGENT_GATEWAY_URL is now optional, so check both URL and service token
before wrapping with GatewayStreamNotifier to avoid TS2345.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* ♻️ refactor: extract gateway execution logic to GatewayActionImpl

Move server-side gateway execution logic from conversationLifecycle.ts
into GatewayActionImpl.startGatewayExecution(). The sendMessage flow
now does a simple early return when gateway mode is active, keeping
the existing client-mode code path untouched.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* ♻️ refactor: split gateway into isGatewayModeEnabled check + executeGatewayAgent

Replace fire-and-forget startGatewayExecution with explicit check/execute
pattern. Caller does: if (check) { await execute(); return; } — giving
proper error handling and clearer control flow.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-08 23:31:26 +08:00
renovate[bot]
84eff30be1
Update dependency lucide-react to ^0.577.0 (#13580)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2026-04-08 23:31:20 +08:00
Innei
50a1cc1ec2
♻️ refactor(resource): tree store for library hierarchy and move sync (#13640)
*  feat(ResourceManager): integrate tree store for folder management and enhance file operations

- Added `useTreeStore` to manage folder structure and state, replacing previous file store dependencies.
- Updated `EmptyPlaceholder` to utilize `currentFolderId` for file uploads.
- Refactored `MoveToFolderModal` to use tree store for moving items, improving folder navigation.
- Enhanced drag-and-drop functionality in `DndContextWrapper` to support moving items between folders.
- Removed obsolete `LibraryHierarchy` state management, streamlining folder operations.
- Improved file renaming and deletion processes to ensure tree state consistency.

This update enhances the overall file management experience by leveraging a dedicated tree store for better performance and maintainability.

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

*  feat(TreeAction): enhance resource movement and update handling

- Updated mutation logic for moving resources to differentiate between items visible in the Explorer and those not visible, improving performance and user experience.
- Added refresh functionality for the file list after resource updates (move, update, delete) to ensure the Explorer reflects the latest state.
- Refactored mutation methods to use async/await for better readability and error handling.

This update streamlines resource management within the tree structure, ensuring a more responsive and consistent user interface.

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

* Fix file updates and tree move fallback regressions

---------

Signed-off-by: Innei <tukon479@gmail.com>
2026-04-08 23:26:58 +08:00
Arvin Xu
d49aba748e
🐛 fix: hide LocalFile actions in topic share page (#12254)
🐛 fix: hide LocalFile actions (Open/Show in Folder) in share page

In topic share pages, the LocalFile component was showing 'Open' and
'Show in Folder' action buttons on hover, which are desktop-only
operations not available to share page viewers.

- Add 'readonly' prop to LocalFile component to disable interactive actions
- Detect share page context via topicShareId in LocalFile Render plugin
- Skip Popover rendering when readonly is true
2026-04-08 22:45:08 +08:00
Arvin Xu
8a0c3cb36a
♻️ refactor: remove legacy messageLoadingIds from chat store (#13662)
* ♻️ refactor: remove legacy messageLoadingIds from chat store

The messageLoadingIds state and internal_toggleMessageLoading action in the
chat store have been fully superseded by the operation system. The state was
being written to but never read by any consumer — all UI components and
selectors already use operation-based selectors (isMessageGenerating,
isMessageProcessing, etc.).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* 📝 chore: update skill docs to remove messageLoadingIds references

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* 🐛 fix: replace messageLoadingIds with operationSelectors in generation action

The Conversation store's regenerateUserMessage was reading messageLoadingIds
from the chat store to check if a message is already being processed. Replace
with operationSelectors.isMessageProcessing which is the correct way to check
operation state.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* 🐛 fix: add operationsByMessage to test mocks for operation selector

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-08 21:54:11 +08:00
LiJian
26d1d6bbfb
🐛 fix: slove the agents_documents will coverd the systemRole (#13667)
fix: slove the agents_documents will coverd the systemRole
2026-04-08 20:54:20 +08:00
YuTengjing
c5ec0ef2a1
💰 chore: adjust Seedance 2.0 pricing with 20% service fee (#13676) 2026-04-08 20:50:18 +08:00
YuTengjing
6d0c8d710a
🐛 fix: video page icon collision, missing locale keys, and model query param (#13671) 2026-04-08 19:44:35 +08:00
Rdmclin2
e10265fadd
feat: add skill panel and fix skill icon (#13666)
* fix: custom agent skill icon

* feat: support skill detail

* chore: remove unnecessary custom tag
2026-04-08 18:51:01 +08:00
Arvin Xu
c68dfa00df
feat(cli): add lh notify command for external agent callbacks (#13664)
*  feat(cli): add `lh notify` command for external agent callbacks

Add a new `lh notify` CLI command and server-side TRPC endpoint that allows
external agents (e.g. Claude Code) to send callback messages to a topic and
trigger the agent loop to process them.

Fixes LOBE-6888

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* 🔧 chore(cli): replace sessionId with agentId and threadId in notify command

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-08 18:03:55 +08:00
Arvin Xu
b6a47debfd
♻️ refactor: remove promptfoo configs and dependencies (#13665)
♻️ refactor: remove promptfoo configs and dependencies from packages

Migrate all prompt evaluation tests to the cloud repo's agent-evals framework.
Remove promptfoo directories, configs, dependencies, and generator scripts
from @lobechat/prompts, @lobechat/memory-user-memory, and @lobechat/builtin-tool-memory.

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-08 17:50:55 +08:00
YuTengjing
147ff3976f
feat: add Seedance 2.0 & 2.0 Fast video generation models (#13663) 2026-04-08 17:39:50 +08:00
René Wang
034c7c203b
feat: changelog (#13634)
* feat: changelog

* feat: edito content
2026-04-08 15:30:33 +08:00
Rdmclin2
b0b6684294
🔨 chore: optimize model and skills (#13659)
* chore: model detail default close

* fix: model detail show info in normal mode
2026-04-08 15:20:35 +08:00
Arvin Xu
36d2427947
🐛 fix: use parametersJsonSchema for Google tool schemas (#13656)
* 🐛 fix: use parametersJsonSchema for Google tool schemas to support full JSON Schema

Replace Google's restrictive Schema subset with parametersJsonSchema, which accepts
standard JSON Schema directly. This eliminates the need for resolveRefs and
sanitizeSchemaForGoogle, fixing nullable enum (LOBE-6607) and $ref (LOBE-6680) issues.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* 🐛 fix: update remaining tests to use parametersJsonSchema

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-08 15:08:59 +08:00
Innei
4d15979fab
💄 fix(RuntimeConfig): instant-apply working directory with recent list (#13641)
* 💄 fix(RuntimeConfig): instant-apply working directory with recent list

Remove Save/Cancel buttons from working directory selector.
Directories now apply immediately on click. Show recent directories
list with checkmark for active selection and "Choose a different folder"
entry at bottom.

*  feat(SystemCtr): enhance folder selection to return repository type

Updated the `selectFolder` method to return an object containing the selected folder path and its repository type (either 'git' or 'github'). Added a new private method `detectRepoType` to determine the repository type based on the presence of a `.git/config` file. Introduced a new utility for managing recent directories, allowing the application to display appropriate icons based on the repository type in the UI.

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

---------

Signed-off-by: Innei <tukon479@gmail.com>
2026-04-08 14:56:18 +08:00
Arvin Xu
53786e30b6
🔨 chore: remove redundant update-status call from GatewayStreamNotifier (#13655)
* ♻️ refactor: remove redundant update-status call from GatewayStreamNotifier

Gateway now handles session completion directly in pushEvent when it
receives agent_runtime_end, so the separate update-status HTTP call
is no longer needed.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

*  test: update GatewayStreamNotifier tests for removed update-status call

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-08 14:03:46 +08:00
LiJian
7300b53e99
🐛 fix: not use sanitizeHTMLContent to block the scripts & sandbox styles (#13649)
* fix: not use sanitizeHTMLContent to block the scripts & sandbox styles

* fix: clean the code & remove the allows-popups
2026-04-08 13:34:40 +08:00
Arvin Xu
6f3897a6e8
🔨 chore: generate JWT token for Gateway WebSocket auth in execAgent (#13654)
 feat: generate JWT token for Gateway WebSocket auth in execAgent

Sign a short-lived RS256 JWT via signUserJWT(userId) when creating an agent
operation, and return it in ExecAgentResult.token so the client can
authenticate with the Agent Gateway WebSocket.

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-08 13:28:37 +08:00
Arvin Xu
a6e330cfa9
🐛 fix(web-crawler): prevent happy-dom CSS parsing crash in htmlToMarkdown (#13652)
- Disable CSS file loading and JS evaluation in happy-dom Window (root cause)
- Add try-catch around Readability.parse() for defense in depth
- Add regression tests for invalid CSS selectors and external stylesheet links

Closes LOBE-6869

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-08 12:59:49 +08:00
LobeHub Bot
accc173068
🌐 chore: translate non-English comments to English in openapi routes (#13647)
Co-authored-by: claude[bot] <41898282+claude[bot]@users.noreply.github.com>
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-08 12:50:17 +08:00
Arvin Xu
81ab8aa07b
🔨 chore: support nested subtask tree in task.detail (#13625)
*  feat: support nested subtask tree in task.detail

Replace flat subtask list with recursive nested tree structure.
Backend builds the complete subtask tree in one response,
eliminating the need for separate getTaskTree API calls.

Fixes LOBE-6814

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* 🐛 fix: return empty array for root subtasks instead of undefined

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* 📝 docs: add cli-backend-testing skill

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-08 12:49:26 +08:00
YuTengjing
12ee7c9e9a
🐛 fix: support ENABLE_MOCK_DEV_USER in checkAuth and openapi auth middleware (#13648) 2026-04-08 12:37:27 +08:00
LiJian
8d8b60e4f9
🐛 fix: should filiter the current agents in avaiable agents list (#13644)
* fix: should inject the current agents & remove current agent from avaiable agents list

* fix: delete the current agents blocks
2026-04-08 11:24:53 +08:00
YuTengjing
19aedcdf56
fix: skip @mention for team members in PR assign and issue triage (#13633) 2026-04-08 11:00:19 +08:00
YuTengjing
3bb09e0ef9
feat: enhance linear skill with image extraction and in-progress status (#13629) 2026-04-08 10:58:07 +08:00
Arvin Xu
13fc65faa2 update 2026-04-08 10:53:00 +08:00
Arvin Xu
de8761cf29 🐛 fix: import hook types before re-exporting for tsgo compatibility
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-08 10:52:11 +08:00
Arvin Xu
4f2f0055e1 ♻️ refactor(agent-runtime): improve AgentInstruction types and extract hook event types
- Each instruction interface now extends AgentInstructionBase directly instead of intersection
- Group instructions by category: LLM, Tool, Task, Human Interaction, Control
- Extract AgentHookType and AgentHookEvent into agent-runtime package
- Keep AgentHook, AgentHookWebhook, SerializedHook in server layer (webhook is server-specific)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-08 10:45:00 +08:00
Arvin Xu
2290929255
🔨 chore: add GraphAgent and agentFactory for graph-driven agent execution (#13643)
*  feat: add GraphAgent and agentFactory for graph-driven agent execution

- Add GraphAgent: a decorator around GeneralChatAgent that drives execution via declarative ReasoningGraph
  - Agent nodes: delegate to GeneralChatAgent for tool-calling loops, then extract structured output
  - LLM nodes: single structured LLM call
  - Programmatic transition evaluation (not LLM-driven)
  - Backtracking with configurable limits
- Add AgentInstruction.stepLabel: allows any Agent to label steps for display in stream events and hooks
- Add agentFactory to AgentRuntimeServiceOptions: external injection of custom Agent implementations
- Add stepLabel propagation: stream_start/stream_end events and afterStep hooks carry the label
- Fix: sanitize null bytes in MessageModel.create content (consistent with existing plugin argument sanitization)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* 🐛 fix(agent-runtime): validate graph node existence and preserve transitions at backtrack limit

- Add node existence check in startNode to prevent runtime crash on invalid entry/transition targets
- Evaluate all transitions even when backtrack limit is reached; only suppress actual backtrack targets
2026-04-08 10:28:15 +08:00
Innei
a2eab24536
🐛 fix(device-gateway-client): prevent uncaught WebSocket error on disconnect (#13635)
* 🐛(device-gateway-client): prevent uncaught error when closing connecting WebSocket

Detach ws event listeners safely, temporarily handle close-phase errors, and guard ws.close() so logout/token clear does not surface a main-process uncaught exception.

Made-with: Cursor

* 🧹 refactor(tests): remove unused mockProps from ComfyUIForm test

Cleaned up the ComfyUIForm test by removing the unused mockProps object, streamlining the test setup for better clarity and maintainability.

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

* Hide onboarding finish tool call and preserve close error listener

---------

Signed-off-by: Innei <tukon479@gmail.com>
2026-04-07 23:59:03 +08:00
Innei
b279c108b6
🐛 fix(desktop): use stored locale from URL parameter instead of syste… (#13620)
🐛 fix(desktop): use stored locale from URL parameter instead of system language

When the desktop app restarts, the UI language was reverting to the system
language instead of respecting the user's saved language preference.

Root cause: The inline script in index.html was setting document.documentElement.lang
from navigator.language (system language) before i18n initialization could read
the stored locale from Electron store.

Fix: Check the URL's `lng` query parameter first (which is set by Electron main
process from stored settings in Browser.ts:buildUrlWithLocale()), then fall back
to navigator.language.

Fixes #13616

https://claude.ai/code/session_0128LZAbJL1a5vkGboH4U5FP

Co-authored-by: Claude <noreply@anthropic.com>
2026-04-07 22:58:09 +08:00
Innei
7a6fd8e865
🐛 fix(desktop): remote re-auth for batched tRPC and clean OIDC on disconnect (#13614)
* 🐛 fix(desktop): remote re-auth for batched tRPC and clean OIDC on disconnect

- Notify authorization required when X-Auth-Required is set, not only on HTTP 401 (207 batch)
- Show AuthRequiredModal after remote config init; do not gate on dataSyncConfig.active
- Desktop: market 401 only silent refresh; avoid community sign-in UI (AuthRequiredModal handles cloud)
- Disconnect: clearRemoteServerConfig to wipe encrypted OIDC tokens

Made-with: Cursor

* 🐛 Reset user-data Zustand stores on remote disconnect and sync refresh

- Add ResetableStoreAction helper and batched reset via userDataStores
- Wire reset into Electron remote disconnect and refreshUserData
- Handle refreshUserData failures in data sync SWR onSuccess

Made-with: Cursor

* 🐛 fix(useUserAvatar): refactor desktop environment checks to use mockConstEnv

- Replace direct manipulation of mockIsDesktop with mockConstEnv.isDesktop for better encapsulation.
- Update all relevant test cases to utilize the new mock structure, ensuring consistent behavior across tests.

This change improves the clarity and maintainability of the test code.

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

* 🐛 test: update mocks for ShikiLobeTheme and refactor session/agent mocks

- Added ShikiLobeTheme mock to ComfyUIForm and AddFilesToKnowledgeBase tests for consistent theming.
- Refactored session and agent mocks to use async imports, improving test isolation and performance.

This enhances the clarity and maintainability of the test suite.

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

---------

Signed-off-by: Innei <tukon479@gmail.com>
2026-04-07 22:57:49 +08:00
lobehubbot
1206db7c12 Merge remote-tracking branch 'origin/main' into canary 2026-04-07 14:48:16 +00:00
Arvin Xu
bd61b61843
🚀 release: 20260407 (#13626)
# 🚀 release: 20260407

This release includes **148 commits**. Key updates are below.

- **Response API tool execution is more capable and reliable** — Added
hosted builtin tools + client-side function tools and improved tool-call
streaming/completion behavior.
[#13406](https://github.com/lobehub/lobehub/pull/13406)
[#13414](https://github.com/lobehub/lobehub/pull/13414)
[#13506](https://github.com/lobehub/lobehub/pull/13506)
[#13555](https://github.com/lobehub/lobehub/pull/13555)
- **Input and composition UX upgraded** — Added AI input auto-completion
and multiple chat-input stability fixes.
[#13458](https://github.com/lobehub/lobehub/pull/13458)
[#13551](https://github.com/lobehub/lobehub/pull/13551)
[#13481](https://github.com/lobehub/lobehub/pull/13481)
- **Model/provider compatibility improved** — Better Gemini/Google tool
schema handling and additional model updates.
[#13429](https://github.com/lobehub/lobehub/pull/13429)
[#13465](https://github.com/lobehub/lobehub/pull/13465)
[#13613](https://github.com/lobehub/lobehub/pull/13613)
- **Desktop and CLI reliability improved** — Gateway WebSocket support
and desktop runtime upgrades.
[#13608](https://github.com/lobehub/lobehub/pull/13608)
[#13550](https://github.com/lobehub/lobehub/pull/13550)
[#13557](https://github.com/lobehub/lobehub/pull/13557)
- **Security hardening continued** — Fixed auth and sanitization risks
and upgraded vulnerable dependencies.
[#13535](https://github.com/lobehub/lobehub/pull/13535)
[#13529](https://github.com/lobehub/lobehub/pull/13529)
[#13479](https://github.com/lobehub/lobehub/pull/13479)

### Models & Providers

- Added/updated support for `glm-5v-turbo`, GLM-5.1 updates, and
qwen3.5-omni series.
[#13487](https://github.com/lobehub/lobehub/pull/13487)
[#13405](https://github.com/lobehub/lobehub/pull/13405)
[#13422](https://github.com/lobehub/lobehub/pull/13422)
- Added additional ImageGen providers/models (Wanxiang 2.7 and Keling
from Qwen). [#13478](https://github.com/lobehub/lobehub/pull/13478)
- Improved Gemini/Google tool schema and compatibility handling across
runtime paths. [#13429](https://github.com/lobehub/lobehub/pull/13429)
[#13465](https://github.com/lobehub/lobehub/pull/13465)
[#13613](https://github.com/lobehub/lobehub/pull/13613)

### Response API & Runtime

- Added hosted builtin tools in Response API and client-side function
tool execution support.
[#13406](https://github.com/lobehub/lobehub/pull/13406)
[#13414](https://github.com/lobehub/lobehub/pull/13414)
- Improved stream tool-call argument handling and `response.completed`
output correctness.
[#13506](https://github.com/lobehub/lobehub/pull/13506)
[#13555](https://github.com/lobehub/lobehub/pull/13555)
- Improved runtime error/context handling for intervention and provider
edge cases. [#13420](https://github.com/lobehub/lobehub/pull/13420)
[#13607](https://github.com/lobehub/lobehub/pull/13607)

### Desktop App

- Bumped desktop dependencies and runtime integrations (`agent-browser`,
`electron`). [#13550](https://github.com/lobehub/lobehub/pull/13550)
[#13557](https://github.com/lobehub/lobehub/pull/13557)
- Simplified desktop release channel setup by removing nightly release
flow. [#13480](https://github.com/lobehub/lobehub/pull/13480)

### CLI

- Added OpenClaw migration command.
[#13566](https://github.com/lobehub/lobehub/pull/13566)
- Added local device binding support for `lh agent run`.
[#13277](https://github.com/lobehub/lobehub/pull/13277)
- Added WebSocket gateway support and reconnect reliability
improvements. [#13608](https://github.com/lobehub/lobehub/pull/13608)
[#13418](https://github.com/lobehub/lobehub/pull/13418)

### Security

- Removed risky `apiKey` fallback behavior in webapi auth path to
prevent bypass risk.
[#13535](https://github.com/lobehub/lobehub/pull/13535)
- Sanitized HTML artifact rendering and iframe sandboxing to reduce
XSS-to-RCE risk. [#13529](https://github.com/lobehub/lobehub/pull/13529)
- Upgraded nodemailer to v8 to address SMTP command injection advisory.
[#13479](https://github.com/lobehub/lobehub/pull/13479)

### Bug Fixes

- Fixed image generation model default switch issues.
[#13587](https://github.com/lobehub/lobehub/pull/13587)
- Fixed subtopic re-fork message scope behavior and agent panel reset
edge cases. [#13606](https://github.com/lobehub/lobehub/pull/13606)
[#13556](https://github.com/lobehub/lobehub/pull/13556)
- Fixed chat-input freeze on paste and mention plugin behavior.
[#13551](https://github.com/lobehub/lobehub/pull/13551)
[#13415](https://github.com/lobehub/lobehub/pull/13415)
- Fixed auth/social sign-in and settings UX edge cases.
[#13368](https://github.com/lobehub/lobehub/pull/13368)
[#13392](https://github.com/lobehub/lobehub/pull/13392)
[#13338](https://github.com/lobehub/lobehub/pull/13338)

### Credits

Huge thanks to these contributors:

@chriszf @hardy-one @Innei @LiJian @Neko @octopusnote @rdmclin2
@rivertwilight @RylanCai @suyua9 @sxjeru @Tsuki @WangYK @WindSpiritSR
@Yizhuo @YuTengjing @hezhijie0327 @arvinxx
2026-04-07 22:45:54 +08:00
Arvin Xu
0c49b0a039
🔨 chore: add AgentStreamClient for Agent Gateway WebSocket (#13628)
* 🤖 chore(skills): add electron-dev.sh script and update local-testing skill

Add reusable electron-dev.sh script with start/stop/status/restart commands
that reliably manages all Electron processes (main + helpers + vite).
Update SKILL.md to reference the script instead of inline bash commands.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

*  feat: add AgentStreamClient for Agent Gateway WebSocket communication

Browser-compatible WebSocket client for receiving agent execution events
from the Agent Gateway. Supports auto-reconnect with exponential backoff,
heartbeat keep-alive, and event replay via lastEventId resume.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-07 22:42:54 +08:00
Innei
1beb9d4eb6
feat(desktop): add Electron version display in system tools settings (#13630)
*  feat(desktop): add Electron version display in system tools settings

Display Electron, Chrome, and Node.js versions in the desktop app's Settings > System Tools page under a new "App Environment" section.

https://claude.ai/code/session_01C6nUdBci6A29CZCvQSUuDt

* 🐛 fix(desktop): update preload test for new version properties

https://claude.ai/code/session_01C6nUdBci6A29CZCvQSUuDt

* ♻️ refactor: remove unused i18n name keys for app environment section

Tool names (Electron, Chrome, Node.js) are proper nouns that don't need
localization, matching the existing pattern in ToolDetectorSection.

https://claude.ai/code/session_01C6nUdBci6A29CZCvQSUuDt

* 🐛 fix(desktop): handle undefined electron/chrome versions in test env

process.versions.electron and process.versions.chrome are only available
in Electron runtime, not in the Node.js test environment.

https://claude.ai/code/session_01C6nUdBci6A29CZCvQSUuDt

* 🐛 fix: use const assertion for i18n key type safety

https://claude.ai/code/session_01C6nUdBci6A29CZCvQSUuDt

* 🌐 Add app environment strings to setting locales and refine copy

Made-with: Cursor

---------

Co-authored-by: Claude <noreply@anthropic.com>
2026-04-07 21:53:27 +08:00
LiJian
021fd07deb
🐛 fix: can manual close the hidden builtin tools (#13631)
* fix: can manual close the hidden builtin tools

* fix: should change it into chatConfigByIdSelectors

* fix: add the always not close tools
2026-04-07 21:37:32 +08:00
LiJian
33f729cd1a
🐛 fix: add the availableAgents into the prompt inject (#13621)
* fix: add the availableAgents into the prompt inject

* fix: should auto inject the avaiable agents into context when use the auto model

* fix: update the prompt

* fix: test fixed
2026-04-07 19:45:29 +08:00
Innei
8b3c871d08
♻️ refactor(onboarding): add OnboardingContextInjector and wire context engine (#13518)
* ♻️ refactor(onboarding): add OnboardingContextInjector and wire context engine

Made-with: Cursor

* 🔧 refactor(onboarding): update tool call references to use `lobe-user-interaction________builtin`

Modified onboarding documentation and utility functions to standardize the use of the `lobe-user-interaction________builtin` tool call for structured input collection, enhancing clarity and consistency across the codebase.

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

* 🔧 refactor(onboarding): standardize tool call references to `lobe-user-interaction____askUserQuestion____builtin`

Updated documentation and utility functions to replace instances of the `lobe-user-interaction________builtin` tool call with `lobe-user-interaction____askUserQuestion____builtin`, ensuring consistency in structured input collection across the onboarding process.

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

* ♻️ refactor(onboarding): move onboarding context before first user

* ♻️ refactor(context-engine): add virtual last user provider

* update v3

* 🐛 fix(onboarding): add early exit escape hatch for boundary cases

The `<next_actions>` directive only prompted finishOnboarding in the
summary phase, but phase transition required all fields + 5 discovery
exchanges — a condition extreme cases rarely meet. This left the model
stuck in discovery, never calling finishOnboarding.

- Add EARLY EXIT hint in discovery phase next_actions
- Add universal completion-signal REMINDER across all phases
- Add minimum-viable discovery fallback in systemRole
- Add explicit completion signal list in Early Exit section
- Add off-topic redirect limit in Boundaries
- Add CRITICAL persistence rule in toolSystemRole

*  test(context-engine): fix OnboardingContextInjector tests to match BaseFirstUserContentProvider

Remove brittle MessagesEngine onboarding test that hardcoded XML content.

---------

Signed-off-by: Innei <tukon479@gmail.com>
2026-04-07 19:25:16 +08:00