@promptbook/website-crawler 0.112.0-65 → 0.112.0-69
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 +3 -3
- package/esm/index.es.js +581 -545
- package/esm/index.es.js.map +1 -1
- package/esm/src/_packages/core.index.d.ts +2 -0
- package/esm/src/avatars/AvatarOrImage.d.ts +2 -1
- package/esm/src/avatars/avatarRenderingUtils.d.ts +1 -1
- package/esm/src/avatars/renderAvatarVisual.d.ts +1 -2
- package/esm/src/avatars/types/AvatarDefinition.d.ts +2 -1
- package/esm/src/avatars/types/AvatarVisualDefinition.d.ts +3 -2
- package/esm/src/avatars/visuals/minecraft2AvatarVisual.d.ts +7 -0
- package/esm/src/avatars/visuals/minecraftAvatarVisualShared.d.ts +48 -0
- package/esm/src/book-2.0/agent-source/AgentBasicInformation.d.ts +5 -1
- package/esm/src/book-2.0/agent-source/AgentModelRequirements.d.ts +3 -2
- package/esm/src/book-2.0/agent-source/AgentSourceParseResult.d.ts +1 -1
- package/esm/src/book-2.0/agent-source/computeAgentHash.d.ts +2 -2
- package/esm/src/book-2.0/agent-source/createAgentModelRequirements.d.ts +4 -1
- package/esm/src/book-2.0/agent-source/createAgentModelRequirementsWithCommitments.d.ts +1 -1
- package/esm/src/book-2.0/agent-source/createDefaultAgentName.d.ts +2 -2
- package/esm/src/book-2.0/agent-source/normalizeAgentName.d.ts +1 -1
- package/esm/src/book-2.0/agent-source/parseAgentSourcePrelude.d.ts +1 -1
- package/esm/src/book-2.0/agent-source/parseTeamCommitment.d.ts +1 -1
- package/esm/src/book-2.0/book-language-documentation/createStandaloneBookLanguageMarkdown.d.ts +1 -1
- package/esm/src/book-2.0/utils/generatePlaceholderAgentProfileImageUrl.d.ts +3 -1
- package/esm/src/book-3.0/Book.d.ts +33 -0
- package/esm/src/book-3.0/Book.test.d.ts +1 -0
- package/esm/src/book-components/AvatarProfile/AvatarChip/AvatarChip.d.ts +1 -1
- package/esm/src/book-components/AvatarProfile/AvatarProfile/AvatarProfile.d.ts +1 -1
- package/esm/src/book-components/BookEditor/BookEditor.d.ts +4 -1
- package/esm/src/book-components/BookEditor/BookEditorActionbar.d.ts +1 -1
- package/esm/src/book-components/Chat/AgentChip/AgentChip.d.ts +1 -1
- package/esm/src/book-components/Chat/Chat/ChatMessageItem.d.ts +2 -2
- package/esm/src/book-components/Chat/Chat/ChatMessageList.d.ts +1 -1
- package/esm/src/book-components/Chat/Chat/ChatMessageRichContent.d.ts +1 -1
- package/esm/src/book-components/Chat/Chat/ChatProps.d.ts +4 -4
- package/esm/src/book-components/Chat/Chat/ChatRatingModal.d.ts +1 -1
- package/esm/src/book-components/Chat/Chat/ChatToolCallModalContent.d.ts +2 -2
- package/esm/src/book-components/Chat/Chat/TeamToolCallModalContent.d.ts +2 -2
- package/esm/src/book-components/Chat/Chat/createChatMessageToolCallRenderModel.d.ts +2 -2
- package/esm/src/book-components/Chat/Chat/renderToolCallDetails.d.ts +1 -1
- package/esm/src/book-components/Chat/Chat/resolveRunBrowserToolCallDetailsState.d.ts +1 -1
- package/esm/src/book-components/Chat/Chat/useChatInputAreaDictation.d.ts +1 -1
- package/esm/src/book-components/Chat/Chat/useChatInputAreaDictationPersistence.d.ts +1 -1
- package/esm/src/book-components/Chat/Chat/useChatInputAreaDictationSupport.d.ts +1 -1
- package/esm/src/book-components/Chat/Chat/useChatToolCallModalState.d.ts +3 -3
- package/esm/src/book-components/Chat/LlmChat/LlmChatProps.d.ts +2 -2
- package/esm/src/book-components/Chat/LlmChat/useLlmChatMessageHandler.d.ts +1 -1
- package/esm/src/book-components/Chat/MarkdownContent/MarkdownContent.d.ts +1 -1
- package/esm/src/book-components/Chat/hooks/useChatRatings.d.ts +2 -2
- package/esm/src/book-components/Chat/save/_common/ChatSaveFormatDefinition.d.ts +2 -1
- package/esm/src/book-components/Chat/types/ChatMessage.d.ts +6 -2
- package/esm/src/book-components/Chat/types/ChatParticipant.d.ts +5 -3
- package/esm/src/book-components/Chat/utils/citationHelpers.d.ts +1 -1
- package/esm/src/book-components/Chat/utils/collectTeamToolCallSummary.d.ts +1 -1
- package/esm/src/book-components/Chat/utils/createCitationFootnoteRenderModel.d.ts +1 -1
- package/esm/src/book-components/Chat/utils/getToolCallChipletInfo.d.ts +2 -2
- package/esm/src/book-components/Chat/utils/loadAgentProfile.d.ts +2 -1
- package/esm/src/book-components/Chat/utils/resolveCitationUrl.d.ts +1 -1
- package/esm/src/book-components/PromptbookAgent/PromptbookAgentIntegration.d.ts +1 -1
- package/esm/src/book-components/PromptbookAgent/PromptbookAgentSeamlessIntegration.d.ts +1 -1
- package/esm/src/book-components/Qr/useQrCode.d.ts +1 -1
- package/esm/src/book-components/_common/react-utils/classNames.d.ts +1 -1
- package/esm/src/cli/cli-commands/coder/ensureCoderGitignoreFile.d.ts +1 -1
- package/esm/src/cli/cli-commands/coder/initializeCoderProjectConfiguration.d.ts +1 -1
- package/esm/src/cli/cli-commands/common/promptRunnerCliOptions.d.ts +1 -1
- package/esm/src/cli/common/$provideLlmToolsForCli.d.ts +1 -1
- package/esm/src/collection/agent-collection/constructors/agent-collection-in-supabase/AgentCollectionInSupabase.d.ts +3 -3
- package/esm/src/collection/agent-collection/constructors/agent-collection-in-supabase/prepareAgentSourceForPersistence.d.ts +1 -1
- package/esm/src/collection/pipeline-collection/PipelineCollection.d.ts +1 -1
- package/esm/src/collection/pipeline-collection/SimplePipelineCollection.d.ts +1 -1
- package/esm/src/collection/pipeline-collection/constructors/createPipelineCollectionFromDirectory.d.ts +2 -1
- package/esm/src/collection/pipeline-collection/constructors/createPipelineCollectionFromUrl.d.ts +1 -1
- package/esm/src/collection/pipeline-collection/constructors/createPipelineSubcollection.d.ts +1 -1
- package/esm/src/commands/BOOK_VERSION/BookVersionCommand.d.ts +1 -1
- package/esm/src/commands/FOREACH/ForeachJson.d.ts +1 -1
- package/esm/src/commands/JOKER/JokerCommand.d.ts +1 -1
- package/esm/src/commands/KNOWLEDGE/KnowledgeCommand.d.ts +1 -1
- package/esm/src/commands/KNOWLEDGE/utils/knowledgeSourceContentToName.d.ts +2 -2
- package/esm/src/commands/PARAMETER/ParameterCommand.d.ts +2 -2
- package/esm/src/commands/PERSONA/PersonaCommand.d.ts +2 -2
- package/esm/src/commands/POSTPROCESS/PostprocessCommand.d.ts +1 -1
- package/esm/src/commands/_common/parseCommand.d.ts +1 -1
- package/esm/src/commands/_common/stringifyCommand.d.ts +1 -1
- package/esm/src/commands/_common/types/CommandParser.d.ts +2 -1
- package/esm/src/commitments/MEMORY/MEMORY.d.ts +2 -2
- package/esm/src/commitments/MEMORY/MemoryToolRuntimeAdapter.d.ts +1 -1
- package/esm/src/commitments/MEMORY/createMemoryToolFunctions.d.ts +1 -1
- package/esm/src/commitments/MEMORY/getMemoryToolTitles.d.ts +1 -1
- package/esm/src/commitments/MEMORY/resolveMemoryRuntimeContext.d.ts +1 -1
- package/esm/src/commitments/TEAM/TEAM.d.ts +2 -2
- package/esm/src/commitments/USE_BROWSER/USE_BROWSER.d.ts +2 -2
- package/esm/src/commitments/USE_BROWSER/resolveRunBrowserToolForNode.d.ts +1 -1
- package/esm/src/commitments/USE_CALENDAR/USE_CALENDAR.d.ts +1 -1
- package/esm/src/commitments/USE_CALENDAR/createUseCalendarToolFunctions.d.ts +1 -1
- package/esm/src/commitments/USE_CALENDAR/getUseCalendarToolTitles.d.ts +1 -1
- package/esm/src/commitments/USE_CALENDAR/resolveUseCalendarToolRuntimeOrWalletCredentialResult.d.ts +1 -1
- package/esm/src/commitments/USE_DEEPSEARCH/USE_DEEPSEARCH.d.ts +2 -2
- package/esm/src/commitments/USE_EMAIL/USE_EMAIL.d.ts +2 -2
- package/esm/src/commitments/USE_EMAIL/resolveSendEmailToolForNode.d.ts +1 -1
- package/esm/src/commitments/USE_POPUP/USE_POPUP.d.ts +2 -2
- package/esm/src/commitments/USE_PRIVACY/USE_PRIVACY.d.ts +2 -2
- package/esm/src/commitments/USE_PROJECT/USE_PROJECT.d.ts +1 -1
- package/esm/src/commitments/USE_PROJECT/createUseProjectToolFunctions.d.ts +1 -1
- package/esm/src/commitments/USE_PROJECT/getUseProjectToolTitles.d.ts +1 -1
- package/esm/src/commitments/USE_PROJECT/resolveUseProjectToolRuntimeOrWalletCredentialResult.d.ts +1 -1
- package/esm/src/commitments/USE_SEARCH_ENGINE/USE_SEARCH_ENGINE.d.ts +2 -2
- package/esm/src/commitments/USE_SPAWN/USE_SPAWN.d.ts +2 -2
- package/esm/src/commitments/USE_SPAWN/resolveSpawnAgentToolForNode.d.ts +1 -1
- package/esm/src/commitments/USE_TIME/USE_TIME.d.ts +2 -2
- package/esm/src/commitments/USE_TIMEOUT/TimeoutToolRuntimeAdapter.d.ts +1 -1
- package/esm/src/commitments/USE_TIMEOUT/USE_TIMEOUT.d.ts +2 -2
- package/esm/src/commitments/USE_TIMEOUT/createTimeoutToolFunctions.d.ts +1 -1
- package/esm/src/commitments/USE_TIMEOUT/resolveTimeoutRuntimeContext.d.ts +1 -1
- package/esm/src/commitments/USE_USER_LOCATION/USE_USER_LOCATION.d.ts +2 -2
- package/esm/src/commitments/WALLET/WALLET.d.ts +2 -2
- package/esm/src/commitments/WALLET/WalletToolRuntimeAdapter.d.ts +1 -1
- package/esm/src/commitments/WALLET/createWalletToolFunctions.d.ts +1 -1
- package/esm/src/commitments/WALLET/getWalletToolTitles.d.ts +1 -1
- package/esm/src/commitments/WALLET/resolveWalletRuntimeContext.d.ts +1 -1
- package/esm/src/commitments/_base/BaseCommitmentDefinition.d.ts +2 -2
- package/esm/src/commitments/_base/CommitmentDefinition.d.ts +2 -2
- package/esm/src/commitments/_common/commitmentToolFunctions.d.ts +2 -2
- package/esm/src/commitments/_common/createSerpSearchToolFunction.d.ts +1 -1
- package/esm/src/commitments/_common/getAllCommitmentsToolFunctionsForNode.d.ts +1 -1
- package/esm/src/commitments/_common/getAllCommitmentsToolTitles.d.ts +1 -1
- package/esm/src/commitments/_common/getGroupedCommitmentDefinitions.d.ts +1 -1
- package/esm/src/commitments/_common/toolExecutionEnvelope.d.ts +1 -1
- package/esm/src/commitments/_common/toolRuntimeContext.d.ts +1 -1
- package/esm/src/config.d.ts +8 -4
- package/esm/src/conversion/archive/loadArchive.d.ts +1 -1
- package/esm/src/conversion/archive/saveArchive.d.ts +1 -1
- package/esm/src/conversion/prettify/renderPipelineMermaidOptions.d.ts +1 -1
- package/esm/src/conversion/utils/extractParameterNamesFromTask.d.ts +1 -1
- package/esm/src/errors/PipelineExecutionError.d.ts +1 -1
- package/esm/src/errors/utils/ErrorJson.d.ts +1 -1
- package/esm/src/executables/apps/locateLibreoffice.d.ts +1 -1
- package/esm/src/executables/apps/locatePandoc.d.ts +1 -1
- package/esm/src/executables/apps/locateVscode.d.ts +1 -1
- package/esm/src/executables/browsers/locateBrowser.d.ts +1 -1
- package/esm/src/executables/browsers/locateChrome.d.ts +1 -1
- package/esm/src/executables/browsers/locateDefaultSystemBrowser.d.ts +1 -1
- package/esm/src/executables/browsers/locateEdge.d.ts +1 -1
- package/esm/src/executables/browsers/locateFirefox.d.ts +1 -1
- package/esm/src/executables/browsers/locateInternetExplorer.d.ts +1 -1
- package/esm/src/executables/browsers/locateSafari.d.ts +1 -1
- package/esm/src/executables/locateApp.d.ts +1 -1
- package/esm/src/executables/platforms/locateAppOnLinux.d.ts +1 -1
- package/esm/src/executables/platforms/locateAppOnMacOs.d.ts +1 -1
- package/esm/src/executables/platforms/locateAppOnWindows.d.ts +1 -1
- package/esm/src/execution/AbstractTaskResult.d.ts +1 -1
- package/esm/src/execution/AvailableModel.d.ts +5 -1
- package/esm/src/execution/CommonToolsOptions.d.ts +1 -1
- package/esm/src/execution/Executables.d.ts +1 -1
- package/esm/src/execution/ExecutionTask.d.ts +3 -2
- package/esm/src/execution/LlmExecutionTools.d.ts +2 -1
- package/esm/src/execution/PipelineExecutor.d.ts +1 -1
- package/esm/src/execution/PipelineExecutorResult.d.ts +2 -2
- package/esm/src/execution/PromptResult.d.ts +3 -1
- package/esm/src/execution/PromptbookFetch.d.ts +1 -1
- package/esm/src/execution/ScriptExecutionTools.d.ts +2 -2
- package/esm/src/execution/UncertainNumber.d.ts +2 -2
- package/esm/src/execution/UserInterfaceTools.d.ts +1 -2
- package/esm/src/execution/createPipelineExecutor/10-executePipeline.d.ts +1 -1
- package/esm/src/execution/createPipelineExecutor/20-executeTask.d.ts +1 -1
- package/esm/src/execution/createPipelineExecutor/40-executeAttempts.d.ts +2 -1
- package/esm/src/execution/createPipelineExecutor/filterJustOutputParameters.d.ts +1 -1
- package/esm/src/execution/createPipelineExecutor/getContextForTask.d.ts +2 -2
- package/esm/src/execution/createPipelineExecutor/getExamplesForTask.d.ts +2 -2
- package/esm/src/execution/createPipelineExecutor/getKnowledgeForTask.d.ts +3 -1
- package/esm/src/execution/createPipelineExecutor/getReservedParametersForTask.d.ts +1 -2
- package/esm/src/execution/execution-report/ExecutionReportJson.d.ts +3 -3
- package/esm/src/execution/execution-report/ExecutionReportStringOptions.d.ts +1 -1
- package/esm/src/execution/utils/usageToHuman.d.ts +1 -1
- package/esm/src/execution/utils/validatePromptResult.d.ts +1 -1
- package/esm/src/file-security-checkers/FileSecurityCheckResult.d.ts +2 -1
- package/esm/src/file-security-checkers/FileSecurityChecker.d.ts +3 -1
- package/esm/src/file-security-checkers/virustotal/VirusTotalFileSecurityChecker.d.ts +1 -1
- package/esm/src/formats/_common/FormatParser.d.ts +2 -2
- package/esm/src/formats/_common/FormatSubvalueParser.d.ts +2 -3
- package/esm/src/formats/csv/utils/csvParse.d.ts +1 -1
- package/esm/src/formfactors/_common/AbstractFormfactorDefinition.d.ts +2 -3
- package/esm/src/import-plugins/FileImportPlugin.d.ts +1 -1
- package/esm/src/llm-providers/_common/register/$provideEnvFilename.d.ts +1 -1
- package/esm/src/llm-providers/_common/register/$provideLlmToolsForWizardOrCli.d.ts +3 -2
- package/esm/src/llm-providers/_common/register/$registeredLlmToolsMessage.d.ts +2 -1
- package/esm/src/llm-providers/_common/register/LlmToolsConfiguration.d.ts +1 -1
- package/esm/src/llm-providers/_common/register/LlmToolsMetadata.d.ts +2 -1
- package/esm/src/llm-providers/_common/register/createLlmToolsFromConfiguration.d.ts +3 -1
- package/esm/src/llm-providers/_common/utils/assertUniqueModels.d.ts +1 -1
- package/esm/src/llm-providers/_common/utils/cache/CacheItem.d.ts +2 -2
- package/esm/src/llm-providers/_multiple/MultipleLlmExecutionTools.d.ts +2 -1
- package/esm/src/llm-providers/_multiple/joinLlmExecutionTools.d.ts +2 -1
- package/esm/src/llm-providers/agent/Agent.d.ts +6 -2
- package/esm/src/llm-providers/agent/AgentLlmExecutionTools.d.ts +3 -1
- package/esm/src/llm-providers/agent/RemoteAgent.d.ts +2 -2
- package/esm/src/llm-providers/agent/RemoteAgentOptions.d.ts +1 -1
- package/esm/src/llm-providers/anthropic-claude/AnthropicClaudeExecutionTools.d.ts +2 -1
- package/esm/src/llm-providers/anthropic-claude/anthropic-claude-models.d.ts +1 -1
- package/esm/src/llm-providers/azure-openai/AzureOpenAiExecutionTools.d.ts +2 -1
- package/esm/src/llm-providers/azure-openai/AzureOpenAiExecutionToolsOptions.d.ts +2 -3
- package/esm/src/llm-providers/deepseek/deepseek-models.d.ts +1 -1
- package/esm/src/llm-providers/google/google-models.d.ts +1 -1
- package/esm/src/llm-providers/mocked/$fakeTextToExpectations.d.ts +1 -1
- package/esm/src/llm-providers/mocked/MockedEchoLlmExecutionTools.d.ts +2 -1
- package/esm/src/llm-providers/mocked/MockedFackedLlmExecutionTools.d.ts +2 -1
- package/esm/src/llm-providers/ollama/OllamaExecutionTools.d.ts +2 -1
- package/esm/src/llm-providers/openai/OpenAiAgentKitExecutionTools.d.ts +3 -2
- package/esm/src/llm-providers/openai/OpenAiAgentKitExecutionToolsOptions.d.ts +1 -1
- package/esm/src/llm-providers/openai/OpenAiAssistantExecutionTools.d.ts +3 -1
- package/esm/src/llm-providers/openai/OpenAiAssistantExecutionToolsOptions.d.ts +1 -1
- package/esm/src/llm-providers/openai/OpenAiCompatibleExecutionTools.d.ts +3 -1
- package/esm/src/llm-providers/openai/OpenAiExecutionTools.d.ts +2 -1
- package/esm/src/llm-providers/openai/OpenAiVectorStoreHandler.d.ts +2 -2
- package/esm/src/llm-providers/openai/createOpenAiCompatibleExecutionTools.d.ts +3 -1
- package/esm/src/llm-providers/openai/utils/OpenAiCompatibleUnsupportedParameterRetrier.d.ts +1 -1
- package/esm/src/llm-providers/openai/utils/callOpenAiCompatibleChatModel.d.ts +2 -1
- package/esm/src/llm-providers/remote/RemoteLlmExecutionTools.d.ts +2 -1
- package/esm/src/other/templates/getBookTemplates.d.ts +1 -1
- package/esm/src/personas/preparePersona.d.ts +1 -1
- package/esm/src/pipeline/PipelineJson/CommonTaskJson.d.ts +4 -8
- package/esm/src/pipeline/PipelineJson/Expectations.d.ts +1 -2
- package/esm/src/pipeline/PipelineJson/KnowledgePieceJson.d.ts +4 -6
- package/esm/src/pipeline/PipelineJson/KnowledgeSourceJson.d.ts +3 -3
- package/esm/src/pipeline/PipelineJson/ParameterJson.d.ts +2 -3
- package/esm/src/pipeline/PipelineJson/PersonaJson.d.ts +3 -3
- package/esm/src/pipeline/PipelineJson/PipelineJson.d.ts +6 -9
- package/esm/src/pipeline/PipelineJson/PreparationJson.d.ts +1 -1
- package/esm/src/pipeline/PipelineJson/PromptTaskJson.d.ts +1 -1
- package/esm/src/pipeline/prompt-notation.d.ts +1 -1
- package/esm/src/postprocessing/utils/extractBlock.d.ts +1 -1
- package/esm/src/postprocessing/utils/extractJsonBlock.d.ts +1 -2
- package/esm/src/prepare/PrepareAndScrapeOptions.d.ts +1 -1
- package/esm/src/remote-server/socket-types/_subtypes/Identification.d.ts +2 -2
- package/esm/src/remote-server/socket-types/_subtypes/identificationToPromptbookToken.d.ts +1 -1
- package/esm/src/remote-server/socket-types/_subtypes/promptbookTokenToIdentification.d.ts +1 -1
- package/esm/src/remote-server/startAgentServer.d.ts +1 -1
- package/esm/src/remote-server/types/RemoteClientOptions.d.ts +1 -1
- package/esm/src/remote-server/types/RemoteServerOptions.d.ts +2 -1
- package/esm/src/scrapers/_common/Scraper.d.ts +4 -4
- package/esm/src/scrapers/_common/ScraperIntermediateSource.d.ts +1 -1
- package/esm/src/scrapers/_common/register/$registeredScrapersMessage.d.ts +1 -1
- package/esm/src/scrapers/_common/register/ScraperAndConverterMetadata.d.ts +3 -1
- package/esm/src/scrapers/_common/utils/getScraperIntermediateSource.d.ts +1 -1
- package/esm/src/scrapers/website/WebsiteScraper.d.ts +2 -3
- package/esm/src/scripting/javascript/JavascriptExecutionToolsOptions.d.ts +2 -2
- package/esm/src/scripting/javascript/utils/extractVariablesFromJavascript.d.ts +2 -2
- package/esm/src/search-engines/SearchEngine.d.ts +2 -1
- package/esm/src/search-engines/SearchResult.d.ts +1 -1
- package/esm/src/search-engines/bing/BingSearchEngine.d.ts +2 -1
- package/esm/src/search-engines/dummy/DummySearchEngine.d.ts +2 -1
- package/esm/src/search-engines/google/GoogleSearchEngine.d.ts +2 -1
- package/esm/src/search-engines/serp/SerpSearchEngine.d.ts +2 -1
- package/esm/src/storage/file-cache-storage/FileCacheStorageOptions.d.ts +1 -1
- package/esm/src/storage/file-cache-storage/utils/nameToSubfolderPath.d.ts +1 -1
- package/esm/src/storage/local-storage/utils/IndexedDbStorageOptions.d.ts +1 -1
- package/esm/src/transpilers/_common/BookTranspiler.d.ts +4 -2
- package/esm/src/transpilers/_common/createTranspiledTeamRuntimeSection.d.ts +1 -1
- package/esm/src/transpilers/_common/formatUsedToolFunctions.d.ts +1 -1
- package/esm/src/transpilers/agent-os/AgentOsTranspiler.d.ts +1 -1
- package/esm/src/transpilers/anthropic-claude-managed/AnthropicClaudeManagedTranspiler.d.ts +1 -1
- package/esm/src/transpilers/anthropic-claude-sdk/AnthropicClaudeSdkTranspiler.d.ts +1 -1
- package/esm/src/transpilers/e2b/E2BTranspiler.d.ts +1 -1
- package/esm/src/transpilers/formatted-book-in-markdown/FormattedBookInMarkdownTranspiler.d.ts +1 -1
- package/esm/src/transpilers/openai-agents/OpenAiAgentsTranspiler.d.ts +1 -1
- package/esm/src/transpilers/openai-sdk/OpenAiSdkTranspiler.d.ts +1 -1
- package/esm/src/types/LlmCall.d.ts +1 -1
- package/esm/src/types/LlmToolDefinition.d.ts +2 -1
- package/esm/src/types/Message.d.ts +4 -3
- package/esm/src/types/ModelRequirements.d.ts +4 -2
- package/esm/src/types/Prompt.d.ts +7 -12
- package/esm/src/types/SpeechRecognition.d.ts +1 -1
- package/esm/src/types/ToolCall.d.ts +1 -1
- package/esm/src/types/string_email.d.ts +1 -1
- package/esm/src/types/string_host.d.ts +1 -1
- package/esm/src/types/string_person_fullname.d.ts +1 -1
- package/esm/src/types/string_token.d.ts +1 -1
- package/esm/src/utils/agents/resolveAgentAvatarImageUrl.d.ts +2 -1
- package/esm/src/utils/color/Color.d.ts +2 -1
- package/esm/src/utils/color/internal-utils/hslToRgb.d.ts +2 -3
- package/esm/src/utils/color/internal-utils/rgbToHsl.d.ts +2 -3
- package/esm/src/utils/color/operators/darken.d.ts +1 -1
- package/esm/src/utils/color/operators/grayscale.d.ts +1 -1
- package/esm/src/utils/color/operators/lighten.d.ts +1 -1
- package/esm/src/utils/color/operators/mixWithColor.d.ts +1 -1
- package/esm/src/utils/color/operators/saturate.d.ts +1 -1
- package/esm/src/utils/color/parsers/parseHexColor.d.ts +1 -1
- package/esm/src/utils/color/parsers/parseHslColor.d.ts +1 -1
- package/esm/src/utils/color/parsers/parseRgbColor.d.ts +1 -1
- package/esm/src/utils/color/utils/colorToDataUrl.d.ts +3 -1
- package/esm/src/utils/editable/edit-pipeline-string/addPipelineCommand.d.ts +1 -1
- package/esm/src/utils/editable/types/PipelineEditableSerialized.d.ts +1 -1
- package/esm/src/utils/editable/utils/renamePipelineParameter.d.ts +1 -1
- package/esm/src/utils/editable/utils/stringifyPipelineJson.d.ts +1 -1
- package/esm/src/utils/files/$induceFileDownload.d.ts +1 -1
- package/esm/src/utils/files/ObjectUrl.d.ts +2 -1
- package/esm/src/utils/files/extensionToMimeType.d.ts +2 -2
- package/esm/src/utils/files/getFileExtension.d.ts +2 -2
- package/esm/src/utils/files/isDirectoryExisting.d.ts +1 -1
- package/esm/src/utils/files/isFileExisting.d.ts +1 -1
- package/esm/src/utils/files/listAllFiles.d.ts +1 -1
- package/esm/src/utils/files/mimeTypeToExtension.d.ts +2 -2
- package/esm/src/utils/filesystem/promptbookTemporaryPath.d.ts +27 -0
- package/esm/src/utils/filesystem/promptbookTemporaryPath.test.d.ts +1 -0
- package/esm/src/utils/knowledge/inlineKnowledgeSource.d.ts +3 -1
- package/esm/src/utils/markdown/addAutoGeneratedSection.d.ts +2 -2
- package/esm/src/utils/markdown/createMarkdownChart.d.ts +1 -1
- package/esm/src/utils/markdown/createMarkdownTable.d.ts +1 -2
- package/esm/src/utils/markdown/escapeMarkdownBlock.d.ts +1 -1
- package/esm/src/utils/markdown/extractAllBlocksFromMarkdown.d.ts +1 -1
- package/esm/src/utils/markdown/extractAllListItemsFromMarkdown.d.ts +1 -1
- package/esm/src/utils/markdown/extractOneBlockFromMarkdown.d.ts +1 -1
- package/esm/src/utils/markdown/flattenMarkdown.d.ts +1 -1
- package/esm/src/utils/markdown/humanizeAiText.d.ts +1 -1
- package/esm/src/utils/markdown/humanizeAiTextEllipsis.d.ts +1 -1
- package/esm/src/utils/markdown/humanizeAiTextEmdashed.d.ts +1 -1
- package/esm/src/utils/markdown/humanizeAiTextQuotes.d.ts +1 -1
- package/esm/src/utils/markdown/humanizeAiTextSources.d.ts +1 -1
- package/esm/src/utils/markdown/humanizeAiTextWhitespace.d.ts +1 -1
- package/esm/src/utils/markdown/parseMarkdownSection.d.ts +1 -1
- package/esm/src/utils/markdown/prettifyMarkdown.d.ts +1 -1
- package/esm/src/utils/markdown/promptbookifyAiText.d.ts +1 -1
- package/esm/src/utils/markdown/removeMarkdownComments.d.ts +1 -2
- package/esm/src/utils/markdown/removeMarkdownFormatting.d.ts +1 -1
- package/esm/src/utils/markdown/splitMarkdownIntoSections.d.ts +1 -1
- package/esm/src/utils/misc/$Register.d.ts +1 -1
- package/esm/src/utils/misc/$getCurrentDate.d.ts +1 -1
- package/esm/src/utils/misc/aboutPromptbookInformation.d.ts +1 -1
- package/esm/src/utils/misc/computeHash.d.ts +2 -2
- package/esm/src/utils/misc/injectCssModuleIntoShadowRoot.d.ts +1 -1
- package/esm/src/utils/normalization/suffixUrl.d.ts +1 -1
- package/esm/src/utils/organization/keepImported.d.ts +1 -1
- package/esm/src/utils/parameters/extractParameterNames.d.ts +2 -2
- package/esm/src/utils/parameters/mapAvailableToExpectedParameters.d.ts +1 -1
- package/esm/src/utils/parameters/numberToString.d.ts +1 -1
- package/esm/src/utils/parameters/templateParameters.d.ts +2 -1
- package/esm/src/utils/parameters/valueToString.d.ts +1 -1
- package/esm/src/utils/random/$generateBookBoilerplate.d.ts +1 -1
- package/esm/src/utils/random/$randomAgentPersona.d.ts +1 -1
- package/esm/src/utils/random/$randomAgentRule.d.ts +1 -1
- package/esm/src/utils/random/$randomFullnameWithColor.d.ts +1 -1
- package/esm/src/utils/random/$randomSeed.d.ts +1 -1
- package/esm/src/utils/random/$randomToken.d.ts +1 -1
- package/esm/src/utils/random/NamePool.d.ts +1 -1
- package/esm/src/utils/serialization/checkSerializableAsJson.d.ts +1 -1
- package/esm/src/utils/serialization/serializeToPromptbookJavascript.d.ts +1 -1
- package/esm/src/utils/toolCalls/mergeToolCalls.d.ts +1 -1
- package/esm/src/utils/validators/email/isValidEmail.d.ts +1 -1
- package/esm/src/utils/validators/filePath/isRootPath.d.ts +1 -2
- package/esm/src/utils/validators/filePath/isValidFilePath.d.ts +1 -1
- package/esm/src/utils/validators/javascriptName/isValidJavascriptName.d.ts +1 -1
- package/esm/src/utils/validators/parameterName/validateParameterName.d.ts +1 -1
- package/esm/src/utils/validators/semanticVersion/isValidSemanticVersion.d.ts +1 -1
- package/esm/src/utils/validators/url/isHostnameOnPrivateNetwork.d.ts +1 -1
- package/esm/src/utils/validators/url/isUrlOnPrivateNetwork.d.ts +2 -2
- package/esm/src/utils/validators/url/isValidAgentUrl.d.ts +1 -1
- package/esm/src/utils/validators/url/isValidPipelineUrl.d.ts +1 -1
- package/esm/src/utils/validators/url/isValidUrl.d.ts +1 -1
- package/esm/src/utils/validators/uuid/isValidUuid.d.ts +1 -1
- package/esm/src/version.d.ts +1 -1
- package/esm/src/wizard/$getCompiledBook.d.ts +2 -1
- package/esm/src/wizard/wizard.d.ts +4 -1
- package/package.json +2 -2
- package/umd/index.umd.js +578 -542
- package/umd/index.umd.js.map +1 -1
- package/umd/src/_packages/core.index.d.ts +2 -0
- package/umd/src/avatars/AvatarOrImage.d.ts +2 -1
- package/umd/src/avatars/avatarRenderingUtils.d.ts +1 -1
- package/umd/src/avatars/renderAvatarVisual.d.ts +1 -2
- package/umd/src/avatars/types/AvatarDefinition.d.ts +2 -1
- package/umd/src/avatars/types/AvatarVisualDefinition.d.ts +3 -2
- package/umd/src/avatars/visuals/minecraft2AvatarVisual.d.ts +7 -0
- package/umd/src/avatars/visuals/minecraftAvatarVisualShared.d.ts +48 -0
- package/umd/src/book-2.0/agent-source/AgentBasicInformation.d.ts +5 -1
- package/umd/src/book-2.0/agent-source/AgentModelRequirements.d.ts +3 -2
- package/umd/src/book-2.0/agent-source/AgentSourceParseResult.d.ts +1 -1
- package/umd/src/book-2.0/agent-source/computeAgentHash.d.ts +2 -2
- package/umd/src/book-2.0/agent-source/createAgentModelRequirements.d.ts +4 -1
- package/umd/src/book-2.0/agent-source/createAgentModelRequirementsWithCommitments.d.ts +1 -1
- package/umd/src/book-2.0/agent-source/createDefaultAgentName.d.ts +2 -2
- package/umd/src/book-2.0/agent-source/normalizeAgentName.d.ts +1 -1
- package/umd/src/book-2.0/agent-source/parseAgentSourcePrelude.d.ts +1 -1
- package/umd/src/book-2.0/agent-source/parseTeamCommitment.d.ts +1 -1
- package/umd/src/book-2.0/book-language-documentation/createStandaloneBookLanguageMarkdown.d.ts +1 -1
- package/umd/src/book-2.0/utils/generatePlaceholderAgentProfileImageUrl.d.ts +3 -1
- package/umd/src/book-3.0/Book.d.ts +33 -0
- package/umd/src/book-3.0/Book.test.d.ts +1 -0
- package/umd/src/book-components/AvatarProfile/AvatarChip/AvatarChip.d.ts +1 -1
- package/umd/src/book-components/AvatarProfile/AvatarProfile/AvatarProfile.d.ts +1 -1
- package/umd/src/book-components/BookEditor/BookEditor.d.ts +4 -1
- package/umd/src/book-components/BookEditor/BookEditorActionbar.d.ts +1 -1
- package/umd/src/book-components/Chat/AgentChip/AgentChip.d.ts +1 -1
- package/umd/src/book-components/Chat/Chat/ChatMessageItem.d.ts +2 -2
- package/umd/src/book-components/Chat/Chat/ChatMessageList.d.ts +1 -1
- package/umd/src/book-components/Chat/Chat/ChatMessageRichContent.d.ts +1 -1
- package/umd/src/book-components/Chat/Chat/ChatProps.d.ts +4 -4
- package/umd/src/book-components/Chat/Chat/ChatRatingModal.d.ts +1 -1
- package/umd/src/book-components/Chat/Chat/ChatToolCallModalContent.d.ts +2 -2
- package/umd/src/book-components/Chat/Chat/TeamToolCallModalContent.d.ts +2 -2
- package/umd/src/book-components/Chat/Chat/createChatMessageToolCallRenderModel.d.ts +2 -2
- package/umd/src/book-components/Chat/Chat/renderToolCallDetails.d.ts +1 -1
- package/umd/src/book-components/Chat/Chat/resolveRunBrowserToolCallDetailsState.d.ts +1 -1
- package/umd/src/book-components/Chat/Chat/useChatInputAreaDictation.d.ts +1 -1
- package/umd/src/book-components/Chat/Chat/useChatInputAreaDictationPersistence.d.ts +1 -1
- package/umd/src/book-components/Chat/Chat/useChatInputAreaDictationSupport.d.ts +1 -1
- package/umd/src/book-components/Chat/Chat/useChatToolCallModalState.d.ts +3 -3
- package/umd/src/book-components/Chat/LlmChat/LlmChatProps.d.ts +2 -2
- package/umd/src/book-components/Chat/LlmChat/useLlmChatMessageHandler.d.ts +1 -1
- package/umd/src/book-components/Chat/MarkdownContent/MarkdownContent.d.ts +1 -1
- package/umd/src/book-components/Chat/hooks/useChatRatings.d.ts +2 -2
- package/umd/src/book-components/Chat/save/_common/ChatSaveFormatDefinition.d.ts +2 -1
- package/umd/src/book-components/Chat/types/ChatMessage.d.ts +6 -2
- package/umd/src/book-components/Chat/types/ChatParticipant.d.ts +5 -3
- package/umd/src/book-components/Chat/utils/citationHelpers.d.ts +1 -1
- package/umd/src/book-components/Chat/utils/collectTeamToolCallSummary.d.ts +1 -1
- package/umd/src/book-components/Chat/utils/createCitationFootnoteRenderModel.d.ts +1 -1
- package/umd/src/book-components/Chat/utils/getToolCallChipletInfo.d.ts +2 -2
- package/umd/src/book-components/Chat/utils/loadAgentProfile.d.ts +2 -1
- package/umd/src/book-components/Chat/utils/resolveCitationUrl.d.ts +1 -1
- package/umd/src/book-components/PromptbookAgent/PromptbookAgentIntegration.d.ts +1 -1
- package/umd/src/book-components/PromptbookAgent/PromptbookAgentSeamlessIntegration.d.ts +1 -1
- package/umd/src/book-components/Qr/useQrCode.d.ts +1 -1
- package/umd/src/book-components/_common/react-utils/classNames.d.ts +1 -1
- package/umd/src/cli/cli-commands/coder/ensureCoderGitignoreFile.d.ts +1 -1
- package/umd/src/cli/cli-commands/coder/initializeCoderProjectConfiguration.d.ts +1 -1
- package/umd/src/cli/cli-commands/common/promptRunnerCliOptions.d.ts +1 -1
- package/umd/src/cli/common/$provideLlmToolsForCli.d.ts +1 -1
- package/umd/src/collection/agent-collection/constructors/agent-collection-in-supabase/AgentCollectionInSupabase.d.ts +3 -3
- package/umd/src/collection/agent-collection/constructors/agent-collection-in-supabase/prepareAgentSourceForPersistence.d.ts +1 -1
- package/umd/src/collection/pipeline-collection/PipelineCollection.d.ts +1 -1
- package/umd/src/collection/pipeline-collection/SimplePipelineCollection.d.ts +1 -1
- package/umd/src/collection/pipeline-collection/constructors/createPipelineCollectionFromDirectory.d.ts +2 -1
- package/umd/src/collection/pipeline-collection/constructors/createPipelineCollectionFromUrl.d.ts +1 -1
- package/umd/src/collection/pipeline-collection/constructors/createPipelineSubcollection.d.ts +1 -1
- package/umd/src/commands/BOOK_VERSION/BookVersionCommand.d.ts +1 -1
- package/umd/src/commands/FOREACH/ForeachJson.d.ts +1 -1
- package/umd/src/commands/JOKER/JokerCommand.d.ts +1 -1
- package/umd/src/commands/KNOWLEDGE/KnowledgeCommand.d.ts +1 -1
- package/umd/src/commands/KNOWLEDGE/utils/knowledgeSourceContentToName.d.ts +2 -2
- package/umd/src/commands/PARAMETER/ParameterCommand.d.ts +2 -2
- package/umd/src/commands/PERSONA/PersonaCommand.d.ts +2 -2
- package/umd/src/commands/POSTPROCESS/PostprocessCommand.d.ts +1 -1
- package/umd/src/commands/_common/parseCommand.d.ts +1 -1
- package/umd/src/commands/_common/stringifyCommand.d.ts +1 -1
- package/umd/src/commands/_common/types/CommandParser.d.ts +2 -1
- package/umd/src/commitments/MEMORY/MEMORY.d.ts +2 -2
- package/umd/src/commitments/MEMORY/MemoryToolRuntimeAdapter.d.ts +1 -1
- package/umd/src/commitments/MEMORY/createMemoryToolFunctions.d.ts +1 -1
- package/umd/src/commitments/MEMORY/getMemoryToolTitles.d.ts +1 -1
- package/umd/src/commitments/MEMORY/resolveMemoryRuntimeContext.d.ts +1 -1
- package/umd/src/commitments/TEAM/TEAM.d.ts +2 -2
- package/umd/src/commitments/USE_BROWSER/USE_BROWSER.d.ts +2 -2
- package/umd/src/commitments/USE_BROWSER/resolveRunBrowserToolForNode.d.ts +1 -1
- package/umd/src/commitments/USE_CALENDAR/USE_CALENDAR.d.ts +1 -1
- package/umd/src/commitments/USE_CALENDAR/createUseCalendarToolFunctions.d.ts +1 -1
- package/umd/src/commitments/USE_CALENDAR/getUseCalendarToolTitles.d.ts +1 -1
- package/umd/src/commitments/USE_CALENDAR/resolveUseCalendarToolRuntimeOrWalletCredentialResult.d.ts +1 -1
- package/umd/src/commitments/USE_DEEPSEARCH/USE_DEEPSEARCH.d.ts +2 -2
- package/umd/src/commitments/USE_EMAIL/USE_EMAIL.d.ts +2 -2
- package/umd/src/commitments/USE_EMAIL/resolveSendEmailToolForNode.d.ts +1 -1
- package/umd/src/commitments/USE_POPUP/USE_POPUP.d.ts +2 -2
- package/umd/src/commitments/USE_PRIVACY/USE_PRIVACY.d.ts +2 -2
- package/umd/src/commitments/USE_PROJECT/USE_PROJECT.d.ts +1 -1
- package/umd/src/commitments/USE_PROJECT/createUseProjectToolFunctions.d.ts +1 -1
- package/umd/src/commitments/USE_PROJECT/getUseProjectToolTitles.d.ts +1 -1
- package/umd/src/commitments/USE_PROJECT/resolveUseProjectToolRuntimeOrWalletCredentialResult.d.ts +1 -1
- package/umd/src/commitments/USE_SEARCH_ENGINE/USE_SEARCH_ENGINE.d.ts +2 -2
- package/umd/src/commitments/USE_SPAWN/USE_SPAWN.d.ts +2 -2
- package/umd/src/commitments/USE_SPAWN/resolveSpawnAgentToolForNode.d.ts +1 -1
- package/umd/src/commitments/USE_TIME/USE_TIME.d.ts +2 -2
- package/umd/src/commitments/USE_TIMEOUT/TimeoutToolRuntimeAdapter.d.ts +1 -1
- package/umd/src/commitments/USE_TIMEOUT/USE_TIMEOUT.d.ts +2 -2
- package/umd/src/commitments/USE_TIMEOUT/createTimeoutToolFunctions.d.ts +1 -1
- package/umd/src/commitments/USE_TIMEOUT/resolveTimeoutRuntimeContext.d.ts +1 -1
- package/umd/src/commitments/USE_USER_LOCATION/USE_USER_LOCATION.d.ts +2 -2
- package/umd/src/commitments/WALLET/WALLET.d.ts +2 -2
- package/umd/src/commitments/WALLET/WalletToolRuntimeAdapter.d.ts +1 -1
- package/umd/src/commitments/WALLET/createWalletToolFunctions.d.ts +1 -1
- package/umd/src/commitments/WALLET/getWalletToolTitles.d.ts +1 -1
- package/umd/src/commitments/WALLET/resolveWalletRuntimeContext.d.ts +1 -1
- package/umd/src/commitments/_base/BaseCommitmentDefinition.d.ts +2 -2
- package/umd/src/commitments/_base/CommitmentDefinition.d.ts +2 -2
- package/umd/src/commitments/_common/commitmentToolFunctions.d.ts +2 -2
- package/umd/src/commitments/_common/createSerpSearchToolFunction.d.ts +1 -1
- package/umd/src/commitments/_common/getAllCommitmentsToolFunctionsForNode.d.ts +1 -1
- package/umd/src/commitments/_common/getAllCommitmentsToolTitles.d.ts +1 -1
- package/umd/src/commitments/_common/getGroupedCommitmentDefinitions.d.ts +1 -1
- package/umd/src/commitments/_common/toolExecutionEnvelope.d.ts +1 -1
- package/umd/src/commitments/_common/toolRuntimeContext.d.ts +1 -1
- package/umd/src/config.d.ts +8 -4
- package/umd/src/conversion/archive/loadArchive.d.ts +1 -1
- package/umd/src/conversion/archive/saveArchive.d.ts +1 -1
- package/umd/src/conversion/prettify/renderPipelineMermaidOptions.d.ts +1 -1
- package/umd/src/conversion/utils/extractParameterNamesFromTask.d.ts +1 -1
- package/umd/src/errors/PipelineExecutionError.d.ts +1 -1
- package/umd/src/errors/utils/ErrorJson.d.ts +1 -1
- package/umd/src/executables/apps/locateLibreoffice.d.ts +1 -1
- package/umd/src/executables/apps/locatePandoc.d.ts +1 -1
- package/umd/src/executables/apps/locateVscode.d.ts +1 -1
- package/umd/src/executables/browsers/locateBrowser.d.ts +1 -1
- package/umd/src/executables/browsers/locateChrome.d.ts +1 -1
- package/umd/src/executables/browsers/locateDefaultSystemBrowser.d.ts +1 -1
- package/umd/src/executables/browsers/locateEdge.d.ts +1 -1
- package/umd/src/executables/browsers/locateFirefox.d.ts +1 -1
- package/umd/src/executables/browsers/locateInternetExplorer.d.ts +1 -1
- package/umd/src/executables/browsers/locateSafari.d.ts +1 -1
- package/umd/src/executables/locateApp.d.ts +1 -1
- package/umd/src/executables/platforms/locateAppOnLinux.d.ts +1 -1
- package/umd/src/executables/platforms/locateAppOnMacOs.d.ts +1 -1
- package/umd/src/executables/platforms/locateAppOnWindows.d.ts +1 -1
- package/umd/src/execution/AbstractTaskResult.d.ts +1 -1
- package/umd/src/execution/AvailableModel.d.ts +5 -1
- package/umd/src/execution/CommonToolsOptions.d.ts +1 -1
- package/umd/src/execution/Executables.d.ts +1 -1
- package/umd/src/execution/ExecutionTask.d.ts +3 -2
- package/umd/src/execution/LlmExecutionTools.d.ts +2 -1
- package/umd/src/execution/PipelineExecutor.d.ts +1 -1
- package/umd/src/execution/PipelineExecutorResult.d.ts +2 -2
- package/umd/src/execution/PromptResult.d.ts +3 -1
- package/umd/src/execution/PromptbookFetch.d.ts +1 -1
- package/umd/src/execution/ScriptExecutionTools.d.ts +2 -2
- package/umd/src/execution/UncertainNumber.d.ts +2 -2
- package/umd/src/execution/UserInterfaceTools.d.ts +1 -2
- package/umd/src/execution/createPipelineExecutor/10-executePipeline.d.ts +1 -1
- package/umd/src/execution/createPipelineExecutor/20-executeTask.d.ts +1 -1
- package/umd/src/execution/createPipelineExecutor/40-executeAttempts.d.ts +2 -1
- package/umd/src/execution/createPipelineExecutor/filterJustOutputParameters.d.ts +1 -1
- package/umd/src/execution/createPipelineExecutor/getContextForTask.d.ts +2 -2
- package/umd/src/execution/createPipelineExecutor/getExamplesForTask.d.ts +2 -2
- package/umd/src/execution/createPipelineExecutor/getKnowledgeForTask.d.ts +3 -1
- package/umd/src/execution/createPipelineExecutor/getReservedParametersForTask.d.ts +1 -2
- package/umd/src/execution/execution-report/ExecutionReportJson.d.ts +3 -3
- package/umd/src/execution/execution-report/ExecutionReportStringOptions.d.ts +1 -1
- package/umd/src/execution/utils/usageToHuman.d.ts +1 -1
- package/umd/src/execution/utils/validatePromptResult.d.ts +1 -1
- package/umd/src/file-security-checkers/FileSecurityCheckResult.d.ts +2 -1
- package/umd/src/file-security-checkers/FileSecurityChecker.d.ts +3 -1
- package/umd/src/file-security-checkers/virustotal/VirusTotalFileSecurityChecker.d.ts +1 -1
- package/umd/src/formats/_common/FormatParser.d.ts +2 -2
- package/umd/src/formats/_common/FormatSubvalueParser.d.ts +2 -3
- package/umd/src/formats/csv/utils/csvParse.d.ts +1 -1
- package/umd/src/formfactors/_common/AbstractFormfactorDefinition.d.ts +2 -3
- package/umd/src/import-plugins/FileImportPlugin.d.ts +1 -1
- package/umd/src/llm-providers/_common/register/$provideEnvFilename.d.ts +1 -1
- package/umd/src/llm-providers/_common/register/$provideLlmToolsForWizardOrCli.d.ts +3 -2
- package/umd/src/llm-providers/_common/register/$registeredLlmToolsMessage.d.ts +2 -1
- package/umd/src/llm-providers/_common/register/LlmToolsConfiguration.d.ts +1 -1
- package/umd/src/llm-providers/_common/register/LlmToolsMetadata.d.ts +2 -1
- package/umd/src/llm-providers/_common/register/createLlmToolsFromConfiguration.d.ts +3 -1
- package/umd/src/llm-providers/_common/utils/assertUniqueModels.d.ts +1 -1
- package/umd/src/llm-providers/_common/utils/cache/CacheItem.d.ts +2 -2
- package/umd/src/llm-providers/_multiple/MultipleLlmExecutionTools.d.ts +2 -1
- package/umd/src/llm-providers/_multiple/joinLlmExecutionTools.d.ts +2 -1
- package/umd/src/llm-providers/agent/Agent.d.ts +6 -2
- package/umd/src/llm-providers/agent/AgentLlmExecutionTools.d.ts +3 -1
- package/umd/src/llm-providers/agent/RemoteAgent.d.ts +2 -2
- package/umd/src/llm-providers/agent/RemoteAgentOptions.d.ts +1 -1
- package/umd/src/llm-providers/anthropic-claude/AnthropicClaudeExecutionTools.d.ts +2 -1
- package/umd/src/llm-providers/anthropic-claude/anthropic-claude-models.d.ts +1 -1
- package/umd/src/llm-providers/azure-openai/AzureOpenAiExecutionTools.d.ts +2 -1
- package/umd/src/llm-providers/azure-openai/AzureOpenAiExecutionToolsOptions.d.ts +2 -3
- package/umd/src/llm-providers/deepseek/deepseek-models.d.ts +1 -1
- package/umd/src/llm-providers/google/google-models.d.ts +1 -1
- package/umd/src/llm-providers/mocked/$fakeTextToExpectations.d.ts +1 -1
- package/umd/src/llm-providers/mocked/MockedEchoLlmExecutionTools.d.ts +2 -1
- package/umd/src/llm-providers/mocked/MockedFackedLlmExecutionTools.d.ts +2 -1
- package/umd/src/llm-providers/ollama/OllamaExecutionTools.d.ts +2 -1
- package/umd/src/llm-providers/openai/OpenAiAgentKitExecutionTools.d.ts +3 -2
- package/umd/src/llm-providers/openai/OpenAiAgentKitExecutionToolsOptions.d.ts +1 -1
- package/umd/src/llm-providers/openai/OpenAiAssistantExecutionTools.d.ts +3 -1
- package/umd/src/llm-providers/openai/OpenAiAssistantExecutionToolsOptions.d.ts +1 -1
- package/umd/src/llm-providers/openai/OpenAiCompatibleExecutionTools.d.ts +3 -1
- package/umd/src/llm-providers/openai/OpenAiExecutionTools.d.ts +2 -1
- package/umd/src/llm-providers/openai/OpenAiVectorStoreHandler.d.ts +2 -2
- package/umd/src/llm-providers/openai/createOpenAiCompatibleExecutionTools.d.ts +3 -1
- package/umd/src/llm-providers/openai/utils/OpenAiCompatibleUnsupportedParameterRetrier.d.ts +1 -1
- package/umd/src/llm-providers/openai/utils/callOpenAiCompatibleChatModel.d.ts +2 -1
- package/umd/src/llm-providers/remote/RemoteLlmExecutionTools.d.ts +2 -1
- package/umd/src/other/templates/getBookTemplates.d.ts +1 -1
- package/umd/src/personas/preparePersona.d.ts +1 -1
- package/umd/src/pipeline/PipelineJson/CommonTaskJson.d.ts +4 -8
- package/umd/src/pipeline/PipelineJson/Expectations.d.ts +1 -2
- package/umd/src/pipeline/PipelineJson/KnowledgePieceJson.d.ts +4 -6
- package/umd/src/pipeline/PipelineJson/KnowledgeSourceJson.d.ts +3 -3
- package/umd/src/pipeline/PipelineJson/ParameterJson.d.ts +2 -3
- package/umd/src/pipeline/PipelineJson/PersonaJson.d.ts +3 -3
- package/umd/src/pipeline/PipelineJson/PipelineJson.d.ts +6 -9
- package/umd/src/pipeline/PipelineJson/PreparationJson.d.ts +1 -1
- package/umd/src/pipeline/PipelineJson/PromptTaskJson.d.ts +1 -1
- package/umd/src/pipeline/prompt-notation.d.ts +1 -1
- package/umd/src/postprocessing/utils/extractBlock.d.ts +1 -1
- package/umd/src/postprocessing/utils/extractJsonBlock.d.ts +1 -2
- package/umd/src/prepare/PrepareAndScrapeOptions.d.ts +1 -1
- package/umd/src/remote-server/socket-types/_subtypes/Identification.d.ts +2 -2
- package/umd/src/remote-server/socket-types/_subtypes/identificationToPromptbookToken.d.ts +1 -1
- package/umd/src/remote-server/socket-types/_subtypes/promptbookTokenToIdentification.d.ts +1 -1
- package/umd/src/remote-server/startAgentServer.d.ts +1 -1
- package/umd/src/remote-server/types/RemoteClientOptions.d.ts +1 -1
- package/umd/src/remote-server/types/RemoteServerOptions.d.ts +2 -1
- package/umd/src/scrapers/_common/Scraper.d.ts +4 -4
- package/umd/src/scrapers/_common/ScraperIntermediateSource.d.ts +1 -1
- package/umd/src/scrapers/_common/register/$registeredScrapersMessage.d.ts +1 -1
- package/umd/src/scrapers/_common/register/ScraperAndConverterMetadata.d.ts +3 -1
- package/umd/src/scrapers/_common/utils/getScraperIntermediateSource.d.ts +1 -1
- package/umd/src/scrapers/website/WebsiteScraper.d.ts +2 -3
- package/umd/src/scripting/javascript/JavascriptExecutionToolsOptions.d.ts +2 -2
- package/umd/src/scripting/javascript/utils/extractVariablesFromJavascript.d.ts +2 -2
- package/umd/src/search-engines/SearchEngine.d.ts +2 -1
- package/umd/src/search-engines/SearchResult.d.ts +1 -1
- package/umd/src/search-engines/bing/BingSearchEngine.d.ts +2 -1
- package/umd/src/search-engines/dummy/DummySearchEngine.d.ts +2 -1
- package/umd/src/search-engines/google/GoogleSearchEngine.d.ts +2 -1
- package/umd/src/search-engines/serp/SerpSearchEngine.d.ts +2 -1
- package/umd/src/storage/file-cache-storage/FileCacheStorageOptions.d.ts +1 -1
- package/umd/src/storage/file-cache-storage/utils/nameToSubfolderPath.d.ts +1 -1
- package/umd/src/storage/local-storage/utils/IndexedDbStorageOptions.d.ts +1 -1
- package/umd/src/transpilers/_common/BookTranspiler.d.ts +4 -2
- package/umd/src/transpilers/_common/createTranspiledTeamRuntimeSection.d.ts +1 -1
- package/umd/src/transpilers/_common/formatUsedToolFunctions.d.ts +1 -1
- package/umd/src/transpilers/agent-os/AgentOsTranspiler.d.ts +1 -1
- package/umd/src/transpilers/anthropic-claude-managed/AnthropicClaudeManagedTranspiler.d.ts +1 -1
- package/umd/src/transpilers/anthropic-claude-sdk/AnthropicClaudeSdkTranspiler.d.ts +1 -1
- package/umd/src/transpilers/e2b/E2BTranspiler.d.ts +1 -1
- package/umd/src/transpilers/formatted-book-in-markdown/FormattedBookInMarkdownTranspiler.d.ts +1 -1
- package/umd/src/transpilers/openai-agents/OpenAiAgentsTranspiler.d.ts +1 -1
- package/umd/src/transpilers/openai-sdk/OpenAiSdkTranspiler.d.ts +1 -1
- package/umd/src/types/LlmCall.d.ts +1 -1
- package/umd/src/types/LlmToolDefinition.d.ts +2 -1
- package/umd/src/types/Message.d.ts +4 -3
- package/umd/src/types/ModelRequirements.d.ts +4 -2
- package/umd/src/types/Prompt.d.ts +7 -12
- package/umd/src/types/SpeechRecognition.d.ts +1 -1
- package/umd/src/types/ToolCall.d.ts +1 -1
- package/umd/src/types/string_email.d.ts +1 -1
- package/umd/src/types/string_host.d.ts +1 -1
- package/umd/src/types/string_person_fullname.d.ts +1 -1
- package/umd/src/types/string_token.d.ts +1 -1
- package/umd/src/utils/agents/resolveAgentAvatarImageUrl.d.ts +2 -1
- package/umd/src/utils/color/Color.d.ts +2 -1
- package/umd/src/utils/color/internal-utils/hslToRgb.d.ts +2 -3
- package/umd/src/utils/color/internal-utils/rgbToHsl.d.ts +2 -3
- package/umd/src/utils/color/operators/darken.d.ts +1 -1
- package/umd/src/utils/color/operators/grayscale.d.ts +1 -1
- package/umd/src/utils/color/operators/lighten.d.ts +1 -1
- package/umd/src/utils/color/operators/mixWithColor.d.ts +1 -1
- package/umd/src/utils/color/operators/saturate.d.ts +1 -1
- package/umd/src/utils/color/parsers/parseHexColor.d.ts +1 -1
- package/umd/src/utils/color/parsers/parseHslColor.d.ts +1 -1
- package/umd/src/utils/color/parsers/parseRgbColor.d.ts +1 -1
- package/umd/src/utils/color/utils/colorToDataUrl.d.ts +3 -1
- package/umd/src/utils/editable/edit-pipeline-string/addPipelineCommand.d.ts +1 -1
- package/umd/src/utils/editable/types/PipelineEditableSerialized.d.ts +1 -1
- package/umd/src/utils/editable/utils/renamePipelineParameter.d.ts +1 -1
- package/umd/src/utils/editable/utils/stringifyPipelineJson.d.ts +1 -1
- package/umd/src/utils/files/$induceFileDownload.d.ts +1 -1
- package/umd/src/utils/files/ObjectUrl.d.ts +2 -1
- package/umd/src/utils/files/extensionToMimeType.d.ts +2 -2
- package/umd/src/utils/files/getFileExtension.d.ts +2 -2
- package/umd/src/utils/files/isDirectoryExisting.d.ts +1 -1
- package/umd/src/utils/files/isFileExisting.d.ts +1 -1
- package/umd/src/utils/files/listAllFiles.d.ts +1 -1
- package/umd/src/utils/files/mimeTypeToExtension.d.ts +2 -2
- package/umd/src/utils/filesystem/promptbookTemporaryPath.d.ts +27 -0
- package/umd/src/utils/filesystem/promptbookTemporaryPath.test.d.ts +1 -0
- package/umd/src/utils/knowledge/inlineKnowledgeSource.d.ts +3 -1
- package/umd/src/utils/markdown/addAutoGeneratedSection.d.ts +2 -2
- package/umd/src/utils/markdown/createMarkdownChart.d.ts +1 -1
- package/umd/src/utils/markdown/createMarkdownTable.d.ts +1 -2
- package/umd/src/utils/markdown/escapeMarkdownBlock.d.ts +1 -1
- package/umd/src/utils/markdown/extractAllBlocksFromMarkdown.d.ts +1 -1
- package/umd/src/utils/markdown/extractAllListItemsFromMarkdown.d.ts +1 -1
- package/umd/src/utils/markdown/extractOneBlockFromMarkdown.d.ts +1 -1
- package/umd/src/utils/markdown/flattenMarkdown.d.ts +1 -1
- package/umd/src/utils/markdown/humanizeAiText.d.ts +1 -1
- package/umd/src/utils/markdown/humanizeAiTextEllipsis.d.ts +1 -1
- package/umd/src/utils/markdown/humanizeAiTextEmdashed.d.ts +1 -1
- package/umd/src/utils/markdown/humanizeAiTextQuotes.d.ts +1 -1
- package/umd/src/utils/markdown/humanizeAiTextSources.d.ts +1 -1
- package/umd/src/utils/markdown/humanizeAiTextWhitespace.d.ts +1 -1
- package/umd/src/utils/markdown/parseMarkdownSection.d.ts +1 -1
- package/umd/src/utils/markdown/prettifyMarkdown.d.ts +1 -1
- package/umd/src/utils/markdown/promptbookifyAiText.d.ts +1 -1
- package/umd/src/utils/markdown/removeMarkdownComments.d.ts +1 -2
- package/umd/src/utils/markdown/removeMarkdownFormatting.d.ts +1 -1
- package/umd/src/utils/markdown/splitMarkdownIntoSections.d.ts +1 -1
- package/umd/src/utils/misc/$Register.d.ts +1 -1
- package/umd/src/utils/misc/$getCurrentDate.d.ts +1 -1
- package/umd/src/utils/misc/aboutPromptbookInformation.d.ts +1 -1
- package/umd/src/utils/misc/computeHash.d.ts +2 -2
- package/umd/src/utils/misc/injectCssModuleIntoShadowRoot.d.ts +1 -1
- package/umd/src/utils/normalization/suffixUrl.d.ts +1 -1
- package/umd/src/utils/organization/keepImported.d.ts +1 -1
- package/umd/src/utils/parameters/extractParameterNames.d.ts +2 -2
- package/umd/src/utils/parameters/mapAvailableToExpectedParameters.d.ts +1 -1
- package/umd/src/utils/parameters/numberToString.d.ts +1 -1
- package/umd/src/utils/parameters/templateParameters.d.ts +2 -1
- package/umd/src/utils/parameters/valueToString.d.ts +1 -1
- package/umd/src/utils/random/$generateBookBoilerplate.d.ts +1 -1
- package/umd/src/utils/random/$randomAgentPersona.d.ts +1 -1
- package/umd/src/utils/random/$randomAgentRule.d.ts +1 -1
- package/umd/src/utils/random/$randomFullnameWithColor.d.ts +1 -1
- package/umd/src/utils/random/$randomSeed.d.ts +1 -1
- package/umd/src/utils/random/$randomToken.d.ts +1 -1
- package/umd/src/utils/random/NamePool.d.ts +1 -1
- package/umd/src/utils/serialization/checkSerializableAsJson.d.ts +1 -1
- package/umd/src/utils/serialization/serializeToPromptbookJavascript.d.ts +1 -1
- package/umd/src/utils/toolCalls/mergeToolCalls.d.ts +1 -1
- package/umd/src/utils/validators/email/isValidEmail.d.ts +1 -1
- package/umd/src/utils/validators/filePath/isRootPath.d.ts +1 -2
- package/umd/src/utils/validators/filePath/isValidFilePath.d.ts +1 -1
- package/umd/src/utils/validators/javascriptName/isValidJavascriptName.d.ts +1 -1
- package/umd/src/utils/validators/parameterName/validateParameterName.d.ts +1 -1
- package/umd/src/utils/validators/semanticVersion/isValidSemanticVersion.d.ts +1 -1
- package/umd/src/utils/validators/url/isHostnameOnPrivateNetwork.d.ts +1 -1
- package/umd/src/utils/validators/url/isUrlOnPrivateNetwork.d.ts +2 -2
- package/umd/src/utils/validators/url/isValidAgentUrl.d.ts +1 -1
- package/umd/src/utils/validators/url/isValidPipelineUrl.d.ts +1 -1
- package/umd/src/utils/validators/url/isValidUrl.d.ts +1 -1
- package/umd/src/utils/validators/uuid/isValidUuid.d.ts +1 -1
- package/umd/src/version.d.ts +1 -1
- package/umd/src/wizard/$getCompiledBook.d.ts +2 -1
- package/umd/src/wizard/wizard.d.ts +4 -1
package/umd/index.umd.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
(function (global, factory) {
|
|
2
|
-
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('spacetrim'), require('@mozilla/readability'), require('jsdom'), require('crypto
|
|
3
|
-
typeof define === 'function' && define.amd ? define(['exports', 'spacetrim', '@mozilla/readability', 'jsdom', 'crypto
|
|
4
|
-
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global["promptbook-website-crawler"] = {}, global.spacetrim, global.readability, global.jsdom, global.
|
|
5
|
-
})(this, (function (exports, spacetrim, readability, jsdom,
|
|
2
|
+
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('spacetrim'), require('@mozilla/readability'), require('jsdom'), require('crypto'), require('rxjs'), require('waitasecond'), require('crypto-js/enc-hex'), require('crypto-js/sha256'), require('path'), require('crypto-js'), require('mime-types'), require('papaparse'), require('fs/promises'), require('showdown')) :
|
|
3
|
+
typeof define === 'function' && define.amd ? define(['exports', 'spacetrim', '@mozilla/readability', 'jsdom', 'crypto', 'rxjs', 'waitasecond', 'crypto-js/enc-hex', 'crypto-js/sha256', 'path', 'crypto-js', 'mime-types', 'papaparse', 'fs/promises', 'showdown'], factory) :
|
|
4
|
+
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global["promptbook-website-crawler"] = {}, global.spacetrim, global.readability, global.jsdom, global.crypto, global.rxjs, global.waitasecond, global.hexEncoder, global.sha256, global.path, global.cryptoJs, global.mimeTypes, global.papaparse, global.promises, global.showdown));
|
|
5
|
+
})(this, (function (exports, spacetrim, readability, jsdom, crypto, rxjs, waitasecond, hexEncoder, sha256, path, cryptoJs, mimeTypes, papaparse, promises, showdown) { 'use strict';
|
|
6
6
|
|
|
7
7
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
8
8
|
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
* @generated
|
|
24
24
|
* @see https://github.com/webgptorg/promptbook
|
|
25
25
|
*/
|
|
26
|
-
const PROMPTBOOK_ENGINE_VERSION = '0.112.0-
|
|
26
|
+
const PROMPTBOOK_ENGINE_VERSION = '0.112.0-69';
|
|
27
27
|
/**
|
|
28
28
|
* TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
|
|
29
29
|
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
@@ -986,6 +986,35 @@
|
|
|
986
986
|
}
|
|
987
987
|
// TODO: Maybe implement by mix+hsl
|
|
988
988
|
|
|
989
|
+
/**
|
|
990
|
+
* Stable root directory used for Promptbook-owned temporary files and caches.
|
|
991
|
+
*
|
|
992
|
+
* @private internal utility for Promptbook temporary folders
|
|
993
|
+
*/
|
|
994
|
+
const PROMPTBOOK_TEMPORARY_DIRECTORY = '.promptbook';
|
|
995
|
+
/**
|
|
996
|
+
* Builds one normalized project-relative path inside Promptbook's dedicated temporary root.
|
|
997
|
+
*
|
|
998
|
+
* The returned path intentionally uses `/` separators so the same helper can be reused from
|
|
999
|
+
* Node.js and edge-safe code without depending on the Node `path` module.
|
|
1000
|
+
*
|
|
1001
|
+
* @private internal utility for Promptbook temporary folders
|
|
1002
|
+
*/
|
|
1003
|
+
function getPromptbookTemporaryPath(...pathSegments) {
|
|
1004
|
+
const normalizedPathSegments = pathSegments.flatMap(splitPathSegments).filter(Boolean);
|
|
1005
|
+
return [PROMPTBOOK_TEMPORARY_DIRECTORY, ...normalizedPathSegments].join('/');
|
|
1006
|
+
}
|
|
1007
|
+
/**
|
|
1008
|
+
* Normalizes one raw path segment into slash-delimited pieces without empty items.
|
|
1009
|
+
*/
|
|
1010
|
+
function splitPathSegments(pathSegment) {
|
|
1011
|
+
return pathSegment
|
|
1012
|
+
.split(/[\\/]+/u)
|
|
1013
|
+
.map((segment) => segment.trim())
|
|
1014
|
+
.filter(Boolean);
|
|
1015
|
+
}
|
|
1016
|
+
// Note: [💞] Ignore a discrepancy between file name and entity name
|
|
1017
|
+
|
|
989
1018
|
/**
|
|
990
1019
|
* Returns the same value that is passed as argument.
|
|
991
1020
|
* No side effects.
|
|
@@ -1161,7 +1190,6 @@
|
|
|
1161
1190
|
*/
|
|
1162
1191
|
const DEFAULT_MAX_EXECUTION_ATTEMPTS = 7; // <- TODO: [🤹♂️]
|
|
1163
1192
|
// <- TODO: [🕝] Make also `AGENTS_DIRNAME_ALTERNATIVES`
|
|
1164
|
-
// TODO: Just `.promptbook` in config, hardcode subfolders like `download-cache` or `execution-cache`
|
|
1165
1193
|
/**
|
|
1166
1194
|
* Where to store the temporary downloads
|
|
1167
1195
|
*
|
|
@@ -1169,7 +1197,15 @@
|
|
|
1169
1197
|
*
|
|
1170
1198
|
* @public exported from `@promptbook/core`
|
|
1171
1199
|
*/
|
|
1172
|
-
const DEFAULT_DOWNLOAD_CACHE_DIRNAME = '
|
|
1200
|
+
const DEFAULT_DOWNLOAD_CACHE_DIRNAME = `./${getPromptbookTemporaryPath('download-cache')}`;
|
|
1201
|
+
/**
|
|
1202
|
+
* Where to store the cache of executions for promptbook CLI
|
|
1203
|
+
*
|
|
1204
|
+
* Note: When the folder does not exist, it is created recursively
|
|
1205
|
+
*
|
|
1206
|
+
* @public exported from `@promptbook/core`
|
|
1207
|
+
*/
|
|
1208
|
+
`./${getPromptbookTemporaryPath('execution-cache')}`;
|
|
1173
1209
|
/**
|
|
1174
1210
|
* Where to store the scrape cache
|
|
1175
1211
|
*
|
|
@@ -1177,7 +1213,7 @@
|
|
|
1177
1213
|
*
|
|
1178
1214
|
* @public exported from `@promptbook/core`
|
|
1179
1215
|
*/
|
|
1180
|
-
const DEFAULT_SCRAPE_CACHE_DIRNAME = '
|
|
1216
|
+
const DEFAULT_SCRAPE_CACHE_DIRNAME = `./${getPromptbookTemporaryPath('scrape-cache')}`;
|
|
1181
1217
|
// <- TODO: [🧜♂️]
|
|
1182
1218
|
/**
|
|
1183
1219
|
* Default settings for parsing and generating CSV files in Promptbook.
|
|
@@ -1519,337 +1555,27 @@
|
|
|
1519
1555
|
}
|
|
1520
1556
|
}
|
|
1521
1557
|
|
|
1558
|
+
var PipelineCollection = [{title:"Prepare Knowledge from Markdown",pipelineUrl:"https://promptbook.studio/promptbook/prepare-knowledge-from-markdown.book",formfactorName:"GENERIC",parameters:[{name:"knowledgeContent",description:"Markdown document content",isInput:true,isOutput:false},{name:"knowledgePieces",description:"The knowledge JSON object",isInput:false,isOutput:true}],tasks:[{taskType:"PROMPT_TASK",name:"knowledge",title:"Knowledge",content:"You are experienced data researcher, extract the important knowledge from the document.\n\n# Rules\n\n- Make pieces of information concise, clear, and easy to understand\n- One piece of information should be approximately 1 paragraph\n- Divide the paragraphs by markdown horizontal lines ---\n- Omit irrelevant information\n- Group redundant information\n- Write just extracted information, nothing else\n\n# The document\n\nTake information from this document:\n\n> {knowledgeContent}",resultingParameterName:"knowledgePieces",dependentParameterNames:["knowledgeContent"]}],personas:[],preparations:[],knowledgeSources:[],knowledgePieces:[],sources:[{type:"BOOK",path:null,content:"# Prepare Knowledge from Markdown\n\n- PIPELINE URL `https://promptbook.studio/promptbook/prepare-knowledge-from-markdown.book`\n- INPUT PARAMETER `{knowledgeContent}` Markdown document content\n- OUTPUT PARAMETER `{knowledgePieces}` The knowledge JSON object\n\n## Knowledge\n\n<!-- TODO: [🍆] -FORMAT JSON -->\n\n```markdown\nYou are experienced data researcher, extract the important knowledge from the document.\n\n# Rules\n\n- Make pieces of information concise, clear, and easy to understand\n- One piece of information should be approximately 1 paragraph\n- Divide the paragraphs by markdown horizontal lines ---\n- Omit irrelevant information\n- Group redundant information\n- Write just extracted information, nothing else\n\n# The document\n\nTake information from this document:\n\n> {knowledgeContent}\n```\n\n`-> {knowledgePieces}`\n"}],sourceFile:"./books/prepare-knowledge-from-markdown.book"},{title:"Prepare Keywords",pipelineUrl:"https://promptbook.studio/promptbook/prepare-knowledge-keywords.book",formfactorName:"GENERIC",parameters:[{name:"knowledgePieceContent",description:"The content",isInput:true,isOutput:false},{name:"keywords",description:"Keywords separated by comma",isInput:false,isOutput:true}],tasks:[{taskType:"PROMPT_TASK",name:"knowledge",title:"Knowledge",content:"You are experienced data researcher, detect the important keywords in the document.\n\n# Rules\n\n- Write just keywords separated by comma\n\n# The document\n\nTake information from this document:\n\n> {knowledgePieceContent}",resultingParameterName:"keywords",dependentParameterNames:["knowledgePieceContent"]}],personas:[],preparations:[],knowledgeSources:[],knowledgePieces:[],sources:[{type:"BOOK",path:null,content:"# Prepare Keywords\n\n- PIPELINE URL `https://promptbook.studio/promptbook/prepare-knowledge-keywords.book`\n- INPUT PARAMETER `{knowledgePieceContent}` The content\n- OUTPUT PARAMETER `{keywords}` Keywords separated by comma\n\n## Knowledge\n\n<!-- TODO: [🍆] -FORMAT JSON -->\n\n```markdown\nYou are experienced data researcher, detect the important keywords in the document.\n\n# Rules\n\n- Write just keywords separated by comma\n\n# The document\n\nTake information from this document:\n\n> {knowledgePieceContent}\n```\n\n`-> {keywords}`\n"}],sourceFile:"./books/prepare-knowledge-keywords.book"},{title:"Prepare Knowledge-piece Title",pipelineUrl:"https://promptbook.studio/promptbook/prepare-knowledge-title.book",formfactorName:"GENERIC",parameters:[{name:"knowledgePieceContent",description:"The content",isInput:true,isOutput:false},{name:"title",description:"The title of the document",isInput:false,isOutput:true}],tasks:[{taskType:"PROMPT_TASK",name:"knowledge",title:"Knowledge",content:"You are experienced content creator, write best title for the document.\n\n# Rules\n\n- Write just title, nothing else\n- Write maximum 5 words for the title\n\n# The document\n\n> {knowledgePieceContent}",resultingParameterName:"title",expectations:{words:{min:1,max:8}},dependentParameterNames:["knowledgePieceContent"]}],personas:[],preparations:[],knowledgeSources:[],knowledgePieces:[],sources:[{type:"BOOK",path:null,content:"# Prepare Knowledge-piece Title\n\n- PIPELINE URL `https://promptbook.studio/promptbook/prepare-knowledge-title.book`\n- INPUT PARAMETER `{knowledgePieceContent}` The content\n- OUTPUT PARAMETER `{title}` The title of the document\n\n## Knowledge\n\n- EXPECT MIN 1 WORD\n- EXPECT MAX 8 WORDS\n\n```markdown\nYou are experienced content creator, write best title for the document.\n\n# Rules\n\n- Write just title, nothing else\n- Write maximum 5 words for the title\n\n# The document\n\n> {knowledgePieceContent}\n```\n\n`-> {title}`\n"}],sourceFile:"./books/prepare-knowledge-title.book"},{title:"Prepare Persona",pipelineUrl:"https://promptbook.studio/promptbook/prepare-persona.book",formfactorName:"GENERIC",parameters:[{name:"availableModels",description:"List of available model names together with their descriptions as JSON",isInput:true,isOutput:false},{name:"personaDescription",description:"Description of the persona",isInput:true,isOutput:false},{name:"modelsRequirements",description:"Specific requirements for the model",isInput:false,isOutput:true}],tasks:[{taskType:"PROMPT_TASK",name:"make-model-requirements",title:"Make modelRequirements",content:"You are an experienced AI engineer, you need to find the best models for virtual assistants:\n\n## Example\n\n```json\n[\n {\n \"modelName\": \"gpt-4o\",\n \"systemMessage\": \"You are experienced AI engineer and helpful assistant.\",\n \"temperature\": 0.7\n },\n {\n \"modelName\": \"claude-3-5-sonnet\",\n \"systemMessage\": \"You are a friendly and knowledgeable chatbot.\",\n \"temperature\": 0.5\n }\n]\n```\n\n## Instructions\n\n- Your output format is JSON array\n- Sort best-fitting models first\n- Omit any models that are not suitable\n- Write just the JSON, no other text should be present\n- Array contain items with following keys:\n - `modelName`: The name of the model to use\n - `systemMessage`: The system message to provide context to the model\n - `temperature`: The sampling temperature to use\n\n### Key `modelName`\n\nHere are the available models:\n\n```json\n{availableModels}\n```\n\n### Key `systemMessage`\n\nThe system message is used to communicate instructions or provide context to the model at the beginning of a conversation. It is displayed in a different format compared to user messages, helping the model understand its role in the conversation. The system message typically guides the model's behavior, sets the tone, or specifies desired output from the model. By utilizing the system message effectively, users can steer the model towards generating more accurate and relevant responses.\n\nFor example:\n\n> You are an experienced AI engineer and helpful assistant.\n\n> You are a friendly and knowledgeable chatbot.\n\n### Key `temperature`\n\nThe sampling temperature, between 0 and 1. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic. If set to 0, the model will use log probability to automatically increase the temperature until certain thresholds are hit.\n\nYou can pick a value between 0 and 2. For example:\n\n- `0.1`: Low temperature, extremely conservative and deterministic\n- `0.5`: Medium temperature, balanced between conservative and creative\n- `1.0`: High temperature, creative and bit random\n- `1.5`: Very high temperature, extremely creative and often chaotic and unpredictable\n- `2.0`: Maximum temperature, completely random and unpredictable, for some extreme creative use cases\n\n# The assistant\n\nTake this description of the persona:\n\n> {personaDescription}",resultingParameterName:"modelsRequirements",format:"JSON",dependentParameterNames:["availableModels","personaDescription"]}],personas:[],preparations:[],knowledgeSources:[],knowledgePieces:[],sources:[{type:"BOOK",path:null,content:"# Prepare Persona\n\n- PIPELINE URL `https://promptbook.studio/promptbook/prepare-persona.book`\n- INPUT PARAMETER `{availableModels}` List of available model names together with their descriptions as JSON\n- INPUT PARAMETER `{personaDescription}` Description of the persona\n- OUTPUT PARAMETER `{modelsRequirements}` Specific requirements for the model\n\n## Make modelRequirements\n\n- FORMAT JSON\n\n```markdown\nYou are an experienced AI engineer, you need to find the best models for virtual assistants:\n\n## Example\n\n\\`\\`\\`json\n[\n {\n \"modelName\": \"gpt-4o\",\n \"systemMessage\": \"You are experienced AI engineer and helpful assistant.\",\n \"temperature\": 0.7\n },\n {\n \"modelName\": \"claude-3-5-sonnet\",\n \"systemMessage\": \"You are a friendly and knowledgeable chatbot.\",\n \"temperature\": 0.5\n }\n]\n\\`\\`\\`\n\n## Instructions\n\n- Your output format is JSON array\n- Sort best-fitting models first\n- Omit any models that are not suitable\n- Write just the JSON, no other text should be present\n- Array contain items with following keys:\n - `modelName`: The name of the model to use\n - `systemMessage`: The system message to provide context to the model\n - `temperature`: The sampling temperature to use\n\n### Key `modelName`\n\nHere are the available models:\n\n\\`\\`\\`json\n{availableModels}\n\\`\\`\\`\n\n### Key `systemMessage`\n\nThe system message is used to communicate instructions or provide context to the model at the beginning of a conversation. It is displayed in a different format compared to user messages, helping the model understand its role in the conversation. The system message typically guides the model's behavior, sets the tone, or specifies desired output from the model. By utilizing the system message effectively, users can steer the model towards generating more accurate and relevant responses.\n\nFor example:\n\n> You are an experienced AI engineer and helpful assistant.\n\n> You are a friendly and knowledgeable chatbot.\n\n### Key `temperature`\n\nThe sampling temperature, between 0 and 1. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic. If set to 0, the model will use log probability to automatically increase the temperature until certain thresholds are hit.\n\nYou can pick a value between 0 and 2. For example:\n\n- `0.1`: Low temperature, extremely conservative and deterministic\n- `0.5`: Medium temperature, balanced between conservative and creative\n- `1.0`: High temperature, creative and bit random\n- `1.5`: Very high temperature, extremely creative and often chaotic and unpredictable\n- `2.0`: Maximum temperature, completely random and unpredictable, for some extreme creative use cases\n\n# The assistant\n\nTake this description of the persona:\n\n> {personaDescription}\n```\n\n`-> {modelsRequirements}`\n"}],sourceFile:"./books/prepare-persona.book"},{title:"Prepare Title",pipelineUrl:"https://promptbook.studio/promptbook/prepare-title.book",formfactorName:"GENERIC",parameters:[{name:"book",description:"The book to prepare the title for",isInput:true,isOutput:false},{name:"title",description:"Best title for the book",isInput:false,isOutput:true}],tasks:[{taskType:"PROMPT_TASK",name:"make-title",title:"Make title",content:"Make best title for given text which describes the workflow:\n\n## Rules\n\n- Write just title, nothing else\n- Title should be concise and clear - Write maximum ideally 2 words, maximum 5 words\n- Title starts with emoticon\n- Title should not mention the input and output of the workflow but the main purpose of the workflow\n _For example, not \"✍ Convert Knowledge-piece to title\" but \"✍ Title\"_\n\n## The workflow\n\n> {book}",resultingParameterName:"title",expectations:{words:{min:1,max:8},lines:{min:1,max:1}},dependentParameterNames:["book"]}],personas:[],preparations:[],knowledgeSources:[],knowledgePieces:[],sources:[{type:"BOOK",path:null,content:"# Prepare Title\n\n- PIPELINE URL `https://promptbook.studio/promptbook/prepare-title.book`\n- INPUT PARAMETER `{book}` The book to prepare the title for\n- OUTPUT PARAMETER `{title}` Best title for the book\n\n## Make title\n\n- EXPECT MIN 1 Word\n- EXPECT MAX 8 Words\n- EXPECT EXACTLY 1 Line\n\n```markdown\nMake best title for given text which describes the workflow:\n\n## Rules\n\n- Write just title, nothing else\n- Title should be concise and clear - Write maximum ideally 2 words, maximum 5 words\n- Title starts with emoticon\n- Title should not mention the input and output of the workflow but the main purpose of the workflow\n _For example, not \"✍ Convert Knowledge-piece to title\" but \"✍ Title\"_\n\n## The workflow\n\n> {book}\n```\n\n`-> {title}`\n"}],sourceFile:"./books/prepare-title.book"}];
|
|
1559
|
+
|
|
1522
1560
|
/**
|
|
1523
|
-
*
|
|
1524
|
-
* Handles normalization and path formatting to create consistent cache directory structures.
|
|
1561
|
+
* Checks if value is valid email
|
|
1525
1562
|
*
|
|
1526
|
-
* @
|
|
1563
|
+
* @public exported from `@promptbook/utils`
|
|
1527
1564
|
*/
|
|
1528
|
-
function
|
|
1529
|
-
|
|
1565
|
+
function isValidEmail(email) {
|
|
1566
|
+
if (typeof email !== 'string') {
|
|
1567
|
+
return false;
|
|
1568
|
+
}
|
|
1569
|
+
if (email.split(/\r?\n/).length > 1) {
|
|
1570
|
+
return false;
|
|
1571
|
+
}
|
|
1572
|
+
return /^.+@.+\..+$/.test(email);
|
|
1530
1573
|
}
|
|
1531
1574
|
|
|
1532
1575
|
/**
|
|
1533
|
-
*
|
|
1534
|
-
*/
|
|
1535
|
-
const defaultDiacriticsRemovalMap = [
|
|
1536
|
-
{
|
|
1537
|
-
base: 'A',
|
|
1538
|
-
letters: '\u0041\u24B6\uFF21\u00C0\u00C1\u00C2\u1EA6\u1EA4\u1EAA\u1EA8\u00C3\u0100\u0102\u1EB0\u1EAE\u1EB4\u1EB2\u0226\u01E0\u00C4\u01DE\u1EA2\u00C5\u01FA\u01CD\u0200\u0202\u1EA0\u1EAC\u1EB6\u1E00\u0104\u023A\u2C6F',
|
|
1539
|
-
},
|
|
1540
|
-
{ base: 'AA', letters: '\uA732' },
|
|
1541
|
-
{ base: 'AE', letters: '\u00C6\u01FC\u01E2' },
|
|
1542
|
-
{ base: 'AO', letters: '\uA734' },
|
|
1543
|
-
{ base: 'AU', letters: '\uA736' },
|
|
1544
|
-
{ base: 'AV', letters: '\uA738\uA73A' },
|
|
1545
|
-
{ base: 'AY', letters: '\uA73C' },
|
|
1546
|
-
{
|
|
1547
|
-
base: 'B',
|
|
1548
|
-
letters: '\u0042\u24B7\uFF22\u1E02\u1E04\u1E06\u0243\u0182\u0181',
|
|
1549
|
-
},
|
|
1550
|
-
{
|
|
1551
|
-
base: 'C',
|
|
1552
|
-
letters: '\u0043\u24B8\uFF23\u0106\u0108\u010A\u010C\u00C7\u1E08\u0187\u023B\uA73E',
|
|
1553
|
-
},
|
|
1554
|
-
{
|
|
1555
|
-
base: 'D',
|
|
1556
|
-
letters: '\u0044\u24B9\uFF24\u1E0A\u010E\u1E0C\u1E10\u1E12\u1E0E\u0110\u018B\u018A\u0189\uA779\u00D0',
|
|
1557
|
-
},
|
|
1558
|
-
{ base: 'DZ', letters: '\u01F1\u01C4' },
|
|
1559
|
-
{ base: 'Dz', letters: '\u01F2\u01C5' },
|
|
1560
|
-
{
|
|
1561
|
-
base: 'E',
|
|
1562
|
-
letters: '\u0045\u24BA\uFF25\u00C8\u00C9\u00CA\u1EC0\u1EBE\u1EC4\u1EC2\u1EBC\u0112\u1E14\u1E16\u0114\u0116\u00CB\u1EBA\u011A\u0204\u0206\u1EB8\u1EC6\u0228\u1E1C\u0118\u1E18\u1E1A\u0190\u018E',
|
|
1563
|
-
},
|
|
1564
|
-
{ base: 'F', letters: '\u0046\u24BB\uFF26\u1E1E\u0191\uA77B' },
|
|
1565
|
-
{
|
|
1566
|
-
base: 'G',
|
|
1567
|
-
letters: '\u0047\u24BC\uFF27\u01F4\u011C\u1E20\u011E\u0120\u01E6\u0122\u01E4\u0193\uA7A0\uA77D\uA77E',
|
|
1568
|
-
},
|
|
1569
|
-
{
|
|
1570
|
-
base: 'H',
|
|
1571
|
-
letters: '\u0048\u24BD\uFF28\u0124\u1E22\u1E26\u021E\u1E24\u1E28\u1E2A\u0126\u2C67\u2C75\uA78D',
|
|
1572
|
-
},
|
|
1573
|
-
{
|
|
1574
|
-
base: 'I',
|
|
1575
|
-
letters: '\u0049\u24BE\uFF29\u00CC\u00CD\u00CE\u0128\u012A\u012C\u0130\u00CF\u1E2E\u1EC8\u01CF\u0208\u020A\u1ECA\u012E\u1E2C\u0197',
|
|
1576
|
-
},
|
|
1577
|
-
{ base: 'J', letters: '\u004A\u24BF\uFF2A\u0134\u0248' },
|
|
1578
|
-
{
|
|
1579
|
-
base: 'K',
|
|
1580
|
-
letters: '\u004B\u24C0\uFF2B\u1E30\u01E8\u1E32\u0136\u1E34\u0198\u2C69\uA740\uA742\uA744\uA7A2',
|
|
1581
|
-
},
|
|
1582
|
-
{
|
|
1583
|
-
base: 'L',
|
|
1584
|
-
letters: '\u004C\u24C1\uFF2C\u013F\u0139\u013D\u1E36\u1E38\u013B\u1E3C\u1E3A\u0141\u023D\u2C62\u2C60\uA748\uA746\uA780',
|
|
1585
|
-
},
|
|
1586
|
-
{ base: 'LJ', letters: '\u01C7' },
|
|
1587
|
-
{ base: 'Lj', letters: '\u01C8' },
|
|
1588
|
-
{ base: 'M', letters: '\u004D\u24C2\uFF2D\u1E3E\u1E40\u1E42\u2C6E\u019C' },
|
|
1589
|
-
{
|
|
1590
|
-
base: 'N',
|
|
1591
|
-
letters: '\u004E\u24C3\uFF2E\u01F8\u0143\u00D1\u1E44\u0147\u1E46\u0145\u1E4A\u1E48\u0220\u019D\uA790\uA7A4',
|
|
1592
|
-
},
|
|
1593
|
-
{ base: 'NJ', letters: '\u01CA' },
|
|
1594
|
-
{ base: 'Nj', letters: '\u01CB' },
|
|
1595
|
-
{
|
|
1596
|
-
base: 'O',
|
|
1597
|
-
letters: '\u004F\u24C4\uFF2F\u00D2\u00D3\u00D4\u1ED2\u1ED0\u1ED6\u1ED4\u00D5\u1E4C\u022C\u1E4E\u014C\u1E50\u1E52\u014E\u022E\u0230\u00D6\u022A\u1ECE\u0150\u01D1\u020C\u020E\u01A0\u1EDC\u1EDA\u1EE0\u1EDE\u1EE2\u1ECC\u1ED8\u01EA\u01EC\u00D8\u01FE\u0186\u019F\uA74A\uA74C',
|
|
1598
|
-
},
|
|
1599
|
-
{ base: 'OI', letters: '\u01A2' },
|
|
1600
|
-
{ base: 'OO', letters: '\uA74E' },
|
|
1601
|
-
{ base: 'OU', letters: '\u0222' },
|
|
1602
|
-
{ base: 'OE', letters: '\u008C\u0152' },
|
|
1603
|
-
{ base: 'oe', letters: '\u009C\u0153' },
|
|
1604
|
-
{
|
|
1605
|
-
base: 'P',
|
|
1606
|
-
letters: '\u0050\u24C5\uFF30\u1E54\u1E56\u01A4\u2C63\uA750\uA752\uA754',
|
|
1607
|
-
},
|
|
1608
|
-
{ base: 'Q', letters: '\u0051\u24C6\uFF31\uA756\uA758\u024A' },
|
|
1609
|
-
{
|
|
1610
|
-
base: 'R',
|
|
1611
|
-
letters: '\u0052\u24C7\uFF32\u0154\u1E58\u0158\u0210\u0212\u1E5A\u1E5C\u0156\u1E5E\u024C\u2C64\uA75A\uA7A6\uA782',
|
|
1612
|
-
},
|
|
1613
|
-
{
|
|
1614
|
-
base: 'S',
|
|
1615
|
-
letters: '\u0053\u24C8\uFF33\u1E9E\u015A\u1E64\u015C\u1E60\u0160\u1E66\u1E62\u1E68\u0218\u015E\u2C7E\uA7A8\uA784',
|
|
1616
|
-
},
|
|
1617
|
-
{
|
|
1618
|
-
base: 'T',
|
|
1619
|
-
letters: '\u0054\u24C9\uFF34\u1E6A\u0164\u1E6C\u021A\u0162\u1E70\u1E6E\u0166\u01AC\u01AE\u023E\uA786',
|
|
1620
|
-
},
|
|
1621
|
-
{ base: 'TZ', letters: '\uA728' },
|
|
1622
|
-
{
|
|
1623
|
-
base: 'U',
|
|
1624
|
-
letters: '\u0055\u24CA\uFF35\u00D9\u00DA\u00DB\u0168\u1E78\u016A\u1E7A\u016C\u00DC\u01DB\u01D7\u01D5\u01D9\u1EE6\u016E\u0170\u01D3\u0214\u0216\u01AF\u1EEA\u1EE8\u1EEE\u1EEC\u1EF0\u1EE4\u1E72\u0172\u1E76\u1E74\u0244',
|
|
1625
|
-
},
|
|
1626
|
-
{ base: 'V', letters: '\u0056\u24CB\uFF36\u1E7C\u1E7E\u01B2\uA75E\u0245' },
|
|
1627
|
-
{ base: 'VY', letters: '\uA760' },
|
|
1628
|
-
{
|
|
1629
|
-
base: 'W',
|
|
1630
|
-
letters: '\u0057\u24CC\uFF37\u1E80\u1E82\u0174\u1E86\u1E84\u1E88\u2C72',
|
|
1631
|
-
},
|
|
1632
|
-
{ base: 'X', letters: '\u0058\u24CD\uFF38\u1E8A\u1E8C' },
|
|
1633
|
-
{
|
|
1634
|
-
base: 'Y',
|
|
1635
|
-
letters: '\u0059\u24CE\uFF39\u1EF2\u00DD\u0176\u1EF8\u0232\u1E8E\u0178\u1EF6\u1EF4\u01B3\u024E\u1EFE',
|
|
1636
|
-
},
|
|
1637
|
-
{
|
|
1638
|
-
base: 'Z',
|
|
1639
|
-
letters: '\u005A\u24CF\uFF3A\u0179\u1E90\u017B\u017D\u1E92\u1E94\u01B5\u0224\u2C7F\u2C6B\uA762',
|
|
1640
|
-
},
|
|
1641
|
-
{
|
|
1642
|
-
base: 'a',
|
|
1643
|
-
letters: '\u0061\u24D0\uFF41\u1E9A\u00E0\u00E1\u00E2\u1EA7\u1EA5\u1EAB\u1EA9\u00E3\u0101\u0103\u1EB1\u1EAF\u1EB5\u1EB3\u0227\u01E1\u00E4\u01DF\u1EA3\u00E5\u01FB\u01CE\u0201\u0203\u1EA1\u1EAD\u1EB7\u1E01\u0105\u2C65\u0250',
|
|
1644
|
-
},
|
|
1645
|
-
{ base: 'aa', letters: '\uA733' },
|
|
1646
|
-
{ base: 'ae', letters: '\u00E6\u01FD\u01E3' },
|
|
1647
|
-
{ base: 'ao', letters: '\uA735' },
|
|
1648
|
-
{ base: 'au', letters: '\uA737' },
|
|
1649
|
-
{ base: 'av', letters: '\uA739\uA73B' },
|
|
1650
|
-
{ base: 'ay', letters: '\uA73D' },
|
|
1651
|
-
{
|
|
1652
|
-
base: 'b',
|
|
1653
|
-
letters: '\u0062\u24D1\uFF42\u1E03\u1E05\u1E07\u0180\u0183\u0253',
|
|
1654
|
-
},
|
|
1655
|
-
{
|
|
1656
|
-
base: 'c',
|
|
1657
|
-
letters: '\u0063\u24D2\uFF43\u0107\u0109\u010B\u010D\u00E7\u1E09\u0188\u023C\uA73F\u2184',
|
|
1658
|
-
},
|
|
1659
|
-
{
|
|
1660
|
-
base: 'd',
|
|
1661
|
-
letters: '\u0064\u24D3\uFF44\u1E0B\u010F\u1E0D\u1E11\u1E13\u1E0F\u0111\u018C\u0256\u0257\uA77A',
|
|
1662
|
-
},
|
|
1663
|
-
{ base: 'dz', letters: '\u01F3\u01C6' },
|
|
1664
|
-
{
|
|
1665
|
-
base: 'e',
|
|
1666
|
-
letters: '\u0065\u24D4\uFF45\u00E8\u00E9\u00EA\u1EC1\u1EBF\u1EC5\u1EC3\u1EBD\u0113\u1E15\u1E17\u0115\u0117\u00EB\u1EBB\u011B\u0205\u0207\u1EB9\u1EC7\u0229\u1E1D\u0119\u1E19\u1E1B\u0247\u025B\u01DD',
|
|
1667
|
-
},
|
|
1668
|
-
{ base: 'f', letters: '\u0066\u24D5\uFF46\u1E1F\u0192\uA77C' },
|
|
1669
|
-
{
|
|
1670
|
-
base: 'g',
|
|
1671
|
-
letters: '\u0067\u24D6\uFF47\u01F5\u011D\u1E21\u011F\u0121\u01E7\u0123\u01E5\u0260\uA7A1\u1D79\uA77F',
|
|
1672
|
-
},
|
|
1673
|
-
{
|
|
1674
|
-
base: 'h',
|
|
1675
|
-
letters: '\u0068\u24D7\uFF48\u0125\u1E23\u1E27\u021F\u1E25\u1E29\u1E2B\u1E96\u0127\u2C68\u2C76\u0265',
|
|
1676
|
-
},
|
|
1677
|
-
{ base: 'hv', letters: '\u0195' },
|
|
1678
|
-
{
|
|
1679
|
-
base: 'i',
|
|
1680
|
-
letters: '\u0069\u24D8\uFF49\u00EC\u00ED\u00EE\u0129\u012B\u012D\u00EF\u1E2F\u1EC9\u01D0\u0209\u020B\u1ECB\u012F\u1E2D\u0268\u0131',
|
|
1681
|
-
},
|
|
1682
|
-
{ base: 'j', letters: '\u006A\u24D9\uFF4A\u0135\u01F0\u0249' },
|
|
1683
|
-
{
|
|
1684
|
-
base: 'k',
|
|
1685
|
-
letters: '\u006B\u24DA\uFF4B\u1E31\u01E9\u1E33\u0137\u1E35\u0199\u2C6A\uA741\uA743\uA745\uA7A3',
|
|
1686
|
-
},
|
|
1687
|
-
{
|
|
1688
|
-
base: 'l',
|
|
1689
|
-
letters: '\u006C\u24DB\uFF4C\u0140\u013A\u013E\u1E37\u1E39\u013C\u1E3D\u1E3B\u017F\u0142\u019A\u026B\u2C61\uA749\uA781\uA747',
|
|
1690
|
-
},
|
|
1691
|
-
{ base: 'lj', letters: '\u01C9' },
|
|
1692
|
-
{ base: 'm', letters: '\u006D\u24DC\uFF4D\u1E3F\u1E41\u1E43\u0271\u026F' },
|
|
1693
|
-
{
|
|
1694
|
-
base: 'n',
|
|
1695
|
-
letters: '\u006E\u24DD\uFF4E\u01F9\u0144\u00F1\u1E45\u0148\u1E47\u0146\u1E4B\u1E49\u019E\u0272\u0149\uA791\uA7A5',
|
|
1696
|
-
},
|
|
1697
|
-
{ base: 'nj', letters: '\u01CC' },
|
|
1698
|
-
{
|
|
1699
|
-
base: 'o',
|
|
1700
|
-
letters: '\u006F\u24DE\uFF4F\u00F2\u00F3\u00F4\u1ED3\u1ED1\u1ED7\u1ED5\u00F5\u1E4D\u022D\u1E4F\u014D\u1E51\u1E53\u014F\u022F\u0231\u00F6\u022B\u1ECF\u0151\u01D2\u020D\u020F\u01A1\u1EDD\u1EDB\u1EE1\u1EDF\u1EE3\u1ECD\u1ED9\u01EB\u01ED\u00F8\u01FF\u0254\uA74B\uA74D\u0275',
|
|
1701
|
-
},
|
|
1702
|
-
{ base: 'oi', letters: '\u01A3' },
|
|
1703
|
-
{ base: 'ou', letters: '\u0223' },
|
|
1704
|
-
{ base: 'oo', letters: '\uA74F' },
|
|
1705
|
-
{
|
|
1706
|
-
base: 'p',
|
|
1707
|
-
letters: '\u0070\u24DF\uFF50\u1E55\u1E57\u01A5\u1D7D\uA751\uA753\uA755',
|
|
1708
|
-
},
|
|
1709
|
-
{ base: 'q', letters: '\u0071\u24E0\uFF51\u024B\uA757\uA759' },
|
|
1710
|
-
{
|
|
1711
|
-
base: 'r',
|
|
1712
|
-
letters: '\u0072\u24E1\uFF52\u0155\u1E59\u0159\u0211\u0213\u1E5B\u1E5D\u0157\u1E5F\u024D\u027D\uA75B\uA7A7\uA783',
|
|
1713
|
-
},
|
|
1714
|
-
{
|
|
1715
|
-
base: 's',
|
|
1716
|
-
letters: '\u0073\u24E2\uFF53\u00DF\u015B\u1E65\u015D\u1E61\u0161\u1E67\u1E63\u1E69\u0219\u015F\u023F\uA7A9\uA785\u1E9B',
|
|
1717
|
-
},
|
|
1718
|
-
{
|
|
1719
|
-
base: 't',
|
|
1720
|
-
letters: '\u0074\u24E3\uFF54\u1E6B\u1E97\u0165\u1E6D\u021B\u0163\u1E71\u1E6F\u0167\u01AD\u0288\u2C66\uA787',
|
|
1721
|
-
},
|
|
1722
|
-
{ base: 'tz', letters: '\uA729' },
|
|
1723
|
-
{
|
|
1724
|
-
base: 'u',
|
|
1725
|
-
letters: '\u0075\u24E4\uFF55\u00F9\u00FA\u00FB\u0169\u1E79\u016B\u1E7B\u016D\u00FC\u01DC\u01D8\u01D6\u01DA\u1EE7\u016F\u0171\u01D4\u0215\u0217\u01B0\u1EEB\u1EE9\u1EEF\u1EED\u1EF1\u1EE5\u1E73\u0173\u1E77\u1E75\u0289',
|
|
1726
|
-
},
|
|
1727
|
-
{ base: 'v', letters: '\u0076\u24E5\uFF56\u1E7D\u1E7F\u028B\uA75F\u028C' },
|
|
1728
|
-
{ base: 'vy', letters: '\uA761' },
|
|
1729
|
-
{
|
|
1730
|
-
base: 'w',
|
|
1731
|
-
letters: '\u0077\u24E6\uFF57\u1E81\u1E83\u0175\u1E87\u1E85\u1E98\u1E89\u2C73',
|
|
1732
|
-
},
|
|
1733
|
-
{ base: 'x', letters: '\u0078\u24E7\uFF58\u1E8B\u1E8D' },
|
|
1734
|
-
{
|
|
1735
|
-
base: 'y',
|
|
1736
|
-
letters: '\u0079\u24E8\uFF59\u1EF3\u00FD\u0177\u1EF9\u0233\u1E8F\u00FF\u1EF7\u1E99\u1EF5\u01B4\u024F\u1EFF',
|
|
1737
|
-
},
|
|
1738
|
-
{
|
|
1739
|
-
base: 'z',
|
|
1740
|
-
letters: '\u007A\u24E9\uFF5A\u017A\u1E91\u017C\u017E\u1E93\u1E95\u01B6\u0225\u0240\u2C6C\uA763',
|
|
1741
|
-
},
|
|
1742
|
-
];
|
|
1743
|
-
/**
|
|
1744
|
-
* Map of letters from diacritic variant to diacritless variant
|
|
1745
|
-
* Contains lowercase and uppercase separatelly
|
|
1576
|
+
* Tests if given string is valid file path.
|
|
1746
1577
|
*
|
|
1747
|
-
*
|
|
1748
|
-
* > "ě" => "e"
|
|
1749
|
-
* > "Ă" => "A"
|
|
1750
|
-
* > ...
|
|
1751
|
-
*
|
|
1752
|
-
* @public exported from `@promptbook/utils`
|
|
1753
|
-
*/
|
|
1754
|
-
const DIACRITIC_VARIANTS_LETTERS = {};
|
|
1755
|
-
// tslint:disable-next-line: prefer-for-of
|
|
1756
|
-
for (let i = 0; i < defaultDiacriticsRemovalMap.length; i++) {
|
|
1757
|
-
const letters = defaultDiacriticsRemovalMap[i].letters;
|
|
1758
|
-
// tslint:disable-next-line: prefer-for-of
|
|
1759
|
-
for (let j = 0; j < letters.length; j++) {
|
|
1760
|
-
DIACRITIC_VARIANTS_LETTERS[letters[j]] = defaultDiacriticsRemovalMap[i].base;
|
|
1761
|
-
}
|
|
1762
|
-
}
|
|
1763
|
-
// <- TODO: [🍓] Put to maker function to save execution time if not needed
|
|
1764
|
-
/*
|
|
1765
|
-
@see https://stackoverflow.com/questions/990904/remove-accents-diacritics-in-a-string-in-javascript
|
|
1766
|
-
Licensed under the Apache License, Version 2.0 (the "License");
|
|
1767
|
-
you may not use this file except in compliance with the License.
|
|
1768
|
-
You may obtain a copy of the License at
|
|
1769
|
-
|
|
1770
|
-
http://www.apache.org/licenses/LICENSE-2.0
|
|
1771
|
-
|
|
1772
|
-
Unless required by applicable law or agreed to in writing, software
|
|
1773
|
-
distributed under the License is distributed on an "AS IS" BASIS,
|
|
1774
|
-
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1775
|
-
See the License for the specific language governing permissions and
|
|
1776
|
-
limitations under the License.
|
|
1777
|
-
*/
|
|
1778
|
-
|
|
1779
|
-
/**
|
|
1780
|
-
* Removes diacritic marks (accents) from characters in a string.
|
|
1781
|
-
*
|
|
1782
|
-
* Note: [🔂] This function is idempotent.
|
|
1783
|
-
*
|
|
1784
|
-
* @param input The string containing diacritics to be normalized.
|
|
1785
|
-
* @returns The string with diacritics removed or normalized.
|
|
1786
|
-
*
|
|
1787
|
-
* @public exported from `@promptbook/utils`
|
|
1788
|
-
*/
|
|
1789
|
-
function removeDiacritics(input) {
|
|
1790
|
-
/*eslint no-control-regex: "off"*/
|
|
1791
|
-
return input.replace(/[^\u0000-\u007E]/g, (character) => {
|
|
1792
|
-
return DIACRITIC_VARIANTS_LETTERS[character] || character;
|
|
1793
|
-
});
|
|
1794
|
-
}
|
|
1795
|
-
// TODO: [Ж] Variant for cyrillic (and in general non-latin) letters
|
|
1796
|
-
|
|
1797
|
-
/**
|
|
1798
|
-
* Converts a given text to kebab-case format.
|
|
1799
|
-
*
|
|
1800
|
-
* Note: [🔂] This function is idempotent.
|
|
1801
|
-
*
|
|
1802
|
-
* @param text The text to be converted.
|
|
1803
|
-
* @returns The kebab-case formatted string.
|
|
1804
|
-
* @example 'hello-world'
|
|
1805
|
-
* @example 'i-love-promptbook'
|
|
1806
|
-
*
|
|
1807
|
-
* @public exported from `@promptbook/utils`
|
|
1808
|
-
*/
|
|
1809
|
-
function normalizeToKebabCase(text) {
|
|
1810
|
-
text = removeDiacritics(text);
|
|
1811
|
-
let charType;
|
|
1812
|
-
let lastCharType = 'OTHER';
|
|
1813
|
-
let normalizedName = '';
|
|
1814
|
-
for (const char of text) {
|
|
1815
|
-
let normalizedChar;
|
|
1816
|
-
if (/^[a-z]$/.test(char)) {
|
|
1817
|
-
charType = 'LOWERCASE';
|
|
1818
|
-
normalizedChar = char;
|
|
1819
|
-
}
|
|
1820
|
-
else if (/^[A-Z]$/.test(char)) {
|
|
1821
|
-
charType = 'UPPERCASE';
|
|
1822
|
-
normalizedChar = char.toLowerCase();
|
|
1823
|
-
}
|
|
1824
|
-
else if (/^[0-9]$/.test(char)) {
|
|
1825
|
-
charType = 'NUMBER';
|
|
1826
|
-
normalizedChar = char;
|
|
1827
|
-
}
|
|
1828
|
-
else {
|
|
1829
|
-
charType = 'OTHER';
|
|
1830
|
-
normalizedChar = '-';
|
|
1831
|
-
}
|
|
1832
|
-
if (charType !== lastCharType &&
|
|
1833
|
-
!(lastCharType === 'UPPERCASE' && charType === 'LOWERCASE') &&
|
|
1834
|
-
!(lastCharType === 'NUMBER') &&
|
|
1835
|
-
!(charType === 'NUMBER')) {
|
|
1836
|
-
normalizedName += '-';
|
|
1837
|
-
}
|
|
1838
|
-
normalizedName += normalizedChar;
|
|
1839
|
-
lastCharType = charType;
|
|
1840
|
-
}
|
|
1841
|
-
normalizedName = normalizedName.split(/-+/g).join('-');
|
|
1842
|
-
normalizedName = normalizedName.split(/-?\/-?/g).join('/');
|
|
1843
|
-
normalizedName = normalizedName.replace(/^-/, '');
|
|
1844
|
-
normalizedName = normalizedName.replace(/-$/, '');
|
|
1845
|
-
return normalizedName;
|
|
1846
|
-
}
|
|
1847
|
-
// Note: [💞] Ignore a discrepancy between file name and entity name
|
|
1848
|
-
|
|
1849
|
-
/**
|
|
1850
|
-
* Tests if given string is valid file path.
|
|
1851
|
-
*
|
|
1852
|
-
* Note: This does not check if the file exists only if the path is valid
|
|
1578
|
+
* Note: This does not check if the file exists only if the path is valid
|
|
1853
1579
|
*
|
|
1854
1580
|
* @public exported from `@promptbook/utils`
|
|
1855
1581
|
*/
|
|
@@ -1932,137 +1658,6 @@
|
|
|
1932
1658
|
}
|
|
1933
1659
|
}
|
|
1934
1660
|
|
|
1935
|
-
/**
|
|
1936
|
-
* Removes emojis from a string and fix whitespaces
|
|
1937
|
-
*
|
|
1938
|
-
* Note: [🔂] This function is idempotent.
|
|
1939
|
-
*
|
|
1940
|
-
* @param text with emojis
|
|
1941
|
-
* @returns text without emojis
|
|
1942
|
-
*
|
|
1943
|
-
* @public exported from `@promptbook/utils`
|
|
1944
|
-
*/
|
|
1945
|
-
function removeEmojis(text) {
|
|
1946
|
-
// Replace emojis (and also ZWJ sequence) with hyphens
|
|
1947
|
-
text = text.replace(/(\p{Extended_Pictographic})\p{Modifier_Symbol}/gu, '$1');
|
|
1948
|
-
text = text.replace(/(\p{Extended_Pictographic})[\u{FE00}-\u{FE0F}]/gu, '$1');
|
|
1949
|
-
text = text.replace(/(\p{Extended_Pictographic})(\u{200D}\p{Extended_Pictographic})*/gu, '$1');
|
|
1950
|
-
text = text.replace(/\p{Extended_Pictographic}/gu, '');
|
|
1951
|
-
return text;
|
|
1952
|
-
}
|
|
1953
|
-
|
|
1954
|
-
/**
|
|
1955
|
-
* Converts a title string into a normalized name.
|
|
1956
|
-
*
|
|
1957
|
-
* Note: [🔂] This function is idempotent.
|
|
1958
|
-
*
|
|
1959
|
-
* @param value The title string to be converted to a name.
|
|
1960
|
-
* @returns A normalized name derived from the input title.
|
|
1961
|
-
* @example 'Hello World!' -> 'hello-world'
|
|
1962
|
-
*
|
|
1963
|
-
* @public exported from `@promptbook/utils`
|
|
1964
|
-
*/
|
|
1965
|
-
function titleToName(value) {
|
|
1966
|
-
if (isValidUrl(value)) {
|
|
1967
|
-
value = value.replace(/^https?:\/\//, '');
|
|
1968
|
-
value = value.replace(/\.html$/, '');
|
|
1969
|
-
}
|
|
1970
|
-
else if (isValidFilePath(value)) {
|
|
1971
|
-
value = path.basename(value);
|
|
1972
|
-
// Note: Keeping extension in the name
|
|
1973
|
-
}
|
|
1974
|
-
value = value.split('/').join('-');
|
|
1975
|
-
value = removeEmojis(value);
|
|
1976
|
-
value = normalizeToKebabCase(value);
|
|
1977
|
-
// TODO: [🧠] Maybe warn or add some padding to short name which are not good identifiers
|
|
1978
|
-
return value;
|
|
1979
|
-
}
|
|
1980
|
-
|
|
1981
|
-
/**
|
|
1982
|
-
* Retrieves an intermediate source for a scraper based on the knowledge source.
|
|
1983
|
-
* Manages the caching and retrieval of intermediate scraper results for optimized performance.
|
|
1984
|
-
*
|
|
1985
|
-
* @private as internal utility for scrapers
|
|
1986
|
-
*/
|
|
1987
|
-
async function getScraperIntermediateSource(source, options) {
|
|
1988
|
-
const { filename: sourceFilename, url } = source;
|
|
1989
|
-
const { rootDirname, cacheDirname, intermediateFilesStrategy, extension, isVerbose } = options;
|
|
1990
|
-
// TODO: [👬] DRY
|
|
1991
|
-
const hash = cryptoJs.SHA256(
|
|
1992
|
-
// <- TODO: [🥬] Encapsulate sha256 to some private utility function
|
|
1993
|
-
hexEncoder__default["default"].parse(sourceFilename || url || 'untitled'))
|
|
1994
|
-
.toString( /* hex */)
|
|
1995
|
-
.substring(0, 20);
|
|
1996
|
-
// <- TODO: [🥬] Make some system for hashes and ids of promptbook
|
|
1997
|
-
const semanticName = normalizeToKebabCase(titleToName((sourceFilename || url || '').split('intermediate').join(''))).substring(0, 20);
|
|
1998
|
-
// <- TODO: [🐱🐉]
|
|
1999
|
-
const pieces = ['intermediate', semanticName, hash].filter((piece) => piece !== '');
|
|
2000
|
-
const name = pieces.join('-').split('--').join('-');
|
|
2001
|
-
const cacheFilename = path.join(process.cwd(), cacheDirname, ...nameToSubfolderPath(hash /* <- TODO: [🎎] Maybe add some SHA256 prefix */), name)
|
|
2002
|
-
.split('\\')
|
|
2003
|
-
.join('/') +
|
|
2004
|
-
'.' +
|
|
2005
|
-
extension;
|
|
2006
|
-
// Note: Try to create cache directory, but don't fail if filesystem has issues
|
|
2007
|
-
try {
|
|
2008
|
-
await promises.mkdir(path.dirname(cacheFilename), { recursive: true });
|
|
2009
|
-
}
|
|
2010
|
-
catch (error) {
|
|
2011
|
-
// Note: If we can't create cache directory, continue without it
|
|
2012
|
-
// This handles read-only filesystems, permission issues, and missing parent directories
|
|
2013
|
-
if (error instanceof Error &&
|
|
2014
|
-
(error.message.includes('EROFS') ||
|
|
2015
|
-
error.message.includes('read-only') ||
|
|
2016
|
-
error.message.includes('EACCES') ||
|
|
2017
|
-
error.message.includes('EPERM') ||
|
|
2018
|
-
error.message.includes('ENOENT'))) ;
|
|
2019
|
-
else {
|
|
2020
|
-
// Re-throw other unexpected errors
|
|
2021
|
-
throw error;
|
|
2022
|
-
}
|
|
2023
|
-
}
|
|
2024
|
-
let isDestroyed = true;
|
|
2025
|
-
const fileHandler = {
|
|
2026
|
-
filename: cacheFilename,
|
|
2027
|
-
get isDestroyed() {
|
|
2028
|
-
return isDestroyed;
|
|
2029
|
-
},
|
|
2030
|
-
async destroy() {
|
|
2031
|
-
if (intermediateFilesStrategy === 'HIDE_AND_CLEAN') {
|
|
2032
|
-
if (isVerbose) {
|
|
2033
|
-
console.info('legacyDocumentScraper: Clening cache');
|
|
2034
|
-
}
|
|
2035
|
-
await promises.rm(cacheFilename);
|
|
2036
|
-
// TODO: [🐿][🧠] Maybe remove empty folders
|
|
2037
|
-
}
|
|
2038
|
-
isDestroyed = true;
|
|
2039
|
-
},
|
|
2040
|
-
};
|
|
2041
|
-
return fileHandler;
|
|
2042
|
-
}
|
|
2043
|
-
// Note: [🟢] Code for Node scraper helper [getScraperIntermediateSource](src/scrapers/_common/utils/getScraperIntermediateSource.ts) should never be published into packages that could be imported into browser environment
|
|
2044
|
-
// Note: Not using `FileCacheStorage` for two reasons:
|
|
2045
|
-
// 1. Need to store more than serialized JSONs.
|
|
2046
|
-
// 2. Need to switch between a `rootDirname` and `cacheDirname` <- TODO: [😡]
|
|
2047
|
-
// TODO: [🐱🐉][🧠] Make some smart crop
|
|
2048
|
-
|
|
2049
|
-
var PipelineCollection = [{title:"Prepare Knowledge from Markdown",pipelineUrl:"https://promptbook.studio/promptbook/prepare-knowledge-from-markdown.book",formfactorName:"GENERIC",parameters:[{name:"knowledgeContent",description:"Markdown document content",isInput:true,isOutput:false},{name:"knowledgePieces",description:"The knowledge JSON object",isInput:false,isOutput:true}],tasks:[{taskType:"PROMPT_TASK",name:"knowledge",title:"Knowledge",content:"You are experienced data researcher, extract the important knowledge from the document.\n\n# Rules\n\n- Make pieces of information concise, clear, and easy to understand\n- One piece of information should be approximately 1 paragraph\n- Divide the paragraphs by markdown horizontal lines ---\n- Omit irrelevant information\n- Group redundant information\n- Write just extracted information, nothing else\n\n# The document\n\nTake information from this document:\n\n> {knowledgeContent}",resultingParameterName:"knowledgePieces",dependentParameterNames:["knowledgeContent"]}],personas:[],preparations:[],knowledgeSources:[],knowledgePieces:[],sources:[{type:"BOOK",path:null,content:"# Prepare Knowledge from Markdown\n\n- PIPELINE URL `https://promptbook.studio/promptbook/prepare-knowledge-from-markdown.book`\n- INPUT PARAMETER `{knowledgeContent}` Markdown document content\n- OUTPUT PARAMETER `{knowledgePieces}` The knowledge JSON object\n\n## Knowledge\n\n<!-- TODO: [🍆] -FORMAT JSON -->\n\n```markdown\nYou are experienced data researcher, extract the important knowledge from the document.\n\n# Rules\n\n- Make pieces of information concise, clear, and easy to understand\n- One piece of information should be approximately 1 paragraph\n- Divide the paragraphs by markdown horizontal lines ---\n- Omit irrelevant information\n- Group redundant information\n- Write just extracted information, nothing else\n\n# The document\n\nTake information from this document:\n\n> {knowledgeContent}\n```\n\n`-> {knowledgePieces}`\n"}],sourceFile:"./books/prepare-knowledge-from-markdown.book"},{title:"Prepare Keywords",pipelineUrl:"https://promptbook.studio/promptbook/prepare-knowledge-keywords.book",formfactorName:"GENERIC",parameters:[{name:"knowledgePieceContent",description:"The content",isInput:true,isOutput:false},{name:"keywords",description:"Keywords separated by comma",isInput:false,isOutput:true}],tasks:[{taskType:"PROMPT_TASK",name:"knowledge",title:"Knowledge",content:"You are experienced data researcher, detect the important keywords in the document.\n\n# Rules\n\n- Write just keywords separated by comma\n\n# The document\n\nTake information from this document:\n\n> {knowledgePieceContent}",resultingParameterName:"keywords",dependentParameterNames:["knowledgePieceContent"]}],personas:[],preparations:[],knowledgeSources:[],knowledgePieces:[],sources:[{type:"BOOK",path:null,content:"# Prepare Keywords\n\n- PIPELINE URL `https://promptbook.studio/promptbook/prepare-knowledge-keywords.book`\n- INPUT PARAMETER `{knowledgePieceContent}` The content\n- OUTPUT PARAMETER `{keywords}` Keywords separated by comma\n\n## Knowledge\n\n<!-- TODO: [🍆] -FORMAT JSON -->\n\n```markdown\nYou are experienced data researcher, detect the important keywords in the document.\n\n# Rules\n\n- Write just keywords separated by comma\n\n# The document\n\nTake information from this document:\n\n> {knowledgePieceContent}\n```\n\n`-> {keywords}`\n"}],sourceFile:"./books/prepare-knowledge-keywords.book"},{title:"Prepare Knowledge-piece Title",pipelineUrl:"https://promptbook.studio/promptbook/prepare-knowledge-title.book",formfactorName:"GENERIC",parameters:[{name:"knowledgePieceContent",description:"The content",isInput:true,isOutput:false},{name:"title",description:"The title of the document",isInput:false,isOutput:true}],tasks:[{taskType:"PROMPT_TASK",name:"knowledge",title:"Knowledge",content:"You are experienced content creator, write best title for the document.\n\n# Rules\n\n- Write just title, nothing else\n- Write maximum 5 words for the title\n\n# The document\n\n> {knowledgePieceContent}",resultingParameterName:"title",expectations:{words:{min:1,max:8}},dependentParameterNames:["knowledgePieceContent"]}],personas:[],preparations:[],knowledgeSources:[],knowledgePieces:[],sources:[{type:"BOOK",path:null,content:"# Prepare Knowledge-piece Title\n\n- PIPELINE URL `https://promptbook.studio/promptbook/prepare-knowledge-title.book`\n- INPUT PARAMETER `{knowledgePieceContent}` The content\n- OUTPUT PARAMETER `{title}` The title of the document\n\n## Knowledge\n\n- EXPECT MIN 1 WORD\n- EXPECT MAX 8 WORDS\n\n```markdown\nYou are experienced content creator, write best title for the document.\n\n# Rules\n\n- Write just title, nothing else\n- Write maximum 5 words for the title\n\n# The document\n\n> {knowledgePieceContent}\n```\n\n`-> {title}`\n"}],sourceFile:"./books/prepare-knowledge-title.book"},{title:"Prepare Persona",pipelineUrl:"https://promptbook.studio/promptbook/prepare-persona.book",formfactorName:"GENERIC",parameters:[{name:"availableModels",description:"List of available model names together with their descriptions as JSON",isInput:true,isOutput:false},{name:"personaDescription",description:"Description of the persona",isInput:true,isOutput:false},{name:"modelsRequirements",description:"Specific requirements for the model",isInput:false,isOutput:true}],tasks:[{taskType:"PROMPT_TASK",name:"make-model-requirements",title:"Make modelRequirements",content:"You are an experienced AI engineer, you need to find the best models for virtual assistants:\n\n## Example\n\n```json\n[\n {\n \"modelName\": \"gpt-4o\",\n \"systemMessage\": \"You are experienced AI engineer and helpful assistant.\",\n \"temperature\": 0.7\n },\n {\n \"modelName\": \"claude-3-5-sonnet\",\n \"systemMessage\": \"You are a friendly and knowledgeable chatbot.\",\n \"temperature\": 0.5\n }\n]\n```\n\n## Instructions\n\n- Your output format is JSON array\n- Sort best-fitting models first\n- Omit any models that are not suitable\n- Write just the JSON, no other text should be present\n- Array contain items with following keys:\n - `modelName`: The name of the model to use\n - `systemMessage`: The system message to provide context to the model\n - `temperature`: The sampling temperature to use\n\n### Key `modelName`\n\nHere are the available models:\n\n```json\n{availableModels}\n```\n\n### Key `systemMessage`\n\nThe system message is used to communicate instructions or provide context to the model at the beginning of a conversation. It is displayed in a different format compared to user messages, helping the model understand its role in the conversation. The system message typically guides the model's behavior, sets the tone, or specifies desired output from the model. By utilizing the system message effectively, users can steer the model towards generating more accurate and relevant responses.\n\nFor example:\n\n> You are an experienced AI engineer and helpful assistant.\n\n> You are a friendly and knowledgeable chatbot.\n\n### Key `temperature`\n\nThe sampling temperature, between 0 and 1. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic. If set to 0, the model will use log probability to automatically increase the temperature until certain thresholds are hit.\n\nYou can pick a value between 0 and 2. For example:\n\n- `0.1`: Low temperature, extremely conservative and deterministic\n- `0.5`: Medium temperature, balanced between conservative and creative\n- `1.0`: High temperature, creative and bit random\n- `1.5`: Very high temperature, extremely creative and often chaotic and unpredictable\n- `2.0`: Maximum temperature, completely random and unpredictable, for some extreme creative use cases\n\n# The assistant\n\nTake this description of the persona:\n\n> {personaDescription}",resultingParameterName:"modelsRequirements",format:"JSON",dependentParameterNames:["availableModels","personaDescription"]}],personas:[],preparations:[],knowledgeSources:[],knowledgePieces:[],sources:[{type:"BOOK",path:null,content:"# Prepare Persona\n\n- PIPELINE URL `https://promptbook.studio/promptbook/prepare-persona.book`\n- INPUT PARAMETER `{availableModels}` List of available model names together with their descriptions as JSON\n- INPUT PARAMETER `{personaDescription}` Description of the persona\n- OUTPUT PARAMETER `{modelsRequirements}` Specific requirements for the model\n\n## Make modelRequirements\n\n- FORMAT JSON\n\n```markdown\nYou are an experienced AI engineer, you need to find the best models for virtual assistants:\n\n## Example\n\n\\`\\`\\`json\n[\n {\n \"modelName\": \"gpt-4o\",\n \"systemMessage\": \"You are experienced AI engineer and helpful assistant.\",\n \"temperature\": 0.7\n },\n {\n \"modelName\": \"claude-3-5-sonnet\",\n \"systemMessage\": \"You are a friendly and knowledgeable chatbot.\",\n \"temperature\": 0.5\n }\n]\n\\`\\`\\`\n\n## Instructions\n\n- Your output format is JSON array\n- Sort best-fitting models first\n- Omit any models that are not suitable\n- Write just the JSON, no other text should be present\n- Array contain items with following keys:\n - `modelName`: The name of the model to use\n - `systemMessage`: The system message to provide context to the model\n - `temperature`: The sampling temperature to use\n\n### Key `modelName`\n\nHere are the available models:\n\n\\`\\`\\`json\n{availableModels}\n\\`\\`\\`\n\n### Key `systemMessage`\n\nThe system message is used to communicate instructions or provide context to the model at the beginning of a conversation. It is displayed in a different format compared to user messages, helping the model understand its role in the conversation. The system message typically guides the model's behavior, sets the tone, or specifies desired output from the model. By utilizing the system message effectively, users can steer the model towards generating more accurate and relevant responses.\n\nFor example:\n\n> You are an experienced AI engineer and helpful assistant.\n\n> You are a friendly and knowledgeable chatbot.\n\n### Key `temperature`\n\nThe sampling temperature, between 0 and 1. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic. If set to 0, the model will use log probability to automatically increase the temperature until certain thresholds are hit.\n\nYou can pick a value between 0 and 2. For example:\n\n- `0.1`: Low temperature, extremely conservative and deterministic\n- `0.5`: Medium temperature, balanced between conservative and creative\n- `1.0`: High temperature, creative and bit random\n- `1.5`: Very high temperature, extremely creative and often chaotic and unpredictable\n- `2.0`: Maximum temperature, completely random and unpredictable, for some extreme creative use cases\n\n# The assistant\n\nTake this description of the persona:\n\n> {personaDescription}\n```\n\n`-> {modelsRequirements}`\n"}],sourceFile:"./books/prepare-persona.book"},{title:"Prepare Title",pipelineUrl:"https://promptbook.studio/promptbook/prepare-title.book",formfactorName:"GENERIC",parameters:[{name:"book",description:"The book to prepare the title for",isInput:true,isOutput:false},{name:"title",description:"Best title for the book",isInput:false,isOutput:true}],tasks:[{taskType:"PROMPT_TASK",name:"make-title",title:"Make title",content:"Make best title for given text which describes the workflow:\n\n## Rules\n\n- Write just title, nothing else\n- Title should be concise and clear - Write maximum ideally 2 words, maximum 5 words\n- Title starts with emoticon\n- Title should not mention the input and output of the workflow but the main purpose of the workflow\n _For example, not \"✍ Convert Knowledge-piece to title\" but \"✍ Title\"_\n\n## The workflow\n\n> {book}",resultingParameterName:"title",expectations:{words:{min:1,max:8},lines:{min:1,max:1}},dependentParameterNames:["book"]}],personas:[],preparations:[],knowledgeSources:[],knowledgePieces:[],sources:[{type:"BOOK",path:null,content:"# Prepare Title\n\n- PIPELINE URL `https://promptbook.studio/promptbook/prepare-title.book`\n- INPUT PARAMETER `{book}` The book to prepare the title for\n- OUTPUT PARAMETER `{title}` Best title for the book\n\n## Make title\n\n- EXPECT MIN 1 Word\n- EXPECT MAX 8 Words\n- EXPECT EXACTLY 1 Line\n\n```markdown\nMake best title for given text which describes the workflow:\n\n## Rules\n\n- Write just title, nothing else\n- Title should be concise and clear - Write maximum ideally 2 words, maximum 5 words\n- Title starts with emoticon\n- Title should not mention the input and output of the workflow but the main purpose of the workflow\n _For example, not \"✍ Convert Knowledge-piece to title\" but \"✍ Title\"_\n\n## The workflow\n\n> {book}\n```\n\n`-> {title}`\n"}],sourceFile:"./books/prepare-title.book"}];
|
|
2050
|
-
|
|
2051
|
-
/**
|
|
2052
|
-
* Checks if value is valid email
|
|
2053
|
-
*
|
|
2054
|
-
* @public exported from `@promptbook/utils`
|
|
2055
|
-
*/
|
|
2056
|
-
function isValidEmail(email) {
|
|
2057
|
-
if (typeof email !== 'string') {
|
|
2058
|
-
return false;
|
|
2059
|
-
}
|
|
2060
|
-
if (email.split(/\r?\n/).length > 1) {
|
|
2061
|
-
return false;
|
|
2062
|
-
}
|
|
2063
|
-
return /^.+@.+\..+$/.test(email);
|
|
2064
|
-
}
|
|
2065
|
-
|
|
2066
1661
|
/**
|
|
2067
1662
|
* This error indicates that the promptbook in a markdown format cannot be parsed into a valid promptbook object
|
|
2068
1663
|
*
|
|
@@ -4426,95 +4021,412 @@
|
|
|
4426
4021
|
*
|
|
4427
4022
|
* @singleton Only one instance of each register is created per build, but there can be more than one in different build modules
|
|
4428
4023
|
*
|
|
4429
|
-
* @public exported from `@promptbook/core`
|
|
4024
|
+
* @public exported from `@promptbook/core`
|
|
4025
|
+
*/
|
|
4026
|
+
const $scrapersRegister = new $Register('scraper_constructors');
|
|
4027
|
+
// TODO: [®] DRY Register logic
|
|
4028
|
+
|
|
4029
|
+
/**
|
|
4030
|
+
* Creates a message with all registered scrapers
|
|
4031
|
+
*
|
|
4032
|
+
* Note: This function is used to create a (error) message when there is no scraper for particular mime type
|
|
4033
|
+
*
|
|
4034
|
+
* @private internal function of `createScrapersFromConfiguration` and `createScrapersFromEnv`
|
|
4035
|
+
*/
|
|
4036
|
+
function $registeredScrapersMessage(availableScrapers) {
|
|
4037
|
+
/**
|
|
4038
|
+
* Mixes registered scrapers from $scrapersMetadataRegister and $scrapersRegister
|
|
4039
|
+
*/
|
|
4040
|
+
const all = [];
|
|
4041
|
+
for (const { packageName, className, mimeTypes, documentationUrl, isAvailableInBrowser, } of $scrapersMetadataRegister.list()) {
|
|
4042
|
+
if (all.some((item) => item.packageName === packageName && item.className === className)) {
|
|
4043
|
+
continue;
|
|
4044
|
+
}
|
|
4045
|
+
all.push({ packageName, className, mimeTypes, documentationUrl, isAvailableInBrowser });
|
|
4046
|
+
}
|
|
4047
|
+
for (const { packageName, className, mimeTypes, documentationUrl, isAvailableInBrowser, } of $scrapersRegister.list()) {
|
|
4048
|
+
if (all.some((item) => item.packageName === packageName && item.className === className)) {
|
|
4049
|
+
continue;
|
|
4050
|
+
}
|
|
4051
|
+
all.push({ packageName, className, mimeTypes, documentationUrl, isAvailableInBrowser });
|
|
4052
|
+
}
|
|
4053
|
+
for (const { metadata } of availableScrapers) {
|
|
4054
|
+
all.push(metadata);
|
|
4055
|
+
}
|
|
4056
|
+
const metadata = all.map((metadata) => {
|
|
4057
|
+
const isMetadataAviailable = $scrapersMetadataRegister
|
|
4058
|
+
.list()
|
|
4059
|
+
.find(({ packageName, className }) => metadata.packageName === packageName && metadata.className === className);
|
|
4060
|
+
const isInstalled = $scrapersRegister
|
|
4061
|
+
.list()
|
|
4062
|
+
.find(({ packageName, className }) => metadata.packageName === packageName && metadata.className === className);
|
|
4063
|
+
const isAvailableInTools = availableScrapers.some(({ metadata: { packageName, className } }) => metadata.packageName === packageName && metadata.className === className);
|
|
4064
|
+
return { ...metadata, isMetadataAviailable, isInstalled, isAvailableInTools };
|
|
4065
|
+
});
|
|
4066
|
+
if (metadata.length === 0) {
|
|
4067
|
+
return spacetrim.spaceTrim(`
|
|
4068
|
+
**No scrapers are available**
|
|
4069
|
+
|
|
4070
|
+
This is a unexpected behavior, you are probably using some broken version of Promptbook
|
|
4071
|
+
At least there should be available the metadata of the scrapers
|
|
4072
|
+
`);
|
|
4073
|
+
}
|
|
4074
|
+
return spacetrim.spaceTrim((block) => `
|
|
4075
|
+
Available scrapers are:
|
|
4076
|
+
${block(metadata
|
|
4077
|
+
.map(({ packageName, className, isMetadataAviailable, isInstalled, mimeTypes, isAvailableInBrowser, isAvailableInTools, }, i) => {
|
|
4078
|
+
const more = [];
|
|
4079
|
+
// TODO: [🧠] Maybe use `documentationUrl`
|
|
4080
|
+
if (isMetadataAviailable) {
|
|
4081
|
+
more.push(`⬜ Metadata registered`);
|
|
4082
|
+
} // not else
|
|
4083
|
+
if (isInstalled) {
|
|
4084
|
+
more.push(`🟩 Installed`);
|
|
4085
|
+
} // not else
|
|
4086
|
+
if (isAvailableInTools) {
|
|
4087
|
+
more.push(`🟦 Available in tools`);
|
|
4088
|
+
} // not else
|
|
4089
|
+
if (!isMetadataAviailable && isInstalled) {
|
|
4090
|
+
more.push(`When no metadata registered but scraper is installed, it is an unexpected behavior`);
|
|
4091
|
+
} // not else
|
|
4092
|
+
if (!isInstalled && isAvailableInTools) {
|
|
4093
|
+
more.push(`When the scraper is not installed but available in tools, it is an unexpected compatibility behavior`);
|
|
4094
|
+
} // not else
|
|
4095
|
+
if (!isAvailableInBrowser) {
|
|
4096
|
+
more.push(`Not usable in browser`);
|
|
4097
|
+
}
|
|
4098
|
+
const moreText = more.length === 0 ? '' : ` *(${more.join('; ')})*`;
|
|
4099
|
+
return `${i + 1}) \`${className}\` from \`${packageName}\` compatible to scrape ${mimeTypes
|
|
4100
|
+
.map((mimeType) => `"${mimeType}"`)
|
|
4101
|
+
.join(', ')}${moreText}`;
|
|
4102
|
+
})
|
|
4103
|
+
.join('\n'))}
|
|
4104
|
+
|
|
4105
|
+
Legend:
|
|
4106
|
+
- ⬜ **Metadata registered** means that Promptbook knows about the scraper, it is similar to registration in some registry
|
|
4107
|
+
- 🟩 **Installed** means that you have imported package with particular scraper
|
|
4108
|
+
- 🟦 **Available in tools** means that you have passed scraper as dependency into prepare or execution process
|
|
4109
|
+
|
|
4110
|
+
`);
|
|
4111
|
+
}
|
|
4112
|
+
// TODO: [®] DRY Register logic
|
|
4113
|
+
|
|
4114
|
+
/**
|
|
4115
|
+
* Collection of default diacritics removal map.
|
|
4116
|
+
*/
|
|
4117
|
+
const defaultDiacriticsRemovalMap = [
|
|
4118
|
+
{
|
|
4119
|
+
base: 'A',
|
|
4120
|
+
letters: '\u0041\u24B6\uFF21\u00C0\u00C1\u00C2\u1EA6\u1EA4\u1EAA\u1EA8\u00C3\u0100\u0102\u1EB0\u1EAE\u1EB4\u1EB2\u0226\u01E0\u00C4\u01DE\u1EA2\u00C5\u01FA\u01CD\u0200\u0202\u1EA0\u1EAC\u1EB6\u1E00\u0104\u023A\u2C6F',
|
|
4121
|
+
},
|
|
4122
|
+
{ base: 'AA', letters: '\uA732' },
|
|
4123
|
+
{ base: 'AE', letters: '\u00C6\u01FC\u01E2' },
|
|
4124
|
+
{ base: 'AO', letters: '\uA734' },
|
|
4125
|
+
{ base: 'AU', letters: '\uA736' },
|
|
4126
|
+
{ base: 'AV', letters: '\uA738\uA73A' },
|
|
4127
|
+
{ base: 'AY', letters: '\uA73C' },
|
|
4128
|
+
{
|
|
4129
|
+
base: 'B',
|
|
4130
|
+
letters: '\u0042\u24B7\uFF22\u1E02\u1E04\u1E06\u0243\u0182\u0181',
|
|
4131
|
+
},
|
|
4132
|
+
{
|
|
4133
|
+
base: 'C',
|
|
4134
|
+
letters: '\u0043\u24B8\uFF23\u0106\u0108\u010A\u010C\u00C7\u1E08\u0187\u023B\uA73E',
|
|
4135
|
+
},
|
|
4136
|
+
{
|
|
4137
|
+
base: 'D',
|
|
4138
|
+
letters: '\u0044\u24B9\uFF24\u1E0A\u010E\u1E0C\u1E10\u1E12\u1E0E\u0110\u018B\u018A\u0189\uA779\u00D0',
|
|
4139
|
+
},
|
|
4140
|
+
{ base: 'DZ', letters: '\u01F1\u01C4' },
|
|
4141
|
+
{ base: 'Dz', letters: '\u01F2\u01C5' },
|
|
4142
|
+
{
|
|
4143
|
+
base: 'E',
|
|
4144
|
+
letters: '\u0045\u24BA\uFF25\u00C8\u00C9\u00CA\u1EC0\u1EBE\u1EC4\u1EC2\u1EBC\u0112\u1E14\u1E16\u0114\u0116\u00CB\u1EBA\u011A\u0204\u0206\u1EB8\u1EC6\u0228\u1E1C\u0118\u1E18\u1E1A\u0190\u018E',
|
|
4145
|
+
},
|
|
4146
|
+
{ base: 'F', letters: '\u0046\u24BB\uFF26\u1E1E\u0191\uA77B' },
|
|
4147
|
+
{
|
|
4148
|
+
base: 'G',
|
|
4149
|
+
letters: '\u0047\u24BC\uFF27\u01F4\u011C\u1E20\u011E\u0120\u01E6\u0122\u01E4\u0193\uA7A0\uA77D\uA77E',
|
|
4150
|
+
},
|
|
4151
|
+
{
|
|
4152
|
+
base: 'H',
|
|
4153
|
+
letters: '\u0048\u24BD\uFF28\u0124\u1E22\u1E26\u021E\u1E24\u1E28\u1E2A\u0126\u2C67\u2C75\uA78D',
|
|
4154
|
+
},
|
|
4155
|
+
{
|
|
4156
|
+
base: 'I',
|
|
4157
|
+
letters: '\u0049\u24BE\uFF29\u00CC\u00CD\u00CE\u0128\u012A\u012C\u0130\u00CF\u1E2E\u1EC8\u01CF\u0208\u020A\u1ECA\u012E\u1E2C\u0197',
|
|
4158
|
+
},
|
|
4159
|
+
{ base: 'J', letters: '\u004A\u24BF\uFF2A\u0134\u0248' },
|
|
4160
|
+
{
|
|
4161
|
+
base: 'K',
|
|
4162
|
+
letters: '\u004B\u24C0\uFF2B\u1E30\u01E8\u1E32\u0136\u1E34\u0198\u2C69\uA740\uA742\uA744\uA7A2',
|
|
4163
|
+
},
|
|
4164
|
+
{
|
|
4165
|
+
base: 'L',
|
|
4166
|
+
letters: '\u004C\u24C1\uFF2C\u013F\u0139\u013D\u1E36\u1E38\u013B\u1E3C\u1E3A\u0141\u023D\u2C62\u2C60\uA748\uA746\uA780',
|
|
4167
|
+
},
|
|
4168
|
+
{ base: 'LJ', letters: '\u01C7' },
|
|
4169
|
+
{ base: 'Lj', letters: '\u01C8' },
|
|
4170
|
+
{ base: 'M', letters: '\u004D\u24C2\uFF2D\u1E3E\u1E40\u1E42\u2C6E\u019C' },
|
|
4171
|
+
{
|
|
4172
|
+
base: 'N',
|
|
4173
|
+
letters: '\u004E\u24C3\uFF2E\u01F8\u0143\u00D1\u1E44\u0147\u1E46\u0145\u1E4A\u1E48\u0220\u019D\uA790\uA7A4',
|
|
4174
|
+
},
|
|
4175
|
+
{ base: 'NJ', letters: '\u01CA' },
|
|
4176
|
+
{ base: 'Nj', letters: '\u01CB' },
|
|
4177
|
+
{
|
|
4178
|
+
base: 'O',
|
|
4179
|
+
letters: '\u004F\u24C4\uFF2F\u00D2\u00D3\u00D4\u1ED2\u1ED0\u1ED6\u1ED4\u00D5\u1E4C\u022C\u1E4E\u014C\u1E50\u1E52\u014E\u022E\u0230\u00D6\u022A\u1ECE\u0150\u01D1\u020C\u020E\u01A0\u1EDC\u1EDA\u1EE0\u1EDE\u1EE2\u1ECC\u1ED8\u01EA\u01EC\u00D8\u01FE\u0186\u019F\uA74A\uA74C',
|
|
4180
|
+
},
|
|
4181
|
+
{ base: 'OI', letters: '\u01A2' },
|
|
4182
|
+
{ base: 'OO', letters: '\uA74E' },
|
|
4183
|
+
{ base: 'OU', letters: '\u0222' },
|
|
4184
|
+
{ base: 'OE', letters: '\u008C\u0152' },
|
|
4185
|
+
{ base: 'oe', letters: '\u009C\u0153' },
|
|
4186
|
+
{
|
|
4187
|
+
base: 'P',
|
|
4188
|
+
letters: '\u0050\u24C5\uFF30\u1E54\u1E56\u01A4\u2C63\uA750\uA752\uA754',
|
|
4189
|
+
},
|
|
4190
|
+
{ base: 'Q', letters: '\u0051\u24C6\uFF31\uA756\uA758\u024A' },
|
|
4191
|
+
{
|
|
4192
|
+
base: 'R',
|
|
4193
|
+
letters: '\u0052\u24C7\uFF32\u0154\u1E58\u0158\u0210\u0212\u1E5A\u1E5C\u0156\u1E5E\u024C\u2C64\uA75A\uA7A6\uA782',
|
|
4194
|
+
},
|
|
4195
|
+
{
|
|
4196
|
+
base: 'S',
|
|
4197
|
+
letters: '\u0053\u24C8\uFF33\u1E9E\u015A\u1E64\u015C\u1E60\u0160\u1E66\u1E62\u1E68\u0218\u015E\u2C7E\uA7A8\uA784',
|
|
4198
|
+
},
|
|
4199
|
+
{
|
|
4200
|
+
base: 'T',
|
|
4201
|
+
letters: '\u0054\u24C9\uFF34\u1E6A\u0164\u1E6C\u021A\u0162\u1E70\u1E6E\u0166\u01AC\u01AE\u023E\uA786',
|
|
4202
|
+
},
|
|
4203
|
+
{ base: 'TZ', letters: '\uA728' },
|
|
4204
|
+
{
|
|
4205
|
+
base: 'U',
|
|
4206
|
+
letters: '\u0055\u24CA\uFF35\u00D9\u00DA\u00DB\u0168\u1E78\u016A\u1E7A\u016C\u00DC\u01DB\u01D7\u01D5\u01D9\u1EE6\u016E\u0170\u01D3\u0214\u0216\u01AF\u1EEA\u1EE8\u1EEE\u1EEC\u1EF0\u1EE4\u1E72\u0172\u1E76\u1E74\u0244',
|
|
4207
|
+
},
|
|
4208
|
+
{ base: 'V', letters: '\u0056\u24CB\uFF36\u1E7C\u1E7E\u01B2\uA75E\u0245' },
|
|
4209
|
+
{ base: 'VY', letters: '\uA760' },
|
|
4210
|
+
{
|
|
4211
|
+
base: 'W',
|
|
4212
|
+
letters: '\u0057\u24CC\uFF37\u1E80\u1E82\u0174\u1E86\u1E84\u1E88\u2C72',
|
|
4213
|
+
},
|
|
4214
|
+
{ base: 'X', letters: '\u0058\u24CD\uFF38\u1E8A\u1E8C' },
|
|
4215
|
+
{
|
|
4216
|
+
base: 'Y',
|
|
4217
|
+
letters: '\u0059\u24CE\uFF39\u1EF2\u00DD\u0176\u1EF8\u0232\u1E8E\u0178\u1EF6\u1EF4\u01B3\u024E\u1EFE',
|
|
4218
|
+
},
|
|
4219
|
+
{
|
|
4220
|
+
base: 'Z',
|
|
4221
|
+
letters: '\u005A\u24CF\uFF3A\u0179\u1E90\u017B\u017D\u1E92\u1E94\u01B5\u0224\u2C7F\u2C6B\uA762',
|
|
4222
|
+
},
|
|
4223
|
+
{
|
|
4224
|
+
base: 'a',
|
|
4225
|
+
letters: '\u0061\u24D0\uFF41\u1E9A\u00E0\u00E1\u00E2\u1EA7\u1EA5\u1EAB\u1EA9\u00E3\u0101\u0103\u1EB1\u1EAF\u1EB5\u1EB3\u0227\u01E1\u00E4\u01DF\u1EA3\u00E5\u01FB\u01CE\u0201\u0203\u1EA1\u1EAD\u1EB7\u1E01\u0105\u2C65\u0250',
|
|
4226
|
+
},
|
|
4227
|
+
{ base: 'aa', letters: '\uA733' },
|
|
4228
|
+
{ base: 'ae', letters: '\u00E6\u01FD\u01E3' },
|
|
4229
|
+
{ base: 'ao', letters: '\uA735' },
|
|
4230
|
+
{ base: 'au', letters: '\uA737' },
|
|
4231
|
+
{ base: 'av', letters: '\uA739\uA73B' },
|
|
4232
|
+
{ base: 'ay', letters: '\uA73D' },
|
|
4233
|
+
{
|
|
4234
|
+
base: 'b',
|
|
4235
|
+
letters: '\u0062\u24D1\uFF42\u1E03\u1E05\u1E07\u0180\u0183\u0253',
|
|
4236
|
+
},
|
|
4237
|
+
{
|
|
4238
|
+
base: 'c',
|
|
4239
|
+
letters: '\u0063\u24D2\uFF43\u0107\u0109\u010B\u010D\u00E7\u1E09\u0188\u023C\uA73F\u2184',
|
|
4240
|
+
},
|
|
4241
|
+
{
|
|
4242
|
+
base: 'd',
|
|
4243
|
+
letters: '\u0064\u24D3\uFF44\u1E0B\u010F\u1E0D\u1E11\u1E13\u1E0F\u0111\u018C\u0256\u0257\uA77A',
|
|
4244
|
+
},
|
|
4245
|
+
{ base: 'dz', letters: '\u01F3\u01C6' },
|
|
4246
|
+
{
|
|
4247
|
+
base: 'e',
|
|
4248
|
+
letters: '\u0065\u24D4\uFF45\u00E8\u00E9\u00EA\u1EC1\u1EBF\u1EC5\u1EC3\u1EBD\u0113\u1E15\u1E17\u0115\u0117\u00EB\u1EBB\u011B\u0205\u0207\u1EB9\u1EC7\u0229\u1E1D\u0119\u1E19\u1E1B\u0247\u025B\u01DD',
|
|
4249
|
+
},
|
|
4250
|
+
{ base: 'f', letters: '\u0066\u24D5\uFF46\u1E1F\u0192\uA77C' },
|
|
4251
|
+
{
|
|
4252
|
+
base: 'g',
|
|
4253
|
+
letters: '\u0067\u24D6\uFF47\u01F5\u011D\u1E21\u011F\u0121\u01E7\u0123\u01E5\u0260\uA7A1\u1D79\uA77F',
|
|
4254
|
+
},
|
|
4255
|
+
{
|
|
4256
|
+
base: 'h',
|
|
4257
|
+
letters: '\u0068\u24D7\uFF48\u0125\u1E23\u1E27\u021F\u1E25\u1E29\u1E2B\u1E96\u0127\u2C68\u2C76\u0265',
|
|
4258
|
+
},
|
|
4259
|
+
{ base: 'hv', letters: '\u0195' },
|
|
4260
|
+
{
|
|
4261
|
+
base: 'i',
|
|
4262
|
+
letters: '\u0069\u24D8\uFF49\u00EC\u00ED\u00EE\u0129\u012B\u012D\u00EF\u1E2F\u1EC9\u01D0\u0209\u020B\u1ECB\u012F\u1E2D\u0268\u0131',
|
|
4263
|
+
},
|
|
4264
|
+
{ base: 'j', letters: '\u006A\u24D9\uFF4A\u0135\u01F0\u0249' },
|
|
4265
|
+
{
|
|
4266
|
+
base: 'k',
|
|
4267
|
+
letters: '\u006B\u24DA\uFF4B\u1E31\u01E9\u1E33\u0137\u1E35\u0199\u2C6A\uA741\uA743\uA745\uA7A3',
|
|
4268
|
+
},
|
|
4269
|
+
{
|
|
4270
|
+
base: 'l',
|
|
4271
|
+
letters: '\u006C\u24DB\uFF4C\u0140\u013A\u013E\u1E37\u1E39\u013C\u1E3D\u1E3B\u017F\u0142\u019A\u026B\u2C61\uA749\uA781\uA747',
|
|
4272
|
+
},
|
|
4273
|
+
{ base: 'lj', letters: '\u01C9' },
|
|
4274
|
+
{ base: 'm', letters: '\u006D\u24DC\uFF4D\u1E3F\u1E41\u1E43\u0271\u026F' },
|
|
4275
|
+
{
|
|
4276
|
+
base: 'n',
|
|
4277
|
+
letters: '\u006E\u24DD\uFF4E\u01F9\u0144\u00F1\u1E45\u0148\u1E47\u0146\u1E4B\u1E49\u019E\u0272\u0149\uA791\uA7A5',
|
|
4278
|
+
},
|
|
4279
|
+
{ base: 'nj', letters: '\u01CC' },
|
|
4280
|
+
{
|
|
4281
|
+
base: 'o',
|
|
4282
|
+
letters: '\u006F\u24DE\uFF4F\u00F2\u00F3\u00F4\u1ED3\u1ED1\u1ED7\u1ED5\u00F5\u1E4D\u022D\u1E4F\u014D\u1E51\u1E53\u014F\u022F\u0231\u00F6\u022B\u1ECF\u0151\u01D2\u020D\u020F\u01A1\u1EDD\u1EDB\u1EE1\u1EDF\u1EE3\u1ECD\u1ED9\u01EB\u01ED\u00F8\u01FF\u0254\uA74B\uA74D\u0275',
|
|
4283
|
+
},
|
|
4284
|
+
{ base: 'oi', letters: '\u01A3' },
|
|
4285
|
+
{ base: 'ou', letters: '\u0223' },
|
|
4286
|
+
{ base: 'oo', letters: '\uA74F' },
|
|
4287
|
+
{
|
|
4288
|
+
base: 'p',
|
|
4289
|
+
letters: '\u0070\u24DF\uFF50\u1E55\u1E57\u01A5\u1D7D\uA751\uA753\uA755',
|
|
4290
|
+
},
|
|
4291
|
+
{ base: 'q', letters: '\u0071\u24E0\uFF51\u024B\uA757\uA759' },
|
|
4292
|
+
{
|
|
4293
|
+
base: 'r',
|
|
4294
|
+
letters: '\u0072\u24E1\uFF52\u0155\u1E59\u0159\u0211\u0213\u1E5B\u1E5D\u0157\u1E5F\u024D\u027D\uA75B\uA7A7\uA783',
|
|
4295
|
+
},
|
|
4296
|
+
{
|
|
4297
|
+
base: 's',
|
|
4298
|
+
letters: '\u0073\u24E2\uFF53\u00DF\u015B\u1E65\u015D\u1E61\u0161\u1E67\u1E63\u1E69\u0219\u015F\u023F\uA7A9\uA785\u1E9B',
|
|
4299
|
+
},
|
|
4300
|
+
{
|
|
4301
|
+
base: 't',
|
|
4302
|
+
letters: '\u0074\u24E3\uFF54\u1E6B\u1E97\u0165\u1E6D\u021B\u0163\u1E71\u1E6F\u0167\u01AD\u0288\u2C66\uA787',
|
|
4303
|
+
},
|
|
4304
|
+
{ base: 'tz', letters: '\uA729' },
|
|
4305
|
+
{
|
|
4306
|
+
base: 'u',
|
|
4307
|
+
letters: '\u0075\u24E4\uFF55\u00F9\u00FA\u00FB\u0169\u1E79\u016B\u1E7B\u016D\u00FC\u01DC\u01D8\u01D6\u01DA\u1EE7\u016F\u0171\u01D4\u0215\u0217\u01B0\u1EEB\u1EE9\u1EEF\u1EED\u1EF1\u1EE5\u1E73\u0173\u1E77\u1E75\u0289',
|
|
4308
|
+
},
|
|
4309
|
+
{ base: 'v', letters: '\u0076\u24E5\uFF56\u1E7D\u1E7F\u028B\uA75F\u028C' },
|
|
4310
|
+
{ base: 'vy', letters: '\uA761' },
|
|
4311
|
+
{
|
|
4312
|
+
base: 'w',
|
|
4313
|
+
letters: '\u0077\u24E6\uFF57\u1E81\u1E83\u0175\u1E87\u1E85\u1E98\u1E89\u2C73',
|
|
4314
|
+
},
|
|
4315
|
+
{ base: 'x', letters: '\u0078\u24E7\uFF58\u1E8B\u1E8D' },
|
|
4316
|
+
{
|
|
4317
|
+
base: 'y',
|
|
4318
|
+
letters: '\u0079\u24E8\uFF59\u1EF3\u00FD\u0177\u1EF9\u0233\u1E8F\u00FF\u1EF7\u1E99\u1EF5\u01B4\u024F\u1EFF',
|
|
4319
|
+
},
|
|
4320
|
+
{
|
|
4321
|
+
base: 'z',
|
|
4322
|
+
letters: '\u007A\u24E9\uFF5A\u017A\u1E91\u017C\u017E\u1E93\u1E95\u01B6\u0225\u0240\u2C6C\uA763',
|
|
4323
|
+
},
|
|
4324
|
+
];
|
|
4325
|
+
/**
|
|
4326
|
+
* Map of letters from diacritic variant to diacritless variant
|
|
4327
|
+
* Contains lowercase and uppercase separatelly
|
|
4328
|
+
*
|
|
4329
|
+
* > "á" => "a"
|
|
4330
|
+
* > "ě" => "e"
|
|
4331
|
+
* > "Ă" => "A"
|
|
4332
|
+
* > ...
|
|
4333
|
+
*
|
|
4334
|
+
* @public exported from `@promptbook/utils`
|
|
4335
|
+
*/
|
|
4336
|
+
const DIACRITIC_VARIANTS_LETTERS = {};
|
|
4337
|
+
// tslint:disable-next-line: prefer-for-of
|
|
4338
|
+
for (let i = 0; i < defaultDiacriticsRemovalMap.length; i++) {
|
|
4339
|
+
const letters = defaultDiacriticsRemovalMap[i].letters;
|
|
4340
|
+
// tslint:disable-next-line: prefer-for-of
|
|
4341
|
+
for (let j = 0; j < letters.length; j++) {
|
|
4342
|
+
DIACRITIC_VARIANTS_LETTERS[letters[j]] = defaultDiacriticsRemovalMap[i].base;
|
|
4343
|
+
}
|
|
4344
|
+
}
|
|
4345
|
+
// <- TODO: [🍓] Put to maker function to save execution time if not needed
|
|
4346
|
+
/*
|
|
4347
|
+
@see https://stackoverflow.com/questions/990904/remove-accents-diacritics-in-a-string-in-javascript
|
|
4348
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
4349
|
+
you may not use this file except in compliance with the License.
|
|
4350
|
+
You may obtain a copy of the License at
|
|
4351
|
+
|
|
4352
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
4353
|
+
|
|
4354
|
+
Unless required by applicable law or agreed to in writing, software
|
|
4355
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
4356
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
4357
|
+
See the License for the specific language governing permissions and
|
|
4358
|
+
limitations under the License.
|
|
4359
|
+
*/
|
|
4360
|
+
|
|
4361
|
+
/**
|
|
4362
|
+
* Removes diacritic marks (accents) from characters in a string.
|
|
4363
|
+
*
|
|
4364
|
+
* Note: [🔂] This function is idempotent.
|
|
4365
|
+
*
|
|
4366
|
+
* @param input The string containing diacritics to be normalized.
|
|
4367
|
+
* @returns The string with diacritics removed or normalized.
|
|
4368
|
+
*
|
|
4369
|
+
* @public exported from `@promptbook/utils`
|
|
4430
4370
|
*/
|
|
4431
|
-
|
|
4432
|
-
|
|
4371
|
+
function removeDiacritics(input) {
|
|
4372
|
+
/*eslint no-control-regex: "off"*/
|
|
4373
|
+
return input.replace(/[^\u0000-\u007E]/g, (character) => {
|
|
4374
|
+
return DIACRITIC_VARIANTS_LETTERS[character] || character;
|
|
4375
|
+
});
|
|
4376
|
+
}
|
|
4377
|
+
// TODO: [Ж] Variant for cyrillic (and in general non-latin) letters
|
|
4433
4378
|
|
|
4434
4379
|
/**
|
|
4435
|
-
*
|
|
4380
|
+
* Converts a given text to kebab-case format.
|
|
4436
4381
|
*
|
|
4437
|
-
* Note: This function is
|
|
4382
|
+
* Note: [🔂] This function is idempotent.
|
|
4438
4383
|
*
|
|
4439
|
-
* @
|
|
4384
|
+
* @param text The text to be converted.
|
|
4385
|
+
* @returns The kebab-case formatted string.
|
|
4386
|
+
* @example 'hello-world'
|
|
4387
|
+
* @example 'i-love-promptbook'
|
|
4388
|
+
*
|
|
4389
|
+
* @public exported from `@promptbook/utils`
|
|
4440
4390
|
*/
|
|
4441
|
-
function
|
|
4442
|
-
|
|
4443
|
-
|
|
4444
|
-
|
|
4445
|
-
|
|
4446
|
-
for (const
|
|
4447
|
-
|
|
4448
|
-
|
|
4391
|
+
function normalizeToKebabCase(text) {
|
|
4392
|
+
text = removeDiacritics(text);
|
|
4393
|
+
let charType;
|
|
4394
|
+
let lastCharType = 'OTHER';
|
|
4395
|
+
let normalizedName = '';
|
|
4396
|
+
for (const char of text) {
|
|
4397
|
+
let normalizedChar;
|
|
4398
|
+
if (/^[a-z]$/.test(char)) {
|
|
4399
|
+
charType = 'LOWERCASE';
|
|
4400
|
+
normalizedChar = char;
|
|
4449
4401
|
}
|
|
4450
|
-
|
|
4451
|
-
|
|
4452
|
-
|
|
4453
|
-
if (all.some((item) => item.packageName === packageName && item.className === className)) {
|
|
4454
|
-
continue;
|
|
4402
|
+
else if (/^[A-Z]$/.test(char)) {
|
|
4403
|
+
charType = 'UPPERCASE';
|
|
4404
|
+
normalizedChar = char.toLowerCase();
|
|
4455
4405
|
}
|
|
4456
|
-
|
|
4457
|
-
|
|
4458
|
-
|
|
4459
|
-
|
|
4460
|
-
|
|
4461
|
-
|
|
4462
|
-
|
|
4463
|
-
|
|
4464
|
-
|
|
4465
|
-
|
|
4466
|
-
|
|
4467
|
-
|
|
4468
|
-
|
|
4469
|
-
|
|
4470
|
-
|
|
4471
|
-
|
|
4472
|
-
return spacetrim.spaceTrim(`
|
|
4473
|
-
**No scrapers are available**
|
|
4474
|
-
|
|
4475
|
-
This is a unexpected behavior, you are probably using some broken version of Promptbook
|
|
4476
|
-
At least there should be available the metadata of the scrapers
|
|
4477
|
-
`);
|
|
4478
|
-
}
|
|
4479
|
-
return spacetrim.spaceTrim((block) => `
|
|
4480
|
-
Available scrapers are:
|
|
4481
|
-
${block(metadata
|
|
4482
|
-
.map(({ packageName, className, isMetadataAviailable, isInstalled, mimeTypes, isAvailableInBrowser, isAvailableInTools, }, i) => {
|
|
4483
|
-
const more = [];
|
|
4484
|
-
// TODO: [🧠] Maybe use `documentationUrl`
|
|
4485
|
-
if (isMetadataAviailable) {
|
|
4486
|
-
more.push(`⬜ Metadata registered`);
|
|
4487
|
-
} // not else
|
|
4488
|
-
if (isInstalled) {
|
|
4489
|
-
more.push(`🟩 Installed`);
|
|
4490
|
-
} // not else
|
|
4491
|
-
if (isAvailableInTools) {
|
|
4492
|
-
more.push(`🟦 Available in tools`);
|
|
4493
|
-
} // not else
|
|
4494
|
-
if (!isMetadataAviailable && isInstalled) {
|
|
4495
|
-
more.push(`When no metadata registered but scraper is installed, it is an unexpected behavior`);
|
|
4496
|
-
} // not else
|
|
4497
|
-
if (!isInstalled && isAvailableInTools) {
|
|
4498
|
-
more.push(`When the scraper is not installed but available in tools, it is an unexpected compatibility behavior`);
|
|
4499
|
-
} // not else
|
|
4500
|
-
if (!isAvailableInBrowser) {
|
|
4501
|
-
more.push(`Not usable in browser`);
|
|
4406
|
+
else if (/^[0-9]$/.test(char)) {
|
|
4407
|
+
charType = 'NUMBER';
|
|
4408
|
+
normalizedChar = char;
|
|
4409
|
+
}
|
|
4410
|
+
else {
|
|
4411
|
+
charType = 'OTHER';
|
|
4412
|
+
normalizedChar = '-';
|
|
4413
|
+
}
|
|
4414
|
+
if (charType !== lastCharType &&
|
|
4415
|
+
!(lastCharType === 'UPPERCASE' && charType === 'LOWERCASE') &&
|
|
4416
|
+
!(lastCharType === 'NUMBER') &&
|
|
4417
|
+
!(charType === 'NUMBER')) {
|
|
4418
|
+
normalizedName += '-';
|
|
4419
|
+
}
|
|
4420
|
+
normalizedName += normalizedChar;
|
|
4421
|
+
lastCharType = charType;
|
|
4502
4422
|
}
|
|
4503
|
-
|
|
4504
|
-
|
|
4505
|
-
|
|
4506
|
-
|
|
4507
|
-
|
|
4508
|
-
.join('\n'))}
|
|
4509
|
-
|
|
4510
|
-
Legend:
|
|
4511
|
-
- ⬜ **Metadata registered** means that Promptbook knows about the scraper, it is similar to registration in some registry
|
|
4512
|
-
- 🟩 **Installed** means that you have imported package with particular scraper
|
|
4513
|
-
- 🟦 **Available in tools** means that you have passed scraper as dependency into prepare or execution process
|
|
4514
|
-
|
|
4515
|
-
`);
|
|
4423
|
+
normalizedName = normalizedName.split(/-+/g).join('-');
|
|
4424
|
+
normalizedName = normalizedName.split(/-?\/-?/g).join('/');
|
|
4425
|
+
normalizedName = normalizedName.replace(/^-/, '');
|
|
4426
|
+
normalizedName = normalizedName.replace(/-$/, '');
|
|
4427
|
+
return normalizedName;
|
|
4516
4428
|
}
|
|
4517
|
-
//
|
|
4429
|
+
// Note: [💞] Ignore a discrepancy between file name and entity name
|
|
4518
4430
|
|
|
4519
4431
|
/**
|
|
4520
4432
|
* Creates unique name for the source
|
|
@@ -4535,6 +4447,16 @@
|
|
|
4535
4447
|
}
|
|
4536
4448
|
// TODO: [🐱🐉][🧠] Make some smart crop NOT source-i-m-pavol-a-develop-... BUT source-i-m-pavol-a-developer-...
|
|
4537
4449
|
|
|
4450
|
+
/**
|
|
4451
|
+
* Converts a name to a properly formatted subfolder path for cache storage.
|
|
4452
|
+
* Handles normalization and path formatting to create consistent cache directory structures.
|
|
4453
|
+
*
|
|
4454
|
+
* @private for `FileCacheStorage`
|
|
4455
|
+
*/
|
|
4456
|
+
function nameToSubfolderPath(name) {
|
|
4457
|
+
return [name.substr(0, 1).toLowerCase(), name.substr(1, 1).toLowerCase()];
|
|
4458
|
+
}
|
|
4459
|
+
|
|
4538
4460
|
/**
|
|
4539
4461
|
* Convert file extension to mime type
|
|
4540
4462
|
*
|
|
@@ -4588,6 +4510,52 @@
|
|
|
4588
4510
|
return mimeTypes.extension(value) || null;
|
|
4589
4511
|
}
|
|
4590
4512
|
|
|
4513
|
+
/**
|
|
4514
|
+
* Removes emojis from a string and fix whitespaces
|
|
4515
|
+
*
|
|
4516
|
+
* Note: [🔂] This function is idempotent.
|
|
4517
|
+
*
|
|
4518
|
+
* @param text with emojis
|
|
4519
|
+
* @returns text without emojis
|
|
4520
|
+
*
|
|
4521
|
+
* @public exported from `@promptbook/utils`
|
|
4522
|
+
*/
|
|
4523
|
+
function removeEmojis(text) {
|
|
4524
|
+
// Replace emojis (and also ZWJ sequence) with hyphens
|
|
4525
|
+
text = text.replace(/(\p{Extended_Pictographic})\p{Modifier_Symbol}/gu, '$1');
|
|
4526
|
+
text = text.replace(/(\p{Extended_Pictographic})[\u{FE00}-\u{FE0F}]/gu, '$1');
|
|
4527
|
+
text = text.replace(/(\p{Extended_Pictographic})(\u{200D}\p{Extended_Pictographic})*/gu, '$1');
|
|
4528
|
+
text = text.replace(/\p{Extended_Pictographic}/gu, '');
|
|
4529
|
+
return text;
|
|
4530
|
+
}
|
|
4531
|
+
|
|
4532
|
+
/**
|
|
4533
|
+
* Converts a title string into a normalized name.
|
|
4534
|
+
*
|
|
4535
|
+
* Note: [🔂] This function is idempotent.
|
|
4536
|
+
*
|
|
4537
|
+
* @param value The title string to be converted to a name.
|
|
4538
|
+
* @returns A normalized name derived from the input title.
|
|
4539
|
+
* @example 'Hello World!' -> 'hello-world'
|
|
4540
|
+
*
|
|
4541
|
+
* @public exported from `@promptbook/utils`
|
|
4542
|
+
*/
|
|
4543
|
+
function titleToName(value) {
|
|
4544
|
+
if (isValidUrl(value)) {
|
|
4545
|
+
value = value.replace(/^https?:\/\//, '');
|
|
4546
|
+
value = value.replace(/\.html$/, '');
|
|
4547
|
+
}
|
|
4548
|
+
else if (isValidFilePath(value)) {
|
|
4549
|
+
value = path.basename(value);
|
|
4550
|
+
// Note: Keeping extension in the name
|
|
4551
|
+
}
|
|
4552
|
+
value = value.split('/').join('-');
|
|
4553
|
+
value = removeEmojis(value);
|
|
4554
|
+
value = normalizeToKebabCase(value);
|
|
4555
|
+
// TODO: [🧠] Maybe warn or add some padding to short name which are not good identifiers
|
|
4556
|
+
return value;
|
|
4557
|
+
}
|
|
4558
|
+
|
|
4591
4559
|
/**
|
|
4592
4560
|
* The built-in `fetch' function with a lightweight error handling wrapper as default fetch function used in Promptbook scrapers
|
|
4593
4561
|
*
|
|
@@ -7699,6 +7667,74 @@
|
|
|
7699
7667
|
// TODO: [🪂] Do it in parallel 11:11
|
|
7700
7668
|
// Note: No need to aggregate usage here, it is done by intercepting the llmTools
|
|
7701
7669
|
|
|
7670
|
+
/**
|
|
7671
|
+
* Retrieves an intermediate source for a scraper based on the knowledge source.
|
|
7672
|
+
* Manages the caching and retrieval of intermediate scraper results for optimized performance.
|
|
7673
|
+
*
|
|
7674
|
+
* @private as internal utility for scrapers
|
|
7675
|
+
*/
|
|
7676
|
+
async function getScraperIntermediateSource(source, options) {
|
|
7677
|
+
const { filename: sourceFilename, url } = source;
|
|
7678
|
+
const { rootDirname, cacheDirname, intermediateFilesStrategy, extension, isVerbose } = options;
|
|
7679
|
+
// TODO: [👬] DRY
|
|
7680
|
+
const hash = cryptoJs.SHA256(
|
|
7681
|
+
// <- TODO: [🥬] Encapsulate sha256 to some private utility function
|
|
7682
|
+
hexEncoder__default["default"].parse(sourceFilename || url || 'untitled'))
|
|
7683
|
+
.toString( /* hex */)
|
|
7684
|
+
.substring(0, 20);
|
|
7685
|
+
// <- TODO: [🥬] Make some system for hashes and ids of promptbook
|
|
7686
|
+
const semanticName = normalizeToKebabCase(titleToName((sourceFilename || url || '').split('intermediate').join(''))).substring(0, 20);
|
|
7687
|
+
// <- TODO: [🐱🐉]
|
|
7688
|
+
const pieces = ['intermediate', semanticName, hash].filter((piece) => piece !== '');
|
|
7689
|
+
const name = pieces.join('-').split('--').join('-');
|
|
7690
|
+
const cacheFilename = path.join(process.cwd(), cacheDirname, ...nameToSubfolderPath(hash /* <- TODO: [🎎] Maybe add some SHA256 prefix */), name)
|
|
7691
|
+
.split('\\')
|
|
7692
|
+
.join('/') +
|
|
7693
|
+
'.' +
|
|
7694
|
+
extension;
|
|
7695
|
+
// Note: Try to create cache directory, but don't fail if filesystem has issues
|
|
7696
|
+
try {
|
|
7697
|
+
await promises.mkdir(path.dirname(cacheFilename), { recursive: true });
|
|
7698
|
+
}
|
|
7699
|
+
catch (error) {
|
|
7700
|
+
// Note: If we can't create cache directory, continue without it
|
|
7701
|
+
// This handles read-only filesystems, permission issues, and missing parent directories
|
|
7702
|
+
if (error instanceof Error &&
|
|
7703
|
+
(error.message.includes('EROFS') ||
|
|
7704
|
+
error.message.includes('read-only') ||
|
|
7705
|
+
error.message.includes('EACCES') ||
|
|
7706
|
+
error.message.includes('EPERM') ||
|
|
7707
|
+
error.message.includes('ENOENT'))) ;
|
|
7708
|
+
else {
|
|
7709
|
+
// Re-throw other unexpected errors
|
|
7710
|
+
throw error;
|
|
7711
|
+
}
|
|
7712
|
+
}
|
|
7713
|
+
let isDestroyed = true;
|
|
7714
|
+
const fileHandler = {
|
|
7715
|
+
filename: cacheFilename,
|
|
7716
|
+
get isDestroyed() {
|
|
7717
|
+
return isDestroyed;
|
|
7718
|
+
},
|
|
7719
|
+
async destroy() {
|
|
7720
|
+
if (intermediateFilesStrategy === 'HIDE_AND_CLEAN') {
|
|
7721
|
+
if (isVerbose) {
|
|
7722
|
+
console.info('legacyDocumentScraper: Clening cache');
|
|
7723
|
+
}
|
|
7724
|
+
await promises.rm(cacheFilename);
|
|
7725
|
+
// TODO: [🐿][🧠] Maybe remove empty folders
|
|
7726
|
+
}
|
|
7727
|
+
isDestroyed = true;
|
|
7728
|
+
},
|
|
7729
|
+
};
|
|
7730
|
+
return fileHandler;
|
|
7731
|
+
}
|
|
7732
|
+
// Note: [🟢] Code for Node scraper helper [getScraperIntermediateSource](src/scrapers/_common/utils/getScraperIntermediateSource.ts) should never be published into packages that could be imported into browser environment
|
|
7733
|
+
// Note: Not using `FileCacheStorage` for two reasons:
|
|
7734
|
+
// 1. Need to store more than serialized JSONs.
|
|
7735
|
+
// 2. Need to switch between a `rootDirname` and `cacheDirname` <- TODO: [😡]
|
|
7736
|
+
// TODO: [🐱🐉][🧠] Make some smart crop
|
|
7737
|
+
|
|
7702
7738
|
/**
|
|
7703
7739
|
* Create a new showdown converter instance
|
|
7704
7740
|
*
|