@lobehub/lobehub 2.0.0-next.52 → 2.0.0-next.53

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (27) hide show
  1. package/CHANGELOG.md +33 -0
  2. package/README.md +8 -8
  3. package/README.zh-CN.md +8 -8
  4. package/apps/desktop/package.json +1 -1
  5. package/changelog/v1.json +12 -0
  6. package/package.json +2 -2
  7. package/packages/const/src/models.ts +2 -0
  8. package/packages/electron-server-ipc/src/ipcClient.ts +31 -31
  9. package/packages/electron-server-ipc/src/ipcServer.ts +15 -15
  10. package/packages/model-bank/src/aiModels/aihubmix.ts +106 -2
  11. package/packages/model-bank/src/aiModels/openai.ts +107 -3
  12. package/packages/model-bank/src/aiModels/qwen.ts +76 -7
  13. package/packages/model-bank/src/types/aiModel.ts +1 -0
  14. package/packages/types/src/agent/chatConfig.ts +9 -0
  15. package/src/app/[variants]/(main)/chat/components/WorkspaceLayout.tsx +32 -23
  16. package/src/features/ChatInput/ActionBar/Model/ControlsForm.tsx +12 -0
  17. package/src/features/ChatInput/ActionBar/Model/GPT51ReasoningEffortSlider.tsx +58 -0
  18. package/src/features/ChatItem/components/MessageContent.tsx +3 -1
  19. package/src/features/Conversation/Messages/Group/Tool/Render/Intervention/ApprovalActions.tsx +34 -13
  20. package/src/features/Conversation/Messages/User/index.tsx +11 -1
  21. package/src/libs/mcp/__tests__/__snapshots__/index.test.ts.snap +0 -6
  22. package/src/locales/default/chat.ts +2 -0
  23. package/src/services/chat/index.ts +7 -0
  24. package/src/store/chat/slices/aiChat/actions/conversationControl.ts +42 -0
  25. package/src/tools/local-system/Intervention/RunCommand/index.tsx +4 -5
  26. package/src/tools/local-system/Render/ReadLocalFile/ReadFileView.tsx +2 -1
  27. package/src/tools/local-system/index.ts +1 -0
@@ -43,6 +43,10 @@ export interface ConversationControlAction {
43
43
  * Reject tool intervention
44
44
  */
45
45
  rejectToolCalling: (messageId: string, reason?: string) => Promise<void>;
46
+ /**
47
+ * Reject tool intervention and continue
48
+ */
49
+ rejectAndContinueToolCalling: (messageId: string, reason?: string) => Promise<void>;
46
50
  /**
47
51
  * Toggle sendMessage operation state
48
52
  */
@@ -206,6 +210,44 @@ export const conversationControl: StateCreator<
206
210
  await get().optimisticUpdateMessageContent(messageId, toolContent);
207
211
  },
208
212
 
213
+ rejectAndContinueToolCalling: async (messageId, reason) => {
214
+ await get().rejectToolCalling(messageId, reason);
215
+
216
+ const toolMessage = dbMessageSelectors.getDbMessageById(messageId)(get());
217
+ if (!toolMessage) return;
218
+
219
+ // Get current messages for state construction
220
+ const currentMessages = displayMessageSelectors.mainAIChats(get());
221
+ const { activeThreadId, internal_execAgentRuntime } = get();
222
+
223
+ // Create agent state and context to continue from rejected tool message
224
+ const { state, context: initialContext } = get().internal_createAgentState({
225
+ messages: currentMessages,
226
+ parentMessageId: messageId,
227
+ threadId: activeThreadId,
228
+ });
229
+
230
+ // Override context with 'userInput' phase to continue as if user provided feedback
231
+ const context: AgentRuntimeContext = {
232
+ ...initialContext,
233
+ phase: 'user_input',
234
+ };
235
+
236
+ // Execute agent runtime from rejected tool message position to continue
237
+ try {
238
+ await internal_execAgentRuntime({
239
+ messages: currentMessages,
240
+ parentMessageId: messageId,
241
+ parentMessageType: 'tool',
242
+ threadId: activeThreadId,
243
+ initialState: state,
244
+ initialContext: context,
245
+ });
246
+ } catch (error) {
247
+ console.error('[rejectAndContinueToolCalling] Error executing agent runtime:', error);
248
+ }
249
+ },
250
+
209
251
  internal_updateSendMessageOperation: (key, value, actionName) => {
210
252
  const operationKey = typeof key === 'string' ? key : messageMapKey(key.sessionId, key.topicId);
211
253
 
@@ -3,6 +3,8 @@ import { Highlighter, Text } from '@lobehub/ui';
3
3
  import { memo } from 'react';
4
4
  import { Flexbox } from 'react-layout-kit';
5
5
 
6
+ import { BuiltinInterventionProps } from '@/types/tool';
7
+
6
8
  const formatTimeout = (ms?: number) => {
7
9
  if (!ms) return null;
8
10
 
@@ -23,11 +25,8 @@ const formatTimeout = (ms?: number) => {
23
25
  return `${ms}ms`;
24
26
  };
25
27
 
26
- interface RunCommandProps extends RunCommandParams {
27
- messageId: string;
28
- }
29
-
30
- const RunCommand = memo<RunCommandProps>(({ description, command, timeout }) => {
28
+ const RunCommand = memo<BuiltinInterventionProps<RunCommandParams>>(({ args }) => {
29
+ const { description, command, timeout } = args;
31
30
  return (
32
31
  <Flexbox gap={8}>
33
32
  <Flexbox horizontal justify={'space-between'}>
@@ -26,9 +26,10 @@ const useStyles = createStyles(({ css, token, cx }) => ({
26
26
 
27
27
  height: 64px;
28
28
  padding: 8px;
29
- border: 1px solid ${token.colorBorderSecondary};
30
29
  border-radius: ${token.borderRadiusLG}px;
31
30
 
31
+ background: ${token.colorFillQuaternary};
32
+
32
33
  transition: all 0.2s ${token.motionEaseInOut};
33
34
 
34
35
  .local-file-actions {
@@ -186,6 +186,7 @@ export const LocalSystemManifest: BuiltinToolManifest = {
186
186
  {
187
187
  description:
188
188
  'Write content to a specific file. Input should be the file path and content. Overwrites existing file or creates a new one.',
189
+ humanIntervention: 'required',
189
190
  name: LocalSystemApiName.writeLocalFile,
190
191
  parameters: {
191
192
  properties: {