@lobehub/lobehub 2.0.0-next.338 → 2.0.0-next.339
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.
- package/.gitattributes +35 -0
- package/CHANGELOG.md +44 -0
- package/changelog/v1.json +15 -0
- package/locales/ar/plugin.json +12 -2
- package/locales/ar/providers.json +1 -0
- package/locales/ar/setting.json +77 -1
- package/locales/bg-BG/models.json +5 -10
- package/locales/bg-BG/plugin.json +12 -2
- package/locales/bg-BG/providers.json +1 -0
- package/locales/bg-BG/setting.json +78 -2
- package/locales/de-DE/models.json +51 -9
- package/locales/de-DE/plugin.json +12 -2
- package/locales/de-DE/providers.json +1 -0
- package/locales/de-DE/setting.json +78 -2
- package/locales/en-US/models.json +11 -10
- package/locales/en-US/plugin.json +14 -4
- package/locales/en-US/providers.json +1 -0
- package/locales/en-US/setting.json +78 -2
- package/locales/es-ES/plugin.json +12 -2
- package/locales/es-ES/providers.json +1 -0
- package/locales/es-ES/setting.json +78 -2
- package/locales/fa-IR/plugin.json +12 -2
- package/locales/fa-IR/providers.json +1 -0
- package/locales/fa-IR/setting.json +78 -2
- package/locales/fr-FR/plugin.json +12 -2
- package/locales/fr-FR/providers.json +1 -0
- package/locales/fr-FR/setting.json +78 -2
- package/locales/it-IT/plugin.json +12 -2
- package/locales/it-IT/providers.json +1 -0
- package/locales/it-IT/setting.json +78 -2
- package/locales/ja-JP/plugin.json +12 -2
- package/locales/ja-JP/providers.json +1 -0
- package/locales/ja-JP/setting.json +78 -2
- package/locales/ko-KR/plugin.json +12 -2
- package/locales/ko-KR/providers.json +1 -0
- package/locales/ko-KR/setting.json +78 -2
- package/locales/nl-NL/models.json +4 -9
- package/locales/nl-NL/plugin.json +12 -2
- package/locales/nl-NL/providers.json +1 -0
- package/locales/nl-NL/setting.json +78 -2
- package/locales/pl-PL/plugin.json +12 -2
- package/locales/pl-PL/providers.json +1 -0
- package/locales/pl-PL/setting.json +78 -2
- package/locales/pt-BR/plugin.json +12 -2
- package/locales/pt-BR/providers.json +1 -0
- package/locales/pt-BR/setting.json +78 -2
- package/locales/ru-RU/plugin.json +12 -2
- package/locales/ru-RU/providers.json +1 -0
- package/locales/ru-RU/setting.json +78 -2
- package/locales/tr-TR/plugin.json +12 -2
- package/locales/tr-TR/providers.json +1 -0
- package/locales/tr-TR/setting.json +78 -2
- package/locales/vi-VN/plugin.json +12 -2
- package/locales/vi-VN/providers.json +1 -0
- package/locales/vi-VN/setting.json +77 -1
- package/locales/zh-CN/plugin.json +12 -2
- package/locales/zh-CN/providers.json +1 -0
- package/locales/zh-CN/setting.json +78 -2
- package/locales/zh-TW/plugin.json +12 -2
- package/locales/zh-TW/providers.json +1 -0
- package/locales/zh-TW/setting.json +78 -2
- package/package.json +1 -1
- package/packages/agent-runtime/src/groupOrchestration/GroupOrchestrationSupervisor.ts +2 -0
- package/packages/agent-runtime/src/groupOrchestration/__tests__/GroupOrchestrationSupervisor.test.ts +3 -1
- package/packages/agent-runtime/src/groupOrchestration/types.ts +5 -0
- package/packages/const/src/index.ts +1 -0
- package/packages/const/src/klavis.ts +144 -0
- package/packages/const/src/lobehubSkill.ts +34 -0
- package/packages/const/src/recommendedSkill.ts +17 -0
- package/packages/model-runtime/src/core/contextBuilders/anthropic.test.ts +38 -0
- package/packages/model-runtime/src/core/contextBuilders/anthropic.ts +20 -1
- package/packages/model-runtime/src/core/contextBuilders/google.test.ts +42 -0
- package/packages/model-runtime/src/core/contextBuilders/google.ts +17 -0
- package/scripts/electronWorkflow/modifiers/dynamicToStatic.mts +273 -0
- package/scripts/electronWorkflow/modifiers/index.mts +10 -0
- package/scripts/electronWorkflow/modifiers/nextConfig.mts +1 -0
- package/scripts/electronWorkflow/modifiers/nextDynamicToStatic.mts +233 -0
- package/scripts/electronWorkflow/modifiers/removeSuspense.mts +124 -0
- package/scripts/electronWorkflow/modifiers/routes.mts +14 -2
- package/scripts/electronWorkflow/modifiers/settingsContentToStatic.mts +148 -0
- package/scripts/electronWorkflow/modifiers/wrapChildrenWithClientOnly.mts +73 -0
- package/src/app/[variants]/(main)/home/features/InputArea/SkillInstallBanner.tsx +131 -0
- package/src/app/[variants]/(main)/home/features/InputArea/index.tsx +34 -27
- package/src/app/[variants]/(main)/settings/features/SettingHeader.tsx +8 -4
- package/src/app/[variants]/(main)/settings/features/SettingsContent.tsx +3 -0
- package/src/app/[variants]/(main)/settings/hooks/useCategory.tsx +6 -0
- package/src/{features/PluginStore/InstalledList/List/Item/Action.tsx → app/[variants]/(main)/settings/skill/features/Actions.tsx} +45 -40
- package/src/app/[variants]/(main)/settings/skill/features/KlavisSkillItem.tsx +353 -0
- package/src/app/[variants]/(main)/settings/skill/features/LobehubSkillItem.tsx +344 -0
- package/src/app/[variants]/(main)/settings/skill/features/McpSkillItem.tsx +116 -0
- package/src/app/[variants]/(main)/settings/skill/features/SkillList.tsx +244 -0
- package/src/app/[variants]/(main)/settings/skill/index.tsx +35 -0
- package/src/components/Plugins/PluginTag.tsx +23 -35
- package/src/components/client/ClientOnly.tsx +6 -2
- package/src/features/AgentSetting/AgentPlugin/index.tsx +2 -2
- package/src/features/ChatInput/ActionBar/Tools/KlavisServerItem.tsx +8 -32
- package/src/features/ChatInput/ActionBar/Tools/LobehubSkillServerItem.tsx +8 -30
- package/src/features/ChatInput/ActionBar/Tools/PopoverContent.tsx +48 -59
- package/src/features/ChatInput/ActionBar/Tools/index.tsx +5 -23
- package/src/features/ChatInput/ActionBar/Tools/useControls.tsx +158 -56
- package/src/features/IntegrationDetailModal/index.tsx +293 -0
- package/src/features/{PluginStore/McpList/Detail → MCP/MCPDetail}/index.tsx +15 -6
- package/src/features/MCP/MCPSettings/McpSettingsModal.tsx +58 -0
- package/src/features/{PluginStore/McpList/Detail/Settings → MCP/MCPSettings}/index.tsx +39 -27
- package/src/features/PluginDetailModal/index.tsx +2 -2
- package/src/features/PluginDevModal/index.tsx +16 -40
- package/src/features/ProfileEditor/AgentTool.tsx +2 -2
- package/src/features/ProtocolUrlHandler/InstallPlugin/OfficialPluginInstallModal/index.tsx +1 -1
- package/src/features/{PluginStore/AddPluginButton.tsx → SkillStore/AddSkillButton.tsx} +3 -3
- package/src/features/SkillStore/CommunityList/Item.tsx +158 -0
- package/src/features/SkillStore/CommunityList/index.tsx +101 -0
- package/src/features/SkillStore/Content.tsx +59 -0
- package/src/features/{PluginStore/PluginEmpty.tsx → SkillStore/Empty.tsx} +8 -8
- package/src/features/SkillStore/LobeHubList/Item.tsx +118 -0
- package/src/features/SkillStore/LobeHubList/index.tsx +187 -0
- package/src/features/SkillStore/LobeHubList/useSkillConnect.ts +239 -0
- package/src/features/SkillStore/Search/index.tsx +43 -0
- package/src/features/{PluginStore → SkillStore}/index.tsx +14 -10
- package/src/features/SkillStore/style.ts +27 -0
- package/src/locales/default/plugin.ts +15 -4
- package/src/locales/default/setting.ts +185 -2
- package/src/services/chat/mecha/agentConfigResolver.test.ts +197 -0
- package/src/services/chat/mecha/agentConfigResolver.ts +44 -17
- package/src/store/chat/agents/GroupOrchestration/createGroupOrchestrationExecutors.ts +40 -37
- package/src/store/chat/slices/aiChat/actions/__tests__/streamingExecutor.test.ts +78 -0
- package/src/store/chat/slices/aiChat/actions/streamingExecutor.ts +50 -16
- package/src/store/global/initialState.ts +1 -0
- package/src/store/tool/slices/lobehubSkillStore/action.test.ts +914 -0
- package/src/store/tool/slices/lobehubSkillStore/selectors.test.ts +548 -0
- package/.cursor/skills/vercel-react-best-practices/AGENTS.md +0 -2410
- package/.cursor/skills/vercel-react-best-practices/SKILL.md +0 -125
- package/.cursor/skills/vercel-react-best-practices/rules/advanced-event-handler-refs.md +0 -55
- package/.cursor/skills/vercel-react-best-practices/rules/advanced-use-latest.md +0 -49
- package/.cursor/skills/vercel-react-best-practices/rules/async-api-routes.md +0 -38
- package/.cursor/skills/vercel-react-best-practices/rules/async-defer-await.md +0 -80
- package/.cursor/skills/vercel-react-best-practices/rules/async-dependencies.md +0 -36
- package/.cursor/skills/vercel-react-best-practices/rules/async-parallel.md +0 -28
- package/.cursor/skills/vercel-react-best-practices/rules/async-suspense-boundaries.md +0 -99
- package/.cursor/skills/vercel-react-best-practices/rules/bundle-barrel-imports.md +0 -59
- package/.cursor/skills/vercel-react-best-practices/rules/bundle-conditional.md +0 -31
- package/.cursor/skills/vercel-react-best-practices/rules/bundle-defer-third-party.md +0 -49
- package/.cursor/skills/vercel-react-best-practices/rules/bundle-dynamic-imports.md +0 -35
- package/.cursor/skills/vercel-react-best-practices/rules/bundle-preload.md +0 -50
- package/.cursor/skills/vercel-react-best-practices/rules/client-event-listeners.md +0 -74
- package/.cursor/skills/vercel-react-best-practices/rules/client-localstorage-schema.md +0 -71
- package/.cursor/skills/vercel-react-best-practices/rules/client-passive-event-listeners.md +0 -48
- package/.cursor/skills/vercel-react-best-practices/rules/client-swr-dedup.md +0 -56
- package/.cursor/skills/vercel-react-best-practices/rules/js-batch-dom-css.md +0 -57
- package/.cursor/skills/vercel-react-best-practices/rules/js-cache-function-results.md +0 -80
- package/.cursor/skills/vercel-react-best-practices/rules/js-cache-property-access.md +0 -28
- package/.cursor/skills/vercel-react-best-practices/rules/js-cache-storage.md +0 -70
- package/.cursor/skills/vercel-react-best-practices/rules/js-combine-iterations.md +0 -32
- package/.cursor/skills/vercel-react-best-practices/rules/js-early-exit.md +0 -50
- package/.cursor/skills/vercel-react-best-practices/rules/js-hoist-regexp.md +0 -45
- package/.cursor/skills/vercel-react-best-practices/rules/js-index-maps.md +0 -37
- package/.cursor/skills/vercel-react-best-practices/rules/js-length-check-first.md +0 -49
- package/.cursor/skills/vercel-react-best-practices/rules/js-min-max-loop.md +0 -82
- package/.cursor/skills/vercel-react-best-practices/rules/js-set-map-lookups.md +0 -24
- package/.cursor/skills/vercel-react-best-practices/rules/js-tosorted-immutable.md +0 -57
- package/.cursor/skills/vercel-react-best-practices/rules/rendering-activity.md +0 -26
- package/.cursor/skills/vercel-react-best-practices/rules/rendering-animate-svg-wrapper.md +0 -47
- package/.cursor/skills/vercel-react-best-practices/rules/rendering-conditional-render.md +0 -40
- package/.cursor/skills/vercel-react-best-practices/rules/rendering-content-visibility.md +0 -38
- package/.cursor/skills/vercel-react-best-practices/rules/rendering-hoist-jsx.md +0 -46
- package/.cursor/skills/vercel-react-best-practices/rules/rendering-hydration-no-flicker.md +0 -82
- package/.cursor/skills/vercel-react-best-practices/rules/rendering-svg-precision.md +0 -28
- package/.cursor/skills/vercel-react-best-practices/rules/rerender-defer-reads.md +0 -39
- package/.cursor/skills/vercel-react-best-practices/rules/rerender-dependencies.md +0 -45
- package/.cursor/skills/vercel-react-best-practices/rules/rerender-derived-state.md +0 -29
- package/.cursor/skills/vercel-react-best-practices/rules/rerender-functional-setstate.md +0 -74
- package/.cursor/skills/vercel-react-best-practices/rules/rerender-lazy-state-init.md +0 -58
- package/.cursor/skills/vercel-react-best-practices/rules/rerender-memo.md +0 -44
- package/.cursor/skills/vercel-react-best-practices/rules/rerender-transitions.md +0 -40
- package/.cursor/skills/vercel-react-best-practices/rules/server-after-nonblocking.md +0 -73
- package/.cursor/skills/vercel-react-best-practices/rules/server-cache-lru.md +0 -41
- package/.cursor/skills/vercel-react-best-practices/rules/server-cache-react.md +0 -76
- package/.cursor/skills/vercel-react-best-practices/rules/server-parallel-fetching.md +0 -83
- package/.cursor/skills/vercel-react-best-practices/rules/server-serialization.md +0 -38
- package/src/features/PluginStore/Content.tsx +0 -54
- package/src/features/PluginStore/InstalledList/Detail/CustomPluginEmptyState.tsx +0 -79
- package/src/features/PluginStore/InstalledList/Detail/index.tsx +0 -21
- package/src/features/PluginStore/InstalledList/List/Item/index.tsx +0 -61
- package/src/features/PluginStore/InstalledList/List/index.tsx +0 -72
- package/src/features/PluginStore/InstalledList/index.tsx +0 -90
- package/src/features/PluginStore/McpList/List/Action.tsx +0 -119
- package/src/features/PluginStore/McpList/List/Item.tsx +0 -83
- package/src/features/PluginStore/McpList/List/index.tsx +0 -93
- package/src/features/PluginStore/McpList/index.tsx +0 -58
- package/src/features/PluginStore/PluginList/Detail/DetailProvider.tsx +0 -19
- package/src/features/PluginStore/PluginList/Detail/EmptyState.tsx +0 -56
- package/src/features/PluginStore/PluginList/Detail/Header.tsx +0 -130
- package/src/features/PluginStore/PluginList/Detail/InstallDetail/Nav.tsx +0 -73
- package/src/features/PluginStore/PluginList/Detail/InstallDetail/Settings.tsx +0 -19
- package/src/features/PluginStore/PluginList/Detail/InstallDetail/Tools.tsx +0 -111
- package/src/features/PluginStore/PluginList/Detail/InstallDetail/index.tsx +0 -24
- package/src/features/PluginStore/PluginList/Detail/Loading.tsx +0 -42
- package/src/features/PluginStore/PluginList/Detail/TagList.tsx +0 -35
- package/src/features/PluginStore/PluginList/Detail/index.tsx +0 -39
- package/src/features/PluginStore/PluginList/Detail/useCategory.tsx +0 -76
- package/src/features/PluginStore/PluginList/List/Action.tsx +0 -78
- package/src/features/PluginStore/PluginList/List/Item.tsx +0 -92
- package/src/features/PluginStore/PluginList/List/index.tsx +0 -94
- package/src/features/PluginStore/PluginList/index.tsx +0 -46
- package/src/features/PluginStore/Search/index.tsx +0 -40
- /package/{.codex/skills → .agents}/vercel-react-best-practices/AGENTS.md +0 -0
- /package/{.codex/skills → .agents}/vercel-react-best-practices/SKILL.md +0 -0
- /package/{.codex/skills → .agents}/vercel-react-best-practices/rules/advanced-event-handler-refs.md +0 -0
- /package/{.codex/skills → .agents}/vercel-react-best-practices/rules/advanced-use-latest.md +0 -0
- /package/{.codex/skills → .agents}/vercel-react-best-practices/rules/async-api-routes.md +0 -0
- /package/{.codex/skills → .agents}/vercel-react-best-practices/rules/async-defer-await.md +0 -0
- /package/{.codex/skills → .agents}/vercel-react-best-practices/rules/async-dependencies.md +0 -0
- /package/{.codex/skills → .agents}/vercel-react-best-practices/rules/async-parallel.md +0 -0
- /package/{.codex/skills → .agents}/vercel-react-best-practices/rules/async-suspense-boundaries.md +0 -0
- /package/{.codex/skills → .agents}/vercel-react-best-practices/rules/bundle-barrel-imports.md +0 -0
- /package/{.codex/skills → .agents}/vercel-react-best-practices/rules/bundle-conditional.md +0 -0
- /package/{.codex/skills → .agents}/vercel-react-best-practices/rules/bundle-defer-third-party.md +0 -0
- /package/{.codex/skills → .agents}/vercel-react-best-practices/rules/bundle-dynamic-imports.md +0 -0
- /package/{.codex/skills → .agents}/vercel-react-best-practices/rules/bundle-preload.md +0 -0
- /package/{.codex/skills → .agents}/vercel-react-best-practices/rules/client-event-listeners.md +0 -0
- /package/{.codex/skills → .agents}/vercel-react-best-practices/rules/client-localstorage-schema.md +0 -0
- /package/{.codex/skills → .agents}/vercel-react-best-practices/rules/client-passive-event-listeners.md +0 -0
- /package/{.codex/skills → .agents}/vercel-react-best-practices/rules/client-swr-dedup.md +0 -0
- /package/{.codex/skills → .agents}/vercel-react-best-practices/rules/js-batch-dom-css.md +0 -0
- /package/{.codex/skills → .agents}/vercel-react-best-practices/rules/js-cache-function-results.md +0 -0
- /package/{.codex/skills → .agents}/vercel-react-best-practices/rules/js-cache-property-access.md +0 -0
- /package/{.codex/skills → .agents}/vercel-react-best-practices/rules/js-cache-storage.md +0 -0
- /package/{.codex/skills → .agents}/vercel-react-best-practices/rules/js-combine-iterations.md +0 -0
- /package/{.codex/skills → .agents}/vercel-react-best-practices/rules/js-early-exit.md +0 -0
- /package/{.codex/skills → .agents}/vercel-react-best-practices/rules/js-hoist-regexp.md +0 -0
- /package/{.codex/skills → .agents}/vercel-react-best-practices/rules/js-index-maps.md +0 -0
- /package/{.codex/skills → .agents}/vercel-react-best-practices/rules/js-length-check-first.md +0 -0
- /package/{.codex/skills → .agents}/vercel-react-best-practices/rules/js-min-max-loop.md +0 -0
- /package/{.codex/skills → .agents}/vercel-react-best-practices/rules/js-set-map-lookups.md +0 -0
- /package/{.codex/skills → .agents}/vercel-react-best-practices/rules/js-tosorted-immutable.md +0 -0
- /package/{.codex/skills → .agents}/vercel-react-best-practices/rules/rendering-activity.md +0 -0
- /package/{.codex/skills → .agents}/vercel-react-best-practices/rules/rendering-animate-svg-wrapper.md +0 -0
- /package/{.codex/skills → .agents}/vercel-react-best-practices/rules/rendering-conditional-render.md +0 -0
- /package/{.codex/skills → .agents}/vercel-react-best-practices/rules/rendering-content-visibility.md +0 -0
- /package/{.codex/skills → .agents}/vercel-react-best-practices/rules/rendering-hoist-jsx.md +0 -0
- /package/{.codex/skills → .agents}/vercel-react-best-practices/rules/rendering-hydration-no-flicker.md +0 -0
- /package/{.codex/skills → .agents}/vercel-react-best-practices/rules/rendering-svg-precision.md +0 -0
- /package/{.codex/skills → .agents}/vercel-react-best-practices/rules/rerender-defer-reads.md +0 -0
- /package/{.codex/skills → .agents}/vercel-react-best-practices/rules/rerender-dependencies.md +0 -0
- /package/{.codex/skills → .agents}/vercel-react-best-practices/rules/rerender-derived-state.md +0 -0
- /package/{.codex/skills → .agents}/vercel-react-best-practices/rules/rerender-functional-setstate.md +0 -0
- /package/{.codex/skills → .agents}/vercel-react-best-practices/rules/rerender-lazy-state-init.md +0 -0
- /package/{.codex/skills → .agents}/vercel-react-best-practices/rules/rerender-memo.md +0 -0
- /package/{.codex/skills → .agents}/vercel-react-best-practices/rules/rerender-transitions.md +0 -0
- /package/{.codex/skills → .agents}/vercel-react-best-practices/rules/server-after-nonblocking.md +0 -0
- /package/{.codex/skills → .agents}/vercel-react-best-practices/rules/server-cache-lru.md +0 -0
- /package/{.codex/skills → .agents}/vercel-react-best-practices/rules/server-cache-react.md +0 -0
- /package/{.codex/skills → .agents}/vercel-react-best-practices/rules/server-parallel-fetching.md +0 -0
- /package/{.codex/skills → .agents}/vercel-react-best-practices/rules/server-serialization.md +0 -0
- /package/src/{features/PluginStore/InstalledList → app/[variants]/(main)/settings/skill/features}/EditCustomPlugin.tsx +0 -0
- /package/src/features/{PluginStore/McpList/Detail → MCP/MCPDetail}/Loading.tsx +0 -0
- /package/src/features/{PluginStore → SkillStore}/Loading.tsx +0 -0
- /package/src/features/{PluginStore → SkillStore}/VirtuosoLoading.tsx +0 -0
|
@@ -235,13 +235,14 @@ export const createGroupOrchestrationExecutors = (
|
|
|
235
235
|
parallel_call_agents: async (instruction, state): Promise<GroupOrchestrationExecutorOutput> => {
|
|
236
236
|
const {
|
|
237
237
|
agentIds,
|
|
238
|
+
disableTools,
|
|
238
239
|
instruction: agentInstruction,
|
|
239
240
|
toolMessageId,
|
|
240
241
|
} = (instruction as SupervisorInstructionParallelCallAgents).payload;
|
|
241
242
|
|
|
242
243
|
const sessionLogId = `${state.operationId}:parallel_call_agents`;
|
|
243
244
|
log(
|
|
244
|
-
`[${sessionLogId}] Broadcasting to agents: ${agentIds.join(', ')}, instruction: ${agentInstruction}, toolMessageId: ${toolMessageId}`,
|
|
245
|
+
`[${sessionLogId}] Broadcasting to agents: ${agentIds.join(', ')}, instruction: ${agentInstruction}, toolMessageId: ${toolMessageId}, disableTools: ${disableTools}`,
|
|
245
246
|
);
|
|
246
247
|
|
|
247
248
|
const messages = getMessages();
|
|
@@ -279,10 +280,12 @@ export const createGroupOrchestrationExecutors = (
|
|
|
279
280
|
// - messageContext keeps the group's main conversation context (for message storage)
|
|
280
281
|
// - subAgentId specifies which agent's config to use for each agent
|
|
281
282
|
// - toolMessageId is used as parentMessageId so agent responses are children of the tool message
|
|
283
|
+
// - disableTools prevents broadcast agents from calling tools (expected behavior for broadcast)
|
|
282
284
|
await Promise.all(
|
|
283
285
|
agentIds.map(async (agentId) => {
|
|
284
286
|
await get().internal_execAgentRuntime({
|
|
285
287
|
context: { ...messageContext, subAgentId: agentId },
|
|
288
|
+
disableTools,
|
|
286
289
|
messages: messagesWithInstruction,
|
|
287
290
|
parentMessageId: toolMessageId,
|
|
288
291
|
parentMessageType: 'tool',
|
|
@@ -776,48 +779,48 @@ export const createGroupOrchestrationExecutors = (
|
|
|
776
779
|
}
|
|
777
780
|
|
|
778
781
|
switch (status.status) {
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
782
|
+
case 'completed': {
|
|
783
|
+
tracker.status = 'completed';
|
|
784
|
+
tracker.result = status.result;
|
|
785
|
+
log(`[${taskLogId}] Task completed successfully`);
|
|
786
|
+
if (status.result) {
|
|
787
|
+
await get().optimisticUpdateMessageContent(
|
|
788
|
+
tracker.taskMessageId,
|
|
789
|
+
status.result,
|
|
790
|
+
undefined,
|
|
791
|
+
{ operationId: state.operationId },
|
|
792
|
+
);
|
|
793
|
+
}
|
|
794
|
+
|
|
795
|
+
break;
|
|
796
|
+
}
|
|
797
|
+
case 'failed': {
|
|
798
|
+
tracker.status = 'failed';
|
|
799
|
+
tracker.error = status.error;
|
|
800
|
+
console.error(`[${taskLogId}] Task failed: ${status.error}`);
|
|
784
801
|
await get().optimisticUpdateMessageContent(
|
|
785
802
|
tracker.taskMessageId,
|
|
786
|
-
status.
|
|
803
|
+
`Task failed: ${status.error}`,
|
|
787
804
|
undefined,
|
|
788
805
|
{ operationId: state.operationId },
|
|
789
806
|
);
|
|
807
|
+
|
|
808
|
+
break;
|
|
790
809
|
}
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
break;
|
|
806
|
-
}
|
|
807
|
-
case 'cancel': {
|
|
808
|
-
tracker.status = 'failed';
|
|
809
|
-
tracker.error = 'Task was cancelled';
|
|
810
|
-
log(`[${taskLogId}] Task was cancelled`);
|
|
811
|
-
await get().optimisticUpdateMessageContent(
|
|
812
|
-
tracker.taskMessageId,
|
|
813
|
-
'Task was cancelled',
|
|
814
|
-
undefined,
|
|
815
|
-
{ operationId: state.operationId },
|
|
816
|
-
);
|
|
817
|
-
|
|
818
|
-
break;
|
|
819
|
-
}
|
|
820
|
-
// No default
|
|
810
|
+
case 'cancel': {
|
|
811
|
+
tracker.status = 'failed';
|
|
812
|
+
tracker.error = 'Task was cancelled';
|
|
813
|
+
log(`[${taskLogId}] Task was cancelled`);
|
|
814
|
+
await get().optimisticUpdateMessageContent(
|
|
815
|
+
tracker.taskMessageId,
|
|
816
|
+
'Task was cancelled',
|
|
817
|
+
undefined,
|
|
818
|
+
{ operationId: state.operationId },
|
|
819
|
+
);
|
|
820
|
+
|
|
821
|
+
break;
|
|
822
|
+
}
|
|
823
|
+
// No default
|
|
821
824
|
}
|
|
822
825
|
|
|
823
826
|
// Check individual task timeout
|
|
@@ -1451,6 +1451,84 @@ describe('StreamingExecutor actions', () => {
|
|
|
1451
1451
|
});
|
|
1452
1452
|
});
|
|
1453
1453
|
|
|
1454
|
+
describe('internal_createAgentState with disableTools', () => {
|
|
1455
|
+
it('should return empty toolManifestMap when disableTools is true', async () => {
|
|
1456
|
+
act(() => {
|
|
1457
|
+
useChatStore.setState({ internal_execAgentRuntime: realExecAgentRuntime });
|
|
1458
|
+
});
|
|
1459
|
+
|
|
1460
|
+
const { result } = renderHook(() => useChatStore());
|
|
1461
|
+
const userMessage = {
|
|
1462
|
+
id: TEST_IDS.USER_MESSAGE_ID,
|
|
1463
|
+
role: 'user',
|
|
1464
|
+
content: TEST_CONTENT.USER_MESSAGE,
|
|
1465
|
+
sessionId: TEST_IDS.SESSION_ID,
|
|
1466
|
+
topicId: TEST_IDS.TOPIC_ID,
|
|
1467
|
+
} as UIChatMessage;
|
|
1468
|
+
|
|
1469
|
+
// Get actual internal_createAgentState result with disableTools: true
|
|
1470
|
+
const { state } = result.current.internal_createAgentState({
|
|
1471
|
+
messages: [userMessage],
|
|
1472
|
+
parentMessageId: userMessage.id,
|
|
1473
|
+
agentId: TEST_IDS.SESSION_ID,
|
|
1474
|
+
topicId: TEST_IDS.TOPIC_ID,
|
|
1475
|
+
disableTools: true,
|
|
1476
|
+
});
|
|
1477
|
+
|
|
1478
|
+
// toolManifestMap should be empty when disableTools is true
|
|
1479
|
+
expect(state.toolManifestMap).toEqual({});
|
|
1480
|
+
});
|
|
1481
|
+
|
|
1482
|
+
it('should include tools in toolManifestMap when disableTools is false or undefined', async () => {
|
|
1483
|
+
act(() => {
|
|
1484
|
+
useChatStore.setState({ internal_execAgentRuntime: realExecAgentRuntime });
|
|
1485
|
+
});
|
|
1486
|
+
|
|
1487
|
+
const { result } = renderHook(() => useChatStore());
|
|
1488
|
+
const userMessage = {
|
|
1489
|
+
id: TEST_IDS.USER_MESSAGE_ID,
|
|
1490
|
+
role: 'user',
|
|
1491
|
+
content: TEST_CONTENT.USER_MESSAGE,
|
|
1492
|
+
sessionId: TEST_IDS.SESSION_ID,
|
|
1493
|
+
topicId: TEST_IDS.TOPIC_ID,
|
|
1494
|
+
} as UIChatMessage;
|
|
1495
|
+
|
|
1496
|
+
// Mock resolveAgentConfig to return plugins
|
|
1497
|
+
vi.spyOn(agentConfigResolver, 'resolveAgentConfig').mockReturnValue({
|
|
1498
|
+
agentConfig: {
|
|
1499
|
+
...createMockAgentConfig(),
|
|
1500
|
+
plugins: ['test-plugin'],
|
|
1501
|
+
},
|
|
1502
|
+
chatConfig: createMockChatConfig(),
|
|
1503
|
+
isBuiltinAgent: false,
|
|
1504
|
+
plugins: ['test-plugin'],
|
|
1505
|
+
});
|
|
1506
|
+
|
|
1507
|
+
// Get actual internal_createAgentState result without disableTools
|
|
1508
|
+
const { state: stateWithoutDisable } = result.current.internal_createAgentState({
|
|
1509
|
+
messages: [userMessage],
|
|
1510
|
+
parentMessageId: userMessage.id,
|
|
1511
|
+
agentId: TEST_IDS.SESSION_ID,
|
|
1512
|
+
topicId: TEST_IDS.TOPIC_ID,
|
|
1513
|
+
// disableTools not set (undefined)
|
|
1514
|
+
});
|
|
1515
|
+
|
|
1516
|
+
// Get actual internal_createAgentState result with disableTools: false
|
|
1517
|
+
const { state: stateWithDisableFalse } = result.current.internal_createAgentState({
|
|
1518
|
+
messages: [userMessage],
|
|
1519
|
+
parentMessageId: userMessage.id,
|
|
1520
|
+
agentId: TEST_IDS.SESSION_ID,
|
|
1521
|
+
topicId: TEST_IDS.TOPIC_ID,
|
|
1522
|
+
disableTools: false,
|
|
1523
|
+
});
|
|
1524
|
+
|
|
1525
|
+
// Both should have the same toolManifestMap (tools enabled)
|
|
1526
|
+
// Note: The actual content depends on what plugins are resolved,
|
|
1527
|
+
// but the key point is they should not be empty (unless no plugins are configured)
|
|
1528
|
+
expect(stateWithoutDisable.toolManifestMap).toEqual(stateWithDisableFalse.toolManifestMap);
|
|
1529
|
+
});
|
|
1530
|
+
});
|
|
1531
|
+
|
|
1454
1532
|
describe('operation status handling', () => {
|
|
1455
1533
|
it('should complete operation when state is waiting_for_human', async () => {
|
|
1456
1534
|
const { result } = renderHook(() => useChatStore());
|
|
@@ -59,6 +59,11 @@ export interface StreamingExecutorAction {
|
|
|
59
59
|
* Explicit agentId for this execution (avoids using global activeAgentId)
|
|
60
60
|
*/
|
|
61
61
|
agentId?: string;
|
|
62
|
+
/**
|
|
63
|
+
* Whether to disable tools for this agent execution
|
|
64
|
+
* When true, agent will respond without calling any tools
|
|
65
|
+
*/
|
|
66
|
+
disableTools?: boolean;
|
|
62
67
|
/**
|
|
63
68
|
* Explicit topicId for this execution (avoids using global activeTopicId)
|
|
64
69
|
*/
|
|
@@ -117,6 +122,11 @@ export interface StreamingExecutorAction {
|
|
|
117
122
|
* Contains agentId, topicId, threadId, groupId, scope, etc.
|
|
118
123
|
*/
|
|
119
124
|
context: ConversationContext;
|
|
125
|
+
/**
|
|
126
|
+
* Whether to disable tools for this agent execution
|
|
127
|
+
* When true, agent will respond without calling any tools
|
|
128
|
+
*/
|
|
129
|
+
disableTools?: boolean;
|
|
120
130
|
/**
|
|
121
131
|
* Initial agent runtime context (for resuming execution from a specific phase)
|
|
122
132
|
*/
|
|
@@ -156,6 +166,7 @@ export const streamingExecutor: StateCreator<
|
|
|
156
166
|
messages,
|
|
157
167
|
parentMessageId,
|
|
158
168
|
agentId: paramAgentId,
|
|
169
|
+
disableTools,
|
|
159
170
|
topicId: paramTopicId,
|
|
160
171
|
threadId,
|
|
161
172
|
initialState,
|
|
@@ -165,8 +176,9 @@ export const streamingExecutor: StateCreator<
|
|
|
165
176
|
isSubTask,
|
|
166
177
|
}) => {
|
|
167
178
|
// Use provided agentId/topicId or fallback to global state
|
|
179
|
+
// Note: Use || instead of ?? to also fallback when paramAgentId is empty string
|
|
168
180
|
const { activeAgentId, activeTopicId } = get();
|
|
169
|
-
const agentId = paramAgentId
|
|
181
|
+
const agentId = paramAgentId || activeAgentId;
|
|
170
182
|
const topicId = paramTopicId !== undefined ? paramTopicId : activeTopicId;
|
|
171
183
|
|
|
172
184
|
// For group orchestration scenarios:
|
|
@@ -181,29 +193,48 @@ export const streamingExecutor: StateCreator<
|
|
|
181
193
|
|
|
182
194
|
// Resolve agent config with builtin agent runtime config merged
|
|
183
195
|
// This ensures runtime plugins (e.g., 'lobe-agent-builder' for Agent Builder) are included
|
|
184
|
-
// isSubTask
|
|
196
|
+
// - isSubTask: filters out lobe-gtd tools to prevent nested sub-task creation
|
|
197
|
+
// - disableTools: clears all plugins for broadcast scenarios
|
|
185
198
|
const agentConfig = resolveAgentConfig({
|
|
186
199
|
agentId: effectiveAgentId || '',
|
|
200
|
+
disableTools, // Clear plugins for broadcast scenarios
|
|
187
201
|
groupId, // Pass groupId for supervisor detection
|
|
188
202
|
isSubTask, // Filter out lobe-gtd in sub-task context
|
|
189
203
|
scope, // Pass scope from operation context
|
|
190
204
|
});
|
|
191
205
|
const { agentConfig: agentConfigData, plugins: pluginIds } = agentConfig;
|
|
192
206
|
|
|
193
|
-
log(
|
|
207
|
+
log(
|
|
208
|
+
'[internal_createAgentState] resolved plugins=%o, isSubTask=%s, disableTools=%s',
|
|
209
|
+
pluginIds,
|
|
210
|
+
isSubTask,
|
|
211
|
+
disableTools,
|
|
212
|
+
);
|
|
194
213
|
|
|
195
|
-
// Get tools manifest map
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
214
|
+
// Get tools manifest map (skip if disableTools is true / no plugins)
|
|
215
|
+
let toolManifestMap: Record<string, unknown> = {};
|
|
216
|
+
let enabledToolIds: string[] = [];
|
|
217
|
+
|
|
218
|
+
if (pluginIds.length > 0) {
|
|
219
|
+
const toolsEngine = createAgentToolsEngine({
|
|
220
|
+
model: agentConfigData.model,
|
|
221
|
+
provider: agentConfigData.provider!,
|
|
222
|
+
});
|
|
223
|
+
const toolsDetailed = toolsEngine.generateToolsDetailed({
|
|
224
|
+
model: agentConfigData.model,
|
|
225
|
+
provider: agentConfigData.provider!,
|
|
226
|
+
toolIds: pluginIds,
|
|
227
|
+
});
|
|
228
|
+
enabledToolIds = toolsDetailed.enabledToolIds;
|
|
229
|
+
toolManifestMap = Object.fromEntries(
|
|
230
|
+
toolsEngine.getEnabledPluginManifests(enabledToolIds).entries(),
|
|
231
|
+
);
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
log(
|
|
235
|
+
'[internal_createAgentState] toolManifestMap keys=%o, count=%d',
|
|
236
|
+
Object.keys(toolManifestMap),
|
|
237
|
+
Object.keys(toolManifestMap).length,
|
|
207
238
|
);
|
|
208
239
|
|
|
209
240
|
// Get user intervention config
|
|
@@ -549,6 +580,7 @@ export const streamingExecutor: StateCreator<
|
|
|
549
580
|
|
|
550
581
|
internal_execAgentRuntime: async (params) => {
|
|
551
582
|
const {
|
|
583
|
+
disableTools,
|
|
552
584
|
messages: originalMessages,
|
|
553
585
|
parentMessageId,
|
|
554
586
|
parentMessageType,
|
|
@@ -588,7 +620,7 @@ export const streamingExecutor: StateCreator<
|
|
|
588
620
|
}
|
|
589
621
|
|
|
590
622
|
log(
|
|
591
|
-
'[internal_execAgentRuntime] start, operationId: %s, agentId: %s, subAgentId: %s, effectiveAgentId: %s, topicId: %s, messageKey: %s, parentMessageId: %s, parentMessageType: %s, messages count: %d',
|
|
623
|
+
'[internal_execAgentRuntime] start, operationId: %s, agentId: %s, subAgentId: %s, effectiveAgentId: %s, topicId: %s, messageKey: %s, parentMessageId: %s, parentMessageType: %s, messages count: %d, disableTools: %s',
|
|
592
624
|
operationId,
|
|
593
625
|
agentId,
|
|
594
626
|
subAgentId,
|
|
@@ -598,6 +630,7 @@ export const streamingExecutor: StateCreator<
|
|
|
598
630
|
parentMessageId,
|
|
599
631
|
parentMessageType,
|
|
600
632
|
originalMessages.length,
|
|
633
|
+
disableTools,
|
|
601
634
|
);
|
|
602
635
|
|
|
603
636
|
// Create a new array to avoid modifying the original messages
|
|
@@ -615,6 +648,7 @@ export const streamingExecutor: StateCreator<
|
|
|
615
648
|
messages,
|
|
616
649
|
parentMessageId: params.parentMessageId,
|
|
617
650
|
agentId,
|
|
651
|
+
disableTools,
|
|
618
652
|
topicId,
|
|
619
653
|
threadId: threadId ?? undefined,
|
|
620
654
|
initialState: params.initialState,
|