nolo-cli 0.1.39 → 0.1.41
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/README.md +4 -4
- package/agent-runtime/dialogWritePlan.ts +39 -0
- package/agent-runtime/hostAdapter.ts +4 -0
- package/agent-runtime/hybridRecordStore.ts +5 -3
- package/agent-runtime/index.ts +15 -0
- package/agent-runtime/localLoop.ts +87 -7
- package/agent-runtime/localToolPolicy.ts +2 -13
- package/agent-runtime/localWorkspaceTools.ts +42 -110
- package/agent-runtime/runtimeToolPolicy.ts +2 -11
- package/agent-runtime/runtimeToolSurface.ts +198 -0
- package/agent-runtime/types.ts +1 -0
- package/agentAliases.ts +2 -1
- package/agentRunCommand.ts +10 -32
- package/agentRuntimeLocal.ts +1 -0
- package/ai/agent/_executeModel.ts +146 -0
- package/ai/agent/agentSlice.ts +556 -1
- package/ai/agent/appWorkingMemory.ts +126 -0
- package/ai/agent/buildEditingContext.ts +378 -0
- package/ai/agent/buildSystemPrompt.ts +585 -0
- package/ai/agent/canvasEditingContext.ts +49 -0
- package/ai/agent/cleanAgentMessages.ts +140 -0
- package/ai/agent/cliChatClient.ts +153 -0
- package/ai/agent/cliExecutor.ts +314 -40
- package/ai/agent/contextCompiler.ts +107 -0
- package/ai/agent/contextLayerContract.ts +44 -0
- package/ai/agent/createAgentSchema.ts +272 -0
- package/ai/agent/currentTimeContext.ts +65 -0
- package/ai/agent/executeToolCall.ts +58 -0
- package/ai/agent/fetchAgentContexts.ts +42 -0
- package/ai/agent/generatePrompt.ts +3 -0
- package/ai/agent/getFullChatContextKeys.ts +168 -0
- package/ai/agent/guidedCreation/capabilities.ts +84 -0
- package/ai/agent/guidedCreation/types.ts +38 -0
- package/ai/agent/isLiveAudioOnlyAgent.ts +26 -0
- package/ai/agent/liveAudioModel.ts +2 -0
- package/ai/agent/pageBuilderHandoffRules.ts +75 -0
- package/ai/agent/persistMessageWithFixedId.ts +37 -0
- package/ai/agent/planSlice.ts +259 -0
- package/ai/agent/referenceUtils.ts +229 -0
- package/ai/agent/runAgentBackground.ts +310 -0
- package/ai/agent/runAgentClientLoop.ts +164 -0
- package/ai/agent/runtimeGuidance.ts +116 -0
- package/ai/agent/serverOrigin.ts +7 -0
- package/ai/agent/startParallelAgentStreams.ts +424 -0
- package/ai/agent/startupProtocol.ts +53 -0
- package/ai/agent/streamAgentChatTurn.ts +2001 -0
- package/ai/agent/streamAgentChatTurnUtils.ts +860 -0
- package/ai/agent/toolFailureGuard.ts +99 -0
- package/ai/agent/types.ts +73 -0
- package/ai/agent/utils/imageOutput.ts +37 -0
- package/ai/agent/utils/publicImageAgentMode.ts +26 -0
- package/ai/ai.locale.ts +1095 -0
- package/ai/chat/accumulateToolCallChunks.ts +126 -0
- package/ai/chat/fetchUtils.ts +143 -0
- package/ai/chat/inlineImageUrlsForCustomProvider.ts +117 -0
- package/ai/chat/parseApiError.ts +67 -0
- package/ai/chat/parseMultilineSSE.ts +95 -0
- package/ai/chat/sendOpenAICompletionsRequest.ts +897 -0
- package/ai/chat/sendOpenAIResponseRequest.ts +720 -0
- package/ai/chat/serverProxyRetry.ts +102 -0
- package/ai/chat/shouldUseServerProxy.ts +18 -0
- package/ai/chat/streamRetry.ts +46 -0
- package/ai/chat/updateTotalUsage.ts +89 -0
- package/ai/context/buildReferenceContext.ts +437 -0
- package/ai/context/retention.ts +165 -0
- package/ai/context/tokenUtils.ts +78 -0
- package/ai/llm/agentCapabilities.ts +74 -0
- package/ai/llm/deepinfra.ts +79 -0
- package/ai/llm/fireworks.ts +68 -0
- package/ai/llm/generateRequestBody.ts +165 -0
- package/ai/llm/getModelContextWindow.ts +93 -0
- package/ai/llm/getPricing.ts +252 -0
- package/ai/llm/imagePricing.ts +66 -0
- package/ai/llm/isResponseAPIModel.ts +13 -0
- package/ai/llm/kimi.ts +23 -0
- package/ai/llm/mimo.ts +99 -0
- package/ai/llm/mistral.ts +21 -0
- package/ai/llm/models.ts +45 -0
- package/ai/llm/openrouterModels.ts +6 -0
- package/ai/llm/providers.ts +313 -0
- package/ai/llm/reasoningModels.ts +27 -0
- package/ai/llm/types.ts +82 -0
- package/ai/llm/usageRequestOptions.ts +59 -0
- package/ai/memory/queryShared.ts +161 -0
- package/ai/memory/recentRelationshipRecap.ts +247 -0
- package/ai/memory/remember.ts +167 -0
- package/ai/memory/store.ts +20 -0
- package/ai/memory/storeShared.ts +76 -0
- package/ai/memory/types.ts +46 -0
- package/ai/memory/understanding.ts +349 -0
- package/ai/memory/understandingGreeting.ts +264 -0
- package/ai/policy/personalizationDialog.ts +333 -0
- package/ai/policy/runtimePolicy.ts +454 -0
- package/ai/policy/selfUpdateFields.ts +48 -0
- package/ai/policy/types.ts +64 -0
- package/ai/skills/referenceRuntime.ts +274 -0
- package/ai/skills/skillDiagnostics.ts +251 -0
- package/ai/skills/skillDocBuilder.ts +139 -0
- package/ai/skills/skillSummaryMarker.ts +26 -0
- package/ai/token/calculatePrice.ts +576 -0
- package/ai/token/missingUsageEstimate.ts +42 -0
- package/ai/token/normalizeUsage.ts +124 -0
- package/ai/token/openaiImageGenerationUsage.ts +56 -0
- package/ai/token/prepareTokenUsageData.ts +93 -0
- package/ai/token/resolveBillingTarget.ts +52 -0
- package/ai/token/saveTokenRecord.ts +53 -0
- package/ai/token/types.ts +103 -0
- package/ai/tools/agent/agentTools.ts +235 -0
- package/ai/tools/agent/agentUpdateShared.ts +311 -0
- package/ai/tools/agent/callAgentTool.ts +139 -0
- package/ai/tools/agent/createAgentTool.ts +512 -0
- package/ai/tools/agent/createDialogTool.ts +69 -0
- package/ai/tools/agent/createSkillAgentTool.ts +62 -0
- package/ai/tools/agent/parallelBudget.ts +221 -0
- package/ai/tools/agent/prepareAgentDraftTool.ts +159 -0
- package/ai/tools/agent/presets/appBuilderPreset.ts +154 -0
- package/ai/tools/agent/runLlmTool.ts +96 -0
- package/ai/tools/agent/runStreamingAgentTool.ts +73 -0
- package/ai/tools/agent/skillAgentArgs.ts +106 -0
- package/ai/tools/agent/startAgentDialogTool.ts +53 -0
- package/ai/tools/agent/streamParallelAgentsTool.ts +123 -0
- package/ai/tools/agent/updateAgentTool.ts +96 -0
- package/ai/tools/agent/updateSelfTool.ts +113 -0
- package/ai/tools/amazonProductScraperTool.ts +86 -0
- package/ai/tools/apifyActorClient.ts +45 -0
- package/ai/tools/appEditGuard.ts +372 -0
- package/ai/tools/appReadSnapshot.ts +153 -0
- package/ai/tools/appTools.ts +1549 -0
- package/ai/tools/applyEditTool.ts +259 -0
- package/ai/tools/applyLineEditsTool.ts +315 -0
- package/ai/tools/browserTools/click.ts +33 -0
- package/ai/tools/browserTools/closeSession.ts +29 -0
- package/ai/tools/browserTools/common.ts +27 -0
- package/ai/tools/browserTools/openSession.ts +48 -0
- package/ai/tools/browserTools/readContent.ts +38 -0
- package/ai/tools/browserTools/selectOption.ts +46 -0
- package/ai/tools/browserTools/typeText.ts +42 -0
- package/ai/tools/category/createCategoryTool.ts +66 -0
- package/ai/tools/category/queryContentsByCategoryTool.ts +69 -0
- package/ai/tools/category/updateContentCategoryTool.ts +75 -0
- package/ai/tools/cfBrowserTools.ts +319 -0
- package/ai/tools/cfSpeechToTextTool.ts +49 -0
- package/ai/tools/checkEnvTool.ts +102 -0
- package/ai/tools/cloudflareCrawlTool.ts +289 -0
- package/ai/tools/codeSearchTool.ts +123 -0
- package/ai/tools/codeTools.ts +101 -0
- package/ai/tools/convertMarxistsBookTool.ts +103 -0
- package/ai/tools/createDocTool.ts +132 -0
- package/ai/tools/createSkillDocTool.ts +155 -0
- package/ai/tools/createWorkflowTool.ts +154 -0
- package/ai/tools/delayTool.ts +31 -0
- package/ai/tools/deleteSpacesTool.ts +325 -0
- package/ai/tools/deleteSpacesToolModel.ts +159 -0
- package/ai/tools/devReloadUtils.ts +29 -0
- package/ai/tools/dialogMessageSearch.ts +137 -0
- package/ai/tools/doctorSkillTool.ts +72 -0
- package/ai/tools/ecommerceScraperTool.ts +86 -0
- package/ai/tools/emailTools.ts +549 -0
- package/ai/tools/evalSkillTool.ts +92 -0
- package/ai/tools/exaSearchTool.ts +63 -0
- package/ai/tools/execShellTool.ts +266 -0
- package/ai/tools/executeSqlTool.ts +192 -0
- package/ai/tools/fetchWebpageSupport.ts +333 -0
- package/ai/tools/fetchWebpageTool.ts +97 -0
- package/ai/tools/geminiImagePreviewTool.ts +386 -0
- package/ai/tools/generateDocxTool.ts +215 -0
- package/ai/tools/googleSearchScraperTool.ts +106 -0
- package/ai/tools/importDataTool.ts +133 -0
- package/ai/tools/importSkillTool.ts +162 -0
- package/ai/tools/index.ts +2308 -0
- package/ai/tools/jdProductScraperTool.ts +821 -0
- package/ai/tools/listUserSpacesTool.ts +113 -0
- package/ai/tools/localFilesTool.ts +276 -0
- package/ai/tools/marxistsOfflineBook.ts +253 -0
- package/ai/tools/modelUsageTools.ts +206 -0
- package/ai/tools/noloWorkspaceReadTools.ts +467 -0
- package/ai/tools/olmOcrTool.ts +33 -0
- package/ai/tools/openaiImageTool.ts +267 -0
- package/ai/tools/prepareTools.ts +23 -0
- package/ai/tools/readDocTool.ts +88 -0
- package/ai/tools/readFileTool.ts +214 -0
- package/ai/tools/readTool.ts +194 -0
- package/ai/tools/readXPostTool.ts +229 -0
- package/ai/tools/readXhsProfileTool.ts +627 -0
- package/ai/tools/rememberMemoryTool.ts +84 -0
- package/ai/tools/remotionVideoTool.ts +151 -0
- package/ai/tools/searchDialogMessagesTool.ts +222 -0
- package/ai/tools/searchWorkspaceTool.ts +259 -0
- package/ai/tools/skillFollowup.ts +86 -0
- package/ai/tools/surfWeatherTool.ts +169 -0
- package/ai/tools/table/addTableRowTool.ts +217 -0
- package/ai/tools/table/createTableTool.ts +315 -0
- package/ai/tools/table/rowTools.ts +386 -0
- package/ai/tools/table/schemaTools.ts +244 -0
- package/ai/tools/table/shareTableTool.ts +148 -0
- package/ai/tools/table/toolShared.ts +129 -0
- package/ai/tools/taobaoTmallProductScraperTool.ts +49 -0
- package/ai/tools/toolApiClient.ts +279 -0
- package/ai/tools/toolResultError.ts +42 -0
- package/ai/tools/toolRunSlice.ts +303 -0
- package/ai/tools/toolSchemaCompatibility.ts +53 -0
- package/ai/tools/uiAskChoiceTool.ts +104 -0
- package/ai/tools/updateContentTitleTool.ts +84 -0
- package/ai/tools/updateDocTool.ts +105 -0
- package/ai/tools/updateUserPreferenceProfileTool.ts +153 -0
- package/ai/tools/wereadGatewayTool.ts +152 -0
- package/ai/tools/whisperTool.ts +76 -0
- package/ai/tools/writeFileTool.ts +213 -0
- package/ai/tools/youtubeScraperTool.ts +116 -0
- package/ai/tools/ziweiChartTool.ts +678 -0
- package/ai/types.ts +55 -0
- package/ai/workflow/workflowExecutor.ts +323 -0
- package/ai/workflow/workflowSlice.ts +73 -0
- package/ai/workflow/workflowTypes.ts +106 -0
- package/app/actions/syncAppRecord.ts +73 -0
- package/app/constants/animationSets.ts +21 -0
- package/app/constants/appEditor.ts +99 -0
- package/app/favorite/favoriteSlice.ts +690 -0
- package/app/favorite/type.ts +43 -0
- package/app/hooks/deleteDbKey.ts +233 -0
- package/app/i18n/client.ts +13 -0
- package/app/i18n/i18n.base.ts +14 -0
- package/app/i18n/i18n.config.ts +77 -0
- package/app/i18n/index.ts +15 -0
- package/app/i18n/mapLanguage.ts +11 -0
- package/app/i18n/translations/appBuilder.locale.ts +453 -0
- package/app/i18n/translations/error.locale.ts +246 -0
- package/app/i18n/translations/interface.locale.ts +2174 -0
- package/app/i18n/translations/pricing.locale.ts +397 -0
- package/app/i18n/translations/privacy.locale.ts +168 -0
- package/app/i18n/translations/seo.locale.ts +129 -0
- package/app/i18n/translations/terms.locale.ts +124 -0
- package/app/i18n/types.ts +6 -0
- package/app/notifications/model.ts +77 -0
- package/app/notifications/notificationSlice.ts +141 -0
- package/app/reducer.ts +36 -0
- package/app/settings/dbActionThunks.ts +34 -0
- package/app/settings/defaultSpacePreference.ts +87 -0
- package/app/settings/settingSlice.tsx +1212 -0
- package/app/settings/settingsRecord.ts +8 -0
- package/app/stateViews/runtime.ts +90 -0
- package/app/store.ts +55 -0
- package/app/theme/colors.ts +280 -0
- package/app/theme/fontPreference.ts +77 -0
- package/app/theme/theme.config.ts +120 -0
- package/app/theme/themeModeBootstrap.ts +123 -0
- package/app/types/appSummary.ts +114 -0
- package/app/types.ts +358 -0
- package/app/utils/appKeys.ts +55 -0
- package/app/utils/async.ts +28 -0
- package/app/utils/desktopAgentRuntimeTurnClient.ts +73 -0
- package/app/utils/env.ts +17 -0
- package/app/utils/fileUtils.ts +229 -0
- package/app/utils/imageUtils.ts +274 -0
- package/app/utils/myContentItems.ts +289 -0
- package/app/utils/retryAfter.ts +36 -0
- package/app/utils/retryFetch.ts +61 -0
- package/app/utils/toast.ts +3 -0
- package/auth/action/signUpAction.ts +227 -0
- package/auth/adminPermissions.ts +18 -0
- package/auth/authSlice.ts +531 -0
- package/auth/client/loginRequest.ts +14 -0
- package/auth/resetAuthScopedClientState.ts +27 -0
- package/auth/routes.ts +178 -0
- package/auth/token.ts +63 -0
- package/auth/types.ts +40 -0
- package/chat/chat.locale.ts +813 -0
- package/chat/dialog/actions/addCybotAction.ts +52 -0
- package/chat/dialog/actions/addReferenceKeysAction.ts +62 -0
- package/chat/dialog/actions/builtinDialogLlm.ts +35 -0
- package/chat/dialog/actions/cleanupCliSession.ts +40 -0
- package/chat/dialog/actions/createDialogAction.ts +379 -0
- package/chat/dialog/actions/createScheduledTaskAction.ts +78 -0
- package/chat/dialog/actions/handleSendMessageAction.ts +197 -0
- package/chat/dialog/actions/handleSendMessageResolver.ts +27 -0
- package/chat/dialog/actions/removeCybotAction.ts +6 -0
- package/chat/dialog/actions/removeDialogAgentAction.ts +44 -0
- package/chat/dialog/actions/replacePrimaryCybotAction.ts +6 -0
- package/chat/dialog/actions/setPrimaryDialogAgentAction.ts +52 -0
- package/chat/dialog/actions/updateDialogSummaryAction.ts +430 -0
- package/chat/dialog/actions/updateDialogTitleAction.ts +151 -0
- package/chat/dialog/actions/updateDialogTitlePolicy.ts +30 -0
- package/chat/dialog/actions/updateTokensAction.ts +233 -0
- package/chat/dialog/dialogAgents.ts +72 -0
- package/chat/dialog/dialogSlice.ts +872 -0
- package/chat/dialog/dialogTitle.ts +81 -0
- package/chat/dialog/dialogTokenStats.ts +12 -0
- package/chat/dialog/dialogUrl.ts +6 -0
- package/chat/dialog/goal.ts +108 -0
- package/chat/dialog/objectAssistantRegistry.ts +286 -0
- package/chat/dialog/schedule.ts +17 -0
- package/chat/messages/fetchAndCacheMessages.ts +119 -0
- package/chat/messages/fetchConvMsgs.ts +51 -0
- package/chat/messages/fileUrl.ts +13 -0
- package/chat/messages/messageAgent.ts +8 -0
- package/chat/messages/messageContent.ts +199 -0
- package/chat/messages/messageContract.ts +88 -0
- package/chat/messages/messageSlice.ts +1367 -0
- package/chat/messages/toolThunks.ts +625 -0
- package/cli/agentAliases.ts +2 -1
- package/cli/agentRunCommand.ts +10 -32
- package/cli/agentRuntimeLocal.ts +1 -0
- package/cli/client/agentRun.ts +67 -95
- package/cli/client/localRuntimeAdapter.ts +323 -54
- package/cli/commandRegistry.ts +2 -2
- package/cli/machineWsRunDispatch.ts +51 -6
- package/cli/offlineMarxistsAgentCommand.ts +6 -4
- package/client/agentConfigResolver.test.ts +2 -2
- package/client/agentRun.test.ts +175 -57
- package/client/agentRun.ts +67 -95
- package/client/localRuntimeAdapter.test.ts +682 -37
- package/client/localRuntimeAdapter.ts +323 -54
- package/client/localRuntimeDryRun.test.ts +23 -9
- package/client/localToolPolicy.test.ts +4 -4
- package/commandRegistry.ts +2 -2
- package/core/builtinAgents.ts +209 -0
- package/core/config.ts +15 -0
- package/core/crypto.ts +51 -0
- package/core/generateKeyPairFromSeedV1.ts +15 -0
- package/core/generateMainKey.ts +22 -0
- package/core/init.ts +41 -0
- package/core/localOrigins.ts +8 -0
- package/core/password.ts +13 -0
- package/core/prefix.ts +23 -0
- package/create/editor/transforms/fromMarkdown/index.ts +260 -0
- package/create/editor/transforms/fromMarkdown/inline.ts +285 -0
- package/create/editor/transforms/fromMarkdown/table.ts +130 -0
- package/create/editor/transforms/markdownToSlate.ts +24 -0
- package/create/editor/transforms/slateToRenderMarkdown.ts +218 -0
- package/create/editor/transforms/slateToSimplifiedMarkdown.ts +224 -0
- package/create/editor/transforms/slateToText.ts +33 -0
- package/create/editor/utils/slateUtils.ts +233 -0
- package/create/space/addSpaceAction.ts +193 -0
- package/create/space/category/categoryActions.ts +427 -0
- package/create/space/changeSpaceAction.ts +36 -0
- package/create/space/constants.ts +8 -0
- package/create/space/content/addContentAction.ts +116 -0
- package/create/space/content/contentThunks.ts +90 -0
- package/create/space/content/deleteContentFromSpaceAction.ts +187 -0
- package/create/space/content/deleteMultipleContentAction.ts +112 -0
- package/create/space/content/moveContentAction.ts +285 -0
- package/create/space/content/updateContentCategoryAction.ts +154 -0
- package/create/space/content/updateContentTitleAction.ts +151 -0
- package/create/space/content/uploadAndAddFileToSpaceAction.ts +98 -0
- package/create/space/contentKeyUtils.ts +117 -0
- package/create/space/deleteSpaceAction.ts +276 -0
- package/create/space/fetchSpaceAction.ts +70 -0
- package/create/space/fetchSpaceSidebarStateAction.ts +26 -0
- package/create/space/loadDefaultSpaceAction.ts +57 -0
- package/create/space/member/addMemberAction.ts +79 -0
- package/create/space/member/fetchUserSpaceMembershipsAction.ts +386 -0
- package/create/space/member/memberThunks.ts +47 -0
- package/create/space/member/removeMemberAction.ts +67 -0
- package/create/space/resolvePreferredSpaceId.ts +113 -0
- package/create/space/sidebarVisibleTypes.ts +241 -0
- package/create/space/space.locale.ts +1087 -0
- package/create/space/spaceAccess.ts +182 -0
- package/create/space/spaceCollapsedState.ts +54 -0
- package/create/space/spaceKeys.ts +65 -0
- package/create/space/spaceSlice.ts +328 -0
- package/create/space/spaceThunks.ts +410 -0
- package/create/space/types.ts +27 -0
- package/create/space/updateSpaceAction.ts +107 -0
- package/create/space/utils/permissions.ts +47 -0
- package/create/types.ts +21 -0
- package/database/actions/agentReadResolution.ts +33 -0
- package/database/actions/common.ts +243 -0
- package/database/actions/deleteFile.ts +40 -0
- package/database/actions/fileContent.ts +125 -0
- package/database/actions/patch.ts +155 -0
- package/database/actions/read.ts +358 -0
- package/database/actions/readAndWait.ts +260 -0
- package/database/actions/readRequestManager.ts +120 -0
- package/database/actions/readResolution.ts +125 -0
- package/database/actions/remove.ts +94 -0
- package/database/actions/replication.ts +477 -0
- package/database/actions/upload.ts +186 -0
- package/database/actions/upsert.ts +56 -0
- package/database/actions/write.ts +146 -0
- package/database/authority/ownerKey.ts +80 -0
- package/database/authority/recordAuthority.ts +67 -0
- package/database/authority/userAuthorityRegistry.ts +54 -0
- package/database/client/fetchUserData.ts +61 -0
- package/database/dbActionThunks.ts +1 -0
- package/database/dbSlice.ts +149 -0
- package/database/fileRing.ts +51 -0
- package/database/fileStorage.ts +232 -0
- package/database/fileUrl.ts +34 -0
- package/database/keys.ts +767 -0
- package/database/queryPrefixes.ts +14 -0
- package/database/requests.ts +443 -0
- package/database/runtimeServerContext.ts +54 -0
- package/database/server/levelAuthorityStore.ts +20 -1
- package/database/tenantPlacement.ts +57 -0
- package/database/userPreferenceRegister.ts +131 -0
- package/database/utils/ulid.ts +1 -0
- package/integrations/anthropic/anthropicModels.ts +47 -0
- package/integrations/deepseek/models.ts +37 -0
- package/integrations/google/models.ts +341 -0
- package/integrations/openai/chatCompletionStreamMode.ts +10 -0
- package/integrations/openai/filterAndCleanMessages.ts +284 -0
- package/integrations/openai/flexTier.ts +102 -0
- package/integrations/openai/generateOpenAIRequestBody.ts +274 -0
- package/integrations/openai/generateResponseRequestBody.ts +77 -0
- package/integrations/openai/models.ts +271 -0
- package/integrations/openai/providerBodyCompatibility.ts +23 -0
- package/integrations/openai/responsesHelpers.ts +297 -0
- package/integrations/x-reader/types.ts +109 -0
- package/integrations/xai/models.ts +13 -0
- package/integrations/xhs-reader/analyze/profileAnalyzer.ts +205 -0
- package/integrations/xhs-reader/backends/playwrightProfileCollector.ts +624 -0
- package/integrations/xhs-reader/bridge/readXhsProfileWithBridge.ts +227 -0
- package/integrations/xhs-reader/client/xhsWebApiClient.ts +229 -0
- package/integrations/xhs-reader/normalize.ts +390 -0
- package/integrations/xhs-reader/orchestrator.ts +178 -0
- package/integrations/xhs-reader/redaction.ts +68 -0
- package/integrations/xhs-reader/types.ts +244 -0
- package/integrations/xhs-reader/url.ts +57 -0
- package/machineWsRunDispatch.ts +51 -6
- package/offlineMarxistsAgentCommand.ts +6 -4
- package/package.json +430 -3
- package/render/page/createPageAction.ts +183 -0
- package/render/page/docSlice.ts +468 -0
- package/render/page/types.ts +17 -0
- package/render/table/createTableAction.ts +270 -0
- package/render/table/deleteTableAction.ts +193 -0
- package/render/table/fetchAndCacheTableRows.ts +174 -0
- package/render/table/tableSlice.ts +1106 -0
- package/render/table/toolValueUtils.ts +363 -0
- package/render/table/types.ts +252 -0
- package/render/table/utils/tableSerialization.ts +50 -0
- package/server/handlers/agentRun/types.ts +104 -0
- package/share/action.ts +225 -0
- package/share/helpers.ts +302 -0
- package/share/keys.ts +243 -0
- package/share/publicSharePolicy.ts +27 -0
- package/share/shareSlice.ts +53 -0
- package/share/types.ts +100 -0
|
@@ -0,0 +1,468 @@
|
|
|
1
|
+
// 文件: render/page/docSlice.ts
|
|
2
|
+
|
|
3
|
+
import { formatISO } from "date-fns";
|
|
4
|
+
import {
|
|
5
|
+
asyncThunkCreator,
|
|
6
|
+
buildCreateSlice,
|
|
7
|
+
createListenerMiddleware,
|
|
8
|
+
PayloadAction,
|
|
9
|
+
createSelector,
|
|
10
|
+
} from "@reduxjs/toolkit";
|
|
11
|
+
import { readAndWait, patch } from "../../database/dbSlice";
|
|
12
|
+
import { updateContentTitle } from "../../create/space/spaceSlice";
|
|
13
|
+
import type { EditorContent } from "../../create/editor/utils/slateUtils";
|
|
14
|
+
import { DataType } from "../../create/types";
|
|
15
|
+
import { PageData } from "./types";
|
|
16
|
+
import type { PageSkillMetadata } from "../../ai/skills/skillDocProtocol";
|
|
17
|
+
|
|
18
|
+
// —— State 接口 ——
|
|
19
|
+
export interface DocState {
|
|
20
|
+
content: string | null;
|
|
21
|
+
slateData: EditorContent | null;
|
|
22
|
+
title: string | null;
|
|
23
|
+
dbSpaceId: string | null;
|
|
24
|
+
tags: string[] | null;
|
|
25
|
+
isReadOnly: boolean;
|
|
26
|
+
isLoading: boolean;
|
|
27
|
+
isInitialized: boolean;
|
|
28
|
+
error: string | null;
|
|
29
|
+
pageKey: string | null;
|
|
30
|
+
isSaving: boolean;
|
|
31
|
+
saveError: string | null;
|
|
32
|
+
lastSavedAt: string | null;
|
|
33
|
+
lastSavedSlateData: EditorContent | null;
|
|
34
|
+
lastSavedTitle: string | null;
|
|
35
|
+
justSaved: boolean;
|
|
36
|
+
tools: string[] | null;
|
|
37
|
+
meta: PageSkillMetadata | null;
|
|
38
|
+
id: string | null;
|
|
39
|
+
type: DataType | null;
|
|
40
|
+
focusContext: {
|
|
41
|
+
isFocused: boolean;
|
|
42
|
+
isCollapsed: boolean;
|
|
43
|
+
anchorPath: number[];
|
|
44
|
+
anchorOffset: number;
|
|
45
|
+
focusPath: number[];
|
|
46
|
+
focusOffset: number;
|
|
47
|
+
selectedText: string | null;
|
|
48
|
+
blockType: string | null;
|
|
49
|
+
} | null;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
// —— 初始状态 ——
|
|
53
|
+
const initialState: DocState = {
|
|
54
|
+
content: null,
|
|
55
|
+
slateData: null,
|
|
56
|
+
title: null,
|
|
57
|
+
dbSpaceId: null,
|
|
58
|
+
tags: null,
|
|
59
|
+
isReadOnly: true,
|
|
60
|
+
isLoading: false,
|
|
61
|
+
isInitialized: false,
|
|
62
|
+
error: null,
|
|
63
|
+
pageKey: null,
|
|
64
|
+
isSaving: false,
|
|
65
|
+
saveError: null,
|
|
66
|
+
lastSavedAt: null,
|
|
67
|
+
lastSavedSlateData: null,
|
|
68
|
+
lastSavedTitle: null,
|
|
69
|
+
justSaved: false,
|
|
70
|
+
tools: null,
|
|
71
|
+
meta: null,
|
|
72
|
+
id: null,
|
|
73
|
+
type: null,
|
|
74
|
+
focusContext: null,
|
|
75
|
+
};
|
|
76
|
+
|
|
77
|
+
const deepEqualEditorContent = (a: any, b: any): boolean => {
|
|
78
|
+
if (a === b) return true;
|
|
79
|
+
if (a == null || b == null) return false;
|
|
80
|
+
if (typeof a !== "object" || typeof b !== "object") return false;
|
|
81
|
+
|
|
82
|
+
const isArrayA = Array.isArray(a);
|
|
83
|
+
const isArrayB = Array.isArray(b);
|
|
84
|
+
if (isArrayA || isArrayB) {
|
|
85
|
+
if (!isArrayA || !isArrayB || a.length !== b.length) return false;
|
|
86
|
+
return a.every((item, index) => deepEqualEditorContent(item, b[index]));
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
const keysA = Object.keys(a);
|
|
90
|
+
const keysB = Object.keys(b);
|
|
91
|
+
if (keysA.length !== keysB.length) return false;
|
|
92
|
+
|
|
93
|
+
return keysA.every((key) =>
|
|
94
|
+
Object.prototype.hasOwnProperty.call(b, key) && deepEqualEditorContent(a[key], b[key])
|
|
95
|
+
);
|
|
96
|
+
};
|
|
97
|
+
|
|
98
|
+
const hasSlateContentChanged = (
|
|
99
|
+
newContent: EditorContent | null,
|
|
100
|
+
oldContent: EditorContent | null
|
|
101
|
+
) => {
|
|
102
|
+
if (newContent === oldContent) return false;
|
|
103
|
+
if (!newContent || !oldContent) return true;
|
|
104
|
+
if (newContent.length !== oldContent.length) return true;
|
|
105
|
+
return !deepEqualEditorContent(newContent, oldContent);
|
|
106
|
+
};
|
|
107
|
+
|
|
108
|
+
interface InitDocArgs {
|
|
109
|
+
pageKey: string;
|
|
110
|
+
isReadOnly: boolean;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
interface InitDocPayload extends PageData {
|
|
114
|
+
isReadOnly: boolean;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
interface SaveDocArgs {
|
|
118
|
+
pageKey: string;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
const createSliceWithThunks = buildCreateSlice({
|
|
122
|
+
creators: { asyncThunk: asyncThunkCreator },
|
|
123
|
+
});
|
|
124
|
+
|
|
125
|
+
export const docSlice = createSliceWithThunks({
|
|
126
|
+
name: "doc",
|
|
127
|
+
initialState,
|
|
128
|
+
reducers: (create): any => ({
|
|
129
|
+
createDoc: create.asyncThunk(async (args: any, thunkApi: any) => {
|
|
130
|
+
const { createPageAction } = await import("./createPageAction");
|
|
131
|
+
return createPageAction(args, thunkApi);
|
|
132
|
+
}),
|
|
133
|
+
|
|
134
|
+
initDoc: create.asyncThunk(
|
|
135
|
+
async (args: InitDocArgs, { dispatch, rejectWithValue }) => {
|
|
136
|
+
const { pageKey, isReadOnly } = args;
|
|
137
|
+
try {
|
|
138
|
+
const readAction = await (dispatch as any)(readAndWait(pageKey));
|
|
139
|
+
|
|
140
|
+
if (readAndWait.fulfilled.match(readAction) && readAction.payload) {
|
|
141
|
+
const data = readAction.payload as PageData;
|
|
142
|
+
|
|
143
|
+
// docSlice 仅处理 DataType.DOC
|
|
144
|
+
if (data.type !== DataType.DOC) {
|
|
145
|
+
return rejectWithValue(`加载的内容 ${pageKey} 不是文档类型 (${data.type})`);
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
return { ...data, isReadOnly };
|
|
149
|
+
} else {
|
|
150
|
+
const msg =
|
|
151
|
+
(readAction.payload as any)?.message || `无法加载文档 ${pageKey}`;
|
|
152
|
+
return rejectWithValue(msg);
|
|
153
|
+
}
|
|
154
|
+
} catch (e: any) {
|
|
155
|
+
return rejectWithValue(e.message || `初始化文档 ${pageKey} 时出错`);
|
|
156
|
+
}
|
|
157
|
+
},
|
|
158
|
+
{
|
|
159
|
+
pending: (state, action) => {
|
|
160
|
+
Object.assign(state, initialState);
|
|
161
|
+
state.isLoading = true;
|
|
162
|
+
state.pageKey = action.meta.arg.pageKey;
|
|
163
|
+
state.isReadOnly = action.meta.arg.isReadOnly;
|
|
164
|
+
},
|
|
165
|
+
fulfilled: (state, action: PayloadAction<InitDocPayload>) => {
|
|
166
|
+
state.isLoading = false;
|
|
167
|
+
state.isInitialized = true;
|
|
168
|
+
state.error = null;
|
|
169
|
+
state.content = action.payload.content || null;
|
|
170
|
+
state.slateData = action.payload.slateData || null;
|
|
171
|
+
state.lastSavedSlateData = action.payload.slateData || null;
|
|
172
|
+
state.title = action.payload.title || null;
|
|
173
|
+
state.lastSavedTitle = action.payload.title || null;
|
|
174
|
+
state.dbSpaceId = action.payload.spaceId || null;
|
|
175
|
+
state.tags = action.payload.tags || null;
|
|
176
|
+
state.isReadOnly = action.payload.isReadOnly;
|
|
177
|
+
state.pageKey = action.payload.dbKey;
|
|
178
|
+
state.id = action.payload.id;
|
|
179
|
+
state.type = action.payload.type;
|
|
180
|
+
const payload = action.payload as any;
|
|
181
|
+
state.lastSavedAt = payload.updatedAt || payload.updated_at || null;
|
|
182
|
+
state.tools = action.payload.tools || null;
|
|
183
|
+
state.meta = action.payload.meta || null;
|
|
184
|
+
},
|
|
185
|
+
rejected: (state, action) => {
|
|
186
|
+
state.isLoading = false;
|
|
187
|
+
state.isInitialized = true;
|
|
188
|
+
state.error =
|
|
189
|
+
(action.payload as string) ||
|
|
190
|
+
action.error.message ||
|
|
191
|
+
"初始化文档时发生未知错误";
|
|
192
|
+
},
|
|
193
|
+
}
|
|
194
|
+
),
|
|
195
|
+
|
|
196
|
+
updateSlate: create.reducer(
|
|
197
|
+
(state, action: PayloadAction<EditorContent>) => {
|
|
198
|
+
if (state.isInitialized && !state.isReadOnly) {
|
|
199
|
+
state.slateData = action.payload;
|
|
200
|
+
state.justSaved = false;
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
),
|
|
204
|
+
|
|
205
|
+
updateTitle: create.reducer((state, action: PayloadAction<string>) => {
|
|
206
|
+
if (state.isInitialized && !state.isReadOnly) {
|
|
207
|
+
state.title = action.payload;
|
|
208
|
+
state.justSaved = false;
|
|
209
|
+
}
|
|
210
|
+
}),
|
|
211
|
+
|
|
212
|
+
saveDoc: create.asyncThunk(
|
|
213
|
+
async (arg: SaveDocArgs, { dispatch, getState, rejectWithValue }) => {
|
|
214
|
+
const requestedPageKey = arg.pageKey;
|
|
215
|
+
const state = (getState() as any).doc;
|
|
216
|
+
const { pageKey, slateData, dbSpaceId, meta } = state;
|
|
217
|
+
|
|
218
|
+
if (!pageKey || pageKey !== requestedPageKey) {
|
|
219
|
+
return rejectWithValue("内容已切换,取消保存");
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
if (!slateData) {
|
|
223
|
+
return rejectWithValue("内容为空,无法保存");
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
const [
|
|
227
|
+
{ extractTitleFromSlate, extractMentionsFromSlate },
|
|
228
|
+
{ slateToRenderMarkdown },
|
|
229
|
+
{ buildSkillSummaryMarker },
|
|
230
|
+
] = await Promise.all([
|
|
231
|
+
import("../../create/editor/utils/slateUtils"),
|
|
232
|
+
import("../../create/editor/transforms/slateToRenderMarkdown"),
|
|
233
|
+
import("../../ai/skills/skillSummaryMarker"),
|
|
234
|
+
]);
|
|
235
|
+
const title =
|
|
236
|
+
(typeof state.title === "string" && state.title.trim()) ||
|
|
237
|
+
extractTitleFromSlate(slateData) ||
|
|
238
|
+
"未命名页面";
|
|
239
|
+
const tools = extractMentionsFromSlate(slateData);
|
|
240
|
+
const skillSummary = buildSkillSummaryMarker(meta);
|
|
241
|
+
// `content` 是只读展示缓存,保存时从当前 Slate 重新生成。
|
|
242
|
+
const content = slateToRenderMarkdown(slateData);
|
|
243
|
+
const now = new Date();
|
|
244
|
+
const updatedAt = formatISO(now);
|
|
245
|
+
|
|
246
|
+
try {
|
|
247
|
+
await (dispatch as (action: any) => any)(
|
|
248
|
+
patch({
|
|
249
|
+
dbKey: pageKey,
|
|
250
|
+
changes: {
|
|
251
|
+
updatedAt,
|
|
252
|
+
slateData,
|
|
253
|
+
title,
|
|
254
|
+
tools,
|
|
255
|
+
content,
|
|
256
|
+
...(meta ? { meta } : {}),
|
|
257
|
+
},
|
|
258
|
+
})
|
|
259
|
+
).unwrap();
|
|
260
|
+
|
|
261
|
+
if (dbSpaceId) {
|
|
262
|
+
await (dispatch as (action: any) => any)(
|
|
263
|
+
(updateContentTitle as any)({
|
|
264
|
+
spaceId: dbSpaceId,
|
|
265
|
+
contentKey: pageKey,
|
|
266
|
+
title,
|
|
267
|
+
skillSummary,
|
|
268
|
+
})
|
|
269
|
+
).unwrap();
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
if (typeof window !== "undefined") {
|
|
273
|
+
window.dispatchEvent(new Event("nolo-user-data-updated"));
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
return { updatedAt, title, savedContent: slateData, content };
|
|
277
|
+
} catch (e: any) {
|
|
278
|
+
return rejectWithValue(e.message || "保存失败");
|
|
279
|
+
}
|
|
280
|
+
},
|
|
281
|
+
{
|
|
282
|
+
pending: (state) => {
|
|
283
|
+
state.isSaving = true;
|
|
284
|
+
state.saveError = null;
|
|
285
|
+
state.justSaved = false;
|
|
286
|
+
},
|
|
287
|
+
fulfilled: (
|
|
288
|
+
state,
|
|
289
|
+
action: PayloadAction<{
|
|
290
|
+
updatedAt: string;
|
|
291
|
+
title: string;
|
|
292
|
+
savedContent: any;
|
|
293
|
+
content: string;
|
|
294
|
+
}>
|
|
295
|
+
) => {
|
|
296
|
+
state.isSaving = false;
|
|
297
|
+
state.lastSavedAt = action.payload.updatedAt;
|
|
298
|
+
state.title = action.payload.title;
|
|
299
|
+
state.content = action.payload.content;
|
|
300
|
+
state.lastSavedSlateData = action.payload.savedContent;
|
|
301
|
+
state.lastSavedTitle = action.payload.title;
|
|
302
|
+
state.justSaved = true;
|
|
303
|
+
},
|
|
304
|
+
rejected: (state, action) => {
|
|
305
|
+
state.isSaving = false;
|
|
306
|
+
state.saveError =
|
|
307
|
+
(action.payload as string) || action.error.message || "未知错误";
|
|
308
|
+
state.justSaved = false;
|
|
309
|
+
},
|
|
310
|
+
}
|
|
311
|
+
),
|
|
312
|
+
|
|
313
|
+
resetJustSavedStatus: create.reducer((state) => {
|
|
314
|
+
state.justSaved = false;
|
|
315
|
+
}),
|
|
316
|
+
|
|
317
|
+
setDocFocusContext: create.reducer(
|
|
318
|
+
(state, action: PayloadAction<DocState["focusContext"]>) => {
|
|
319
|
+
state.focusContext = action.payload;
|
|
320
|
+
}
|
|
321
|
+
),
|
|
322
|
+
|
|
323
|
+
toggleReadOnly: create.reducer((state) => {
|
|
324
|
+
state.isReadOnly = !state.isReadOnly;
|
|
325
|
+
}),
|
|
326
|
+
setReadOnly: create.reducer((state, action: PayloadAction<boolean>) => {
|
|
327
|
+
state.isReadOnly = action.payload;
|
|
328
|
+
}),
|
|
329
|
+
resetDoc: create.reducer((state) => {
|
|
330
|
+
Object.assign(state, initialState);
|
|
331
|
+
}),
|
|
332
|
+
updateDocTags: create.reducer((state, action: PayloadAction<string[]>) => {
|
|
333
|
+
if (state.isInitialized) state.tags = action.payload;
|
|
334
|
+
}),
|
|
335
|
+
previewDoc: create.reducer((state, action: PayloadAction<any>) => {
|
|
336
|
+
Object.assign(state, initialState);
|
|
337
|
+
state.isInitialized = true;
|
|
338
|
+
state.isLoading = false;
|
|
339
|
+
state.isReadOnly = true;
|
|
340
|
+
state.slateData = action.payload.slateData;
|
|
341
|
+
state.title = action.payload.title;
|
|
342
|
+
state.lastSavedTitle = action.payload.title;
|
|
343
|
+
state.pageKey = action.payload.dbKey;
|
|
344
|
+
state.id = action.payload.id;
|
|
345
|
+
state.type = action.payload.type || DataType.DOC;
|
|
346
|
+
state.lastSavedSlateData = action.payload.slateData;
|
|
347
|
+
state.tags = action.payload.tags || null;
|
|
348
|
+
state.dbSpaceId = action.payload.spaceId;
|
|
349
|
+
state.content = action.payload.content || null;
|
|
350
|
+
state.meta = action.payload.meta || null;
|
|
351
|
+
}),
|
|
352
|
+
}),
|
|
353
|
+
});
|
|
354
|
+
|
|
355
|
+
export const {
|
|
356
|
+
createDoc,
|
|
357
|
+
initDoc,
|
|
358
|
+
updateSlate,
|
|
359
|
+
updateTitle,
|
|
360
|
+
saveDoc,
|
|
361
|
+
resetJustSavedStatus,
|
|
362
|
+
setDocFocusContext,
|
|
363
|
+
toggleReadOnly,
|
|
364
|
+
setReadOnly,
|
|
365
|
+
resetDoc,
|
|
366
|
+
updateDocTags,
|
|
367
|
+
previewDoc,
|
|
368
|
+
} = docSlice.actions;
|
|
369
|
+
|
|
370
|
+
const selectDocState = (state: any) => state.doc;
|
|
371
|
+
|
|
372
|
+
export const selectDoc = (state: any) => state.doc;
|
|
373
|
+
|
|
374
|
+
export const selectSlateData = createSelector(
|
|
375
|
+
[selectDocState],
|
|
376
|
+
(doc) => doc.slateData
|
|
377
|
+
);
|
|
378
|
+
|
|
379
|
+
export const selectDocIsLoading = createSelector(
|
|
380
|
+
[selectDocState],
|
|
381
|
+
(doc) => doc.isLoading
|
|
382
|
+
);
|
|
383
|
+
|
|
384
|
+
export const selectIsReadOnly = createSelector(
|
|
385
|
+
[selectDocState],
|
|
386
|
+
(doc) => doc.isReadOnly
|
|
387
|
+
);
|
|
388
|
+
|
|
389
|
+
export const selectDocIsInitialized = createSelector(
|
|
390
|
+
[selectDocState],
|
|
391
|
+
(doc) => doc.isInitialized
|
|
392
|
+
);
|
|
393
|
+
|
|
394
|
+
export const selectDocError = createSelector(
|
|
395
|
+
[selectDocState],
|
|
396
|
+
(doc) => doc.error
|
|
397
|
+
);
|
|
398
|
+
|
|
399
|
+
export const selectIsSaving = createSelector(
|
|
400
|
+
[selectDocState],
|
|
401
|
+
(doc) => doc.isSaving
|
|
402
|
+
);
|
|
403
|
+
|
|
404
|
+
export const selectSaveError = createSelector(
|
|
405
|
+
[selectDocState],
|
|
406
|
+
(doc) => doc.saveError
|
|
407
|
+
);
|
|
408
|
+
|
|
409
|
+
export const selectJustSaved = createSelector(
|
|
410
|
+
[selectDocState],
|
|
411
|
+
(doc) => doc.justSaved
|
|
412
|
+
);
|
|
413
|
+
|
|
414
|
+
export const selectDocTitle = createSelector(
|
|
415
|
+
[selectDocState],
|
|
416
|
+
(doc) => doc.title
|
|
417
|
+
);
|
|
418
|
+
|
|
419
|
+
export const selectHasPendingChanges = createSelector(
|
|
420
|
+
[
|
|
421
|
+
selectSlateData,
|
|
422
|
+
(state: any) => state.doc.lastSavedSlateData,
|
|
423
|
+
selectDocTitle,
|
|
424
|
+
(state: any) => state.doc.lastSavedTitle,
|
|
425
|
+
selectIsReadOnly,
|
|
426
|
+
selectDocIsInitialized,
|
|
427
|
+
],
|
|
428
|
+
(slateData, lastSavedSlateData, title, lastSavedTitle, isReadOnly, isInitialized) => {
|
|
429
|
+
if (!isInitialized || isReadOnly) return false;
|
|
430
|
+
return (
|
|
431
|
+
hasSlateContentChanged(slateData, lastSavedSlateData) ||
|
|
432
|
+
(title || "") !== (lastSavedTitle || "")
|
|
433
|
+
);
|
|
434
|
+
}
|
|
435
|
+
);
|
|
436
|
+
|
|
437
|
+
export const selectDocSpaceId = createSelector(
|
|
438
|
+
[selectDocState],
|
|
439
|
+
(doc) => doc.dbSpaceId
|
|
440
|
+
);
|
|
441
|
+
|
|
442
|
+
export const selectDocId = createSelector(
|
|
443
|
+
[selectDocState],
|
|
444
|
+
(doc) => doc.id
|
|
445
|
+
);
|
|
446
|
+
|
|
447
|
+
export const selectDocKey = createSelector(
|
|
448
|
+
[selectDocState],
|
|
449
|
+
(doc) => doc.pageKey
|
|
450
|
+
);
|
|
451
|
+
|
|
452
|
+
export const selectDocTags = createSelector(
|
|
453
|
+
[selectDocState],
|
|
454
|
+
(doc) => doc.tags
|
|
455
|
+
);
|
|
456
|
+
|
|
457
|
+
export const selectDocFocusContext = createSelector(
|
|
458
|
+
[selectDocState],
|
|
459
|
+
(doc) => doc.focusContext
|
|
460
|
+
);
|
|
461
|
+
|
|
462
|
+
export const selectLastSavedAt = createSelector(
|
|
463
|
+
[selectDocState],
|
|
464
|
+
(doc) => doc.lastSavedAt
|
|
465
|
+
);
|
|
466
|
+
|
|
467
|
+
export default docSlice.reducer;
|
|
468
|
+
export const docListenerMiddleware = createListenerMiddleware();
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { DataType } from "../../create/types"; // 确认路径
|
|
2
|
+
import type { PageSkillMetadata } from "../../ai/skills/skillDocProtocol";
|
|
3
|
+
|
|
4
|
+
export interface PageData {
|
|
5
|
+
id: string; // 通常与 pageKey 中的 id 部分相同
|
|
6
|
+
dbKey: string; // pageKey (例如 'page-userid-ulid')
|
|
7
|
+
type: DataType.DOC | DataType.FILE | DataType.IMAGE;
|
|
8
|
+
title: string;
|
|
9
|
+
content?: string | null; // 只读展示 markdown 缓存 / legacy bridge,不是真源
|
|
10
|
+
slateData?: any | null; // 文档真源
|
|
11
|
+
spaceId: string | null; // 页面所属的 spaceId, null 表示不在任何空间
|
|
12
|
+
tags?: string[]; // 页面的标签
|
|
13
|
+
created: string; // ISO 格式创建时间
|
|
14
|
+
updated_at?: string; // ISO 格式更新时间 (可选)
|
|
15
|
+
tools?: string[]; // 关联的工具列表
|
|
16
|
+
meta?: PageSkillMetadata;
|
|
17
|
+
}
|