@lobehub/lobehub 2.0.0-next.294 → 2.0.0-next.296
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/CHANGELOG.md +50 -0
- package/apps/desktop/src/main/__mocks__/node-mac-permissions.ts +0 -1
- package/apps/desktop/src/main/__mocks__/setup.ts +0 -1
- package/apps/desktop/src/main/controllers/__tests__/SystemCtr.test.ts +1 -4
- package/apps/desktop/tsconfig.json +4 -10
- package/changelog/v1.json +18 -0
- package/e2e/scripts/setup.ts +45 -32
- package/locales/en-US/plugin.json +4 -0
- package/locales/zh-CN/plugin.json +4 -0
- package/package.json +1 -1
- package/packages/agent-runtime/src/core/__tests__/runtime.test.ts +5 -5
- package/packages/agent-runtime/src/utils/stepContextComputer.test.ts +5 -5
- package/packages/builtin-tool-gtd/src/client/Inspector/index.ts +0 -4
- package/packages/builtin-tool-gtd/src/client/Intervention/AddTodo.tsx +1 -1
- package/packages/builtin-tool-gtd/src/client/Render/TodoList/index.tsx +39 -10
- package/packages/builtin-tool-gtd/src/client/Render/index.ts +0 -2
- package/packages/builtin-tool-gtd/src/client/components/SortableTodoList/TodoItemRow.tsx +26 -12
- package/packages/builtin-tool-gtd/src/client/components/SortableTodoList/store/actions.ts +5 -5
- package/packages/builtin-tool-gtd/src/client/components/SortableTodoList/store/store.test.ts +14 -8
- package/packages/builtin-tool-gtd/src/executor/index.test.ts +48 -227
- package/packages/builtin-tool-gtd/src/executor/index.ts +15 -158
- package/packages/builtin-tool-gtd/src/manifest.ts +12 -42
- package/packages/builtin-tool-gtd/src/systemRole.ts +14 -8
- package/packages/builtin-tool-gtd/src/types.ts +47 -41
- package/packages/builtin-tool-memory/package.json +8 -0
- package/packages/builtin-tool-memory/src/client/Inspector/AddContextMemory/index.tsx +60 -0
- package/packages/builtin-tool-memory/src/client/Inspector/AddExperienceMemory/index.tsx +60 -0
- package/packages/builtin-tool-memory/src/client/Inspector/AddIdentityMemory/index.tsx +60 -0
- package/packages/builtin-tool-memory/src/client/Inspector/AddPreferenceMemory/index.tsx +60 -0
- package/packages/builtin-tool-memory/src/client/Inspector/RemoveIdentityMemory/index.tsx +60 -0
- package/packages/builtin-tool-memory/src/client/Inspector/SearchUserMemory/index.tsx +67 -0
- package/packages/builtin-tool-memory/src/client/Inspector/UpdateIdentityMemory/index.tsx +60 -0
- package/packages/builtin-tool-memory/src/client/Inspector/index.ts +35 -0
- package/packages/builtin-tool-memory/src/client/Intervention/AddExperienceMemory/index.tsx +17 -0
- package/packages/builtin-tool-memory/src/client/Intervention/index.ts +13 -0
- package/packages/builtin-tool-memory/src/client/Render/AddExperienceMemory/index.tsx +17 -0
- package/packages/builtin-tool-memory/src/client/Render/SearchUserMemory/index.tsx +217 -0
- package/packages/builtin-tool-memory/src/client/Render/index.ts +15 -0
- package/packages/builtin-tool-memory/src/client/Streaming/AddExperienceMemory/index.tsx +17 -0
- package/packages/builtin-tool-memory/src/client/Streaming/index.ts +18 -0
- package/packages/builtin-tool-memory/src/client/components/ExperienceMemoryCard.tsx +231 -0
- package/packages/builtin-tool-memory/src/client/components/index.ts +1 -0
- package/packages/builtin-tool-memory/src/client/index.ts +27 -0
- package/packages/builtin-tool-memory/src/executor/index.ts +9 -1
- package/packages/builtin-tool-memory/src/types.ts +61 -0
- package/packages/context-engine/src/providers/GTDTodoInjector.ts +15 -7
- package/packages/conversation-flow/src/__tests__/fixtures/outputs/assistantGroup/tools-with-branches.json +4 -0
- package/packages/conversation-flow/src/transformation/FlatListBuilder.ts +1 -0
- package/packages/database/src/models/__tests__/knowledgeBase.test.ts +1 -1
- package/packages/database/src/repositories/knowledge/index.ts +1 -4
- package/packages/prompts/src/prompts/gtd/index.test.ts +32 -16
- package/packages/prompts/src/prompts/gtd/index.ts +9 -5
- package/packages/types/src/discover/assistants.ts +2 -2
- package/packages/types/src/stepContext.ts +4 -1
- package/scripts/migrate-spa-navigation.ts +129 -0
- package/src/app/(backend)/api/workflows/memory-user-memory/pipelines/chat-topic/process-topics/route.ts +112 -109
- package/src/app/(backend)/api/workflows/memory-user-memory/pipelines/chat-topic/process-user-topics/route.ts +125 -113
- package/src/app/(backend)/api/workflows/memory-user-memory/pipelines/chat-topic/process-users/route.ts +74 -65
- package/src/app/[variants]/(auth)/auth-error/page.tsx +1 -1
- package/src/app/[variants]/(auth)/login/[[...login]]/page.tsx +1 -1
- package/src/app/[variants]/(auth)/next-auth/error/AuthErrorPage.tsx +1 -1
- package/src/app/[variants]/(auth)/next-auth/signin/AuthSignInBox.tsx +1 -1
- package/src/app/[variants]/(auth)/oauth/callback/error/page.tsx +1 -1
- package/src/app/[variants]/(auth)/oauth/callback/success/page.tsx +1 -1
- package/src/app/[variants]/(auth)/oauth/consent/[uid]/page.tsx +1 -1
- package/src/app/[variants]/(auth)/reset-password/layout.tsx +1 -1
- package/src/app/[variants]/(auth)/reset-password/page.tsx +2 -2
- package/src/app/[variants]/(auth)/signin/layout.tsx +1 -1
- package/src/app/[variants]/(auth)/signin/useSignIn.ts +1 -1
- package/src/app/[variants]/(auth)/signup/[[...signup]]/BetterAuthSignUpForm.tsx +2 -2
- package/src/app/[variants]/(auth)/signup/[[...signup]]/page.tsx +1 -1
- package/src/app/[variants]/(auth)/signup/[[...signup]]/useSignUp.tsx +1 -1
- package/src/app/[variants]/(auth)/verify-email/layout.tsx +1 -1
- package/src/app/[variants]/(auth)/verify-email/page.tsx +2 -2
- package/src/app/[variants]/(main)/_layout/index.tsx +1 -1
- package/src/app/[variants]/(main)/agent/_layout/Sidebar/Cron/CronTopicGroup.tsx +1 -1
- package/src/app/[variants]/(main)/agent/_layout/Sidebar/Header/AddTopicButon.tsx +1 -1
- package/src/app/[variants]/(main)/agent/_layout/Sidebar/Header/Nav.tsx +1 -1
- package/src/app/[variants]/(main)/agent/_layout/Sidebar/Topic/AllTopicsDrawer/index.tsx +1 -1
- package/src/app/[variants]/(main)/agent/_layout/Sidebar/Topic/hooks/useThreadNavigation.ts +1 -1
- package/src/app/[variants]/(main)/agent/_layout/Sidebar/Topic/hooks/useTopicNavigation.ts +1 -1
- package/src/app/[variants]/(main)/agent/features/TelemetryNotification.tsx +2 -3
- package/src/app/[variants]/(main)/community/(detail)/assistant/features/Details/Nav.tsx +9 -9
- package/src/app/[variants]/(main)/community/(detail)/assistant/features/Details/Versions/index.tsx +2 -3
- package/src/app/[variants]/(main)/community/(detail)/features/MakedownRender.tsx +1 -2
- package/src/app/[variants]/(main)/community/(detail)/features/ShareButton.tsx +2 -3
- package/src/app/[variants]/(main)/community/(detail)/features/Toc/Heading.tsx +2 -3
- package/src/app/[variants]/(main)/community/(detail)/mcp/features/Details/Versions/index.tsx +2 -2
- package/src/app/[variants]/(main)/community/(detail)/model/features/Details/Nav.tsx +12 -11
- package/src/app/[variants]/(main)/community/(detail)/model/features/Details/Parameter/ParameterItem.tsx +2 -3
- package/src/app/[variants]/(main)/community/(detail)/provider/features/Details/Nav.tsx +11 -10
- package/src/app/[variants]/(main)/community/(detail)/provider/features/Header.tsx +10 -9
- package/src/app/[variants]/(main)/community/(list)/(home)/index.tsx +1 -1
- package/src/app/[variants]/(main)/community/(list)/assistant/features/Category/useCategory.tsx +1 -1
- package/src/app/[variants]/(main)/community/(list)/features/SortButton/index.tsx +2 -3
- package/src/app/[variants]/(main)/community/_layout/Sidebar/Header/Nav.tsx +1 -1
- package/src/app/[variants]/(main)/community/features/CreateButton/Inner.tsx +1 -1
- package/src/app/[variants]/(main)/community/features/CreateButton/index.tsx +1 -1
- package/src/app/[variants]/(main)/community/features/Search.tsx +1 -2
- package/src/app/[variants]/(main)/community/features/Title.tsx +5 -5
- package/src/app/[variants]/(main)/group/_layout/Sidebar/Header/Nav.tsx +1 -1
- package/src/app/[variants]/(main)/group/_layout/Sidebar/Topic/AllTopicsDrawer/index.tsx +1 -1
- package/src/app/[variants]/(main)/group/_layout/Sidebar/Topic/hooks/useThreadNavigation.ts +1 -1
- package/src/app/[variants]/(main)/group/features/Conversation/Header/ShareButton/index.tsx +1 -1
- package/src/app/[variants]/(main)/group/features/TelemetryNotification.tsx +2 -3
- package/src/app/[variants]/(main)/home/_layout/Body/Agent/AllAgentsDrawer/index.tsx +1 -1
- package/src/app/[variants]/(main)/hooks/useActiveTabKey.ts +6 -11
- package/src/app/[variants]/(main)/image/NotSupportClient.tsx +4 -3
- package/src/app/[variants]/(main)/image/_layout/ConfigPanel/components/ImageUpload.tsx +1 -1
- package/src/app/[variants]/(main)/image/_layout/ConfigPanel/components/MultiImagesUpload/ImageManageModal.tsx +1 -1
- package/src/app/[variants]/(main)/image/_layout/ConfigPanel/components/MultiImagesUpload/index.tsx +1 -1
- package/src/app/[variants]/(main)/memory/(home)/features/RoleTagCloud/index.tsx +1 -1
- package/src/app/[variants]/(main)/memory/_layout/Sidebar/Header/Nav.tsx +1 -1
- package/src/app/[variants]/(main)/memory/features/SourceLink.tsx +1 -1
- package/src/app/[variants]/(main)/page/_layout/Body/AllPagesDrawer/index.tsx +1 -1
- package/src/app/[variants]/(main)/resource/features/DndContextWrapper.tsx +4 -2
- package/src/app/[variants]/(main)/resource/library/_layout/Header/LibraryHead.tsx +30 -35
- package/src/app/[variants]/(main)/resource/library/_layout/Header/index.tsx +9 -11
- package/src/app/[variants]/(main)/settings/about/features/ItemCard.tsx +2 -3
- package/src/app/[variants]/(main)/settings/about/features/ItemLink.tsx +2 -3
- package/src/app/[variants]/(main)/settings/about/features/Version.tsx +6 -7
- package/src/app/[variants]/(main)/settings/features/SettingsContent.tsx +1 -1
- package/src/app/[variants]/(main)/settings/features/UpgradeAlert.tsx +4 -4
- package/src/app/[variants]/(main)/settings/provider/(list)/Footer.tsx +2 -2
- package/src/app/[variants]/(main)/settings/provider/detail/index.tsx +1 -1
- package/src/app/[variants]/(main)/settings/provider/detail/ollama/CheckError.tsx +1 -1
- package/src/app/[variants]/(main)/settings/provider/features/ProviderConfig/index.tsx +12 -6
- package/src/app/[variants]/(main)/settings/security/index.tsx +1 -1
- package/src/app/[variants]/(main)/settings/stats/features/overview/ShareButton/ShareModal.tsx +1 -1
- package/src/app/[variants]/(main)/settings/stats/features/rankings/AssistantsRank.tsx +1 -1
- package/src/app/[variants]/(main)/settings/stats/features/rankings/TopicsRank.tsx +1 -1
- package/src/app/[variants]/(mobile)/_layout/index.tsx +1 -1
- package/src/app/[variants]/(mobile)/chat/settings/features/AgentInfoDescription/index.tsx +1 -1
- package/src/app/[variants]/(mobile)/chat/settings/features/SettingButton.tsx +1 -1
- package/src/app/[variants]/(mobile)/router/index.tsx +1 -1
- package/src/app/[variants]/page.tsx +1 -1
- package/src/app/[variants]/router/index.tsx +1 -1
- package/src/components/404/index.tsx +4 -4
- package/src/components/Analytics/index.tsx +1 -1
- package/src/components/BrandWatermark/index.tsx +4 -4
- package/src/components/Branding/ProductLogo/Custom.tsx +1 -1
- package/src/components/Error/index.tsx +3 -4
- package/src/components/GoBack/index.tsx +2 -2
- package/src/components/LabsModal/LabCard.tsx +1 -1
- package/src/components/Link.tsx +25 -5
- package/src/components/OllamaSetupGuide/index.tsx +5 -4
- package/src/components/WebFavicon/index.tsx +1 -1
- package/src/components/client/ClientResponsiveContent/index.tsx +1 -1
- package/src/components/client/ClientResponsiveLayout.tsx +1 -1
- package/src/components/mdx/Image.tsx +1 -1
- package/src/components/mdx/Link.tsx +26 -9
- package/src/features/AlertBanner/CloudBanner.tsx +2 -3
- package/src/features/ChatInput/ActionBar/Model/ControlsForm.tsx +8 -7
- package/src/features/ChatInput/ActionBar/Params/Controls.tsx +1 -3
- package/src/features/ChatInput/ActionBar/Token/index.tsx +1 -1
- package/src/features/ChatInput/Mobile/index.tsx +1 -1
- package/src/features/Conversation/ChatItem/components/MessageContent/index.tsx +1 -1
- package/src/features/Conversation/Error/OllamaBizError/index.tsx +1 -1
- package/src/features/Conversation/Error/OllamaSetupGuide/Desktop.tsx +1 -2
- package/src/features/Conversation/Error/index.tsx +1 -1
- package/src/features/Conversation/Messages/AssistantGroup/Tool/Actions/Settings.tsx +1 -1
- package/src/features/Conversation/Messages/AssistantGroup/Tool/Actions/index.tsx +11 -17
- package/src/features/Conversation/Messages/AssistantGroup/Tool/{Render → Detail}/LoadingPlaceholder/index.tsx +13 -3
- package/src/features/Conversation/Messages/AssistantGroup/Tool/Detail/Render/CustomRender.tsx +43 -0
- package/src/features/Conversation/Messages/AssistantGroup/Tool/Detail/Render/FallbacktArgumentRender.tsx +59 -0
- package/src/features/Conversation/Messages/AssistantGroup/Tool/Detail/Render/index.tsx +46 -0
- package/src/features/Conversation/Messages/AssistantGroup/Tool/{Render → Detail}/index.tsx +13 -19
- package/src/features/Conversation/Messages/AssistantGroup/Tool/index.tsx +18 -18
- package/src/features/Conversation/Messages/AssistantGroup/index.tsx +1 -1
- package/src/features/Conversation/Messages/Tool/Tool/index.tsx +11 -10
- package/src/features/Conversation/Messages/components/SearchGrounding.tsx +1 -1
- package/src/features/Conversation/TodoProgress/index.tsx +56 -23
- package/src/features/DataImporter/Error.tsx +3 -3
- package/src/features/DevPanel/CacheViewer/cacheProvider.tsx +2 -1
- package/src/features/DevPanel/MetadataViewer/Og.tsx +1 -1
- package/src/features/DevPanel/features/FloatPanel.tsx +1 -1
- package/src/features/DevPanel/features/Table/TooltipContent.tsx +3 -4
- package/src/features/DevPanel/index.tsx +1 -1
- package/src/features/EditorCanvas/InlineToolbar.tsx +1 -6
- package/src/features/FileViewer/NotSupport/index.tsx +2 -3
- package/src/features/Follow/index.tsx +8 -9
- package/src/features/LibraryModal/AddFilesToKnowledgeBase/SelectForm.tsx +2 -2
- package/src/features/MCP/Scores.tsx +1 -1
- package/src/features/MCPPluginDetail/Nav.tsx +8 -8
- package/src/features/MCPPluginDetail/Overview/TagList.tsx +1 -1
- package/src/features/MobileTabBar/index.tsx +2 -1
- package/src/features/OllamaSetupGuide/Desktop.tsx +1 -2
- package/src/features/PWAInstall/Install.tsx +1 -1
- package/src/features/PWAInstall/index.tsx +1 -1
- package/src/features/PluginStore/McpList/index.tsx +1 -1
- package/src/features/PluginStore/PluginList/Detail/Header.tsx +6 -6
- package/src/features/PluginsUI/Render/DefaultType/index.tsx +1 -1
- package/src/features/PluginsUI/Render/MCPType/index.tsx +1 -1
- package/src/features/Portal/Artifacts/Body/Renderer/index.tsx +1 -1
- package/src/features/ResourceManager/components/ChunkDrawer/index.tsx +1 -1
- package/src/features/ResourceManager/components/Explorer/Header/index.tsx +57 -4
- package/src/features/ResourceManager/components/Explorer/ListView/ListItem/index.tsx +6 -4
- package/src/features/ResourceManager/components/Explorer/ListView/Skeleton.tsx +26 -26
- package/src/features/ResourceManager/components/Explorer/ListView/index.tsx +16 -5
- package/src/features/ResourceManager/components/Explorer/ToolBar/BatchActionsDropdown.tsx +147 -149
- package/src/features/ResourceManager/components/LibraryHierarchy/styles.ts +5 -4
- package/src/features/ResourceManager/index.tsx +1 -1
- package/src/features/Setting/Footer.tsx +4 -5
- package/src/features/User/UserPanel/PanelContent.tsx +1 -1
- package/src/hooks/useActiveTabKey.ts +6 -4
- package/src/hooks/useIsSingleMode.test.ts +10 -24
- package/src/hooks/useIsSingleMode.ts +4 -2
- package/src/hooks/useIsSubSlug.ts +2 -1
- package/src/hooks/useQuery.ts +5 -5
- package/src/layout/GlobalProvider/AppTheme.tsx +2 -2
- package/src/layout/GlobalProvider/StyleRegistry.tsx +1 -1
- package/src/layout/GlobalProvider/useUserStateRedirect.ts +13 -25
- package/src/libs/next/Image.tsx +13 -0
- package/src/libs/next/Link.tsx +13 -0
- package/src/libs/next/dynamic.tsx +13 -0
- package/src/libs/next/index.ts +22 -0
- package/src/libs/next/navigation.ts +22 -0
- package/src/libs/router/Link.tsx +30 -0
- package/src/libs/router/index.ts +18 -0
- package/src/libs/router/navigation.ts +72 -0
- package/src/locales/default/plugin.ts +1 -0
- package/src/server/modules/AgentRuntime/AgentStateManager.ts +5 -1
- package/src/store/chat/slices/message/selectors/dbMessage.test.ts +11 -11
- package/src/store/chat/slices/portal/selectors.test.ts +5 -15
- package/src/store/file/slices/resource/action.ts +4 -2
- package/src/store/page/index.ts +1 -1
- package/src/store/page/slices/crud/index.ts +1 -1
- package/src/tools/inspectors.ts +2 -0
- package/src/tools/interventions.ts +2 -0
- package/src/tools/renders.ts +3 -1
- package/src/tools/streamings.ts +2 -0
- package/packages/builtin-tool-gtd/src/client/Inspector/CompleteTodos/index.tsx +0 -52
- package/packages/builtin-tool-gtd/src/client/Inspector/RemoveTodos/index.tsx +0 -52
- package/src/app/[variants]/(main)/hooks/usePathname.ts +0 -10
- package/src/app/[variants]/(main)/hooks/useQuery.ts +0 -12
- package/src/app/[variants]/(main)/hooks/useRouter.ts +0 -22
- package/src/app/[variants]/(main)/hooks/useSearchParams.ts +0 -11
- package/src/features/Conversation/Messages/AssistantGroup/Tool/Render/CustomRender.tsx +0 -113
- package/src/features/Conversation/Messages/Tool/Tool/Render.tsx +0 -47
- /package/src/features/Conversation/Messages/AssistantGroup/Tool/{Render → Detail}/AbortResponse.tsx +0 -0
- /package/src/features/Conversation/Messages/AssistantGroup/Tool/{Render → Detail}/Arguments/index.tsx +0 -0
- /package/src/features/Conversation/Messages/AssistantGroup/Tool/{Render → Detail}/ErrorResponse.tsx +0 -0
- /package/src/features/Conversation/Messages/AssistantGroup/Tool/{Render → Detail}/Intervention/ApprovalActions.tsx +0 -0
- /package/src/features/Conversation/Messages/AssistantGroup/Tool/{Render → Detail}/Intervention/Fallback.tsx +0 -0
- /package/src/features/Conversation/Messages/AssistantGroup/Tool/{Render → Detail}/Intervention/KeyValueEditor.tsx +0 -0
- /package/src/features/Conversation/Messages/AssistantGroup/Tool/{Render → Detail}/Intervention/ModeSelector.tsx +0 -0
- /package/src/features/Conversation/Messages/AssistantGroup/Tool/{Render → Detail}/Intervention/index.tsx +0 -0
- /package/src/features/Conversation/Messages/AssistantGroup/Tool/{Render → Detail}/PluginSettings.tsx +0 -0
- /package/src/features/Conversation/Messages/AssistantGroup/Tool/{Render → Detail}/RejectedResponse.tsx +0 -0
|
@@ -0,0 +1,231 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import { Accordion, AccordionItem, Avatar, Flexbox, Tag, Text } from '@lobehub/ui';
|
|
4
|
+
import { Steps } from 'antd';
|
|
5
|
+
import { createStaticStyles, cssVar } from 'antd-style';
|
|
6
|
+
import { memo } from 'react';
|
|
7
|
+
|
|
8
|
+
import BubblesLoading from '@/components/BubblesLoading';
|
|
9
|
+
import NeuralNetworkLoading from '@/components/NeuralNetworkLoading';
|
|
10
|
+
import StreamingMarkdown from '@/components/StreamingMarkdown';
|
|
11
|
+
import { highlightTextStyles } from '@/styles';
|
|
12
|
+
|
|
13
|
+
import type { AddExperienceMemoryParams } from '../../types';
|
|
14
|
+
|
|
15
|
+
const styles = createStaticStyles(({ css, cssVar }) => ({
|
|
16
|
+
container: css`
|
|
17
|
+
overflow: hidden;
|
|
18
|
+
|
|
19
|
+
width: 100%;
|
|
20
|
+
border: 1px solid ${cssVar.colorBorderSecondary};
|
|
21
|
+
border-radius: 16px;
|
|
22
|
+
|
|
23
|
+
background: ${cssVar.colorBgContainer};
|
|
24
|
+
`,
|
|
25
|
+
content: css`
|
|
26
|
+
padding-block: 12px;
|
|
27
|
+
padding-inline: 16px;
|
|
28
|
+
`,
|
|
29
|
+
detail: css`
|
|
30
|
+
font-size: 13px;
|
|
31
|
+
line-height: 1.6;
|
|
32
|
+
color: ${cssVar.colorTextSecondary};
|
|
33
|
+
`,
|
|
34
|
+
header: css`
|
|
35
|
+
padding-block: 10px;
|
|
36
|
+
padding-inline: 12px;
|
|
37
|
+
border-block-end: 1px solid ${cssVar.colorBorderSecondary};
|
|
38
|
+
`,
|
|
39
|
+
keyLearning: css`
|
|
40
|
+
font-size: 14px;
|
|
41
|
+
line-height: 1.6;
|
|
42
|
+
color: ${cssVar.colorText};
|
|
43
|
+
`,
|
|
44
|
+
section: css`
|
|
45
|
+
padding: 4px;
|
|
46
|
+
border-block-start: 1px solid ${cssVar.colorBorderSecondary};
|
|
47
|
+
`,
|
|
48
|
+
stepContent: css`
|
|
49
|
+
font-size: 13px;
|
|
50
|
+
line-height: 1.6;
|
|
51
|
+
color: ${cssVar.colorTextSecondary};
|
|
52
|
+
white-space: pre-wrap;
|
|
53
|
+
`,
|
|
54
|
+
stepsContainer: css`
|
|
55
|
+
.ant-steps-item-content {
|
|
56
|
+
min-height: auto;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
.ant-steps-item-description {
|
|
60
|
+
padding-block-end: 12px !important;
|
|
61
|
+
}
|
|
62
|
+
`,
|
|
63
|
+
summary: css`
|
|
64
|
+
font-size: 14px;
|
|
65
|
+
font-weight: 500;
|
|
66
|
+
color: ${cssVar.colorTextSecondary};
|
|
67
|
+
`,
|
|
68
|
+
tags: css`
|
|
69
|
+
padding-block-start: 8px;
|
|
70
|
+
border-block-start: 1px dashed ${cssVar.colorBorderSecondary};
|
|
71
|
+
`,
|
|
72
|
+
title: css`
|
|
73
|
+
overflow: hidden;
|
|
74
|
+
display: -webkit-box;
|
|
75
|
+
-webkit-box-orient: vertical;
|
|
76
|
+
-webkit-line-clamp: 1;
|
|
77
|
+
|
|
78
|
+
font-weight: 500;
|
|
79
|
+
color: ${cssVar.colorText};
|
|
80
|
+
`,
|
|
81
|
+
}));
|
|
82
|
+
|
|
83
|
+
export interface ExperienceMemoryCardProps {
|
|
84
|
+
data?: AddExperienceMemoryParams;
|
|
85
|
+
loading?: boolean;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
export const ExperienceMemoryCard = memo<ExperienceMemoryCardProps>(({ data, loading }) => {
|
|
89
|
+
const { summary, details, tags, title, withExperience } = data || {};
|
|
90
|
+
const { situation, reasoning, action, possibleOutcome, keyLearning } = withExperience || {};
|
|
91
|
+
|
|
92
|
+
const hasStarContent = situation || reasoning || action || possibleOutcome;
|
|
93
|
+
|
|
94
|
+
if (!summary && !details && !tags?.length && !title && !hasStarContent && !keyLearning)
|
|
95
|
+
return null;
|
|
96
|
+
|
|
97
|
+
const starItems = [
|
|
98
|
+
{ avatar: 'S', content: situation, title: 'Situation' },
|
|
99
|
+
{ avatar: 'T', content: reasoning, title: 'Task' },
|
|
100
|
+
{ avatar: 'A', content: action, title: 'Action' },
|
|
101
|
+
{ avatar: 'R', content: possibleOutcome, title: 'Result' },
|
|
102
|
+
].filter((item) => item.content);
|
|
103
|
+
|
|
104
|
+
return (
|
|
105
|
+
<Flexbox className={styles.container}>
|
|
106
|
+
{/* Header */}
|
|
107
|
+
<Flexbox align={'center'} className={styles.header} gap={8} horizontal>
|
|
108
|
+
<Flexbox flex={1}>
|
|
109
|
+
<div className={styles.title}>{title || 'Experience Memory'}</div>
|
|
110
|
+
</Flexbox>
|
|
111
|
+
{loading && <NeuralNetworkLoading size={20} />}
|
|
112
|
+
</Flexbox>
|
|
113
|
+
|
|
114
|
+
{/* When has STAR content: collapse summary */}
|
|
115
|
+
{hasStarContent ? (
|
|
116
|
+
<>
|
|
117
|
+
{/* Collapsed Summary */}
|
|
118
|
+
{(summary || tags?.length) && (
|
|
119
|
+
<Accordion gap={0}>
|
|
120
|
+
<AccordionItem
|
|
121
|
+
itemKey="summary"
|
|
122
|
+
paddingBlock={8}
|
|
123
|
+
paddingInline={8}
|
|
124
|
+
styles={{
|
|
125
|
+
base: { marginBlock: 4, marginInline: 4 },
|
|
126
|
+
}}
|
|
127
|
+
title={
|
|
128
|
+
<Text fontSize={12} type={'secondary'} weight={500}>
|
|
129
|
+
Summary
|
|
130
|
+
</Text>
|
|
131
|
+
}
|
|
132
|
+
>
|
|
133
|
+
<Flexbox gap={8} paddingBlock={'8px 12px'} paddingInline={8}>
|
|
134
|
+
{summary && <div className={styles.summary}>{summary}</div>}
|
|
135
|
+
{details && <div className={styles.detail}>{details}</div>}
|
|
136
|
+
{tags && tags.length > 0 && (
|
|
137
|
+
<Flexbox className={styles.tags} gap={8} horizontal wrap={'wrap'}>
|
|
138
|
+
{tags.map((tag, index) => (
|
|
139
|
+
<Tag key={index}>{tag}</Tag>
|
|
140
|
+
))}
|
|
141
|
+
</Flexbox>
|
|
142
|
+
)}
|
|
143
|
+
</Flexbox>
|
|
144
|
+
</AccordionItem>
|
|
145
|
+
</Accordion>
|
|
146
|
+
)}
|
|
147
|
+
|
|
148
|
+
{/* STAR Steps */}
|
|
149
|
+
<Accordion className={styles.section} defaultExpandedKeys={['star']} gap={0}>
|
|
150
|
+
<AccordionItem
|
|
151
|
+
itemKey="star"
|
|
152
|
+
paddingBlock={8}
|
|
153
|
+
paddingInline={8}
|
|
154
|
+
title={
|
|
155
|
+
<Text fontSize={12} type={'secondary'} weight={500}>
|
|
156
|
+
STAR
|
|
157
|
+
</Text>
|
|
158
|
+
}
|
|
159
|
+
>
|
|
160
|
+
<Flexbox paddingBlock={'8px 12px'} paddingInline={8}>
|
|
161
|
+
<Steps
|
|
162
|
+
className={styles.stepsContainer}
|
|
163
|
+
current={null as any}
|
|
164
|
+
direction="vertical"
|
|
165
|
+
items={starItems.map((item) => ({
|
|
166
|
+
description: <div className={styles.stepContent}>{item.content}</div>,
|
|
167
|
+
icon: (
|
|
168
|
+
<Avatar
|
|
169
|
+
avatar={item.avatar}
|
|
170
|
+
shadow
|
|
171
|
+
shape={'square'}
|
|
172
|
+
size={20}
|
|
173
|
+
style={{
|
|
174
|
+
border: `1px solid ${cssVar.colorBorderSecondary}`,
|
|
175
|
+
fontSize: 11,
|
|
176
|
+
}}
|
|
177
|
+
/>
|
|
178
|
+
),
|
|
179
|
+
title: (
|
|
180
|
+
<Text as={'span'} fontSize={12} type={'secondary'} weight={500}>
|
|
181
|
+
{item.title}
|
|
182
|
+
</Text>
|
|
183
|
+
),
|
|
184
|
+
}))}
|
|
185
|
+
size="small"
|
|
186
|
+
/>
|
|
187
|
+
</Flexbox>
|
|
188
|
+
</AccordionItem>
|
|
189
|
+
</Accordion>
|
|
190
|
+
|
|
191
|
+
{/* Key Learning */}
|
|
192
|
+
{keyLearning && (
|
|
193
|
+
<Flexbox
|
|
194
|
+
className={styles.section}
|
|
195
|
+
gap={8}
|
|
196
|
+
style={{ paddingBlock: 16, paddingInline: 12 }}
|
|
197
|
+
>
|
|
198
|
+
<Text fontSize={12} weight={500}>
|
|
199
|
+
<span className={highlightTextStyles.gold}>Key Learning</span>
|
|
200
|
+
</Text>
|
|
201
|
+
<div className={styles.keyLearning}>{keyLearning}</div>
|
|
202
|
+
</Flexbox>
|
|
203
|
+
)}
|
|
204
|
+
</>
|
|
205
|
+
) : (
|
|
206
|
+
/* When no STAR content: show summary and details */
|
|
207
|
+
<Flexbox className={styles.content} gap={8}>
|
|
208
|
+
{!summary && loading ? (
|
|
209
|
+
<BubblesLoading />
|
|
210
|
+
) : (
|
|
211
|
+
<>
|
|
212
|
+
{summary && <div className={styles.summary}>{summary}</div>}
|
|
213
|
+
{details && <StreamingMarkdown>{details}</StreamingMarkdown>}
|
|
214
|
+
{tags && tags.length > 0 && (
|
|
215
|
+
<Flexbox className={styles.tags} gap={8} horizontal wrap={'wrap'}>
|
|
216
|
+
{tags.map((tag, index) => (
|
|
217
|
+
<Tag key={index}>{tag}</Tag>
|
|
218
|
+
))}
|
|
219
|
+
</Flexbox>
|
|
220
|
+
)}
|
|
221
|
+
</>
|
|
222
|
+
)}
|
|
223
|
+
</Flexbox>
|
|
224
|
+
)}
|
|
225
|
+
</Flexbox>
|
|
226
|
+
);
|
|
227
|
+
});
|
|
228
|
+
|
|
229
|
+
ExperienceMemoryCard.displayName = 'ExperienceMemoryCard';
|
|
230
|
+
|
|
231
|
+
export default ExperienceMemoryCard;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { ExperienceMemoryCard, type ExperienceMemoryCardProps } from './ExperienceMemoryCard';
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
// Inspector components (customized tool call headers)
|
|
2
|
+
export { MemoryInspectors } from './Inspector';
|
|
3
|
+
export {
|
|
4
|
+
AddContextMemoryInspector,
|
|
5
|
+
AddExperienceMemoryInspector,
|
|
6
|
+
AddIdentityMemoryInspector,
|
|
7
|
+
AddPreferenceMemoryInspector,
|
|
8
|
+
RemoveIdentityMemoryInspector,
|
|
9
|
+
SearchUserMemoryInspector,
|
|
10
|
+
UpdateIdentityMemoryInspector,
|
|
11
|
+
} from './Inspector';
|
|
12
|
+
|
|
13
|
+
// Intervention components (human approval UI before tool execution)
|
|
14
|
+
export { MemoryInterventions } from './Intervention';
|
|
15
|
+
|
|
16
|
+
// Render components (final result display after tool execution)
|
|
17
|
+
export { MemoryRenders } from './Render';
|
|
18
|
+
|
|
19
|
+
// Streaming components (real-time feedback during tool execution)
|
|
20
|
+
export { AddExperienceMemoryStreaming, MemoryStreamings } from './Streaming';
|
|
21
|
+
|
|
22
|
+
// Shared components
|
|
23
|
+
export { ExperienceMemoryCard, type ExperienceMemoryCardProps } from './components';
|
|
24
|
+
|
|
25
|
+
// Re-export types and manifest for convenience
|
|
26
|
+
export { MemoryManifest } from '../manifest';
|
|
27
|
+
export * from '../types';
|
|
@@ -41,6 +41,7 @@ class MemoryExecutor extends BaseExecutor<typeof MemoryApiName> {
|
|
|
41
41
|
} catch (error) {
|
|
42
42
|
const err = error as Error;
|
|
43
43
|
return {
|
|
44
|
+
content: `searchUserMemory with error detail: ${err.message}`,
|
|
44
45
|
error: {
|
|
45
46
|
body: error,
|
|
46
47
|
message: err.message,
|
|
@@ -80,6 +81,7 @@ class MemoryExecutor extends BaseExecutor<typeof MemoryApiName> {
|
|
|
80
81
|
} catch (error) {
|
|
81
82
|
const err = error as Error;
|
|
82
83
|
return {
|
|
84
|
+
content: `addContextMemory with error detail: ${err.message}`,
|
|
83
85
|
error: {
|
|
84
86
|
body: error,
|
|
85
87
|
message: err.message,
|
|
@@ -110,13 +112,15 @@ class MemoryExecutor extends BaseExecutor<typeof MemoryApiName> {
|
|
|
110
112
|
}
|
|
111
113
|
|
|
112
114
|
return {
|
|
113
|
-
content:
|
|
115
|
+
content: `Experience memory "${params.title}" saved with memoryId: "${result.memoryId}" and experienceId: "${result.experienceId}"`,
|
|
114
116
|
state: { experienceId: result.experienceId, memoryId: result.memoryId },
|
|
115
117
|
success: true,
|
|
116
118
|
};
|
|
117
119
|
} catch (error) {
|
|
118
120
|
const err = error as Error;
|
|
121
|
+
|
|
119
122
|
return {
|
|
123
|
+
content: `addExperienceMemory with error detail: ${err.message}`,
|
|
120
124
|
error: {
|
|
121
125
|
body: error,
|
|
122
126
|
message: err.message,
|
|
@@ -154,6 +158,7 @@ class MemoryExecutor extends BaseExecutor<typeof MemoryApiName> {
|
|
|
154
158
|
} catch (error) {
|
|
155
159
|
const err = error as Error;
|
|
156
160
|
return {
|
|
161
|
+
content: `addIdentityMemory with error detail: ${err.message}`,
|
|
157
162
|
error: {
|
|
158
163
|
body: error,
|
|
159
164
|
message: err.message,
|
|
@@ -191,6 +196,7 @@ class MemoryExecutor extends BaseExecutor<typeof MemoryApiName> {
|
|
|
191
196
|
} catch (error) {
|
|
192
197
|
const err = error as Error;
|
|
193
198
|
return {
|
|
199
|
+
content: `addPreferenceMemory with error detail: ${err.message}`,
|
|
194
200
|
error: {
|
|
195
201
|
body: error,
|
|
196
202
|
message: err.message,
|
|
@@ -230,6 +236,7 @@ class MemoryExecutor extends BaseExecutor<typeof MemoryApiName> {
|
|
|
230
236
|
} catch (error) {
|
|
231
237
|
const err = error as Error;
|
|
232
238
|
return {
|
|
239
|
+
content: `updateIdentityMemory with error detail: ${err.message}`,
|
|
233
240
|
error: {
|
|
234
241
|
body: error,
|
|
235
242
|
message: err.message,
|
|
@@ -264,6 +271,7 @@ class MemoryExecutor extends BaseExecutor<typeof MemoryApiName> {
|
|
|
264
271
|
} catch (error) {
|
|
265
272
|
const err = error as Error;
|
|
266
273
|
return {
|
|
274
|
+
content: `removeIdentityMemory with error detail: ${err.message}`,
|
|
267
275
|
error: {
|
|
268
276
|
body: error,
|
|
269
277
|
message: err.message,
|
|
@@ -1,3 +1,14 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
AddIdentityActionSchema,
|
|
3
|
+
ContextMemoryItemSchema,
|
|
4
|
+
ExperienceMemoryItemSchema,
|
|
5
|
+
PreferenceMemoryItemSchema,
|
|
6
|
+
RemoveIdentityActionSchema,
|
|
7
|
+
UpdateIdentityActionSchema,
|
|
8
|
+
} from '@lobechat/memory-user-memory/schemas';
|
|
9
|
+
import type { SearchMemoryResult } from '@lobechat/types';
|
|
10
|
+
import type { z } from 'zod';
|
|
11
|
+
|
|
1
12
|
export const MemoryApiName = {
|
|
2
13
|
addContextMemory: 'addContextMemory',
|
|
3
14
|
addExperienceMemory: 'addExperienceMemory',
|
|
@@ -12,3 +23,53 @@ export type MemoryApiNameType = (typeof MemoryApiName)[keyof typeof MemoryApiNam
|
|
|
12
23
|
|
|
13
24
|
/** @deprecated Use MemoryApiName instead */
|
|
14
25
|
export const UserMemoryApiName = MemoryApiName;
|
|
26
|
+
|
|
27
|
+
// ==================== Inspector Types ====================
|
|
28
|
+
|
|
29
|
+
// Search
|
|
30
|
+
|
|
31
|
+
// SearchUserMemoryState is the same as SearchMemoryResult (executor returns result directly as state)
|
|
32
|
+
export type SearchUserMemoryState = SearchMemoryResult;
|
|
33
|
+
|
|
34
|
+
// Add Context
|
|
35
|
+
export type AddContextMemoryParams = z.infer<typeof ContextMemoryItemSchema>;
|
|
36
|
+
export interface AddContextMemoryState {
|
|
37
|
+
contextId?: string;
|
|
38
|
+
memoryId?: string;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
// Add Experience
|
|
42
|
+
export type AddExperienceMemoryParams = z.infer<typeof ExperienceMemoryItemSchema>;
|
|
43
|
+
export interface AddExperienceMemoryState {
|
|
44
|
+
experienceId?: string;
|
|
45
|
+
memoryId?: string;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
// Add Identity
|
|
49
|
+
export type AddIdentityMemoryParams = z.infer<typeof AddIdentityActionSchema>;
|
|
50
|
+
export interface AddIdentityMemoryState {
|
|
51
|
+
identityId?: string;
|
|
52
|
+
memoryId?: string;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
// Add Preference
|
|
56
|
+
export type AddPreferenceMemoryParams = z.infer<typeof PreferenceMemoryItemSchema>;
|
|
57
|
+
export interface AddPreferenceMemoryState {
|
|
58
|
+
memoryId?: string;
|
|
59
|
+
preferenceId?: string;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
// Update Identity
|
|
63
|
+
export type UpdateIdentityMemoryParams = z.infer<typeof UpdateIdentityActionSchema>;
|
|
64
|
+
export interface UpdateIdentityMemoryState {
|
|
65
|
+
identityId?: string;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
// Remove Identity
|
|
69
|
+
export type RemoveIdentityMemoryParams = z.infer<typeof RemoveIdentityActionSchema>;
|
|
70
|
+
export interface RemoveIdentityMemoryState {
|
|
71
|
+
identityId?: string;
|
|
72
|
+
reason?: string;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
export {type SearchMemoryParams, type SearchMemoryResult} from '@lobechat/types';
|
|
@@ -5,12 +5,15 @@ import type { PipelineContext, ProcessorOptions } from '../types';
|
|
|
5
5
|
|
|
6
6
|
const log = debug('context-engine:provider:GTDTodoInjector');
|
|
7
7
|
|
|
8
|
+
/** Status of a todo item */
|
|
9
|
+
export type GTDTodoStatus = 'todo' | 'processing' | 'completed';
|
|
10
|
+
|
|
8
11
|
/**
|
|
9
12
|
* GTD Todo item structure
|
|
10
13
|
*/
|
|
11
14
|
export interface GTDTodoItem {
|
|
12
|
-
/**
|
|
13
|
-
|
|
15
|
+
/** Status of the todo item */
|
|
16
|
+
status: GTDTodoStatus;
|
|
14
17
|
/** The todo item text */
|
|
15
18
|
text: string;
|
|
16
19
|
}
|
|
@@ -43,13 +46,15 @@ function formatGTDTodos(todos: GTDTodoList): string | null {
|
|
|
43
46
|
const lines: string[] = ['<gtd_todos>'];
|
|
44
47
|
|
|
45
48
|
items.forEach((item, index) => {
|
|
46
|
-
|
|
47
|
-
lines.push(`<todo index="${index}" status="${status}">${item.text}</todo>`);
|
|
49
|
+
lines.push(`<todo index="${index}" status="${item.status}">${item.text}</todo>`);
|
|
48
50
|
});
|
|
49
51
|
|
|
50
|
-
const completedCount = items.filter((item) => item.completed).length;
|
|
52
|
+
const completedCount = items.filter((item) => item.status === 'completed').length;
|
|
53
|
+
const processingCount = items.filter((item) => item.status === 'processing').length;
|
|
51
54
|
const totalCount = items.length;
|
|
52
|
-
lines.push(
|
|
55
|
+
lines.push(
|
|
56
|
+
`<progress completed="${completedCount}" processing="${processingCount}" total="${totalCount}" />`,
|
|
57
|
+
);
|
|
53
58
|
|
|
54
59
|
lines.push('</gtd_todos>');
|
|
55
60
|
|
|
@@ -117,7 +122,10 @@ export class GTDTodoInjector extends BaseLastUserContentProvider {
|
|
|
117
122
|
clonedContext.metadata.gtdTodoInjected = true;
|
|
118
123
|
clonedContext.metadata.gtdTodoCount = this.config.todos.items.length;
|
|
119
124
|
clonedContext.metadata.gtdTodoCompletedCount = this.config.todos.items.filter(
|
|
120
|
-
(item) => item.completed,
|
|
125
|
+
(item) => item.status === 'completed',
|
|
126
|
+
).length;
|
|
127
|
+
clonedContext.metadata.gtdTodoProcessingCount = this.config.todos.items.filter(
|
|
128
|
+
(item) => item.status === 'processing',
|
|
121
129
|
).length;
|
|
122
130
|
|
|
123
131
|
log('GTD Todo context appended to last user message');
|
|
@@ -644,6 +644,7 @@ export class FlatListBuilder {
|
|
|
644
644
|
id: toolMsg.id,
|
|
645
645
|
};
|
|
646
646
|
if (toolMsg.error) result.error = toolMsg.error;
|
|
647
|
+
if (toolMsg.pluginError) result.error = toolMsg.pluginError;
|
|
647
648
|
if (toolMsg.pluginState) result.state = toolMsg.pluginState;
|
|
648
649
|
|
|
649
650
|
const toolWithResult: ChatToolPayloadWithResult = {
|
|
@@ -4,6 +4,7 @@ import { afterEach, beforeEach, describe, expect, it } from 'vitest';
|
|
|
4
4
|
|
|
5
5
|
import { sleep } from '@/utils/sleep';
|
|
6
6
|
|
|
7
|
+
import { getTestDB } from '../../core/getTestDB';
|
|
7
8
|
import {
|
|
8
9
|
NewKnowledgeBase,
|
|
9
10
|
documents,
|
|
@@ -15,7 +16,6 @@ import {
|
|
|
15
16
|
} from '../../schemas';
|
|
16
17
|
import { LobeChatDatabase } from '../../type';
|
|
17
18
|
import { KnowledgeBaseModel } from '../knowledgeBase';
|
|
18
|
-
import { getTestDB } from '../../core/getTestDB';
|
|
19
19
|
|
|
20
20
|
const serverDB: LobeChatDatabase = await getTestDB();
|
|
21
21
|
|
|
@@ -556,10 +556,7 @@ export class KnowledgeRepo {
|
|
|
556
556
|
// When in a knowledge base, return standalone documents (folders and notes without fileId)
|
|
557
557
|
// that have the knowledgeBaseId column set. Documents with fileId are already
|
|
558
558
|
// returned by the file query via their linked file records.
|
|
559
|
-
kbWhereConditions.push(
|
|
560
|
-
sql`d.file_id IS NULL`,
|
|
561
|
-
sql`d.knowledge_base_id = ${knowledgeBaseId}`,
|
|
562
|
-
);
|
|
559
|
+
kbWhereConditions.push(sql`d.file_id IS NULL`, sql`d.knowledge_base_id = ${knowledgeBaseId}`);
|
|
563
560
|
|
|
564
561
|
return sql`
|
|
565
562
|
SELECT
|
|
@@ -15,12 +15,12 @@ describe('formatTodoStateSummary', () => {
|
|
|
15
15
|
|
|
16
16
|
it('should format todo list with only pending items', () => {
|
|
17
17
|
const todos = [
|
|
18
|
-
{ text: 'Task A',
|
|
19
|
-
{ text: 'Task B',
|
|
20
|
-
{ text: 'Task C',
|
|
18
|
+
{ text: 'Task A', status: 'todo' as const },
|
|
19
|
+
{ text: 'Task B', status: 'todo' as const },
|
|
20
|
+
{ text: 'Task C', status: 'todo' as const },
|
|
21
21
|
];
|
|
22
22
|
expect(formatTodoStateSummary(todos)).toMatchInlineSnapshot(`
|
|
23
|
-
"📋 Current Todo List (3
|
|
23
|
+
"📋 Current Todo List (3 todo, 0 processing, 0 completed):
|
|
24
24
|
- [ ] Task A
|
|
25
25
|
- [ ] Task B
|
|
26
26
|
- [ ] Task C"
|
|
@@ -29,11 +29,11 @@ describe('formatTodoStateSummary', () => {
|
|
|
29
29
|
|
|
30
30
|
it('should format todo list with only completed items', () => {
|
|
31
31
|
const todos = [
|
|
32
|
-
{ text: 'Done task 1',
|
|
33
|
-
{ text: 'Done task 2',
|
|
32
|
+
{ text: 'Done task 1', status: 'completed' as const },
|
|
33
|
+
{ text: 'Done task 2', status: 'completed' as const },
|
|
34
34
|
];
|
|
35
35
|
expect(formatTodoStateSummary(todos)).toMatchInlineSnapshot(`
|
|
36
|
-
"📋 Current Todo List (0
|
|
36
|
+
"📋 Current Todo List (0 todo, 0 processing, 2 completed):
|
|
37
37
|
- [x] Done task 1
|
|
38
38
|
- [x] Done task 2"
|
|
39
39
|
`);
|
|
@@ -41,12 +41,12 @@ describe('formatTodoStateSummary', () => {
|
|
|
41
41
|
|
|
42
42
|
it('should format todo list with mixed items', () => {
|
|
43
43
|
const todos = [
|
|
44
|
-
{ text: 'Pending task',
|
|
45
|
-
{ text: 'Completed task',
|
|
46
|
-
{ text: 'Another pending',
|
|
44
|
+
{ text: 'Pending task', status: 'todo' as const },
|
|
45
|
+
{ text: 'Completed task', status: 'completed' as const },
|
|
46
|
+
{ text: 'Another pending', status: 'todo' as const },
|
|
47
47
|
];
|
|
48
48
|
expect(formatTodoStateSummary(todos)).toMatchInlineSnapshot(`
|
|
49
|
-
"📋 Current Todo List (2
|
|
49
|
+
"📋 Current Todo List (2 todo, 0 processing, 1 completed):
|
|
50
50
|
- [ ] Pending task
|
|
51
51
|
- [x] Completed task
|
|
52
52
|
- [ ] Another pending"
|
|
@@ -55,21 +55,37 @@ describe('formatTodoStateSummary', () => {
|
|
|
55
55
|
|
|
56
56
|
it('should format todo list with timestamp', () => {
|
|
57
57
|
const todos = [
|
|
58
|
-
{ text: 'Task 1',
|
|
59
|
-
{ text: 'Task 2',
|
|
58
|
+
{ text: 'Task 1', status: 'todo' as const },
|
|
59
|
+
{ text: 'Task 2', status: 'completed' as const },
|
|
60
60
|
];
|
|
61
61
|
expect(formatTodoStateSummary(todos, '2025-01-15T10:30:00.000Z')).toMatchInlineSnapshot(`
|
|
62
|
-
"📋 Current Todo List (1
|
|
62
|
+
"📋 Current Todo List (1 todo, 0 processing, 1 completed) | Updated: 2025-01-15T10:30:00.000Z:
|
|
63
63
|
- [ ] Task 1
|
|
64
64
|
- [x] Task 2"
|
|
65
65
|
`);
|
|
66
66
|
});
|
|
67
67
|
|
|
68
68
|
it('should handle single item', () => {
|
|
69
|
-
const todos = [{ text: 'Only task',
|
|
69
|
+
const todos = [{ text: 'Only task', status: 'todo' as const }];
|
|
70
70
|
expect(formatTodoStateSummary(todos)).toMatchInlineSnapshot(`
|
|
71
|
-
"📋 Current Todo List (1
|
|
71
|
+
"📋 Current Todo List (1 todo, 0 processing, 0 completed):
|
|
72
72
|
- [ ] Only task"
|
|
73
73
|
`);
|
|
74
74
|
});
|
|
75
|
+
|
|
76
|
+
it('should format todo list with processing items', () => {
|
|
77
|
+
const todos = [
|
|
78
|
+
{ text: 'Todo task', status: 'todo' as const },
|
|
79
|
+
{ text: 'Processing task 1', status: 'processing' as const },
|
|
80
|
+
{ text: 'Processing task 2', status: 'processing' as const },
|
|
81
|
+
{ text: 'Done task', status: 'completed' as const },
|
|
82
|
+
];
|
|
83
|
+
expect(formatTodoStateSummary(todos)).toMatchInlineSnapshot(`
|
|
84
|
+
"📋 Current Todo List (1 todo, 2 processing, 1 completed):
|
|
85
|
+
- [ ] Todo task
|
|
86
|
+
- [~] Processing task 1
|
|
87
|
+
- [~] Processing task 2
|
|
88
|
+
- [x] Done task"
|
|
89
|
+
`);
|
|
90
|
+
});
|
|
75
91
|
});
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
+
export type TodoStatus = 'todo' | 'processing' | 'completed';
|
|
2
|
+
|
|
1
3
|
export interface TodoItem {
|
|
2
|
-
|
|
4
|
+
status: TodoStatus;
|
|
3
5
|
text: string;
|
|
4
6
|
}
|
|
5
7
|
|
|
@@ -17,13 +19,15 @@ export const formatTodoStateSummary = (todos: TodoItem[], updatedAt?: string): s
|
|
|
17
19
|
return `📋 Current Todo List: (empty)${timeInfo}`;
|
|
18
20
|
}
|
|
19
21
|
|
|
20
|
-
const completed = todos.filter((t) => t.completed).length;
|
|
21
|
-
const
|
|
22
|
+
const completed = todos.filter((t) => t.status === 'completed').length;
|
|
23
|
+
const processing = todos.filter((t) => t.status === 'processing').length;
|
|
24
|
+
const pending = todos.length - completed - processing;
|
|
22
25
|
|
|
23
26
|
const lines = todos.map((item) => {
|
|
24
|
-
const checkbox =
|
|
27
|
+
const checkbox =
|
|
28
|
+
item.status === 'completed' ? '- [x]' : item.status === 'processing' ? '- [~]' : '- [ ]';
|
|
25
29
|
return `${checkbox} ${item.text}`;
|
|
26
30
|
});
|
|
27
31
|
|
|
28
|
-
return `📋 Current Todo List (${pending}
|
|
32
|
+
return `📋 Current Todo List (${pending} todo, ${processing} processing, ${completed} completed)${timeInfo}:\n${lines.join('\n')}`;
|
|
29
33
|
};
|
|
@@ -18,7 +18,7 @@ export enum AssistantCategory {
|
|
|
18
18
|
Marketing = 'marketing',
|
|
19
19
|
Office = 'office',
|
|
20
20
|
Programming = 'programming',
|
|
21
|
-
Translation = 'translation'
|
|
21
|
+
Translation = 'translation',
|
|
22
22
|
}
|
|
23
23
|
|
|
24
24
|
export enum AssistantSorts {
|
|
@@ -29,7 +29,7 @@ export enum AssistantSorts {
|
|
|
29
29
|
PluginCount = 'pluginCount',
|
|
30
30
|
Recommended = 'recommended',
|
|
31
31
|
Title = 'title',
|
|
32
|
-
TokenUsage = 'tokenUsage'
|
|
32
|
+
TokenUsage = 'tokenUsage',
|
|
33
33
|
}
|
|
34
34
|
|
|
35
35
|
export enum AssistantNavKey {
|
|
@@ -10,12 +10,15 @@
|
|
|
10
10
|
* 3. Replaces the deprecated pluginState passing pattern
|
|
11
11
|
*/
|
|
12
12
|
|
|
13
|
+
/** Status of a todo item */
|
|
14
|
+
export type StepContextTodoStatus = 'todo' | 'processing' | 'completed';
|
|
15
|
+
|
|
13
16
|
/**
|
|
14
17
|
* Todo item structure
|
|
15
18
|
* Duplicated here to avoid circular dependency with builtin-tool-gtd
|
|
16
19
|
*/
|
|
17
20
|
export interface StepContextTodoItem {
|
|
18
|
-
|
|
21
|
+
status: StepContextTodoStatus;
|
|
19
22
|
text: string;
|
|
20
23
|
}
|
|
21
24
|
|