@promptbook/documents 0.112.0-66 → 0.112.0-70
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 +589 -581
- 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/avatar3dProjectionShared.d.ts +141 -0
- package/esm/src/avatars/visuals/octopus3dAvatarVisual.d.ts +7 -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-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/agent/agentProjectPaths.d.ts +2 -2
- package/esm/src/cli/cli-commands/agent/initializeAgentRunnerCommand.d.ts +22 -0
- package/esm/src/cli/cli-commands/agent/runMultiple.d.ts +10 -0
- package/esm/src/cli/cli-commands/agent.d.ts +3 -2
- 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 +1 -1
- 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 +5 -1
- 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 +590 -582
- 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/avatar3dProjectionShared.d.ts +141 -0
- package/umd/src/avatars/visuals/octopus3dAvatarVisual.d.ts +7 -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/agent/agentProjectPaths.d.ts +2 -2
- package/umd/src/cli/cli-commands/agent/initializeAgentRunnerCommand.d.ts +22 -0
- package/umd/src/cli/cli-commands/agent/runMultiple.d.ts +10 -0
- package/umd/src/cli/cli-commands/agent.d.ts +3 -2
- 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/cli/other/install.test.d.ts +1 -0
- 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 +1 -1
- 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 +5 -1
- 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/esm/src/utils/files/getPromptbookTempPath.d.ts +0 -24
- package/umd/src/utils/files/getPromptbookTempPath.d.ts +0 -24
- /package/esm/src/{utils/files/getPromptbookTempPath.test.d.ts → book-3.0/Book.test.d.ts} +0 -0
- /package/{umd/src/utils/files/getPromptbookTempPath.test.d.ts → esm/src/cli/other/install.test.d.ts} +0 -0
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('fs/promises'), require('spacetrim'), require('
|
|
3
|
-
typeof define === 'function' && define.amd ? define(['exports', 'fs/promises', 'spacetrim', '
|
|
4
|
-
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global["promptbook-documents"] = {}, global.promises, global.spacetrim, global.
|
|
5
|
-
})(this, (function (exports, promises, spacetrim,
|
|
2
|
+
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('fs/promises'), require('spacetrim'), require('child_process'), require('colors'), require('waitasecond'), require('crypto'), require('rxjs'), require('crypto-js/enc-hex'), require('crypto-js/sha256'), require('path'), require('crypto-js'), require('mime-types'), require('papaparse')) :
|
|
3
|
+
typeof define === 'function' && define.amd ? define(['exports', 'fs/promises', 'spacetrim', 'child_process', 'colors', 'waitasecond', 'crypto', 'rxjs', 'crypto-js/enc-hex', 'crypto-js/sha256', 'path', 'crypto-js', 'mime-types', 'papaparse'], factory) :
|
|
4
|
+
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global["promptbook-documents"] = {}, global.promises, global.spacetrim, global.child_process, global.colors, global.waitasecond, global.crypto, global.rxjs, global.hexEncoder, global.sha256, global.path, global.cryptoJs, global.mimeTypes, global.papaparse));
|
|
5
|
+
})(this, (function (exports, promises, spacetrim, child_process, colors, waitasecond, crypto, rxjs, hexEncoder, sha256, path, cryptoJs, mimeTypes, papaparse) { 'use strict';
|
|
6
6
|
|
|
7
7
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
8
8
|
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
* @generated
|
|
25
25
|
* @see https://github.com/webgptorg/promptbook
|
|
26
26
|
*/
|
|
27
|
-
const PROMPTBOOK_ENGINE_VERSION = '0.112.0-
|
|
27
|
+
const PROMPTBOOK_ENGINE_VERSION = '0.112.0-70';
|
|
28
28
|
/**
|
|
29
29
|
* TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
|
|
30
30
|
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
@@ -962,27 +962,33 @@
|
|
|
962
962
|
// TODO: Maybe implement by mix+hsl
|
|
963
963
|
|
|
964
964
|
/**
|
|
965
|
-
*
|
|
965
|
+
* Stable root directory used for Promptbook-owned temporary files and caches.
|
|
966
966
|
*
|
|
967
|
-
* @private internal utility for Promptbook
|
|
967
|
+
* @private internal utility for Promptbook temporary folders
|
|
968
968
|
*/
|
|
969
|
-
const
|
|
969
|
+
const PROMPTBOOK_TEMPORARY_DIRECTORY = '.promptbook';
|
|
970
970
|
/**
|
|
971
|
-
* Builds one project-relative path inside
|
|
971
|
+
* Builds one normalized project-relative path inside Promptbook's dedicated temporary root.
|
|
972
972
|
*
|
|
973
|
-
*
|
|
973
|
+
* The returned path intentionally uses `/` separators so the same helper can be reused from
|
|
974
|
+
* Node.js and edge-safe code without depending on the Node `path` module.
|
|
975
|
+
*
|
|
976
|
+
* @private internal utility for Promptbook temporary folders
|
|
974
977
|
*/
|
|
975
|
-
function
|
|
976
|
-
|
|
978
|
+
function getPromptbookTemporaryPath(...pathSegments) {
|
|
979
|
+
const normalizedPathSegments = pathSegments.flatMap(splitPathSegments).filter(Boolean);
|
|
980
|
+
return [PROMPTBOOK_TEMPORARY_DIRECTORY, ...normalizedPathSegments].join('/');
|
|
977
981
|
}
|
|
978
982
|
/**
|
|
979
|
-
*
|
|
980
|
-
*
|
|
981
|
-
* @private internal utility for Promptbook-owned temp files
|
|
983
|
+
* Normalizes one raw path segment into slash-delimited pieces without empty items.
|
|
982
984
|
*/
|
|
983
|
-
function
|
|
984
|
-
return
|
|
985
|
+
function splitPathSegments(pathSegment) {
|
|
986
|
+
return pathSegment
|
|
987
|
+
.split(/[\\/]+/u)
|
|
988
|
+
.map((segment) => segment.trim())
|
|
989
|
+
.filter(Boolean);
|
|
985
990
|
}
|
|
991
|
+
// Note: [💞] Ignore a discrepancy between file name and entity name
|
|
986
992
|
|
|
987
993
|
/**
|
|
988
994
|
* Returns the same value that is passed as argument.
|
|
@@ -1166,7 +1172,7 @@
|
|
|
1166
1172
|
*
|
|
1167
1173
|
* @public exported from `@promptbook/core`
|
|
1168
1174
|
*/
|
|
1169
|
-
const DEFAULT_DOWNLOAD_CACHE_DIRNAME =
|
|
1175
|
+
const DEFAULT_DOWNLOAD_CACHE_DIRNAME = `./${getPromptbookTemporaryPath('download-cache')}`;
|
|
1170
1176
|
/**
|
|
1171
1177
|
* Where to store the cache of executions for promptbook CLI
|
|
1172
1178
|
*
|
|
@@ -1174,7 +1180,7 @@
|
|
|
1174
1180
|
*
|
|
1175
1181
|
* @public exported from `@promptbook/core`
|
|
1176
1182
|
*/
|
|
1177
|
-
|
|
1183
|
+
`./${getPromptbookTemporaryPath('execution-cache')}`;
|
|
1178
1184
|
/**
|
|
1179
1185
|
* Where to store the scrape cache
|
|
1180
1186
|
*
|
|
@@ -1182,7 +1188,7 @@
|
|
|
1182
1188
|
*
|
|
1183
1189
|
* @public exported from `@promptbook/core`
|
|
1184
1190
|
*/
|
|
1185
|
-
const DEFAULT_SCRAPE_CACHE_DIRNAME =
|
|
1191
|
+
const DEFAULT_SCRAPE_CACHE_DIRNAME = `./${getPromptbookTemporaryPath('scrape-cache')}`;
|
|
1186
1192
|
// <- TODO: [🧜♂️]
|
|
1187
1193
|
/**
|
|
1188
1194
|
* Default settings for parsing and generating CSV files in Promptbook.
|
|
@@ -1562,343 +1568,33 @@
|
|
|
1562
1568
|
// TODO: [🐠] This can be a validator - with variants that return true/false and variants that throw errors with meaningless messages
|
|
1563
1569
|
// TODO: [🖇] What about symlinks?
|
|
1564
1570
|
|
|
1571
|
+
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"}];
|
|
1572
|
+
|
|
1565
1573
|
/**
|
|
1566
|
-
*
|
|
1567
|
-
* Handles normalization and path formatting to create consistent cache directory structures.
|
|
1574
|
+
* Checks if value is valid email
|
|
1568
1575
|
*
|
|
1569
|
-
* @
|
|
1576
|
+
* @public exported from `@promptbook/utils`
|
|
1570
1577
|
*/
|
|
1571
|
-
function
|
|
1572
|
-
|
|
1578
|
+
function isValidEmail(email) {
|
|
1579
|
+
if (typeof email !== 'string') {
|
|
1580
|
+
return false;
|
|
1581
|
+
}
|
|
1582
|
+
if (email.split(/\r?\n/).length > 1) {
|
|
1583
|
+
return false;
|
|
1584
|
+
}
|
|
1585
|
+
return /^.+@.+\..+$/.test(email);
|
|
1573
1586
|
}
|
|
1574
1587
|
|
|
1575
1588
|
/**
|
|
1576
|
-
*
|
|
1577
|
-
*/
|
|
1578
|
-
const defaultDiacriticsRemovalMap = [
|
|
1579
|
-
{
|
|
1580
|
-
base: 'A',
|
|
1581
|
-
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',
|
|
1582
|
-
},
|
|
1583
|
-
{ base: 'AA', letters: '\uA732' },
|
|
1584
|
-
{ base: 'AE', letters: '\u00C6\u01FC\u01E2' },
|
|
1585
|
-
{ base: 'AO', letters: '\uA734' },
|
|
1586
|
-
{ base: 'AU', letters: '\uA736' },
|
|
1587
|
-
{ base: 'AV', letters: '\uA738\uA73A' },
|
|
1588
|
-
{ base: 'AY', letters: '\uA73C' },
|
|
1589
|
-
{
|
|
1590
|
-
base: 'B',
|
|
1591
|
-
letters: '\u0042\u24B7\uFF22\u1E02\u1E04\u1E06\u0243\u0182\u0181',
|
|
1592
|
-
},
|
|
1593
|
-
{
|
|
1594
|
-
base: 'C',
|
|
1595
|
-
letters: '\u0043\u24B8\uFF23\u0106\u0108\u010A\u010C\u00C7\u1E08\u0187\u023B\uA73E',
|
|
1596
|
-
},
|
|
1597
|
-
{
|
|
1598
|
-
base: 'D',
|
|
1599
|
-
letters: '\u0044\u24B9\uFF24\u1E0A\u010E\u1E0C\u1E10\u1E12\u1E0E\u0110\u018B\u018A\u0189\uA779\u00D0',
|
|
1600
|
-
},
|
|
1601
|
-
{ base: 'DZ', letters: '\u01F1\u01C4' },
|
|
1602
|
-
{ base: 'Dz', letters: '\u01F2\u01C5' },
|
|
1603
|
-
{
|
|
1604
|
-
base: 'E',
|
|
1605
|
-
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',
|
|
1606
|
-
},
|
|
1607
|
-
{ base: 'F', letters: '\u0046\u24BB\uFF26\u1E1E\u0191\uA77B' },
|
|
1608
|
-
{
|
|
1609
|
-
base: 'G',
|
|
1610
|
-
letters: '\u0047\u24BC\uFF27\u01F4\u011C\u1E20\u011E\u0120\u01E6\u0122\u01E4\u0193\uA7A0\uA77D\uA77E',
|
|
1611
|
-
},
|
|
1612
|
-
{
|
|
1613
|
-
base: 'H',
|
|
1614
|
-
letters: '\u0048\u24BD\uFF28\u0124\u1E22\u1E26\u021E\u1E24\u1E28\u1E2A\u0126\u2C67\u2C75\uA78D',
|
|
1615
|
-
},
|
|
1616
|
-
{
|
|
1617
|
-
base: 'I',
|
|
1618
|
-
letters: '\u0049\u24BE\uFF29\u00CC\u00CD\u00CE\u0128\u012A\u012C\u0130\u00CF\u1E2E\u1EC8\u01CF\u0208\u020A\u1ECA\u012E\u1E2C\u0197',
|
|
1619
|
-
},
|
|
1620
|
-
{ base: 'J', letters: '\u004A\u24BF\uFF2A\u0134\u0248' },
|
|
1621
|
-
{
|
|
1622
|
-
base: 'K',
|
|
1623
|
-
letters: '\u004B\u24C0\uFF2B\u1E30\u01E8\u1E32\u0136\u1E34\u0198\u2C69\uA740\uA742\uA744\uA7A2',
|
|
1624
|
-
},
|
|
1625
|
-
{
|
|
1626
|
-
base: 'L',
|
|
1627
|
-
letters: '\u004C\u24C1\uFF2C\u013F\u0139\u013D\u1E36\u1E38\u013B\u1E3C\u1E3A\u0141\u023D\u2C62\u2C60\uA748\uA746\uA780',
|
|
1628
|
-
},
|
|
1629
|
-
{ base: 'LJ', letters: '\u01C7' },
|
|
1630
|
-
{ base: 'Lj', letters: '\u01C8' },
|
|
1631
|
-
{ base: 'M', letters: '\u004D\u24C2\uFF2D\u1E3E\u1E40\u1E42\u2C6E\u019C' },
|
|
1632
|
-
{
|
|
1633
|
-
base: 'N',
|
|
1634
|
-
letters: '\u004E\u24C3\uFF2E\u01F8\u0143\u00D1\u1E44\u0147\u1E46\u0145\u1E4A\u1E48\u0220\u019D\uA790\uA7A4',
|
|
1635
|
-
},
|
|
1636
|
-
{ base: 'NJ', letters: '\u01CA' },
|
|
1637
|
-
{ base: 'Nj', letters: '\u01CB' },
|
|
1638
|
-
{
|
|
1639
|
-
base: 'O',
|
|
1640
|
-
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',
|
|
1641
|
-
},
|
|
1642
|
-
{ base: 'OI', letters: '\u01A2' },
|
|
1643
|
-
{ base: 'OO', letters: '\uA74E' },
|
|
1644
|
-
{ base: 'OU', letters: '\u0222' },
|
|
1645
|
-
{ base: 'OE', letters: '\u008C\u0152' },
|
|
1646
|
-
{ base: 'oe', letters: '\u009C\u0153' },
|
|
1647
|
-
{
|
|
1648
|
-
base: 'P',
|
|
1649
|
-
letters: '\u0050\u24C5\uFF30\u1E54\u1E56\u01A4\u2C63\uA750\uA752\uA754',
|
|
1650
|
-
},
|
|
1651
|
-
{ base: 'Q', letters: '\u0051\u24C6\uFF31\uA756\uA758\u024A' },
|
|
1652
|
-
{
|
|
1653
|
-
base: 'R',
|
|
1654
|
-
letters: '\u0052\u24C7\uFF32\u0154\u1E58\u0158\u0210\u0212\u1E5A\u1E5C\u0156\u1E5E\u024C\u2C64\uA75A\uA7A6\uA782',
|
|
1655
|
-
},
|
|
1656
|
-
{
|
|
1657
|
-
base: 'S',
|
|
1658
|
-
letters: '\u0053\u24C8\uFF33\u1E9E\u015A\u1E64\u015C\u1E60\u0160\u1E66\u1E62\u1E68\u0218\u015E\u2C7E\uA7A8\uA784',
|
|
1659
|
-
},
|
|
1660
|
-
{
|
|
1661
|
-
base: 'T',
|
|
1662
|
-
letters: '\u0054\u24C9\uFF34\u1E6A\u0164\u1E6C\u021A\u0162\u1E70\u1E6E\u0166\u01AC\u01AE\u023E\uA786',
|
|
1663
|
-
},
|
|
1664
|
-
{ base: 'TZ', letters: '\uA728' },
|
|
1665
|
-
{
|
|
1666
|
-
base: 'U',
|
|
1667
|
-
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',
|
|
1668
|
-
},
|
|
1669
|
-
{ base: 'V', letters: '\u0056\u24CB\uFF36\u1E7C\u1E7E\u01B2\uA75E\u0245' },
|
|
1670
|
-
{ base: 'VY', letters: '\uA760' },
|
|
1671
|
-
{
|
|
1672
|
-
base: 'W',
|
|
1673
|
-
letters: '\u0057\u24CC\uFF37\u1E80\u1E82\u0174\u1E86\u1E84\u1E88\u2C72',
|
|
1674
|
-
},
|
|
1675
|
-
{ base: 'X', letters: '\u0058\u24CD\uFF38\u1E8A\u1E8C' },
|
|
1676
|
-
{
|
|
1677
|
-
base: 'Y',
|
|
1678
|
-
letters: '\u0059\u24CE\uFF39\u1EF2\u00DD\u0176\u1EF8\u0232\u1E8E\u0178\u1EF6\u1EF4\u01B3\u024E\u1EFE',
|
|
1679
|
-
},
|
|
1680
|
-
{
|
|
1681
|
-
base: 'Z',
|
|
1682
|
-
letters: '\u005A\u24CF\uFF3A\u0179\u1E90\u017B\u017D\u1E92\u1E94\u01B5\u0224\u2C7F\u2C6B\uA762',
|
|
1683
|
-
},
|
|
1684
|
-
{
|
|
1685
|
-
base: 'a',
|
|
1686
|
-
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',
|
|
1687
|
-
},
|
|
1688
|
-
{ base: 'aa', letters: '\uA733' },
|
|
1689
|
-
{ base: 'ae', letters: '\u00E6\u01FD\u01E3' },
|
|
1690
|
-
{ base: 'ao', letters: '\uA735' },
|
|
1691
|
-
{ base: 'au', letters: '\uA737' },
|
|
1692
|
-
{ base: 'av', letters: '\uA739\uA73B' },
|
|
1693
|
-
{ base: 'ay', letters: '\uA73D' },
|
|
1694
|
-
{
|
|
1695
|
-
base: 'b',
|
|
1696
|
-
letters: '\u0062\u24D1\uFF42\u1E03\u1E05\u1E07\u0180\u0183\u0253',
|
|
1697
|
-
},
|
|
1698
|
-
{
|
|
1699
|
-
base: 'c',
|
|
1700
|
-
letters: '\u0063\u24D2\uFF43\u0107\u0109\u010B\u010D\u00E7\u1E09\u0188\u023C\uA73F\u2184',
|
|
1701
|
-
},
|
|
1702
|
-
{
|
|
1703
|
-
base: 'd',
|
|
1704
|
-
letters: '\u0064\u24D3\uFF44\u1E0B\u010F\u1E0D\u1E11\u1E13\u1E0F\u0111\u018C\u0256\u0257\uA77A',
|
|
1705
|
-
},
|
|
1706
|
-
{ base: 'dz', letters: '\u01F3\u01C6' },
|
|
1707
|
-
{
|
|
1708
|
-
base: 'e',
|
|
1709
|
-
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',
|
|
1710
|
-
},
|
|
1711
|
-
{ base: 'f', letters: '\u0066\u24D5\uFF46\u1E1F\u0192\uA77C' },
|
|
1712
|
-
{
|
|
1713
|
-
base: 'g',
|
|
1714
|
-
letters: '\u0067\u24D6\uFF47\u01F5\u011D\u1E21\u011F\u0121\u01E7\u0123\u01E5\u0260\uA7A1\u1D79\uA77F',
|
|
1715
|
-
},
|
|
1716
|
-
{
|
|
1717
|
-
base: 'h',
|
|
1718
|
-
letters: '\u0068\u24D7\uFF48\u0125\u1E23\u1E27\u021F\u1E25\u1E29\u1E2B\u1E96\u0127\u2C68\u2C76\u0265',
|
|
1719
|
-
},
|
|
1720
|
-
{ base: 'hv', letters: '\u0195' },
|
|
1721
|
-
{
|
|
1722
|
-
base: 'i',
|
|
1723
|
-
letters: '\u0069\u24D8\uFF49\u00EC\u00ED\u00EE\u0129\u012B\u012D\u00EF\u1E2F\u1EC9\u01D0\u0209\u020B\u1ECB\u012F\u1E2D\u0268\u0131',
|
|
1724
|
-
},
|
|
1725
|
-
{ base: 'j', letters: '\u006A\u24D9\uFF4A\u0135\u01F0\u0249' },
|
|
1726
|
-
{
|
|
1727
|
-
base: 'k',
|
|
1728
|
-
letters: '\u006B\u24DA\uFF4B\u1E31\u01E9\u1E33\u0137\u1E35\u0199\u2C6A\uA741\uA743\uA745\uA7A3',
|
|
1729
|
-
},
|
|
1730
|
-
{
|
|
1731
|
-
base: 'l',
|
|
1732
|
-
letters: '\u006C\u24DB\uFF4C\u0140\u013A\u013E\u1E37\u1E39\u013C\u1E3D\u1E3B\u017F\u0142\u019A\u026B\u2C61\uA749\uA781\uA747',
|
|
1733
|
-
},
|
|
1734
|
-
{ base: 'lj', letters: '\u01C9' },
|
|
1735
|
-
{ base: 'm', letters: '\u006D\u24DC\uFF4D\u1E3F\u1E41\u1E43\u0271\u026F' },
|
|
1736
|
-
{
|
|
1737
|
-
base: 'n',
|
|
1738
|
-
letters: '\u006E\u24DD\uFF4E\u01F9\u0144\u00F1\u1E45\u0148\u1E47\u0146\u1E4B\u1E49\u019E\u0272\u0149\uA791\uA7A5',
|
|
1739
|
-
},
|
|
1740
|
-
{ base: 'nj', letters: '\u01CC' },
|
|
1741
|
-
{
|
|
1742
|
-
base: 'o',
|
|
1743
|
-
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',
|
|
1744
|
-
},
|
|
1745
|
-
{ base: 'oi', letters: '\u01A3' },
|
|
1746
|
-
{ base: 'ou', letters: '\u0223' },
|
|
1747
|
-
{ base: 'oo', letters: '\uA74F' },
|
|
1748
|
-
{
|
|
1749
|
-
base: 'p',
|
|
1750
|
-
letters: '\u0070\u24DF\uFF50\u1E55\u1E57\u01A5\u1D7D\uA751\uA753\uA755',
|
|
1751
|
-
},
|
|
1752
|
-
{ base: 'q', letters: '\u0071\u24E0\uFF51\u024B\uA757\uA759' },
|
|
1753
|
-
{
|
|
1754
|
-
base: 'r',
|
|
1755
|
-
letters: '\u0072\u24E1\uFF52\u0155\u1E59\u0159\u0211\u0213\u1E5B\u1E5D\u0157\u1E5F\u024D\u027D\uA75B\uA7A7\uA783',
|
|
1756
|
-
},
|
|
1757
|
-
{
|
|
1758
|
-
base: 's',
|
|
1759
|
-
letters: '\u0073\u24E2\uFF53\u00DF\u015B\u1E65\u015D\u1E61\u0161\u1E67\u1E63\u1E69\u0219\u015F\u023F\uA7A9\uA785\u1E9B',
|
|
1760
|
-
},
|
|
1761
|
-
{
|
|
1762
|
-
base: 't',
|
|
1763
|
-
letters: '\u0074\u24E3\uFF54\u1E6B\u1E97\u0165\u1E6D\u021B\u0163\u1E71\u1E6F\u0167\u01AD\u0288\u2C66\uA787',
|
|
1764
|
-
},
|
|
1765
|
-
{ base: 'tz', letters: '\uA729' },
|
|
1766
|
-
{
|
|
1767
|
-
base: 'u',
|
|
1768
|
-
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',
|
|
1769
|
-
},
|
|
1770
|
-
{ base: 'v', letters: '\u0076\u24E5\uFF56\u1E7D\u1E7F\u028B\uA75F\u028C' },
|
|
1771
|
-
{ base: 'vy', letters: '\uA761' },
|
|
1772
|
-
{
|
|
1773
|
-
base: 'w',
|
|
1774
|
-
letters: '\u0077\u24E6\uFF57\u1E81\u1E83\u0175\u1E87\u1E85\u1E98\u1E89\u2C73',
|
|
1775
|
-
},
|
|
1776
|
-
{ base: 'x', letters: '\u0078\u24E7\uFF58\u1E8B\u1E8D' },
|
|
1777
|
-
{
|
|
1778
|
-
base: 'y',
|
|
1779
|
-
letters: '\u0079\u24E8\uFF59\u1EF3\u00FD\u0177\u1EF9\u0233\u1E8F\u00FF\u1EF7\u1E99\u1EF5\u01B4\u024F\u1EFF',
|
|
1780
|
-
},
|
|
1781
|
-
{
|
|
1782
|
-
base: 'z',
|
|
1783
|
-
letters: '\u007A\u24E9\uFF5A\u017A\u1E91\u017C\u017E\u1E93\u1E95\u01B6\u0225\u0240\u2C6C\uA763',
|
|
1784
|
-
},
|
|
1785
|
-
];
|
|
1786
|
-
/**
|
|
1787
|
-
* Map of letters from diacritic variant to diacritless variant
|
|
1788
|
-
* Contains lowercase and uppercase separatelly
|
|
1589
|
+
* Tests if given string is valid file path.
|
|
1789
1590
|
*
|
|
1790
|
-
*
|
|
1791
|
-
* > "ě" => "e"
|
|
1792
|
-
* > "Ă" => "A"
|
|
1793
|
-
* > ...
|
|
1591
|
+
* Note: This does not check if the file exists only if the path is valid
|
|
1794
1592
|
*
|
|
1795
1593
|
* @public exported from `@promptbook/utils`
|
|
1796
1594
|
*/
|
|
1797
|
-
|
|
1798
|
-
|
|
1799
|
-
|
|
1800
|
-
const letters = defaultDiacriticsRemovalMap[i].letters;
|
|
1801
|
-
// tslint:disable-next-line: prefer-for-of
|
|
1802
|
-
for (let j = 0; j < letters.length; j++) {
|
|
1803
|
-
DIACRITIC_VARIANTS_LETTERS[letters[j]] = defaultDiacriticsRemovalMap[i].base;
|
|
1804
|
-
}
|
|
1805
|
-
}
|
|
1806
|
-
// <- TODO: [🍓] Put to maker function to save execution time if not needed
|
|
1807
|
-
/*
|
|
1808
|
-
@see https://stackoverflow.com/questions/990904/remove-accents-diacritics-in-a-string-in-javascript
|
|
1809
|
-
Licensed under the Apache License, Version 2.0 (the "License");
|
|
1810
|
-
you may not use this file except in compliance with the License.
|
|
1811
|
-
You may obtain a copy of the License at
|
|
1812
|
-
|
|
1813
|
-
http://www.apache.org/licenses/LICENSE-2.0
|
|
1814
|
-
|
|
1815
|
-
Unless required by applicable law or agreed to in writing, software
|
|
1816
|
-
distributed under the License is distributed on an "AS IS" BASIS,
|
|
1817
|
-
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1818
|
-
See the License for the specific language governing permissions and
|
|
1819
|
-
limitations under the License.
|
|
1820
|
-
*/
|
|
1821
|
-
|
|
1822
|
-
/**
|
|
1823
|
-
* Removes diacritic marks (accents) from characters in a string.
|
|
1824
|
-
*
|
|
1825
|
-
* Note: [🔂] This function is idempotent.
|
|
1826
|
-
*
|
|
1827
|
-
* @param input The string containing diacritics to be normalized.
|
|
1828
|
-
* @returns The string with diacritics removed or normalized.
|
|
1829
|
-
*
|
|
1830
|
-
* @public exported from `@promptbook/utils`
|
|
1831
|
-
*/
|
|
1832
|
-
function removeDiacritics(input) {
|
|
1833
|
-
/*eslint no-control-regex: "off"*/
|
|
1834
|
-
return input.replace(/[^\u0000-\u007E]/g, (character) => {
|
|
1835
|
-
return DIACRITIC_VARIANTS_LETTERS[character] || character;
|
|
1836
|
-
});
|
|
1837
|
-
}
|
|
1838
|
-
// TODO: [Ж] Variant for cyrillic (and in general non-latin) letters
|
|
1839
|
-
|
|
1840
|
-
/**
|
|
1841
|
-
* Converts a given text to kebab-case format.
|
|
1842
|
-
*
|
|
1843
|
-
* Note: [🔂] This function is idempotent.
|
|
1844
|
-
*
|
|
1845
|
-
* @param text The text to be converted.
|
|
1846
|
-
* @returns The kebab-case formatted string.
|
|
1847
|
-
* @example 'hello-world'
|
|
1848
|
-
* @example 'i-love-promptbook'
|
|
1849
|
-
*
|
|
1850
|
-
* @public exported from `@promptbook/utils`
|
|
1851
|
-
*/
|
|
1852
|
-
function normalizeToKebabCase(text) {
|
|
1853
|
-
text = removeDiacritics(text);
|
|
1854
|
-
let charType;
|
|
1855
|
-
let lastCharType = 'OTHER';
|
|
1856
|
-
let normalizedName = '';
|
|
1857
|
-
for (const char of text) {
|
|
1858
|
-
let normalizedChar;
|
|
1859
|
-
if (/^[a-z]$/.test(char)) {
|
|
1860
|
-
charType = 'LOWERCASE';
|
|
1861
|
-
normalizedChar = char;
|
|
1862
|
-
}
|
|
1863
|
-
else if (/^[A-Z]$/.test(char)) {
|
|
1864
|
-
charType = 'UPPERCASE';
|
|
1865
|
-
normalizedChar = char.toLowerCase();
|
|
1866
|
-
}
|
|
1867
|
-
else if (/^[0-9]$/.test(char)) {
|
|
1868
|
-
charType = 'NUMBER';
|
|
1869
|
-
normalizedChar = char;
|
|
1870
|
-
}
|
|
1871
|
-
else {
|
|
1872
|
-
charType = 'OTHER';
|
|
1873
|
-
normalizedChar = '-';
|
|
1874
|
-
}
|
|
1875
|
-
if (charType !== lastCharType &&
|
|
1876
|
-
!(lastCharType === 'UPPERCASE' && charType === 'LOWERCASE') &&
|
|
1877
|
-
!(lastCharType === 'NUMBER') &&
|
|
1878
|
-
!(charType === 'NUMBER')) {
|
|
1879
|
-
normalizedName += '-';
|
|
1880
|
-
}
|
|
1881
|
-
normalizedName += normalizedChar;
|
|
1882
|
-
lastCharType = charType;
|
|
1883
|
-
}
|
|
1884
|
-
normalizedName = normalizedName.split(/-+/g).join('-');
|
|
1885
|
-
normalizedName = normalizedName.split(/-?\/-?/g).join('/');
|
|
1886
|
-
normalizedName = normalizedName.replace(/^-/, '');
|
|
1887
|
-
normalizedName = normalizedName.replace(/-$/, '');
|
|
1888
|
-
return normalizedName;
|
|
1889
|
-
}
|
|
1890
|
-
// Note: [💞] Ignore a discrepancy between file name and entity name
|
|
1891
|
-
|
|
1892
|
-
/**
|
|
1893
|
-
* Tests if given string is valid file path.
|
|
1894
|
-
*
|
|
1895
|
-
* Note: This does not check if the file exists only if the path is valid
|
|
1896
|
-
*
|
|
1897
|
-
* @public exported from `@promptbook/utils`
|
|
1898
|
-
*/
|
|
1899
|
-
function isValidFilePath(filename) {
|
|
1900
|
-
if (typeof filename !== 'string') {
|
|
1901
|
-
return false;
|
|
1595
|
+
function isValidFilePath(filename) {
|
|
1596
|
+
if (typeof filename !== 'string') {
|
|
1597
|
+
return false;
|
|
1902
1598
|
}
|
|
1903
1599
|
if (filename.split(/\r?\n/).length > 1) {
|
|
1904
1600
|
return false;
|
|
@@ -1975,137 +1671,6 @@
|
|
|
1975
1671
|
}
|
|
1976
1672
|
}
|
|
1977
1673
|
|
|
1978
|
-
/**
|
|
1979
|
-
* Removes emojis from a string and fix whitespaces
|
|
1980
|
-
*
|
|
1981
|
-
* Note: [🔂] This function is idempotent.
|
|
1982
|
-
*
|
|
1983
|
-
* @param text with emojis
|
|
1984
|
-
* @returns text without emojis
|
|
1985
|
-
*
|
|
1986
|
-
* @public exported from `@promptbook/utils`
|
|
1987
|
-
*/
|
|
1988
|
-
function removeEmojis(text) {
|
|
1989
|
-
// Replace emojis (and also ZWJ sequence) with hyphens
|
|
1990
|
-
text = text.replace(/(\p{Extended_Pictographic})\p{Modifier_Symbol}/gu, '$1');
|
|
1991
|
-
text = text.replace(/(\p{Extended_Pictographic})[\u{FE00}-\u{FE0F}]/gu, '$1');
|
|
1992
|
-
text = text.replace(/(\p{Extended_Pictographic})(\u{200D}\p{Extended_Pictographic})*/gu, '$1');
|
|
1993
|
-
text = text.replace(/\p{Extended_Pictographic}/gu, '');
|
|
1994
|
-
return text;
|
|
1995
|
-
}
|
|
1996
|
-
|
|
1997
|
-
/**
|
|
1998
|
-
* Converts a title string into a normalized name.
|
|
1999
|
-
*
|
|
2000
|
-
* Note: [🔂] This function is idempotent.
|
|
2001
|
-
*
|
|
2002
|
-
* @param value The title string to be converted to a name.
|
|
2003
|
-
* @returns A normalized name derived from the input title.
|
|
2004
|
-
* @example 'Hello World!' -> 'hello-world'
|
|
2005
|
-
*
|
|
2006
|
-
* @public exported from `@promptbook/utils`
|
|
2007
|
-
*/
|
|
2008
|
-
function titleToName(value) {
|
|
2009
|
-
if (isValidUrl(value)) {
|
|
2010
|
-
value = value.replace(/^https?:\/\//, '');
|
|
2011
|
-
value = value.replace(/\.html$/, '');
|
|
2012
|
-
}
|
|
2013
|
-
else if (isValidFilePath(value)) {
|
|
2014
|
-
value = path.basename(value);
|
|
2015
|
-
// Note: Keeping extension in the name
|
|
2016
|
-
}
|
|
2017
|
-
value = value.split('/').join('-');
|
|
2018
|
-
value = removeEmojis(value);
|
|
2019
|
-
value = normalizeToKebabCase(value);
|
|
2020
|
-
// TODO: [🧠] Maybe warn or add some padding to short name which are not good identifiers
|
|
2021
|
-
return value;
|
|
2022
|
-
}
|
|
2023
|
-
|
|
2024
|
-
/**
|
|
2025
|
-
* Retrieves an intermediate source for a scraper based on the knowledge source.
|
|
2026
|
-
* Manages the caching and retrieval of intermediate scraper results for optimized performance.
|
|
2027
|
-
*
|
|
2028
|
-
* @private as internal utility for scrapers
|
|
2029
|
-
*/
|
|
2030
|
-
async function getScraperIntermediateSource(source, options) {
|
|
2031
|
-
const { filename: sourceFilename, url } = source;
|
|
2032
|
-
const { rootDirname, cacheDirname, intermediateFilesStrategy, extension, isVerbose } = options;
|
|
2033
|
-
// TODO: [👬] DRY
|
|
2034
|
-
const hash = cryptoJs.SHA256(
|
|
2035
|
-
// <- TODO: [🥬] Encapsulate sha256 to some private utility function
|
|
2036
|
-
hexEncoder__default["default"].parse(sourceFilename || url || 'untitled'))
|
|
2037
|
-
.toString( /* hex */)
|
|
2038
|
-
.substring(0, 20);
|
|
2039
|
-
// <- TODO: [🥬] Make some system for hashes and ids of promptbook
|
|
2040
|
-
const semanticName = normalizeToKebabCase(titleToName((sourceFilename || url || '').split('intermediate').join(''))).substring(0, 20);
|
|
2041
|
-
// <- TODO: [🐱🐉]
|
|
2042
|
-
const pieces = ['intermediate', semanticName, hash].filter((piece) => piece !== '');
|
|
2043
|
-
const name = pieces.join('-').split('--').join('-');
|
|
2044
|
-
const cacheFilename = path.join(process.cwd(), cacheDirname, ...nameToSubfolderPath(hash /* <- TODO: [🎎] Maybe add some SHA256 prefix */), name)
|
|
2045
|
-
.split('\\')
|
|
2046
|
-
.join('/') +
|
|
2047
|
-
'.' +
|
|
2048
|
-
extension;
|
|
2049
|
-
// Note: Try to create cache directory, but don't fail if filesystem has issues
|
|
2050
|
-
try {
|
|
2051
|
-
await promises.mkdir(path.dirname(cacheFilename), { recursive: true });
|
|
2052
|
-
}
|
|
2053
|
-
catch (error) {
|
|
2054
|
-
// Note: If we can't create cache directory, continue without it
|
|
2055
|
-
// This handles read-only filesystems, permission issues, and missing parent directories
|
|
2056
|
-
if (error instanceof Error &&
|
|
2057
|
-
(error.message.includes('EROFS') ||
|
|
2058
|
-
error.message.includes('read-only') ||
|
|
2059
|
-
error.message.includes('EACCES') ||
|
|
2060
|
-
error.message.includes('EPERM') ||
|
|
2061
|
-
error.message.includes('ENOENT'))) ;
|
|
2062
|
-
else {
|
|
2063
|
-
// Re-throw other unexpected errors
|
|
2064
|
-
throw error;
|
|
2065
|
-
}
|
|
2066
|
-
}
|
|
2067
|
-
let isDestroyed = true;
|
|
2068
|
-
const fileHandler = {
|
|
2069
|
-
filename: cacheFilename,
|
|
2070
|
-
get isDestroyed() {
|
|
2071
|
-
return isDestroyed;
|
|
2072
|
-
},
|
|
2073
|
-
async destroy() {
|
|
2074
|
-
if (intermediateFilesStrategy === 'HIDE_AND_CLEAN') {
|
|
2075
|
-
if (isVerbose) {
|
|
2076
|
-
console.info('legacyDocumentScraper: Clening cache');
|
|
2077
|
-
}
|
|
2078
|
-
await promises.rm(cacheFilename);
|
|
2079
|
-
// TODO: [🐿][🧠] Maybe remove empty folders
|
|
2080
|
-
}
|
|
2081
|
-
isDestroyed = true;
|
|
2082
|
-
},
|
|
2083
|
-
};
|
|
2084
|
-
return fileHandler;
|
|
2085
|
-
}
|
|
2086
|
-
// 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
|
|
2087
|
-
// Note: Not using `FileCacheStorage` for two reasons:
|
|
2088
|
-
// 1. Need to store more than serialized JSONs.
|
|
2089
|
-
// 2. Need to switch between a `rootDirname` and `cacheDirname` <- TODO: [😡]
|
|
2090
|
-
// TODO: [🐱🐉][🧠] Make some smart crop
|
|
2091
|
-
|
|
2092
|
-
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"}];
|
|
2093
|
-
|
|
2094
|
-
/**
|
|
2095
|
-
* Checks if value is valid email
|
|
2096
|
-
*
|
|
2097
|
-
* @public exported from `@promptbook/utils`
|
|
2098
|
-
*/
|
|
2099
|
-
function isValidEmail(email) {
|
|
2100
|
-
if (typeof email !== 'string') {
|
|
2101
|
-
return false;
|
|
2102
|
-
}
|
|
2103
|
-
if (email.split(/\r?\n/).length > 1) {
|
|
2104
|
-
return false;
|
|
2105
|
-
}
|
|
2106
|
-
return /^.+@.+\..+$/.test(email);
|
|
2107
|
-
}
|
|
2108
|
-
|
|
2109
1674
|
/**
|
|
2110
1675
|
* This error indicates that the promptbook in a markdown format cannot be parsed into a valid promptbook object
|
|
2111
1676
|
*
|
|
@@ -2255,11 +1820,11 @@
|
|
|
2255
1820
|
*/
|
|
2256
1821
|
function pipelineJsonToString(pipelineJson) {
|
|
2257
1822
|
const { title, pipelineUrl, bookVersion, description, parameters, tasks } = pipelineJson;
|
|
2258
|
-
let pipelineString =
|
|
2259
|
-
|
|
2260
|
-
|
|
2261
|
-
|
|
2262
|
-
|
|
1823
|
+
let pipelineString = spacetrim.spaceTrim((block) => `
|
|
1824
|
+
# ${title}
|
|
1825
|
+
|
|
1826
|
+
${block(description || '')}
|
|
1827
|
+
`);
|
|
2263
1828
|
const commands = [];
|
|
2264
1829
|
if (pipelineUrl) {
|
|
2265
1830
|
commands.push(`PIPELINE URL ${pipelineUrl}`);
|
|
@@ -2275,20 +1840,17 @@
|
|
|
2275
1840
|
for (const parameter of parameters.filter(({ isOutput }) => isOutput)) {
|
|
2276
1841
|
commands.push(`OUTPUT PARAMETER ${taskParameterJsonToString(parameter)}`);
|
|
2277
1842
|
}
|
|
2278
|
-
pipelineString
|
|
2279
|
-
|
|
1843
|
+
pipelineString = spacetrim.spaceTrim((block) => `
|
|
1844
|
+
${block(pipelineString)}
|
|
1845
|
+
|
|
1846
|
+
${block(commands.map((command) => `- ${command}`).join('\n'))}
|
|
1847
|
+
`);
|
|
2280
1848
|
for (const task of tasks) {
|
|
2281
1849
|
const {
|
|
2282
1850
|
/* Note: Not using:> name, */
|
|
2283
1851
|
title, description,
|
|
2284
1852
|
/* Note: dependentParameterNames, */
|
|
2285
1853
|
jokerParameterNames: jokers, taskType, content, postprocessingFunctionNames: postprocessing, expectations, format, resultingParameterName, } = task;
|
|
2286
|
-
pipelineString += '\n\n';
|
|
2287
|
-
pipelineString += `## ${title}`;
|
|
2288
|
-
if (description) {
|
|
2289
|
-
pipelineString += '\n\n';
|
|
2290
|
-
pipelineString += description;
|
|
2291
|
-
}
|
|
2292
1854
|
const commands = [];
|
|
2293
1855
|
let contentLanguage = 'text';
|
|
2294
1856
|
if (taskType === 'PROMPT_TASK') {
|
|
@@ -2351,18 +1913,23 @@
|
|
|
2351
1913
|
commands.push(`FORMAT JSON`);
|
|
2352
1914
|
}
|
|
2353
1915
|
} /* not else */
|
|
2354
|
-
pipelineString
|
|
2355
|
-
|
|
2356
|
-
|
|
2357
|
-
|
|
2358
|
-
|
|
2359
|
-
|
|
2360
|
-
|
|
2361
|
-
|
|
2362
|
-
|
|
2363
|
-
|
|
2364
|
-
|
|
2365
|
-
|
|
1916
|
+
pipelineString = spacetrim.spaceTrim((block) => `
|
|
1917
|
+
${block(pipelineString)}
|
|
1918
|
+
|
|
1919
|
+
## ${title}
|
|
1920
|
+
|
|
1921
|
+
${block(description || '')}
|
|
1922
|
+
|
|
1923
|
+
${block(commands.map((command) => `- ${command}`).join('\n'))}
|
|
1924
|
+
|
|
1925
|
+
\`\`\`${contentLanguage}
|
|
1926
|
+
${block(spacetrim.spaceTrim(content))}
|
|
1927
|
+
\`\`\`
|
|
1928
|
+
|
|
1929
|
+
\`-> {${resultingParameterName}}\`
|
|
1930
|
+
`); // <- TODO: [main] !!3 If the parameter here has description, add it and use taskParameterJsonToString
|
|
1931
|
+
// <- TODO: [main] !!3 Escape
|
|
1932
|
+
// <- TODO: [🧠] Some clear strategy how to spaceTrim the blocks
|
|
2366
1933
|
}
|
|
2367
1934
|
return validatePipelineString(pipelineString);
|
|
2368
1935
|
}
|
|
@@ -4646,95 +4213,412 @@
|
|
|
4646
4213
|
*
|
|
4647
4214
|
* @singleton Only one instance of each register is created per build, but there can be more than one in different build modules
|
|
4648
4215
|
*
|
|
4649
|
-
* @public exported from `@promptbook/core`
|
|
4216
|
+
* @public exported from `@promptbook/core`
|
|
4217
|
+
*/
|
|
4218
|
+
const $scrapersRegister = new $Register('scraper_constructors');
|
|
4219
|
+
// TODO: [®] DRY Register logic
|
|
4220
|
+
|
|
4221
|
+
/**
|
|
4222
|
+
* Creates a message with all registered scrapers
|
|
4223
|
+
*
|
|
4224
|
+
* Note: This function is used to create a (error) message when there is no scraper for particular mime type
|
|
4225
|
+
*
|
|
4226
|
+
* @private internal function of `createScrapersFromConfiguration` and `createScrapersFromEnv`
|
|
4227
|
+
*/
|
|
4228
|
+
function $registeredScrapersMessage(availableScrapers) {
|
|
4229
|
+
/**
|
|
4230
|
+
* Mixes registered scrapers from $scrapersMetadataRegister and $scrapersRegister
|
|
4231
|
+
*/
|
|
4232
|
+
const all = [];
|
|
4233
|
+
for (const { packageName, className, mimeTypes, documentationUrl, isAvailableInBrowser, } of $scrapersMetadataRegister.list()) {
|
|
4234
|
+
if (all.some((item) => item.packageName === packageName && item.className === className)) {
|
|
4235
|
+
continue;
|
|
4236
|
+
}
|
|
4237
|
+
all.push({ packageName, className, mimeTypes, documentationUrl, isAvailableInBrowser });
|
|
4238
|
+
}
|
|
4239
|
+
for (const { packageName, className, mimeTypes, documentationUrl, isAvailableInBrowser, } of $scrapersRegister.list()) {
|
|
4240
|
+
if (all.some((item) => item.packageName === packageName && item.className === className)) {
|
|
4241
|
+
continue;
|
|
4242
|
+
}
|
|
4243
|
+
all.push({ packageName, className, mimeTypes, documentationUrl, isAvailableInBrowser });
|
|
4244
|
+
}
|
|
4245
|
+
for (const { metadata } of availableScrapers) {
|
|
4246
|
+
all.push(metadata);
|
|
4247
|
+
}
|
|
4248
|
+
const metadata = all.map((metadata) => {
|
|
4249
|
+
const isMetadataAviailable = $scrapersMetadataRegister
|
|
4250
|
+
.list()
|
|
4251
|
+
.find(({ packageName, className }) => metadata.packageName === packageName && metadata.className === className);
|
|
4252
|
+
const isInstalled = $scrapersRegister
|
|
4253
|
+
.list()
|
|
4254
|
+
.find(({ packageName, className }) => metadata.packageName === packageName && metadata.className === className);
|
|
4255
|
+
const isAvailableInTools = availableScrapers.some(({ metadata: { packageName, className } }) => metadata.packageName === packageName && metadata.className === className);
|
|
4256
|
+
return { ...metadata, isMetadataAviailable, isInstalled, isAvailableInTools };
|
|
4257
|
+
});
|
|
4258
|
+
if (metadata.length === 0) {
|
|
4259
|
+
return spacetrim.spaceTrim(`
|
|
4260
|
+
**No scrapers are available**
|
|
4261
|
+
|
|
4262
|
+
This is a unexpected behavior, you are probably using some broken version of Promptbook
|
|
4263
|
+
At least there should be available the metadata of the scrapers
|
|
4264
|
+
`);
|
|
4265
|
+
}
|
|
4266
|
+
return spacetrim.spaceTrim((block) => `
|
|
4267
|
+
Available scrapers are:
|
|
4268
|
+
${block(metadata
|
|
4269
|
+
.map(({ packageName, className, isMetadataAviailable, isInstalled, mimeTypes, isAvailableInBrowser, isAvailableInTools, }, i) => {
|
|
4270
|
+
const more = [];
|
|
4271
|
+
// TODO: [🧠] Maybe use `documentationUrl`
|
|
4272
|
+
if (isMetadataAviailable) {
|
|
4273
|
+
more.push(`⬜ Metadata registered`);
|
|
4274
|
+
} // not else
|
|
4275
|
+
if (isInstalled) {
|
|
4276
|
+
more.push(`🟩 Installed`);
|
|
4277
|
+
} // not else
|
|
4278
|
+
if (isAvailableInTools) {
|
|
4279
|
+
more.push(`🟦 Available in tools`);
|
|
4280
|
+
} // not else
|
|
4281
|
+
if (!isMetadataAviailable && isInstalled) {
|
|
4282
|
+
more.push(`When no metadata registered but scraper is installed, it is an unexpected behavior`);
|
|
4283
|
+
} // not else
|
|
4284
|
+
if (!isInstalled && isAvailableInTools) {
|
|
4285
|
+
more.push(`When the scraper is not installed but available in tools, it is an unexpected compatibility behavior`);
|
|
4286
|
+
} // not else
|
|
4287
|
+
if (!isAvailableInBrowser) {
|
|
4288
|
+
more.push(`Not usable in browser`);
|
|
4289
|
+
}
|
|
4290
|
+
const moreText = more.length === 0 ? '' : ` *(${more.join('; ')})*`;
|
|
4291
|
+
return `${i + 1}) \`${className}\` from \`${packageName}\` compatible to scrape ${mimeTypes
|
|
4292
|
+
.map((mimeType) => `"${mimeType}"`)
|
|
4293
|
+
.join(', ')}${moreText}`;
|
|
4294
|
+
})
|
|
4295
|
+
.join('\n'))}
|
|
4296
|
+
|
|
4297
|
+
Legend:
|
|
4298
|
+
- ⬜ **Metadata registered** means that Promptbook knows about the scraper, it is similar to registration in some registry
|
|
4299
|
+
- 🟩 **Installed** means that you have imported package with particular scraper
|
|
4300
|
+
- 🟦 **Available in tools** means that you have passed scraper as dependency into prepare or execution process
|
|
4301
|
+
|
|
4302
|
+
`);
|
|
4303
|
+
}
|
|
4304
|
+
// TODO: [®] DRY Register logic
|
|
4305
|
+
|
|
4306
|
+
/**
|
|
4307
|
+
* Collection of default diacritics removal map.
|
|
4308
|
+
*/
|
|
4309
|
+
const defaultDiacriticsRemovalMap = [
|
|
4310
|
+
{
|
|
4311
|
+
base: 'A',
|
|
4312
|
+
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',
|
|
4313
|
+
},
|
|
4314
|
+
{ base: 'AA', letters: '\uA732' },
|
|
4315
|
+
{ base: 'AE', letters: '\u00C6\u01FC\u01E2' },
|
|
4316
|
+
{ base: 'AO', letters: '\uA734' },
|
|
4317
|
+
{ base: 'AU', letters: '\uA736' },
|
|
4318
|
+
{ base: 'AV', letters: '\uA738\uA73A' },
|
|
4319
|
+
{ base: 'AY', letters: '\uA73C' },
|
|
4320
|
+
{
|
|
4321
|
+
base: 'B',
|
|
4322
|
+
letters: '\u0042\u24B7\uFF22\u1E02\u1E04\u1E06\u0243\u0182\u0181',
|
|
4323
|
+
},
|
|
4324
|
+
{
|
|
4325
|
+
base: 'C',
|
|
4326
|
+
letters: '\u0043\u24B8\uFF23\u0106\u0108\u010A\u010C\u00C7\u1E08\u0187\u023B\uA73E',
|
|
4327
|
+
},
|
|
4328
|
+
{
|
|
4329
|
+
base: 'D',
|
|
4330
|
+
letters: '\u0044\u24B9\uFF24\u1E0A\u010E\u1E0C\u1E10\u1E12\u1E0E\u0110\u018B\u018A\u0189\uA779\u00D0',
|
|
4331
|
+
},
|
|
4332
|
+
{ base: 'DZ', letters: '\u01F1\u01C4' },
|
|
4333
|
+
{ base: 'Dz', letters: '\u01F2\u01C5' },
|
|
4334
|
+
{
|
|
4335
|
+
base: 'E',
|
|
4336
|
+
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',
|
|
4337
|
+
},
|
|
4338
|
+
{ base: 'F', letters: '\u0046\u24BB\uFF26\u1E1E\u0191\uA77B' },
|
|
4339
|
+
{
|
|
4340
|
+
base: 'G',
|
|
4341
|
+
letters: '\u0047\u24BC\uFF27\u01F4\u011C\u1E20\u011E\u0120\u01E6\u0122\u01E4\u0193\uA7A0\uA77D\uA77E',
|
|
4342
|
+
},
|
|
4343
|
+
{
|
|
4344
|
+
base: 'H',
|
|
4345
|
+
letters: '\u0048\u24BD\uFF28\u0124\u1E22\u1E26\u021E\u1E24\u1E28\u1E2A\u0126\u2C67\u2C75\uA78D',
|
|
4346
|
+
},
|
|
4347
|
+
{
|
|
4348
|
+
base: 'I',
|
|
4349
|
+
letters: '\u0049\u24BE\uFF29\u00CC\u00CD\u00CE\u0128\u012A\u012C\u0130\u00CF\u1E2E\u1EC8\u01CF\u0208\u020A\u1ECA\u012E\u1E2C\u0197',
|
|
4350
|
+
},
|
|
4351
|
+
{ base: 'J', letters: '\u004A\u24BF\uFF2A\u0134\u0248' },
|
|
4352
|
+
{
|
|
4353
|
+
base: 'K',
|
|
4354
|
+
letters: '\u004B\u24C0\uFF2B\u1E30\u01E8\u1E32\u0136\u1E34\u0198\u2C69\uA740\uA742\uA744\uA7A2',
|
|
4355
|
+
},
|
|
4356
|
+
{
|
|
4357
|
+
base: 'L',
|
|
4358
|
+
letters: '\u004C\u24C1\uFF2C\u013F\u0139\u013D\u1E36\u1E38\u013B\u1E3C\u1E3A\u0141\u023D\u2C62\u2C60\uA748\uA746\uA780',
|
|
4359
|
+
},
|
|
4360
|
+
{ base: 'LJ', letters: '\u01C7' },
|
|
4361
|
+
{ base: 'Lj', letters: '\u01C8' },
|
|
4362
|
+
{ base: 'M', letters: '\u004D\u24C2\uFF2D\u1E3E\u1E40\u1E42\u2C6E\u019C' },
|
|
4363
|
+
{
|
|
4364
|
+
base: 'N',
|
|
4365
|
+
letters: '\u004E\u24C3\uFF2E\u01F8\u0143\u00D1\u1E44\u0147\u1E46\u0145\u1E4A\u1E48\u0220\u019D\uA790\uA7A4',
|
|
4366
|
+
},
|
|
4367
|
+
{ base: 'NJ', letters: '\u01CA' },
|
|
4368
|
+
{ base: 'Nj', letters: '\u01CB' },
|
|
4369
|
+
{
|
|
4370
|
+
base: 'O',
|
|
4371
|
+
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',
|
|
4372
|
+
},
|
|
4373
|
+
{ base: 'OI', letters: '\u01A2' },
|
|
4374
|
+
{ base: 'OO', letters: '\uA74E' },
|
|
4375
|
+
{ base: 'OU', letters: '\u0222' },
|
|
4376
|
+
{ base: 'OE', letters: '\u008C\u0152' },
|
|
4377
|
+
{ base: 'oe', letters: '\u009C\u0153' },
|
|
4378
|
+
{
|
|
4379
|
+
base: 'P',
|
|
4380
|
+
letters: '\u0050\u24C5\uFF30\u1E54\u1E56\u01A4\u2C63\uA750\uA752\uA754',
|
|
4381
|
+
},
|
|
4382
|
+
{ base: 'Q', letters: '\u0051\u24C6\uFF31\uA756\uA758\u024A' },
|
|
4383
|
+
{
|
|
4384
|
+
base: 'R',
|
|
4385
|
+
letters: '\u0052\u24C7\uFF32\u0154\u1E58\u0158\u0210\u0212\u1E5A\u1E5C\u0156\u1E5E\u024C\u2C64\uA75A\uA7A6\uA782',
|
|
4386
|
+
},
|
|
4387
|
+
{
|
|
4388
|
+
base: 'S',
|
|
4389
|
+
letters: '\u0053\u24C8\uFF33\u1E9E\u015A\u1E64\u015C\u1E60\u0160\u1E66\u1E62\u1E68\u0218\u015E\u2C7E\uA7A8\uA784',
|
|
4390
|
+
},
|
|
4391
|
+
{
|
|
4392
|
+
base: 'T',
|
|
4393
|
+
letters: '\u0054\u24C9\uFF34\u1E6A\u0164\u1E6C\u021A\u0162\u1E70\u1E6E\u0166\u01AC\u01AE\u023E\uA786',
|
|
4394
|
+
},
|
|
4395
|
+
{ base: 'TZ', letters: '\uA728' },
|
|
4396
|
+
{
|
|
4397
|
+
base: 'U',
|
|
4398
|
+
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',
|
|
4399
|
+
},
|
|
4400
|
+
{ base: 'V', letters: '\u0056\u24CB\uFF36\u1E7C\u1E7E\u01B2\uA75E\u0245' },
|
|
4401
|
+
{ base: 'VY', letters: '\uA760' },
|
|
4402
|
+
{
|
|
4403
|
+
base: 'W',
|
|
4404
|
+
letters: '\u0057\u24CC\uFF37\u1E80\u1E82\u0174\u1E86\u1E84\u1E88\u2C72',
|
|
4405
|
+
},
|
|
4406
|
+
{ base: 'X', letters: '\u0058\u24CD\uFF38\u1E8A\u1E8C' },
|
|
4407
|
+
{
|
|
4408
|
+
base: 'Y',
|
|
4409
|
+
letters: '\u0059\u24CE\uFF39\u1EF2\u00DD\u0176\u1EF8\u0232\u1E8E\u0178\u1EF6\u1EF4\u01B3\u024E\u1EFE',
|
|
4410
|
+
},
|
|
4411
|
+
{
|
|
4412
|
+
base: 'Z',
|
|
4413
|
+
letters: '\u005A\u24CF\uFF3A\u0179\u1E90\u017B\u017D\u1E92\u1E94\u01B5\u0224\u2C7F\u2C6B\uA762',
|
|
4414
|
+
},
|
|
4415
|
+
{
|
|
4416
|
+
base: 'a',
|
|
4417
|
+
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',
|
|
4418
|
+
},
|
|
4419
|
+
{ base: 'aa', letters: '\uA733' },
|
|
4420
|
+
{ base: 'ae', letters: '\u00E6\u01FD\u01E3' },
|
|
4421
|
+
{ base: 'ao', letters: '\uA735' },
|
|
4422
|
+
{ base: 'au', letters: '\uA737' },
|
|
4423
|
+
{ base: 'av', letters: '\uA739\uA73B' },
|
|
4424
|
+
{ base: 'ay', letters: '\uA73D' },
|
|
4425
|
+
{
|
|
4426
|
+
base: 'b',
|
|
4427
|
+
letters: '\u0062\u24D1\uFF42\u1E03\u1E05\u1E07\u0180\u0183\u0253',
|
|
4428
|
+
},
|
|
4429
|
+
{
|
|
4430
|
+
base: 'c',
|
|
4431
|
+
letters: '\u0063\u24D2\uFF43\u0107\u0109\u010B\u010D\u00E7\u1E09\u0188\u023C\uA73F\u2184',
|
|
4432
|
+
},
|
|
4433
|
+
{
|
|
4434
|
+
base: 'd',
|
|
4435
|
+
letters: '\u0064\u24D3\uFF44\u1E0B\u010F\u1E0D\u1E11\u1E13\u1E0F\u0111\u018C\u0256\u0257\uA77A',
|
|
4436
|
+
},
|
|
4437
|
+
{ base: 'dz', letters: '\u01F3\u01C6' },
|
|
4438
|
+
{
|
|
4439
|
+
base: 'e',
|
|
4440
|
+
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',
|
|
4441
|
+
},
|
|
4442
|
+
{ base: 'f', letters: '\u0066\u24D5\uFF46\u1E1F\u0192\uA77C' },
|
|
4443
|
+
{
|
|
4444
|
+
base: 'g',
|
|
4445
|
+
letters: '\u0067\u24D6\uFF47\u01F5\u011D\u1E21\u011F\u0121\u01E7\u0123\u01E5\u0260\uA7A1\u1D79\uA77F',
|
|
4446
|
+
},
|
|
4447
|
+
{
|
|
4448
|
+
base: 'h',
|
|
4449
|
+
letters: '\u0068\u24D7\uFF48\u0125\u1E23\u1E27\u021F\u1E25\u1E29\u1E2B\u1E96\u0127\u2C68\u2C76\u0265',
|
|
4450
|
+
},
|
|
4451
|
+
{ base: 'hv', letters: '\u0195' },
|
|
4452
|
+
{
|
|
4453
|
+
base: 'i',
|
|
4454
|
+
letters: '\u0069\u24D8\uFF49\u00EC\u00ED\u00EE\u0129\u012B\u012D\u00EF\u1E2F\u1EC9\u01D0\u0209\u020B\u1ECB\u012F\u1E2D\u0268\u0131',
|
|
4455
|
+
},
|
|
4456
|
+
{ base: 'j', letters: '\u006A\u24D9\uFF4A\u0135\u01F0\u0249' },
|
|
4457
|
+
{
|
|
4458
|
+
base: 'k',
|
|
4459
|
+
letters: '\u006B\u24DA\uFF4B\u1E31\u01E9\u1E33\u0137\u1E35\u0199\u2C6A\uA741\uA743\uA745\uA7A3',
|
|
4460
|
+
},
|
|
4461
|
+
{
|
|
4462
|
+
base: 'l',
|
|
4463
|
+
letters: '\u006C\u24DB\uFF4C\u0140\u013A\u013E\u1E37\u1E39\u013C\u1E3D\u1E3B\u017F\u0142\u019A\u026B\u2C61\uA749\uA781\uA747',
|
|
4464
|
+
},
|
|
4465
|
+
{ base: 'lj', letters: '\u01C9' },
|
|
4466
|
+
{ base: 'm', letters: '\u006D\u24DC\uFF4D\u1E3F\u1E41\u1E43\u0271\u026F' },
|
|
4467
|
+
{
|
|
4468
|
+
base: 'n',
|
|
4469
|
+
letters: '\u006E\u24DD\uFF4E\u01F9\u0144\u00F1\u1E45\u0148\u1E47\u0146\u1E4B\u1E49\u019E\u0272\u0149\uA791\uA7A5',
|
|
4470
|
+
},
|
|
4471
|
+
{ base: 'nj', letters: '\u01CC' },
|
|
4472
|
+
{
|
|
4473
|
+
base: 'o',
|
|
4474
|
+
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',
|
|
4475
|
+
},
|
|
4476
|
+
{ base: 'oi', letters: '\u01A3' },
|
|
4477
|
+
{ base: 'ou', letters: '\u0223' },
|
|
4478
|
+
{ base: 'oo', letters: '\uA74F' },
|
|
4479
|
+
{
|
|
4480
|
+
base: 'p',
|
|
4481
|
+
letters: '\u0070\u24DF\uFF50\u1E55\u1E57\u01A5\u1D7D\uA751\uA753\uA755',
|
|
4482
|
+
},
|
|
4483
|
+
{ base: 'q', letters: '\u0071\u24E0\uFF51\u024B\uA757\uA759' },
|
|
4484
|
+
{
|
|
4485
|
+
base: 'r',
|
|
4486
|
+
letters: '\u0072\u24E1\uFF52\u0155\u1E59\u0159\u0211\u0213\u1E5B\u1E5D\u0157\u1E5F\u024D\u027D\uA75B\uA7A7\uA783',
|
|
4487
|
+
},
|
|
4488
|
+
{
|
|
4489
|
+
base: 's',
|
|
4490
|
+
letters: '\u0073\u24E2\uFF53\u00DF\u015B\u1E65\u015D\u1E61\u0161\u1E67\u1E63\u1E69\u0219\u015F\u023F\uA7A9\uA785\u1E9B',
|
|
4491
|
+
},
|
|
4492
|
+
{
|
|
4493
|
+
base: 't',
|
|
4494
|
+
letters: '\u0074\u24E3\uFF54\u1E6B\u1E97\u0165\u1E6D\u021B\u0163\u1E71\u1E6F\u0167\u01AD\u0288\u2C66\uA787',
|
|
4495
|
+
},
|
|
4496
|
+
{ base: 'tz', letters: '\uA729' },
|
|
4497
|
+
{
|
|
4498
|
+
base: 'u',
|
|
4499
|
+
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',
|
|
4500
|
+
},
|
|
4501
|
+
{ base: 'v', letters: '\u0076\u24E5\uFF56\u1E7D\u1E7F\u028B\uA75F\u028C' },
|
|
4502
|
+
{ base: 'vy', letters: '\uA761' },
|
|
4503
|
+
{
|
|
4504
|
+
base: 'w',
|
|
4505
|
+
letters: '\u0077\u24E6\uFF57\u1E81\u1E83\u0175\u1E87\u1E85\u1E98\u1E89\u2C73',
|
|
4506
|
+
},
|
|
4507
|
+
{ base: 'x', letters: '\u0078\u24E7\uFF58\u1E8B\u1E8D' },
|
|
4508
|
+
{
|
|
4509
|
+
base: 'y',
|
|
4510
|
+
letters: '\u0079\u24E8\uFF59\u1EF3\u00FD\u0177\u1EF9\u0233\u1E8F\u00FF\u1EF7\u1E99\u1EF5\u01B4\u024F\u1EFF',
|
|
4511
|
+
},
|
|
4512
|
+
{
|
|
4513
|
+
base: 'z',
|
|
4514
|
+
letters: '\u007A\u24E9\uFF5A\u017A\u1E91\u017C\u017E\u1E93\u1E95\u01B6\u0225\u0240\u2C6C\uA763',
|
|
4515
|
+
},
|
|
4516
|
+
];
|
|
4517
|
+
/**
|
|
4518
|
+
* Map of letters from diacritic variant to diacritless variant
|
|
4519
|
+
* Contains lowercase and uppercase separatelly
|
|
4520
|
+
*
|
|
4521
|
+
* > "á" => "a"
|
|
4522
|
+
* > "ě" => "e"
|
|
4523
|
+
* > "Ă" => "A"
|
|
4524
|
+
* > ...
|
|
4525
|
+
*
|
|
4526
|
+
* @public exported from `@promptbook/utils`
|
|
4527
|
+
*/
|
|
4528
|
+
const DIACRITIC_VARIANTS_LETTERS = {};
|
|
4529
|
+
// tslint:disable-next-line: prefer-for-of
|
|
4530
|
+
for (let i = 0; i < defaultDiacriticsRemovalMap.length; i++) {
|
|
4531
|
+
const letters = defaultDiacriticsRemovalMap[i].letters;
|
|
4532
|
+
// tslint:disable-next-line: prefer-for-of
|
|
4533
|
+
for (let j = 0; j < letters.length; j++) {
|
|
4534
|
+
DIACRITIC_VARIANTS_LETTERS[letters[j]] = defaultDiacriticsRemovalMap[i].base;
|
|
4535
|
+
}
|
|
4536
|
+
}
|
|
4537
|
+
// <- TODO: [🍓] Put to maker function to save execution time if not needed
|
|
4538
|
+
/*
|
|
4539
|
+
@see https://stackoverflow.com/questions/990904/remove-accents-diacritics-in-a-string-in-javascript
|
|
4540
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
4541
|
+
you may not use this file except in compliance with the License.
|
|
4542
|
+
You may obtain a copy of the License at
|
|
4543
|
+
|
|
4544
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
4545
|
+
|
|
4546
|
+
Unless required by applicable law or agreed to in writing, software
|
|
4547
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
4548
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
4549
|
+
See the License for the specific language governing permissions and
|
|
4550
|
+
limitations under the License.
|
|
4551
|
+
*/
|
|
4552
|
+
|
|
4553
|
+
/**
|
|
4554
|
+
* Removes diacritic marks (accents) from characters in a string.
|
|
4555
|
+
*
|
|
4556
|
+
* Note: [🔂] This function is idempotent.
|
|
4557
|
+
*
|
|
4558
|
+
* @param input The string containing diacritics to be normalized.
|
|
4559
|
+
* @returns The string with diacritics removed or normalized.
|
|
4560
|
+
*
|
|
4561
|
+
* @public exported from `@promptbook/utils`
|
|
4650
4562
|
*/
|
|
4651
|
-
|
|
4652
|
-
|
|
4563
|
+
function removeDiacritics(input) {
|
|
4564
|
+
/*eslint no-control-regex: "off"*/
|
|
4565
|
+
return input.replace(/[^\u0000-\u007E]/g, (character) => {
|
|
4566
|
+
return DIACRITIC_VARIANTS_LETTERS[character] || character;
|
|
4567
|
+
});
|
|
4568
|
+
}
|
|
4569
|
+
// TODO: [Ж] Variant for cyrillic (and in general non-latin) letters
|
|
4653
4570
|
|
|
4654
4571
|
/**
|
|
4655
|
-
*
|
|
4572
|
+
* Converts a given text to kebab-case format.
|
|
4656
4573
|
*
|
|
4657
|
-
* Note: This function is
|
|
4574
|
+
* Note: [🔂] This function is idempotent.
|
|
4658
4575
|
*
|
|
4659
|
-
* @
|
|
4576
|
+
* @param text The text to be converted.
|
|
4577
|
+
* @returns The kebab-case formatted string.
|
|
4578
|
+
* @example 'hello-world'
|
|
4579
|
+
* @example 'i-love-promptbook'
|
|
4580
|
+
*
|
|
4581
|
+
* @public exported from `@promptbook/utils`
|
|
4660
4582
|
*/
|
|
4661
|
-
function
|
|
4662
|
-
|
|
4663
|
-
|
|
4664
|
-
|
|
4665
|
-
|
|
4666
|
-
for (const
|
|
4667
|
-
|
|
4668
|
-
|
|
4583
|
+
function normalizeToKebabCase(text) {
|
|
4584
|
+
text = removeDiacritics(text);
|
|
4585
|
+
let charType;
|
|
4586
|
+
let lastCharType = 'OTHER';
|
|
4587
|
+
let normalizedName = '';
|
|
4588
|
+
for (const char of text) {
|
|
4589
|
+
let normalizedChar;
|
|
4590
|
+
if (/^[a-z]$/.test(char)) {
|
|
4591
|
+
charType = 'LOWERCASE';
|
|
4592
|
+
normalizedChar = char;
|
|
4669
4593
|
}
|
|
4670
|
-
|
|
4671
|
-
|
|
4672
|
-
|
|
4673
|
-
if (all.some((item) => item.packageName === packageName && item.className === className)) {
|
|
4674
|
-
continue;
|
|
4594
|
+
else if (/^[A-Z]$/.test(char)) {
|
|
4595
|
+
charType = 'UPPERCASE';
|
|
4596
|
+
normalizedChar = char.toLowerCase();
|
|
4675
4597
|
}
|
|
4676
|
-
|
|
4677
|
-
|
|
4678
|
-
|
|
4679
|
-
|
|
4680
|
-
|
|
4681
|
-
|
|
4682
|
-
|
|
4683
|
-
|
|
4684
|
-
|
|
4685
|
-
|
|
4686
|
-
|
|
4687
|
-
|
|
4688
|
-
|
|
4689
|
-
|
|
4690
|
-
|
|
4691
|
-
|
|
4692
|
-
return spacetrim.spaceTrim(`
|
|
4693
|
-
**No scrapers are available**
|
|
4694
|
-
|
|
4695
|
-
This is a unexpected behavior, you are probably using some broken version of Promptbook
|
|
4696
|
-
At least there should be available the metadata of the scrapers
|
|
4697
|
-
`);
|
|
4698
|
-
}
|
|
4699
|
-
return spacetrim.spaceTrim((block) => `
|
|
4700
|
-
Available scrapers are:
|
|
4701
|
-
${block(metadata
|
|
4702
|
-
.map(({ packageName, className, isMetadataAviailable, isInstalled, mimeTypes, isAvailableInBrowser, isAvailableInTools, }, i) => {
|
|
4703
|
-
const more = [];
|
|
4704
|
-
// TODO: [🧠] Maybe use `documentationUrl`
|
|
4705
|
-
if (isMetadataAviailable) {
|
|
4706
|
-
more.push(`⬜ Metadata registered`);
|
|
4707
|
-
} // not else
|
|
4708
|
-
if (isInstalled) {
|
|
4709
|
-
more.push(`🟩 Installed`);
|
|
4710
|
-
} // not else
|
|
4711
|
-
if (isAvailableInTools) {
|
|
4712
|
-
more.push(`🟦 Available in tools`);
|
|
4713
|
-
} // not else
|
|
4714
|
-
if (!isMetadataAviailable && isInstalled) {
|
|
4715
|
-
more.push(`When no metadata registered but scraper is installed, it is an unexpected behavior`);
|
|
4716
|
-
} // not else
|
|
4717
|
-
if (!isInstalled && isAvailableInTools) {
|
|
4718
|
-
more.push(`When the scraper is not installed but available in tools, it is an unexpected compatibility behavior`);
|
|
4719
|
-
} // not else
|
|
4720
|
-
if (!isAvailableInBrowser) {
|
|
4721
|
-
more.push(`Not usable in browser`);
|
|
4598
|
+
else if (/^[0-9]$/.test(char)) {
|
|
4599
|
+
charType = 'NUMBER';
|
|
4600
|
+
normalizedChar = char;
|
|
4601
|
+
}
|
|
4602
|
+
else {
|
|
4603
|
+
charType = 'OTHER';
|
|
4604
|
+
normalizedChar = '-';
|
|
4605
|
+
}
|
|
4606
|
+
if (charType !== lastCharType &&
|
|
4607
|
+
!(lastCharType === 'UPPERCASE' && charType === 'LOWERCASE') &&
|
|
4608
|
+
!(lastCharType === 'NUMBER') &&
|
|
4609
|
+
!(charType === 'NUMBER')) {
|
|
4610
|
+
normalizedName += '-';
|
|
4611
|
+
}
|
|
4612
|
+
normalizedName += normalizedChar;
|
|
4613
|
+
lastCharType = charType;
|
|
4722
4614
|
}
|
|
4723
|
-
|
|
4724
|
-
|
|
4725
|
-
|
|
4726
|
-
|
|
4727
|
-
|
|
4728
|
-
.join('\n'))}
|
|
4729
|
-
|
|
4730
|
-
Legend:
|
|
4731
|
-
- ⬜ **Metadata registered** means that Promptbook knows about the scraper, it is similar to registration in some registry
|
|
4732
|
-
- 🟩 **Installed** means that you have imported package with particular scraper
|
|
4733
|
-
- 🟦 **Available in tools** means that you have passed scraper as dependency into prepare or execution process
|
|
4734
|
-
|
|
4735
|
-
`);
|
|
4615
|
+
normalizedName = normalizedName.split(/-+/g).join('-');
|
|
4616
|
+
normalizedName = normalizedName.split(/-?\/-?/g).join('/');
|
|
4617
|
+
normalizedName = normalizedName.replace(/^-/, '');
|
|
4618
|
+
normalizedName = normalizedName.replace(/-$/, '');
|
|
4619
|
+
return normalizedName;
|
|
4736
4620
|
}
|
|
4737
|
-
//
|
|
4621
|
+
// Note: [💞] Ignore a discrepancy between file name and entity name
|
|
4738
4622
|
|
|
4739
4623
|
/**
|
|
4740
4624
|
* Creates unique name for the source
|
|
@@ -4755,6 +4639,16 @@
|
|
|
4755
4639
|
}
|
|
4756
4640
|
// TODO: [🐱🐉][🧠] Make some smart crop NOT source-i-m-pavol-a-develop-... BUT source-i-m-pavol-a-developer-...
|
|
4757
4641
|
|
|
4642
|
+
/**
|
|
4643
|
+
* Converts a name to a properly formatted subfolder path for cache storage.
|
|
4644
|
+
* Handles normalization and path formatting to create consistent cache directory structures.
|
|
4645
|
+
*
|
|
4646
|
+
* @private for `FileCacheStorage`
|
|
4647
|
+
*/
|
|
4648
|
+
function nameToSubfolderPath(name) {
|
|
4649
|
+
return [name.substr(0, 1).toLowerCase(), name.substr(1, 1).toLowerCase()];
|
|
4650
|
+
}
|
|
4651
|
+
|
|
4758
4652
|
/**
|
|
4759
4653
|
* Convert file extension to mime type
|
|
4760
4654
|
*
|
|
@@ -4775,6 +4669,52 @@
|
|
|
4775
4669
|
return mimeTypes.extension(value) || null;
|
|
4776
4670
|
}
|
|
4777
4671
|
|
|
4672
|
+
/**
|
|
4673
|
+
* Removes emojis from a string and fix whitespaces
|
|
4674
|
+
*
|
|
4675
|
+
* Note: [🔂] This function is idempotent.
|
|
4676
|
+
*
|
|
4677
|
+
* @param text with emojis
|
|
4678
|
+
* @returns text without emojis
|
|
4679
|
+
*
|
|
4680
|
+
* @public exported from `@promptbook/utils`
|
|
4681
|
+
*/
|
|
4682
|
+
function removeEmojis(text) {
|
|
4683
|
+
// Replace emojis (and also ZWJ sequence) with hyphens
|
|
4684
|
+
text = text.replace(/(\p{Extended_Pictographic})\p{Modifier_Symbol}/gu, '$1');
|
|
4685
|
+
text = text.replace(/(\p{Extended_Pictographic})[\u{FE00}-\u{FE0F}]/gu, '$1');
|
|
4686
|
+
text = text.replace(/(\p{Extended_Pictographic})(\u{200D}\p{Extended_Pictographic})*/gu, '$1');
|
|
4687
|
+
text = text.replace(/\p{Extended_Pictographic}/gu, '');
|
|
4688
|
+
return text;
|
|
4689
|
+
}
|
|
4690
|
+
|
|
4691
|
+
/**
|
|
4692
|
+
* Converts a title string into a normalized name.
|
|
4693
|
+
*
|
|
4694
|
+
* Note: [🔂] This function is idempotent.
|
|
4695
|
+
*
|
|
4696
|
+
* @param value The title string to be converted to a name.
|
|
4697
|
+
* @returns A normalized name derived from the input title.
|
|
4698
|
+
* @example 'Hello World!' -> 'hello-world'
|
|
4699
|
+
*
|
|
4700
|
+
* @public exported from `@promptbook/utils`
|
|
4701
|
+
*/
|
|
4702
|
+
function titleToName(value) {
|
|
4703
|
+
if (isValidUrl(value)) {
|
|
4704
|
+
value = value.replace(/^https?:\/\//, '');
|
|
4705
|
+
value = value.replace(/\.html$/, '');
|
|
4706
|
+
}
|
|
4707
|
+
else if (isValidFilePath(value)) {
|
|
4708
|
+
value = path.basename(value);
|
|
4709
|
+
// Note: Keeping extension in the name
|
|
4710
|
+
}
|
|
4711
|
+
value = value.split('/').join('-');
|
|
4712
|
+
value = removeEmojis(value);
|
|
4713
|
+
value = normalizeToKebabCase(value);
|
|
4714
|
+
// TODO: [🧠] Maybe warn or add some padding to short name which are not good identifiers
|
|
4715
|
+
return value;
|
|
4716
|
+
}
|
|
4717
|
+
|
|
4778
4718
|
/**
|
|
4779
4719
|
* The built-in `fetch' function with a lightweight error handling wrapper as default fetch function used in Promptbook scrapers
|
|
4780
4720
|
*
|
|
@@ -7886,6 +7826,74 @@
|
|
|
7886
7826
|
// TODO: [🪂] Do it in parallel 11:11
|
|
7887
7827
|
// Note: No need to aggregate usage here, it is done by intercepting the llmTools
|
|
7888
7828
|
|
|
7829
|
+
/**
|
|
7830
|
+
* Retrieves an intermediate source for a scraper based on the knowledge source.
|
|
7831
|
+
* Manages the caching and retrieval of intermediate scraper results for optimized performance.
|
|
7832
|
+
*
|
|
7833
|
+
* @private as internal utility for scrapers
|
|
7834
|
+
*/
|
|
7835
|
+
async function getScraperIntermediateSource(source, options) {
|
|
7836
|
+
const { filename: sourceFilename, url } = source;
|
|
7837
|
+
const { rootDirname, cacheDirname, intermediateFilesStrategy, extension, isVerbose } = options;
|
|
7838
|
+
// TODO: [👬] DRY
|
|
7839
|
+
const hash = cryptoJs.SHA256(
|
|
7840
|
+
// <- TODO: [🥬] Encapsulate sha256 to some private utility function
|
|
7841
|
+
hexEncoder__default["default"].parse(sourceFilename || url || 'untitled'))
|
|
7842
|
+
.toString( /* hex */)
|
|
7843
|
+
.substring(0, 20);
|
|
7844
|
+
// <- TODO: [🥬] Make some system for hashes and ids of promptbook
|
|
7845
|
+
const semanticName = normalizeToKebabCase(titleToName((sourceFilename || url || '').split('intermediate').join(''))).substring(0, 20);
|
|
7846
|
+
// <- TODO: [🐱🐉]
|
|
7847
|
+
const pieces = ['intermediate', semanticName, hash].filter((piece) => piece !== '');
|
|
7848
|
+
const name = pieces.join('-').split('--').join('-');
|
|
7849
|
+
const cacheFilename = path.join(process.cwd(), cacheDirname, ...nameToSubfolderPath(hash /* <- TODO: [🎎] Maybe add some SHA256 prefix */), name)
|
|
7850
|
+
.split('\\')
|
|
7851
|
+
.join('/') +
|
|
7852
|
+
'.' +
|
|
7853
|
+
extension;
|
|
7854
|
+
// Note: Try to create cache directory, but don't fail if filesystem has issues
|
|
7855
|
+
try {
|
|
7856
|
+
await promises.mkdir(path.dirname(cacheFilename), { recursive: true });
|
|
7857
|
+
}
|
|
7858
|
+
catch (error) {
|
|
7859
|
+
// Note: If we can't create cache directory, continue without it
|
|
7860
|
+
// This handles read-only filesystems, permission issues, and missing parent directories
|
|
7861
|
+
if (error instanceof Error &&
|
|
7862
|
+
(error.message.includes('EROFS') ||
|
|
7863
|
+
error.message.includes('read-only') ||
|
|
7864
|
+
error.message.includes('EACCES') ||
|
|
7865
|
+
error.message.includes('EPERM') ||
|
|
7866
|
+
error.message.includes('ENOENT'))) ;
|
|
7867
|
+
else {
|
|
7868
|
+
// Re-throw other unexpected errors
|
|
7869
|
+
throw error;
|
|
7870
|
+
}
|
|
7871
|
+
}
|
|
7872
|
+
let isDestroyed = true;
|
|
7873
|
+
const fileHandler = {
|
|
7874
|
+
filename: cacheFilename,
|
|
7875
|
+
get isDestroyed() {
|
|
7876
|
+
return isDestroyed;
|
|
7877
|
+
},
|
|
7878
|
+
async destroy() {
|
|
7879
|
+
if (intermediateFilesStrategy === 'HIDE_AND_CLEAN') {
|
|
7880
|
+
if (isVerbose) {
|
|
7881
|
+
console.info('legacyDocumentScraper: Clening cache');
|
|
7882
|
+
}
|
|
7883
|
+
await promises.rm(cacheFilename);
|
|
7884
|
+
// TODO: [🐿][🧠] Maybe remove empty folders
|
|
7885
|
+
}
|
|
7886
|
+
isDestroyed = true;
|
|
7887
|
+
},
|
|
7888
|
+
};
|
|
7889
|
+
return fileHandler;
|
|
7890
|
+
}
|
|
7891
|
+
// 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
|
|
7892
|
+
// Note: Not using `FileCacheStorage` for two reasons:
|
|
7893
|
+
// 1. Need to store more than serialized JSONs.
|
|
7894
|
+
// 2. Need to switch between a `rootDirname` and `cacheDirname` <- TODO: [😡]
|
|
7895
|
+
// TODO: [🐱🐉][🧠] Make some smart crop
|
|
7896
|
+
|
|
7889
7897
|
/**
|
|
7890
7898
|
* Metadata of the scraper
|
|
7891
7899
|
*
|