@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
|
@@ -7,14 +7,12 @@ import { useNotebookStore } from '@/store/notebook';
|
|
|
7
7
|
import { GTDIdentifier } from '../manifest';
|
|
8
8
|
import {
|
|
9
9
|
type ClearTodosParams,
|
|
10
|
-
type CompleteTodosParams,
|
|
11
10
|
type CreatePlanParams,
|
|
12
11
|
type CreateTodosParams,
|
|
13
12
|
type ExecTaskParams,
|
|
14
13
|
type ExecTasksParams,
|
|
15
14
|
GTDApiName,
|
|
16
15
|
type Plan,
|
|
17
|
-
type RemoveTodosParams,
|
|
18
16
|
type TodoItem,
|
|
19
17
|
type TodoState,
|
|
20
18
|
type UpdatePlanParams,
|
|
@@ -49,12 +47,10 @@ const syncTodosToPlan = async (topicId: string, todos: TodoState): Promise<void>
|
|
|
49
47
|
// API enum for MVP (Todo + Plan)
|
|
50
48
|
const GTDApiNameEnum = {
|
|
51
49
|
clearTodos: GTDApiName.clearTodos,
|
|
52
|
-
completeTodos: GTDApiName.completeTodos,
|
|
53
50
|
createPlan: GTDApiName.createPlan,
|
|
54
51
|
createTodos: GTDApiName.createTodos,
|
|
55
52
|
execTask: GTDApiName.execTask,
|
|
56
53
|
execTasks: GTDApiName.execTasks,
|
|
57
|
-
removeTodos: GTDApiName.removeTodos,
|
|
58
54
|
updatePlan: GTDApiName.updatePlan,
|
|
59
55
|
updateTodos: GTDApiName.updateTodos,
|
|
60
56
|
} as const;
|
|
@@ -82,7 +78,7 @@ class GTDExecutor extends BaseExecutor<typeof GTDApiNameEnum> {
|
|
|
82
78
|
const itemsToAdd: TodoItem[] = params.items
|
|
83
79
|
? params.items
|
|
84
80
|
: params.adds
|
|
85
|
-
? params.adds.map((text) => ({
|
|
81
|
+
? params.adds.map((text) => ({ status: 'todo' as const, text }))
|
|
86
82
|
: [];
|
|
87
83
|
|
|
88
84
|
if (itemsToAdd.length === 0) {
|
|
@@ -144,7 +140,7 @@ class GTDExecutor extends BaseExecutor<typeof GTDApiNameEnum> {
|
|
|
144
140
|
switch (op.type) {
|
|
145
141
|
case 'add': {
|
|
146
142
|
if (op.text) {
|
|
147
|
-
updatedTodos.push({
|
|
143
|
+
updatedTodos.push({ status: 'todo', text: op.text });
|
|
148
144
|
results.push(`Added: "${op.text}"`);
|
|
149
145
|
}
|
|
150
146
|
break;
|
|
@@ -156,8 +152,9 @@ class GTDExecutor extends BaseExecutor<typeof GTDApiNameEnum> {
|
|
|
156
152
|
if (op.newText !== undefined) {
|
|
157
153
|
updatedItem.text = op.newText;
|
|
158
154
|
}
|
|
159
|
-
|
|
160
|
-
|
|
155
|
+
// Handle status field
|
|
156
|
+
if (op.status !== undefined) {
|
|
157
|
+
updatedItem.status = op.status;
|
|
161
158
|
}
|
|
162
159
|
updatedTodos[op.index] = updatedItem;
|
|
163
160
|
results.push(`Updated item ${op.index + 1}`);
|
|
@@ -174,11 +171,19 @@ class GTDExecutor extends BaseExecutor<typeof GTDApiNameEnum> {
|
|
|
174
171
|
case 'complete': {
|
|
175
172
|
if (op.index !== undefined && op.index >= 0 && op.index < updatedTodos.length) {
|
|
176
173
|
// Create a new object to avoid mutating frozen/immutable objects from store
|
|
177
|
-
updatedTodos[op.index] = { ...updatedTodos[op.index],
|
|
174
|
+
updatedTodos[op.index] = { ...updatedTodos[op.index], status: 'completed' };
|
|
178
175
|
results.push(`Completed: "${updatedTodos[op.index].text}"`);
|
|
179
176
|
}
|
|
180
177
|
break;
|
|
181
178
|
}
|
|
179
|
+
case 'processing': {
|
|
180
|
+
if (op.index !== undefined && op.index >= 0 && op.index < updatedTodos.length) {
|
|
181
|
+
// Create a new object to avoid mutating frozen/immutable objects from store
|
|
182
|
+
updatedTodos[op.index] = { ...updatedTodos[op.index], status: 'processing' };
|
|
183
|
+
results.push(`In progress: "${updatedTodos[op.index].text}"`);
|
|
184
|
+
}
|
|
185
|
+
break;
|
|
186
|
+
}
|
|
182
187
|
}
|
|
183
188
|
}
|
|
184
189
|
|
|
@@ -206,154 +211,6 @@ class GTDExecutor extends BaseExecutor<typeof GTDApiNameEnum> {
|
|
|
206
211
|
};
|
|
207
212
|
};
|
|
208
213
|
|
|
209
|
-
/**
|
|
210
|
-
* Mark todo items as done by their indices
|
|
211
|
-
*/
|
|
212
|
-
completeTodos = async (
|
|
213
|
-
params: CompleteTodosParams,
|
|
214
|
-
ctx: BuiltinToolContext,
|
|
215
|
-
): Promise<BuiltinToolResult> => {
|
|
216
|
-
const { indices } = params;
|
|
217
|
-
|
|
218
|
-
if (!indices || indices.length === 0) {
|
|
219
|
-
return {
|
|
220
|
-
content: 'No indices provided to complete.',
|
|
221
|
-
success: false,
|
|
222
|
-
};
|
|
223
|
-
}
|
|
224
|
-
|
|
225
|
-
const existingTodos = getTodosFromContext(ctx);
|
|
226
|
-
|
|
227
|
-
if (existingTodos.length === 0) {
|
|
228
|
-
const now = new Date().toISOString();
|
|
229
|
-
return {
|
|
230
|
-
content: 'No todos to complete. The list is empty.\n\n' + formatTodoStateSummary([], now),
|
|
231
|
-
state: {
|
|
232
|
-
completedIndices: [],
|
|
233
|
-
todos: { items: [], updatedAt: now },
|
|
234
|
-
},
|
|
235
|
-
success: true,
|
|
236
|
-
};
|
|
237
|
-
}
|
|
238
|
-
|
|
239
|
-
// Validate indices
|
|
240
|
-
const validIndices = indices.filter((i: number) => i >= 0 && i < existingTodos.length);
|
|
241
|
-
const invalidIndices = indices.filter((i: number) => i < 0 || i >= existingTodos.length);
|
|
242
|
-
|
|
243
|
-
if (validIndices.length === 0) {
|
|
244
|
-
return {
|
|
245
|
-
content: `Invalid indices: ${indices.join(', ')}. Valid range is 0-${existingTodos.length - 1}.`,
|
|
246
|
-
success: false,
|
|
247
|
-
};
|
|
248
|
-
}
|
|
249
|
-
|
|
250
|
-
// Mark items as completed
|
|
251
|
-
const updatedTodos = existingTodos.map((todo, index) => {
|
|
252
|
-
if (validIndices.includes(index)) {
|
|
253
|
-
return { ...todo, completed: true };
|
|
254
|
-
}
|
|
255
|
-
return todo;
|
|
256
|
-
});
|
|
257
|
-
|
|
258
|
-
const completedItems = validIndices.map((i: number) => existingTodos[i].text);
|
|
259
|
-
const now = new Date().toISOString();
|
|
260
|
-
|
|
261
|
-
// Format response: action summary + todo state
|
|
262
|
-
let actionSummary = `✔️ Completed ${validIndices.length} item${validIndices.length > 1 ? 's' : ''}:\n`;
|
|
263
|
-
actionSummary += completedItems.map((text: string) => `- ${text}`).join('\n');
|
|
264
|
-
|
|
265
|
-
if (invalidIndices.length > 0) {
|
|
266
|
-
actionSummary += `\n\nNote: Ignored invalid indices: ${invalidIndices.join(', ')}`;
|
|
267
|
-
}
|
|
268
|
-
|
|
269
|
-
const todoState = { items: updatedTodos, updatedAt: now };
|
|
270
|
-
|
|
271
|
-
// Sync todos to Plan document if topic exists
|
|
272
|
-
if (ctx.topicId) {
|
|
273
|
-
await syncTodosToPlan(ctx.topicId, todoState);
|
|
274
|
-
}
|
|
275
|
-
|
|
276
|
-
return {
|
|
277
|
-
content: actionSummary + '\n\n' + formatTodoStateSummary(updatedTodos, now),
|
|
278
|
-
state: {
|
|
279
|
-
completedIndices: validIndices,
|
|
280
|
-
todos: todoState,
|
|
281
|
-
},
|
|
282
|
-
success: true,
|
|
283
|
-
};
|
|
284
|
-
};
|
|
285
|
-
|
|
286
|
-
/**
|
|
287
|
-
* Remove todo items by indices
|
|
288
|
-
*/
|
|
289
|
-
removeTodos = async (
|
|
290
|
-
params: RemoveTodosParams,
|
|
291
|
-
ctx: BuiltinToolContext,
|
|
292
|
-
): Promise<BuiltinToolResult> => {
|
|
293
|
-
const { indices } = params;
|
|
294
|
-
|
|
295
|
-
if (!indices || indices.length === 0) {
|
|
296
|
-
return {
|
|
297
|
-
content: 'No indices provided to remove.',
|
|
298
|
-
success: false,
|
|
299
|
-
};
|
|
300
|
-
}
|
|
301
|
-
|
|
302
|
-
const existingTodos = getTodosFromContext(ctx);
|
|
303
|
-
|
|
304
|
-
if (existingTodos.length === 0) {
|
|
305
|
-
const now = new Date().toISOString();
|
|
306
|
-
return {
|
|
307
|
-
content: 'No todos to remove. The list is empty.\n\n' + formatTodoStateSummary([], now),
|
|
308
|
-
state: {
|
|
309
|
-
removedIndices: [],
|
|
310
|
-
todos: { items: [], updatedAt: now },
|
|
311
|
-
},
|
|
312
|
-
success: true,
|
|
313
|
-
};
|
|
314
|
-
}
|
|
315
|
-
|
|
316
|
-
// Validate indices
|
|
317
|
-
const validIndices = indices.filter((i: number) => i >= 0 && i < existingTodos.length);
|
|
318
|
-
const invalidIndices = indices.filter((i: number) => i < 0 || i >= existingTodos.length);
|
|
319
|
-
|
|
320
|
-
if (validIndices.length === 0) {
|
|
321
|
-
return {
|
|
322
|
-
content: `Invalid indices: ${indices.join(', ')}. Valid range is 0-${existingTodos.length - 1}.`,
|
|
323
|
-
success: false,
|
|
324
|
-
};
|
|
325
|
-
}
|
|
326
|
-
|
|
327
|
-
// Remove items
|
|
328
|
-
const removedItems = validIndices.map((i: number) => existingTodos[i].text);
|
|
329
|
-
const updatedTodos = existingTodos.filter((_, index) => !validIndices.includes(index));
|
|
330
|
-
const now = new Date().toISOString();
|
|
331
|
-
|
|
332
|
-
// Format response: action summary + todo state
|
|
333
|
-
let actionSummary = `🗑️ Removed ${validIndices.length} item${validIndices.length > 1 ? 's' : ''}:\n`;
|
|
334
|
-
actionSummary += removedItems.map((text: string) => `- ${text}`).join('\n');
|
|
335
|
-
|
|
336
|
-
if (invalidIndices.length > 0) {
|
|
337
|
-
actionSummary += `\n\nNote: Ignored invalid indices: ${invalidIndices.join(', ')}`;
|
|
338
|
-
}
|
|
339
|
-
|
|
340
|
-
const todoState = { items: updatedTodos, updatedAt: now };
|
|
341
|
-
|
|
342
|
-
// Sync todos to Plan document if topic exists
|
|
343
|
-
if (ctx.topicId) {
|
|
344
|
-
await syncTodosToPlan(ctx.topicId, todoState);
|
|
345
|
-
}
|
|
346
|
-
|
|
347
|
-
return {
|
|
348
|
-
content: actionSummary + '\n\n' + formatTodoStateSummary(updatedTodos, now),
|
|
349
|
-
state: {
|
|
350
|
-
removedIndices: validIndices,
|
|
351
|
-
todos: todoState,
|
|
352
|
-
},
|
|
353
|
-
success: true,
|
|
354
|
-
};
|
|
355
|
-
};
|
|
356
|
-
|
|
357
214
|
/**
|
|
358
215
|
* Clear todo items
|
|
359
216
|
*/
|
|
@@ -388,7 +245,7 @@ class GTDExecutor extends BaseExecutor<typeof GTDApiNameEnum> {
|
|
|
388
245
|
actionSummary = `🧹 Cleared all ${clearedCount} item${clearedCount > 1 ? 's' : ''} from todo list.`;
|
|
389
246
|
} else {
|
|
390
247
|
// mode === 'completed'
|
|
391
|
-
updatedTodos = existingTodos.filter((todo) =>
|
|
248
|
+
updatedTodos = existingTodos.filter((todo) => todo.status !== 'completed');
|
|
392
249
|
clearedCount = existingTodos.length - updatedTodos.length;
|
|
393
250
|
|
|
394
251
|
if (clearedCount === 0) {
|
|
@@ -84,22 +84,23 @@ export const GTDManifest: BuiltinToolManifest = {
|
|
|
84
84
|
{
|
|
85
85
|
description: `Update todo items with batch operations. Each operation type requires specific fields:
|
|
86
86
|
- "add": requires "text" (the todo text to add)
|
|
87
|
-
- "update": requires "index", optional "newText" and/or "
|
|
87
|
+
- "update": requires "index", optional "newText" and/or "status"
|
|
88
88
|
- "remove": requires "index" only
|
|
89
|
-
- "complete": requires "index" only (marks item as completed)
|
|
89
|
+
- "complete": requires "index" only (marks item as completed)
|
|
90
|
+
- "processing": requires "index" only (marks item as in progress)`,
|
|
90
91
|
name: GTDApiName.updateTodos,
|
|
91
92
|
renderDisplayControl: 'expand',
|
|
92
93
|
parameters: {
|
|
93
94
|
properties: {
|
|
94
95
|
operations: {
|
|
95
96
|
description:
|
|
96
|
-
'Array of update operations. IMPORTANT: For "complete" and "remove" operations, only pass "type" and "index" - no other fields needed.',
|
|
97
|
+
'Array of update operations. IMPORTANT: For "complete", "processing" and "remove" operations, only pass "type" and "index" - no other fields needed.',
|
|
97
98
|
items: {
|
|
98
99
|
properties: {
|
|
99
100
|
type: {
|
|
100
101
|
description:
|
|
101
|
-
'Operation type. "add" needs text, "update" needs index + optional newText/
|
|
102
|
-
enum: ['add', 'update', 'remove', 'complete'],
|
|
102
|
+
'Operation type. "add" needs text, "update" needs index + optional newText/status, "remove", "complete" and "processing" need index only.',
|
|
103
|
+
enum: ['add', 'update', 'remove', 'complete', 'processing'],
|
|
103
104
|
type: 'string',
|
|
104
105
|
},
|
|
105
106
|
text: {
|
|
@@ -108,16 +109,18 @@ export const GTDManifest: BuiltinToolManifest = {
|
|
|
108
109
|
},
|
|
109
110
|
index: {
|
|
110
111
|
description:
|
|
111
|
-
'Required for "update", "remove", "complete": the item index (0-based).',
|
|
112
|
+
'Required for "update", "remove", "complete", "processing": the item index (0-based).',
|
|
112
113
|
type: 'number',
|
|
113
114
|
},
|
|
114
115
|
newText: {
|
|
115
116
|
description: 'Optional for "update" only: the new text.',
|
|
116
117
|
type: 'string',
|
|
117
118
|
},
|
|
118
|
-
|
|
119
|
-
description:
|
|
120
|
-
|
|
119
|
+
status: {
|
|
120
|
+
description:
|
|
121
|
+
'Optional for "update" only: set status (todo, processing, completed).',
|
|
122
|
+
enum: ['todo', 'processing', 'completed'],
|
|
123
|
+
type: 'string',
|
|
121
124
|
},
|
|
122
125
|
},
|
|
123
126
|
required: ['type'],
|
|
@@ -130,39 +133,6 @@ export const GTDManifest: BuiltinToolManifest = {
|
|
|
130
133
|
type: 'object',
|
|
131
134
|
},
|
|
132
135
|
},
|
|
133
|
-
{
|
|
134
|
-
description: 'Mark todo items as completed by their indices (0-based).',
|
|
135
|
-
name: GTDApiName.completeTodos,
|
|
136
|
-
renderDisplayControl: 'expand',
|
|
137
|
-
parameters: {
|
|
138
|
-
properties: {
|
|
139
|
-
indices: {
|
|
140
|
-
description: 'Array of item indices (0-based) to mark as completed.',
|
|
141
|
-
items: { type: 'number' },
|
|
142
|
-
type: 'array',
|
|
143
|
-
},
|
|
144
|
-
},
|
|
145
|
-
required: ['indices'],
|
|
146
|
-
type: 'object',
|
|
147
|
-
},
|
|
148
|
-
},
|
|
149
|
-
{
|
|
150
|
-
description: 'Remove todo items by their indices (0-based).',
|
|
151
|
-
name: GTDApiName.removeTodos,
|
|
152
|
-
humanIntervention: 'always',
|
|
153
|
-
renderDisplayControl: 'expand',
|
|
154
|
-
parameters: {
|
|
155
|
-
properties: {
|
|
156
|
-
indices: {
|
|
157
|
-
description: 'Array of item indices (0-based) to remove.',
|
|
158
|
-
items: { type: 'number' },
|
|
159
|
-
type: 'array',
|
|
160
|
-
},
|
|
161
|
-
},
|
|
162
|
-
required: ['indices'],
|
|
163
|
-
type: 'object',
|
|
164
|
-
},
|
|
165
|
-
},
|
|
166
136
|
{
|
|
167
137
|
description: 'Clear todo items. Can clear only completed items or all items.',
|
|
168
138
|
name: GTDApiName.clearTodos,
|
|
@@ -11,11 +11,11 @@ export const systemPrompt = `You have GTD (Getting Things Done) tools to help ma
|
|
|
11
11
|
|
|
12
12
|
**Todo Tools** - For actionable execution items:
|
|
13
13
|
- \`createTodos\`: Create new todo items from text array
|
|
14
|
-
- \`updateTodos\`: Batch update todos (add, update, remove, complete operations)
|
|
15
|
-
- \`completeTodos\`: Mark items as done by indices
|
|
16
|
-
- \`removeTodos\`: Remove items by indices
|
|
14
|
+
- \`updateTodos\`: Batch update todos (add, update, remove, complete, processing operations)
|
|
17
15
|
- \`clearTodos\`: Clear completed or all items
|
|
18
16
|
|
|
17
|
+
**Todo Status Workflow:** todo → processing → completed (use "processing" when actively working on an item)
|
|
18
|
+
|
|
19
19
|
**Async Task Tools** - For long-running background tasks:
|
|
20
20
|
- \`execTask\`: Execute a single async task in isolated context
|
|
21
21
|
- \`execTasks\`: Execute multiple async tasks in parallel
|
|
@@ -98,23 +98,29 @@ Use \`execTask\` for a single task, \`execTasks\` for multiple parallel tasks.
|
|
|
98
98
|
<updateTodos_usage>
|
|
99
99
|
When using \`updateTodos\`, each operation type requires specific fields:
|
|
100
100
|
|
|
101
|
+
**Todo Status:**
|
|
102
|
+
- \`todo\`: Not started yet
|
|
103
|
+
- \`processing\`: Currently in progress
|
|
104
|
+
- \`completed\`: Done
|
|
105
|
+
|
|
101
106
|
**Minimal required fields per operation type:**
|
|
102
107
|
- \`{ "type": "add", "text": "todo text" }\` - only type + text
|
|
103
|
-
- \`{ "type": "complete", "index": 0 }\` - only type + index
|
|
108
|
+
- \`{ "type": "complete", "index": 0 }\` - only type + index (marks as completed)
|
|
109
|
+
- \`{ "type": "processing", "index": 0 }\` - only type + index (marks as in progress)
|
|
104
110
|
- \`{ "type": "remove", "index": 0 }\` - only type + index
|
|
105
|
-
- \`{ "type": "update", "index": 0, "newText": "..." }\` - type + index + optional newText/
|
|
111
|
+
- \`{ "type": "update", "index": 0, "newText": "..." }\` - type + index + optional newText/status
|
|
106
112
|
|
|
107
|
-
**Example - mark
|
|
113
|
+
**Example - mark item 0 as processing, item 1 as complete:**
|
|
108
114
|
\`\`\`json
|
|
109
115
|
{
|
|
110
116
|
"operations": [
|
|
111
|
-
{ "type": "
|
|
117
|
+
{ "type": "processing", "index": 0 },
|
|
112
118
|
{ "type": "complete", "index": 1 }
|
|
113
119
|
]
|
|
114
120
|
}
|
|
115
121
|
\`\`\`
|
|
116
122
|
|
|
117
|
-
**DO NOT** add extra fields like \`"
|
|
123
|
+
**DO NOT** add extra fields like \`"status": "completed"\` for complete/processing operations - they are ignored.
|
|
118
124
|
</updateTodos_usage>
|
|
119
125
|
|
|
120
126
|
<todo_granularity>
|
|
@@ -14,44 +14,66 @@ export const GTDApiName = {
|
|
|
14
14
|
/** Clear completed or all todos */
|
|
15
15
|
clearTodos: 'clearTodos',
|
|
16
16
|
|
|
17
|
-
|
|
18
|
-
completeTodos: 'completeTodos',
|
|
19
|
-
|
|
17
|
+
|
|
20
18
|
// ==================== Planning ====================
|
|
21
|
-
|
|
22
|
-
|
|
19
|
+
/** Create a structured plan by breaking down a goal into actionable steps */
|
|
20
|
+
createPlan: 'createPlan',
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
/** Create new todo items */
|
|
26
|
+
createTodos: 'createTodos',
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
// ==================== Async Tasks ====================
|
|
32
|
+
/** Execute a single async task */
|
|
33
|
+
execTask: 'execTask',
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
|
|
23
37
|
|
|
24
|
-
/** Create new todo items */
|
|
25
|
-
createTodos: 'createTodos',
|
|
26
38
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
execTask: 'execTask',
|
|
39
|
+
/** Execute one or more async tasks */
|
|
40
|
+
execTasks: 'execTasks',
|
|
30
41
|
|
|
31
|
-
|
|
32
|
-
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
|
|
33
45
|
|
|
34
|
-
/** Remove todo items by indices */
|
|
35
|
-
removeTodos: 'removeTodos',
|
|
36
46
|
|
|
37
|
-
|
|
38
|
-
|
|
47
|
+
/** Update an existing plan */
|
|
48
|
+
updatePlan: 'updatePlan',
|
|
39
49
|
|
|
40
|
-
|
|
41
|
-
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
/** Update todo items with batch operations (add, update, remove, complete, processing) */
|
|
53
|
+
updateTodos: 'updateTodos',
|
|
42
54
|
} as const;
|
|
43
55
|
|
|
44
56
|
export type GTDApiNameType = (typeof GTDApiName)[keyof typeof GTDApiName];
|
|
45
57
|
|
|
46
58
|
// ==================== Todo Item ====================
|
|
47
59
|
|
|
60
|
+
/** Status of a todo item */
|
|
61
|
+
export type TodoStatus = 'todo' | 'processing' | 'completed';
|
|
62
|
+
|
|
48
63
|
export interface TodoItem {
|
|
49
|
-
/**
|
|
50
|
-
|
|
64
|
+
/** Status of the todo item */
|
|
65
|
+
status: TodoStatus;
|
|
51
66
|
/** The todo item text */
|
|
52
67
|
text: string;
|
|
53
68
|
}
|
|
54
69
|
|
|
70
|
+
/** Get the next status in the cycle: todo → processing → completed → todo */
|
|
71
|
+
export const getNextTodoStatus = (current: TodoStatus): TodoStatus => {
|
|
72
|
+
const cycle: TodoStatus[] = ['todo', 'processing', 'completed'];
|
|
73
|
+
const index = cycle.indexOf(current);
|
|
74
|
+
return cycle[(index + 1) % cycle.length];
|
|
75
|
+
};
|
|
76
|
+
|
|
55
77
|
export interface TodoList {
|
|
56
78
|
items: TodoItem[];
|
|
57
79
|
updatedAt: string;
|
|
@@ -77,18 +99,18 @@ export interface CreateTodosParams {
|
|
|
77
99
|
/**
|
|
78
100
|
* Update operation types for batch updates
|
|
79
101
|
*/
|
|
80
|
-
export type TodoUpdateOperationType = 'add' | 'update' | 'remove' | 'complete';
|
|
102
|
+
export type TodoUpdateOperationType = 'add' | 'update' | 'remove' | 'complete' | 'processing';
|
|
81
103
|
|
|
82
104
|
/**
|
|
83
105
|
* Single update operation
|
|
84
106
|
*/
|
|
85
107
|
export interface TodoUpdateOperation {
|
|
86
|
-
/** For 'update': the
|
|
87
|
-
completed?: boolean;
|
|
88
|
-
/** For 'update', 'remove', 'complete': the index of the item (0-based) */
|
|
108
|
+
/** For 'update', 'remove', 'complete', 'processing': the index of the item (0-based) */
|
|
89
109
|
index?: number;
|
|
90
110
|
/** For 'update': the new text */
|
|
91
111
|
newText?: string;
|
|
112
|
+
/** For 'update': the new status */
|
|
113
|
+
status?: TodoStatus;
|
|
92
114
|
/** For 'add': the text to add */
|
|
93
115
|
text?: string;
|
|
94
116
|
/** Operation type */
|
|
@@ -97,29 +119,13 @@ export interface TodoUpdateOperation {
|
|
|
97
119
|
|
|
98
120
|
/**
|
|
99
121
|
* Update todo list with batch operations
|
|
100
|
-
* Supports: add, update, remove, complete
|
|
122
|
+
* Supports: add, update, remove, complete, processing
|
|
101
123
|
*/
|
|
102
124
|
export interface UpdateTodosParams {
|
|
103
125
|
/** Array of update operations to apply */
|
|
104
126
|
operations: TodoUpdateOperation[];
|
|
105
127
|
}
|
|
106
128
|
|
|
107
|
-
/**
|
|
108
|
-
* Mark todo items as completed by indices
|
|
109
|
-
*/
|
|
110
|
-
export interface CompleteTodosParams {
|
|
111
|
-
/** Indices of items to mark as completed (0-based) */
|
|
112
|
-
indices: number[];
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
/**
|
|
116
|
-
* Remove todo items by indices
|
|
117
|
-
*/
|
|
118
|
-
export interface RemoveTodosParams {
|
|
119
|
-
/** Indices of items to remove (0-based) */
|
|
120
|
-
indices: number[];
|
|
121
|
-
}
|
|
122
|
-
|
|
123
129
|
/**
|
|
124
130
|
* Clear todo items
|
|
125
131
|
*/
|
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
"private": true,
|
|
5
5
|
"exports": {
|
|
6
6
|
".": "./src/index.ts",
|
|
7
|
+
"./client": "./src/client/index.ts",
|
|
7
8
|
"./executor": "./src/executor/index.ts"
|
|
8
9
|
},
|
|
9
10
|
"main": "./src/index.ts",
|
|
@@ -13,5 +14,12 @@
|
|
|
13
14
|
},
|
|
14
15
|
"devDependencies": {
|
|
15
16
|
"@lobechat/types": "workspace:*"
|
|
17
|
+
},
|
|
18
|
+
"peerDependencies": {
|
|
19
|
+
"@lobehub/ui": "^4",
|
|
20
|
+
"antd-style": "*",
|
|
21
|
+
"lucide-react": "*",
|
|
22
|
+
"react": "*",
|
|
23
|
+
"react-i18next": "*"
|
|
16
24
|
}
|
|
17
25
|
}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import type { BuiltinInspectorProps } from '@lobechat/types';
|
|
4
|
+
import { createStaticStyles, cssVar, cx } from 'antd-style';
|
|
5
|
+
import { Check } from 'lucide-react';
|
|
6
|
+
import { memo } from 'react';
|
|
7
|
+
import { useTranslation } from 'react-i18next';
|
|
8
|
+
|
|
9
|
+
import { highlightTextStyles, inspectorTextStyles, shinyTextStyles } from '@/styles';
|
|
10
|
+
|
|
11
|
+
import type { AddContextMemoryParams, AddContextMemoryState } from '../../../types';
|
|
12
|
+
|
|
13
|
+
const styles = createStaticStyles(({ css }) => ({
|
|
14
|
+
statusIcon: css`
|
|
15
|
+
margin-block-end: -2px;
|
|
16
|
+
margin-inline-start: 4px;
|
|
17
|
+
`,
|
|
18
|
+
}));
|
|
19
|
+
|
|
20
|
+
export const AddContextMemoryInspector = memo<
|
|
21
|
+
BuiltinInspectorProps<AddContextMemoryParams, AddContextMemoryState>
|
|
22
|
+
>(({ args, partialArgs, isArgumentsStreaming, isLoading, pluginState }) => {
|
|
23
|
+
const { t } = useTranslation('plugin');
|
|
24
|
+
|
|
25
|
+
const title = args?.title || partialArgs?.title;
|
|
26
|
+
|
|
27
|
+
// Initial streaming state
|
|
28
|
+
if (isArgumentsStreaming && !title) {
|
|
29
|
+
return (
|
|
30
|
+
<div className={cx(inspectorTextStyles.root, shinyTextStyles.shinyText)}>
|
|
31
|
+
<span>{t('builtins.lobe-user-memory.apiName.addContextMemory')}</span>
|
|
32
|
+
</div>
|
|
33
|
+
);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
const isSuccess = pluginState?.memoryId;
|
|
37
|
+
|
|
38
|
+
return (
|
|
39
|
+
<div
|
|
40
|
+
className={cx(
|
|
41
|
+
inspectorTextStyles.root,
|
|
42
|
+
(isArgumentsStreaming || isLoading) && shinyTextStyles.shinyText,
|
|
43
|
+
)}
|
|
44
|
+
>
|
|
45
|
+
<span>{t('builtins.lobe-user-memory.apiName.addContextMemory')}</span>
|
|
46
|
+
{title && (
|
|
47
|
+
<>
|
|
48
|
+
: <span className={highlightTextStyles.primary}>{title}</span>
|
|
49
|
+
</>
|
|
50
|
+
)}
|
|
51
|
+
{!isLoading && isSuccess && (
|
|
52
|
+
<Check className={styles.statusIcon} color={cssVar.colorSuccess} size={14} />
|
|
53
|
+
)}
|
|
54
|
+
</div>
|
|
55
|
+
);
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
AddContextMemoryInspector.displayName = 'AddContextMemoryInspector';
|
|
59
|
+
|
|
60
|
+
export default AddContextMemoryInspector;
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import type { BuiltinInspectorProps } from '@lobechat/types';
|
|
4
|
+
import { createStaticStyles, cssVar, cx } from 'antd-style';
|
|
5
|
+
import { Check } from 'lucide-react';
|
|
6
|
+
import { memo } from 'react';
|
|
7
|
+
import { useTranslation } from 'react-i18next';
|
|
8
|
+
|
|
9
|
+
import { highlightTextStyles, inspectorTextStyles, shinyTextStyles } from '@/styles';
|
|
10
|
+
|
|
11
|
+
import type { AddExperienceMemoryParams, AddExperienceMemoryState } from '../../../types';
|
|
12
|
+
|
|
13
|
+
const styles = createStaticStyles(({ css }) => ({
|
|
14
|
+
statusIcon: css`
|
|
15
|
+
margin-block-end: -2px;
|
|
16
|
+
margin-inline-start: 4px;
|
|
17
|
+
`,
|
|
18
|
+
}));
|
|
19
|
+
|
|
20
|
+
export const AddExperienceMemoryInspector = memo<
|
|
21
|
+
BuiltinInspectorProps<AddExperienceMemoryParams, AddExperienceMemoryState>
|
|
22
|
+
>(({ args, partialArgs, isArgumentsStreaming, isLoading, pluginState }) => {
|
|
23
|
+
const { t } = useTranslation('plugin');
|
|
24
|
+
|
|
25
|
+
const title = args?.title || partialArgs?.title;
|
|
26
|
+
|
|
27
|
+
// Initial streaming state
|
|
28
|
+
if (isArgumentsStreaming && !title) {
|
|
29
|
+
return (
|
|
30
|
+
<div className={cx(inspectorTextStyles.root, shinyTextStyles.shinyText)}>
|
|
31
|
+
<span>{t('builtins.lobe-user-memory.apiName.addExperienceMemory')}</span>
|
|
32
|
+
</div>
|
|
33
|
+
);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
const isSuccess = pluginState?.memoryId;
|
|
37
|
+
|
|
38
|
+
return (
|
|
39
|
+
<div
|
|
40
|
+
className={cx(
|
|
41
|
+
inspectorTextStyles.root,
|
|
42
|
+
(isArgumentsStreaming || isLoading) && shinyTextStyles.shinyText,
|
|
43
|
+
)}
|
|
44
|
+
>
|
|
45
|
+
<span>{t('builtins.lobe-user-memory.apiName.addExperienceMemory')}</span>
|
|
46
|
+
{title && (
|
|
47
|
+
<>
|
|
48
|
+
: <span className={highlightTextStyles.primary}>{title}</span>
|
|
49
|
+
</>
|
|
50
|
+
)}
|
|
51
|
+
{!isLoading && isSuccess && (
|
|
52
|
+
<Check className={styles.statusIcon} color={cssVar.colorSuccess} size={14} />
|
|
53
|
+
)}
|
|
54
|
+
</div>
|
|
55
|
+
);
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
AddExperienceMemoryInspector.displayName = 'AddExperienceMemoryInspector';
|
|
59
|
+
|
|
60
|
+
export default AddExperienceMemoryInspector;
|