@promptbook/fake-llm 0.103.0-8 → 0.103.0
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 +59 -39
- package/esm/index.es.js +141 -124
- package/esm/index.es.js.map +1 -1
- package/esm/typings/books/index.d.ts +0 -81
- package/esm/typings/servers.d.ts +9 -7
- package/esm/typings/src/_packages/browser.index.d.ts +6 -0
- package/esm/typings/src/_packages/cli.index.d.ts +4 -0
- package/esm/typings/src/_packages/components.index.d.ts +22 -8
- package/esm/typings/src/_packages/core.index.d.ts +58 -18
- package/esm/typings/src/_packages/node.index.d.ts +2 -2
- package/esm/typings/src/_packages/remote-server.index.d.ts +2 -0
- package/esm/typings/src/_packages/types.index.d.ts +70 -8
- package/esm/typings/src/_packages/utils.index.d.ts +6 -0
- package/esm/typings/src/_packages/wizard.index.d.ts +4 -0
- package/esm/typings/src/book-2.0/agent-source/AgentBasicInformation.d.ts +20 -5
- package/esm/typings/src/book-2.0/agent-source/AgentModelRequirements.d.ts +17 -1
- package/esm/typings/src/book-2.0/agent-source/AgentSourceParseResult.d.ts +3 -2
- package/esm/typings/src/book-2.0/agent-source/computeAgentHash.d.ts +8 -0
- package/esm/typings/src/book-2.0/agent-source/createCommitmentRegex.d.ts +3 -3
- package/esm/typings/src/book-2.0/agent-source/createDefaultAgentName.d.ts +8 -0
- package/esm/typings/src/book-2.0/agent-source/normalizeAgentName.d.ts +9 -0
- package/esm/typings/src/book-2.0/agent-source/padBook.d.ts +18 -0
- package/esm/typings/src/book-2.0/agent-source/parseAgentSourceWithCommitments.d.ts +1 -1
- package/esm/typings/src/book-2.0/agent-source/string_book.d.ts +3 -0
- package/esm/typings/src/book-components/AvatarProfile/AvatarProfile/AvatarProfile.d.ts +6 -1
- package/esm/typings/src/book-components/BookEditor/BookEditor.d.ts +85 -14
- package/esm/typings/src/book-components/BookEditor/BookEditorActionbar.d.ts +18 -0
- package/esm/typings/src/book-components/BookEditor/BookEditorMonaco.d.ts +5 -0
- package/esm/typings/src/book-components/Chat/AgentChat/AgentChat.d.ts +17 -0
- package/esm/typings/src/book-components/Chat/AgentChat/AgentChatProps.d.ts +13 -0
- package/esm/typings/src/book-components/Chat/Chat/ChatProps.d.ts +16 -0
- package/esm/typings/src/book-components/Chat/LlmChat/LlmChatProps.d.ts +5 -0
- package/esm/typings/src/book-components/Chat/MarkdownContent/MarkdownContent.d.ts +15 -0
- package/esm/typings/src/book-components/Chat/MockedChat/MockedChat.d.ts +5 -0
- package/esm/typings/src/book-components/Chat/save/_common/ChatSaveFormatDefinition.d.ts +1 -1
- package/esm/typings/src/book-components/Chat/save/html/htmlSaveFormatDefinition.d.ts +1 -0
- package/esm/typings/src/book-components/Chat/save/pdf/pdfSaveFormatDefinition.d.ts +4 -0
- package/esm/typings/src/book-components/Chat/types/ChatParticipant.d.ts +1 -1
- package/esm/typings/src/book-components/PromptbookAgent/PromptbookAgentIntegration.d.ts +52 -0
- package/esm/typings/src/book-components/PromptbookAgent/PromptbookAgentSeamlessIntegration.d.ts +14 -0
- package/esm/typings/src/book-components/Qr/BrandedQrCode.d.ts +18 -0
- package/esm/typings/src/book-components/Qr/GenericQrCode.d.ts +10 -0
- package/esm/typings/src/book-components/Qr/PromptbookQrCode.d.ts +18 -0
- package/esm/typings/src/book-components/Qr/useQrCode.d.ts +15 -0
- package/esm/typings/src/book-components/_common/Dropdown/Dropdown.d.ts +15 -0
- package/esm/typings/src/book-components/_common/HamburgerMenu/HamburgerMenu.d.ts +12 -0
- package/esm/typings/src/book-components/_common/Modal/Modal.d.ts +2 -2
- package/esm/typings/src/book-components/_common/Tooltip/Tooltip.d.ts +47 -0
- package/esm/typings/src/book-components/icons/AboutIcon.d.ts +9 -0
- package/esm/typings/src/book-components/icons/CameraIcon.d.ts +11 -0
- package/esm/typings/src/book-components/icons/CloseIcon.d.ts +4 -8
- package/esm/typings/src/book-components/icons/DownloadIcon.d.ts +9 -0
- package/esm/typings/src/book-components/icons/ExitFullscreenIcon.d.ts +7 -0
- package/esm/typings/src/book-components/icons/FullscreenIcon.d.ts +7 -0
- package/esm/typings/src/book-components/icons/MenuIcon.d.ts +12 -0
- package/esm/typings/src/book-components/icons/MicIcon.d.ts +8 -0
- package/esm/typings/src/book-components/icons/SendIcon.d.ts +3 -0
- package/esm/typings/src/cli/cli-commands/_boilerplate.d.ts +2 -1
- package/esm/typings/src/cli/cli-commands/about.d.ts +3 -1
- package/esm/typings/src/cli/cli-commands/hello.d.ts +2 -1
- package/esm/typings/src/cli/cli-commands/list-models.d.ts +2 -1
- package/esm/typings/src/cli/cli-commands/list-scrapers.d.ts +2 -1
- package/esm/typings/src/cli/cli-commands/login.d.ts +2 -1
- package/esm/typings/src/cli/cli-commands/make.d.ts +2 -1
- package/esm/typings/src/cli/cli-commands/prettify.d.ts +2 -1
- package/esm/typings/src/cli/cli-commands/run.d.ts +2 -1
- package/esm/typings/src/cli/cli-commands/{start-server.d.ts → start-agents-server.d.ts} +3 -2
- package/esm/typings/src/cli/cli-commands/start-pipelines-server.d.ts +15 -0
- package/esm/typings/src/cli/cli-commands/test-command.d.ts +2 -1
- package/esm/typings/src/cli/common/$addGlobalOptionsToCommand.d.ts +2 -1
- package/esm/typings/src/collection/agent-collection/AgentCollection.d.ts +12 -0
- package/esm/typings/src/collection/agent-collection/constructors/agent-collection-in-supabase/AgentCollectionInSupabase.d.ts +75 -0
- package/esm/typings/src/collection/agent-collection/constructors/agent-collection-in-supabase/AgentCollectionInSupabaseOptions.d.ts +10 -0
- package/esm/typings/src/collection/agent-collection/constructors/agent-collection-in-supabase/AgentsDatabaseSchema.d.ts +154 -0
- package/esm/typings/src/collection/{PipelineCollection.d.ts → pipeline-collection/PipelineCollection.d.ts} +7 -3
- package/esm/typings/src/collection/{SimplePipelineCollection.d.ts → pipeline-collection/SimplePipelineCollection.d.ts} +5 -5
- package/esm/typings/src/collection/{constructors/createCollectionFromDirectory.d.ts → pipeline-collection/constructors/createPipelineCollectionFromDirectory.d.ts} +8 -11
- package/esm/typings/src/collection/pipeline-collection/constructors/createPipelineCollectionFromJson.d.ts +13 -0
- package/esm/typings/src/collection/{constructors/createCollectionFromPromise.d.ts → pipeline-collection/constructors/createPipelineCollectionFromPromise.d.ts} +6 -5
- package/esm/typings/src/collection/pipeline-collection/constructors/createPipelineCollectionFromPromise.test.d.ts +1 -0
- package/esm/typings/src/collection/{constructors/createCollectionFromUrl.d.ts → pipeline-collection/constructors/createPipelineCollectionFromUrl.d.ts} +3 -3
- package/esm/typings/src/collection/{constructors/createSubcollection.d.ts → pipeline-collection/constructors/createPipelineSubcollection.d.ts} +3 -3
- package/esm/typings/src/collection/pipeline-collection/pipelineCollectionToJson.d.ts +13 -0
- package/esm/typings/src/commands/_common/types/CommandParser.d.ts +4 -5
- package/esm/typings/src/{book-2.0/commitments → commitments}/ACTION/ACTION.d.ts +5 -1
- package/esm/typings/src/commitments/CLOSED/CLOSED.d.ts +39 -0
- package/esm/typings/src/commitments/CLOSED/CLOSED.test.d.ts +4 -0
- package/esm/typings/src/commitments/COMPONENT/COMPONENT.d.ts +28 -0
- package/esm/typings/src/{book-2.0/commitments → commitments}/DELETE/DELETE.d.ts +5 -1
- package/esm/typings/src/{book-2.0/commitments → commitments}/FORMAT/FORMAT.d.ts +5 -1
- package/esm/typings/src/commitments/FROM/FROM.d.ts +34 -0
- package/esm/typings/src/{book-2.0/commitments → commitments}/GOAL/GOAL.d.ts +5 -1
- package/esm/typings/src/{book-2.0/commitments → commitments}/KNOWLEDGE/KNOWLEDGE.d.ts +5 -5
- package/esm/typings/src/commitments/LANGUAGE/LANGUAGE.d.ts +35 -0
- package/esm/typings/src/{book-2.0/commitments → commitments}/MEMORY/MEMORY.d.ts +5 -1
- package/esm/typings/src/commitments/MESSAGE/AgentMessageCommitmentDefinition.d.ts +32 -0
- package/esm/typings/src/commitments/MESSAGE/InitialMessageCommitmentDefinition.d.ts +32 -0
- package/esm/typings/src/{book-2.0/commitments → commitments}/MESSAGE/MESSAGE.d.ts +5 -1
- package/esm/typings/src/commitments/MESSAGE/UserMessageCommitmentDefinition.d.ts +32 -0
- package/esm/typings/src/{book-2.0/commitments → commitments}/META/META.d.ts +5 -1
- package/esm/typings/src/commitments/META_COLOR/META_COLOR.d.ts +48 -0
- package/esm/typings/src/commitments/META_FONT/META_FONT.d.ts +42 -0
- package/esm/typings/src/{book-2.0/commitments → commitments}/META_IMAGE/META_IMAGE.d.ts +5 -1
- package/esm/typings/src/{book-2.0/commitments → commitments}/META_LINK/META_LINK.d.ts +5 -1
- package/esm/typings/src/{book-2.0/commitments → commitments}/MODEL/MODEL.d.ts +5 -1
- package/esm/typings/src/{book-2.0/commitments → commitments}/NOTE/NOTE.d.ts +5 -1
- package/esm/typings/src/commitments/OPEN/OPEN.d.ts +35 -0
- package/esm/typings/src/{book-2.0/commitments → commitments}/PERSONA/PERSONA.d.ts +5 -1
- package/esm/typings/src/{book-2.0/commitments → commitments}/RULE/RULE.d.ts +5 -1
- package/esm/typings/src/{book-2.0/commitments → commitments}/SAMPLE/SAMPLE.d.ts +5 -1
- package/esm/typings/src/{book-2.0/commitments → commitments}/SCENARIO/SCENARIO.d.ts +5 -1
- package/esm/typings/src/{book-2.0/commitments → commitments}/STYLE/STYLE.d.ts +5 -1
- package/esm/typings/src/commitments/USE/USE.d.ts +53 -0
- package/esm/typings/src/commitments/USE_BROWSER/USE_BROWSER.d.ts +42 -0
- package/esm/typings/src/commitments/USE_BROWSER/USE_BROWSER.test.d.ts +1 -0
- package/esm/typings/src/commitments/USE_MCP/USE_MCP.d.ts +37 -0
- package/esm/typings/src/commitments/USE_SEARCH_ENGINE/USE_SEARCH_ENGINE.d.ts +38 -0
- package/esm/typings/src/{book-2.0/commitments → commitments}/_base/BaseCommitmentDefinition.d.ts +14 -2
- package/esm/typings/src/{book-2.0/commitments → commitments}/_base/CommitmentDefinition.d.ts +6 -1
- package/esm/typings/src/{book-2.0/commitments → commitments}/_base/NotYetImplementedCommitmentDefinition.d.ts +5 -1
- package/esm/typings/src/{book-2.0/commitments → commitments}/_base/createEmptyAgentModelRequirements.d.ts +1 -1
- package/esm/typings/src/commitments/index.d.ts +93 -0
- package/esm/typings/src/config.d.ts +24 -3
- package/esm/typings/src/conversion/validation/validatePipeline.d.ts +2 -0
- package/esm/typings/src/errors/0-index.d.ts +6 -0
- package/esm/typings/src/errors/DatabaseError.d.ts +12 -0
- package/esm/typings/src/errors/NotAllowed.d.ts +9 -0
- package/esm/typings/src/errors/WrappedError.d.ts +2 -2
- package/esm/typings/src/execution/AvailableModel.d.ts +1 -0
- package/esm/typings/src/execution/Executables.d.ts +3 -0
- package/esm/typings/src/execution/ExecutionTask.d.ts +12 -3
- package/esm/typings/src/execution/ExecutionTools.d.ts +5 -0
- package/esm/typings/src/execution/FilesystemTools.d.ts +1 -1
- package/esm/typings/src/execution/LlmExecutionTools.d.ts +26 -2
- package/esm/typings/src/execution/PromptResult.d.ts +7 -1
- package/esm/typings/src/execution/createPipelineExecutor/10-executePipeline.d.ts +5 -0
- package/esm/typings/src/execution/createPipelineExecutor/20-executeTask.d.ts +5 -0
- package/esm/typings/src/execution/createPipelineExecutor/30-executeFormatSubvalues.d.ts +5 -0
- package/esm/typings/src/execution/createPipelineExecutor/40-executeAttempts.d.ts +5 -0
- package/esm/typings/src/execution/utils/usage-constants.d.ts +4 -124
- package/esm/typings/src/execution/utils/validatePromptResult.d.ts +2 -0
- package/esm/typings/src/high-level-abstractions/_common/HighLevelAbstraction.d.ts +2 -1
- package/esm/typings/src/llm-providers/_common/register/$provideLlmToolsForWizardOrCli.d.ts +2 -2
- package/esm/typings/src/llm-providers/_common/register/$registeredLlmToolsMessage.d.ts +2 -1
- package/esm/typings/src/llm-providers/_common/register/LlmToolsMetadata.d.ts +1 -1
- package/esm/typings/src/llm-providers/_common/utils/assertUniqueModels.d.ts +12 -0
- package/esm/typings/src/llm-providers/_multiple/getSingleLlmExecutionTools.d.ts +1 -0
- package/esm/typings/src/llm-providers/_multiple/joinLlmExecutionTools.d.ts +1 -0
- package/esm/typings/src/llm-providers/agent/Agent.d.ts +72 -0
- package/esm/typings/src/llm-providers/agent/AgentLlmExecutionTools.d.ts +26 -4
- package/esm/typings/src/llm-providers/agent/AgentOptions.d.ts +19 -0
- package/esm/typings/src/llm-providers/agent/CreateAgentLlmExecutionToolsOptions.d.ts +17 -0
- package/esm/typings/src/llm-providers/agent/RemoteAgent.d.ts +50 -0
- package/esm/typings/src/llm-providers/agent/RemoteAgentOptions.d.ts +11 -0
- package/esm/typings/src/llm-providers/agent/createAgentLlmExecutionTools.d.ts +1 -19
- package/esm/typings/src/llm-providers/anthropic-claude/anthropic-claude-models.d.ts +1 -1
- package/esm/typings/src/llm-providers/google/google-models.d.ts +1 -1
- package/esm/typings/src/llm-providers/ollama/OllamaExecutionTools.d.ts +4 -0
- package/esm/typings/src/llm-providers/openai/OpenAiAssistantExecutionTools.d.ts +60 -2
- package/esm/typings/src/llm-providers/openai/OpenAiAssistantExecutionToolsOptions.d.ts +7 -1
- package/esm/typings/src/llm-providers/openai/OpenAiCompatibleExecutionTools.d.ts +13 -1
- package/esm/typings/src/llm-providers/openai/OpenAiExecutionTools.d.ts +4 -0
- package/esm/typings/src/llm-providers/openai/createOpenAiCompatibleExecutionTools.d.ts +6 -6
- package/esm/typings/src/llm-providers/openai/openai-models.d.ts +1 -1
- package/esm/typings/src/llm-providers/openai/openai-models.test.d.ts +4 -0
- package/esm/typings/src/other/templates/getTemplatesPipelineCollection.d.ts +1 -1
- package/esm/typings/src/pipeline/validatePipelineString.d.ts +2 -0
- package/esm/typings/src/playground/permanent/_boilerplate.d.ts +5 -0
- package/esm/typings/src/playground/permanent/agent-with-browser-playground.d.ts +5 -0
- package/esm/typings/src/prepare/PrepareAndScrapeOptions.d.ts +1 -0
- package/esm/typings/src/remote-server/startAgentServer.d.ts +26 -0
- package/esm/typings/src/remote-server/startRemoteServer.d.ts +4 -1
- package/esm/typings/src/remote-server/types/RemoteServerOptions.d.ts +3 -8
- package/esm/typings/src/scrapers/_boilerplate/createBoilerplateScraper.d.ts +1 -12
- package/esm/typings/src/scrapers/_boilerplate/register-metadata.d.ts +1 -9
- package/esm/typings/src/scrapers/document/createDocumentScraper.d.ts +1 -12
- package/esm/typings/src/scrapers/document/register-metadata.d.ts +1 -9
- package/esm/typings/src/scrapers/document-legacy/createLegacyDocumentScraper.d.ts +1 -12
- package/esm/typings/src/scrapers/document-legacy/register-metadata.d.ts +1 -9
- package/esm/typings/src/scrapers/markdown/createMarkdownScraper.d.ts +1 -12
- package/esm/typings/src/scrapers/markdown/register-metadata.d.ts +1 -9
- package/esm/typings/src/scrapers/markitdown/createMarkitdownScraper.d.ts +1 -12
- package/esm/typings/src/scrapers/markitdown/register-metadata.d.ts +1 -9
- package/esm/typings/src/scrapers/pdf/createPdfScraper.d.ts +1 -12
- package/esm/typings/src/scrapers/pdf/register-metadata.d.ts +1 -9
- package/esm/typings/src/scrapers/website/createWebsiteScraper.d.ts +1 -12
- package/esm/typings/src/scrapers/website/register-metadata.d.ts +1 -9
- package/esm/typings/src/storage/_common/PromptbookStorage.d.ts +1 -0
- package/esm/typings/src/storage/env-storage/$EnvStorage.d.ts +2 -1
- package/esm/typings/src/transpilers/_common/BookTranspiler.d.ts +33 -0
- package/esm/typings/src/transpilers/_common/BookTranspilerOptions.d.ts +18 -0
- package/esm/typings/src/transpilers/_common/register/$bookTranspilersRegister.d.ts +15 -0
- package/esm/typings/src/transpilers/formatted-book-in-markdown/FormattedBookInMarkdownTranspiler.d.ts +16 -0
- package/esm/typings/src/transpilers/formatted-book-in-markdown/register.d.ts +15 -0
- package/esm/typings/src/transpilers/openai-sdk/OpenAiSdkTranspiler.d.ts +16 -0
- package/esm/typings/src/transpilers/openai-sdk/OpenAiSdkTranspiler.test.d.ts +1 -0
- package/esm/typings/src/transpilers/openai-sdk/playground/playground.d.ts +5 -0
- package/esm/typings/src/transpilers/openai-sdk/register.d.ts +15 -0
- package/esm/typings/src/types/LlmCall.d.ts +20 -0
- package/esm/typings/src/types/ModelRequirements.d.ts +13 -1
- package/esm/typings/src/types/ModelVariant.d.ts +1 -1
- package/esm/typings/src/types/Prompt.d.ts +13 -1
- package/esm/typings/src/types/Updatable.d.ts +19 -0
- package/esm/typings/src/types/typeAliases.d.ts +38 -2
- package/esm/typings/src/utils/color/$randomColor.d.ts +1 -0
- package/esm/typings/src/utils/color/Color.d.ts +16 -1
- package/esm/typings/src/utils/color/Color.test.d.ts +1 -0
- package/esm/typings/src/utils/color/css-colors.d.ts +1 -0
- package/esm/typings/src/utils/color/internal-utils/checkChannelValue.d.ts +0 -3
- package/esm/typings/src/utils/color/operators/darken.d.ts +1 -1
- package/esm/typings/src/utils/color/operators/grayscale.d.ts +1 -1
- package/esm/typings/src/utils/color/operators/lighten.d.ts +1 -1
- package/esm/typings/src/utils/color/operators/mixWithColor.d.ts +1 -1
- package/esm/typings/src/utils/color/operators/saturate.d.ts +1 -1
- package/esm/typings/src/utils/environment/$detectRuntimeEnvironment.d.ts +16 -0
- package/esm/typings/src/utils/environment/$getGlobalScope.d.ts +2 -2
- package/esm/typings/src/utils/execCommand/$execCommand.d.ts +2 -1
- package/esm/typings/src/utils/execCommand/$execCommands.d.ts +2 -1
- package/esm/typings/src/utils/files/$induceBookDownload.d.ts +13 -0
- package/esm/typings/src/utils/files/$induceFileDownload.d.ts +13 -0
- package/esm/typings/src/utils/files/ObjectUrl.d.ts +46 -0
- package/esm/typings/src/utils/files/listAllFiles.d.ts +2 -3
- package/esm/typings/src/utils/misc/aboutPromptbookInformation.d.ts +27 -0
- package/esm/typings/src/utils/misc/computeHash.d.ts +11 -0
- package/esm/typings/src/utils/misc/computeHash.test.d.ts +1 -0
- package/esm/typings/src/utils/misc/injectCssModuleIntoShadowRoot.d.ts +1 -0
- package/esm/typings/src/utils/misc/xAboutPromptbookInformation.d.ts +13 -0
- package/esm/typings/src/utils/normalization/normalize-to-kebab-case.d.ts +2 -0
- package/esm/typings/src/utils/normalization/normalizeMessageText.d.ts +9 -0
- package/esm/typings/src/utils/normalization/normalizeMessageText.test.d.ts +1 -0
- package/esm/typings/src/utils/normalization/normalizeTo_PascalCase.d.ts +3 -0
- package/esm/typings/src/utils/normalization/normalizeTo_camelCase.d.ts +2 -0
- package/esm/typings/src/utils/normalization/titleToName.d.ts +2 -0
- package/esm/typings/src/utils/organization/$sideEffect.d.ts +2 -2
- package/esm/typings/src/utils/organization/$side_effect.d.ts +7 -0
- package/esm/typings/src/utils/organization/TODO_USE.d.ts +2 -2
- package/esm/typings/src/utils/organization/keepUnused.d.ts +2 -2
- package/esm/typings/src/utils/organization/preserve.d.ts +3 -3
- package/esm/typings/src/utils/organization/really_any.d.ts +7 -0
- package/esm/typings/src/utils/random/$generateBookBoilerplate.d.ts +31 -0
- package/esm/typings/src/utils/random/$randomAgentPersona.d.ts +9 -0
- package/esm/typings/src/utils/random/$randomFullnameWithColor.d.ts +13 -0
- package/esm/typings/src/utils/random/$randomItem.d.ts +9 -0
- package/esm/typings/src/utils/random/$randomSeed.d.ts +3 -0
- package/esm/typings/src/utils/random/$randomToken.d.ts +2 -0
- package/esm/typings/src/utils/random/CzechNamePool.d.ts +7 -0
- package/esm/typings/src/utils/random/EnglishNamePool.d.ts +7 -0
- package/esm/typings/src/utils/random/NamePool.d.ts +17 -0
- package/esm/typings/src/utils/random/getNamePool.d.ts +10 -0
- package/esm/typings/src/utils/serialization/$deepFreeze.d.ts +2 -1
- package/esm/typings/src/utils/serialization/asSerializable.d.ts +2 -2
- package/esm/typings/src/utils/serialization/serializeToPromptbookJavascript.d.ts +2 -2
- package/esm/typings/src/utils/validators/parameterName/validateParameterName.d.ts +2 -0
- package/esm/typings/src/version.d.ts +1 -1
- package/esm/typings/src/wizard/$getCompiledBook.d.ts +1 -2
- package/package.json +6 -6
- package/umd/index.umd.js +141 -126
- package/umd/index.umd.js.map +1 -1
- package/esm/typings/src/book-2.0/commitments/index.d.ts +0 -60
- package/esm/typings/src/book-components/BookEditor/BookEditorInner.d.ts +0 -5
- package/esm/typings/src/book-components/BookEditor/BookEditorWrapper.d.ts +0 -9
- package/esm/typings/src/book-components/BookEditor/config.d.ts +0 -10
- package/esm/typings/src/book-components/Chat/utils/renderMarkdown.d.ts +0 -21
- package/esm/typings/src/collection/collectionToJson.d.ts +0 -13
- package/esm/typings/src/collection/constructors/createCollectionFromJson.d.ts +0 -13
- /package/esm/typings/src/{book-components/Chat/utils/renderMarkdown.test.d.ts → book-2.0/agent-source/computeAgentHash.test.d.ts} +0 -0
- /package/esm/typings/src/{collection/constructors/createCollectionFromDirectory.test.d.ts → book-2.0/agent-source/normalizeAgentName.test.d.ts} +0 -0
- /package/esm/typings/src/{collection/constructors/createCollectionFromJson.test.d.ts → book-components/Chat/AgentChat/AgentChat.test.d.ts} +0 -0
- /package/esm/typings/src/collection/{constructors/createCollectionFromPromise.test.d.ts → pipeline-collection/constructors/createPipelineCollectionFromDirectory.test.d.ts} +0 -0
- /package/esm/typings/src/{commands/_common/parseCommand.test.d.ts → collection/pipeline-collection/constructors/createPipelineCollectionFromJson.test.d.ts} +0 -0
- /package/esm/typings/src/collection/{collectionToJson.test.d.ts → pipeline-collection/pipelineCollectionToJson.test.d.ts} +0 -0
- /package/esm/typings/src/{book-2.0/commitments → commitments}/_base/BookCommitment.d.ts +0 -0
- /package/esm/typings/src/{book-2.0/commitments → commitments}/_base/ParsedCommitment.d.ts +0 -0
package/umd/index.umd.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
(function (global, factory) {
|
|
2
|
-
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('spacetrim'), require('waitasecond'), require('crypto'), require('lorem-ipsum'), require('path')) :
|
|
3
|
-
typeof define === 'function' && define.amd ? define(['exports', 'spacetrim', 'waitasecond', 'crypto', 'lorem-ipsum', 'path'], factory) :
|
|
4
|
-
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global["promptbook-fake-llm"] = {}, global.spaceTrim, global.waitasecond, global.crypto, global.loremIpsum));
|
|
5
|
-
})(this, (function (exports, spaceTrim, waitasecond, crypto, loremIpsum) { 'use strict';
|
|
2
|
+
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('spacetrim'), require('waitasecond'), require('crypto'), require('lorem-ipsum'), require('path'), require('crypto-js'), require('crypto-js/enc-hex')) :
|
|
3
|
+
typeof define === 'function' && define.amd ? define(['exports', 'spacetrim', 'waitasecond', 'crypto', 'lorem-ipsum', 'path', 'crypto-js', 'crypto-js/enc-hex'], factory) :
|
|
4
|
+
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global["promptbook-fake-llm"] = {}, global.spaceTrim$1, global.waitasecond, global.crypto, global.loremIpsum));
|
|
5
|
+
})(this, (function (exports, spaceTrim$1, waitasecond, crypto, loremIpsum) { 'use strict';
|
|
6
6
|
|
|
7
7
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
8
8
|
|
|
9
|
-
var spaceTrim__default = /*#__PURE__*/_interopDefaultLegacy(spaceTrim);
|
|
9
|
+
var spaceTrim__default = /*#__PURE__*/_interopDefaultLegacy(spaceTrim$1);
|
|
10
10
|
|
|
11
11
|
// ⚠️ WARNING: This code has been generated so that any manual changes will be overwritten
|
|
12
12
|
/**
|
|
@@ -15,14 +15,14 @@
|
|
|
15
15
|
* @generated
|
|
16
16
|
* @see https://github.com/webgptorg/book
|
|
17
17
|
*/
|
|
18
|
-
const BOOK_LANGUAGE_VERSION = '
|
|
18
|
+
const BOOK_LANGUAGE_VERSION = '2.0.0';
|
|
19
19
|
/**
|
|
20
20
|
* The version of the Promptbook engine
|
|
21
21
|
*
|
|
22
22
|
* @generated
|
|
23
23
|
* @see https://github.com/webgptorg/promptbook
|
|
24
24
|
*/
|
|
25
|
-
const PROMPTBOOK_ENGINE_VERSION = '0.103.0
|
|
25
|
+
const PROMPTBOOK_ENGINE_VERSION = '0.103.0';
|
|
26
26
|
/**
|
|
27
27
|
* TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
|
|
28
28
|
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
@@ -135,6 +135,17 @@
|
|
|
135
135
|
return new Date().toISOString();
|
|
136
136
|
}
|
|
137
137
|
|
|
138
|
+
/**
|
|
139
|
+
* Trims string from all 4 sides
|
|
140
|
+
*
|
|
141
|
+
* Note: This is a re-exported function from the `spacetrim` package which is
|
|
142
|
+
* Developed by same author @hejny as this package
|
|
143
|
+
*
|
|
144
|
+
* @public exported from `@promptbook/utils`
|
|
145
|
+
* @see https://github.com/hejny/spacetrim#usage
|
|
146
|
+
*/
|
|
147
|
+
const spaceTrim = spaceTrim$1.spaceTrim;
|
|
148
|
+
|
|
138
149
|
/**
|
|
139
150
|
* @private util of `@promptbook/color`
|
|
140
151
|
* @de
|
|
@@ -183,6 +194,7 @@
|
|
|
183
194
|
* @public exported from `@promptbook/color`
|
|
184
195
|
*/
|
|
185
196
|
const CSS_COLORS = {
|
|
197
|
+
promptbook: '#79EAFD',
|
|
186
198
|
transparent: 'rgba(0,0,0,0)',
|
|
187
199
|
aliceblue: '#f0f8ff',
|
|
188
200
|
antiquewhite: '#faebd7',
|
|
@@ -364,9 +376,6 @@
|
|
|
364
376
|
throw new Error(`${channelName} channel is greater than 255, it is ${value}`);
|
|
365
377
|
}
|
|
366
378
|
}
|
|
367
|
-
/**
|
|
368
|
-
* TODO: [🧠][🚓] Is/which combination it better to use asserts/check, validate or is utility function?
|
|
369
|
-
*/
|
|
370
379
|
|
|
371
380
|
/**
|
|
372
381
|
* Color object represents an RGB color with alpha channel
|
|
@@ -386,21 +395,61 @@
|
|
|
386
395
|
* @param color
|
|
387
396
|
* @returns Color object
|
|
388
397
|
*/
|
|
389
|
-
static from(color) {
|
|
390
|
-
if (color
|
|
398
|
+
static from(color, _isSingleValue = false) {
|
|
399
|
+
if (color === '') {
|
|
400
|
+
throw new Error(`Can not create color from empty string`);
|
|
401
|
+
}
|
|
402
|
+
else if (color instanceof Color) {
|
|
391
403
|
return take(color);
|
|
392
404
|
}
|
|
393
405
|
else if (Color.isColor(color)) {
|
|
394
406
|
return take(color);
|
|
395
407
|
}
|
|
396
408
|
else if (typeof color === 'string') {
|
|
397
|
-
|
|
409
|
+
try {
|
|
410
|
+
return Color.fromString(color);
|
|
411
|
+
}
|
|
412
|
+
catch (error) {
|
|
413
|
+
// <- Note: Can not use `assertsError(error)` here because it causes circular dependency
|
|
414
|
+
if (_isSingleValue) {
|
|
415
|
+
throw error;
|
|
416
|
+
}
|
|
417
|
+
const parts = color.split(/[\s+,;|]/);
|
|
418
|
+
if (parts.length > 0) {
|
|
419
|
+
return Color.from(parts[0].trim(), true);
|
|
420
|
+
}
|
|
421
|
+
else {
|
|
422
|
+
throw new Error(`Can not create color from given string "${color}"`);
|
|
423
|
+
}
|
|
424
|
+
}
|
|
398
425
|
}
|
|
399
426
|
else {
|
|
400
427
|
console.error({ color });
|
|
401
428
|
throw new Error(`Can not create color from given object`);
|
|
402
429
|
}
|
|
403
430
|
}
|
|
431
|
+
/**
|
|
432
|
+
* Creates a new Color instance from miscellaneous formats
|
|
433
|
+
* It just does not throw error when it fails, it returns PROMPTBOOK_COLOR instead
|
|
434
|
+
*
|
|
435
|
+
* @param color
|
|
436
|
+
* @returns Color object
|
|
437
|
+
*/
|
|
438
|
+
static fromSafe(color) {
|
|
439
|
+
try {
|
|
440
|
+
return Color.from(color);
|
|
441
|
+
}
|
|
442
|
+
catch (error) {
|
|
443
|
+
// <- Note: Can not use `assertsError(error)` here because it causes circular dependency
|
|
444
|
+
console.warn(spaceTrim((block) => `
|
|
445
|
+
Color.fromSafe error:
|
|
446
|
+
${block(error.message)}
|
|
447
|
+
|
|
448
|
+
Returning default PROMPTBOOK_COLOR.
|
|
449
|
+
`));
|
|
450
|
+
return Color.fromString('promptbook');
|
|
451
|
+
}
|
|
452
|
+
}
|
|
404
453
|
/**
|
|
405
454
|
* Creates a new Color instance from miscellaneous string formats
|
|
406
455
|
*
|
|
@@ -468,6 +517,9 @@
|
|
|
468
517
|
if (hex.length === 3) {
|
|
469
518
|
return Color.fromHex3(hex);
|
|
470
519
|
}
|
|
520
|
+
if (hex.length === 4) {
|
|
521
|
+
return Color.fromHex4(hex);
|
|
522
|
+
}
|
|
471
523
|
if (hex.length === 6) {
|
|
472
524
|
return Color.fromHex6(hex);
|
|
473
525
|
}
|
|
@@ -488,6 +540,19 @@
|
|
|
488
540
|
const b = parseInt(hex.substr(2, 1), 16) * 16;
|
|
489
541
|
return take(new Color(r, g, b));
|
|
490
542
|
}
|
|
543
|
+
/**
|
|
544
|
+
* Creates a new Color instance from color in hex format with 4 digits (with alpha channel)
|
|
545
|
+
*
|
|
546
|
+
* @param color in hex for example `09df`
|
|
547
|
+
* @returns Color object
|
|
548
|
+
*/
|
|
549
|
+
static fromHex4(hex) {
|
|
550
|
+
const r = parseInt(hex.substr(0, 1), 16) * 16;
|
|
551
|
+
const g = parseInt(hex.substr(1, 1), 16) * 16;
|
|
552
|
+
const b = parseInt(hex.substr(2, 1), 16) * 16;
|
|
553
|
+
const a = parseInt(hex.substr(3, 1), 16) * 16;
|
|
554
|
+
return take(new Color(r, g, b, a));
|
|
555
|
+
}
|
|
491
556
|
/**
|
|
492
557
|
* Creates a new Color instance from color in hex format with 6 color digits (without alpha channel)
|
|
493
558
|
*
|
|
@@ -678,7 +743,8 @@
|
|
|
678
743
|
* @returns true if the value is a valid hex color string (e.g., `#009edd`, `#fff`, etc.)
|
|
679
744
|
*/
|
|
680
745
|
static isHexColorString(value) {
|
|
681
|
-
return typeof value === 'string' &&
|
|
746
|
+
return (typeof value === 'string' &&
|
|
747
|
+
/^#(?:[0-9a-fA-F]{3}|[0-9a-fA-F]{4}|[0-9a-fA-F]{6}|[0-9a-fA-F]{8})$/.test(value));
|
|
682
748
|
}
|
|
683
749
|
/**
|
|
684
750
|
* Creates new Color object
|
|
@@ -793,6 +859,23 @@
|
|
|
793
859
|
* TODO: Maybe connect with textures
|
|
794
860
|
*/
|
|
795
861
|
|
|
862
|
+
/**
|
|
863
|
+
* Makes color transformer which returns a grayscale version of the color
|
|
864
|
+
*
|
|
865
|
+
* @param amount from 0 to 1
|
|
866
|
+
*
|
|
867
|
+
* @public exported from `@promptbook/color`
|
|
868
|
+
*/
|
|
869
|
+
function grayscale(amount) {
|
|
870
|
+
return ({ red, green, blue, alpha }) => {
|
|
871
|
+
const average = (red + green + blue) / 3;
|
|
872
|
+
red = Math.round(average * amount + red * (1 - amount));
|
|
873
|
+
green = Math.round(average * amount + green * (1 - amount));
|
|
874
|
+
blue = Math.round(average * amount + blue * (1 - amount));
|
|
875
|
+
return Color.fromValues(red, green, blue, alpha);
|
|
876
|
+
};
|
|
877
|
+
}
|
|
878
|
+
|
|
796
879
|
/**
|
|
797
880
|
* Converts HSL values to RGB values
|
|
798
881
|
*
|
|
@@ -908,102 +991,6 @@
|
|
|
908
991
|
* TODO: Maybe implement by mix+hsl
|
|
909
992
|
*/
|
|
910
993
|
|
|
911
|
-
/**
|
|
912
|
-
* Calculates distance between two colors
|
|
913
|
-
*
|
|
914
|
-
* @param color1 first color
|
|
915
|
-
* @param color2 second color
|
|
916
|
-
*
|
|
917
|
-
* Note: This function is inefficient. Use colorDistanceSquared instead if possible.
|
|
918
|
-
*
|
|
919
|
-
* @public exported from `@promptbook/color`
|
|
920
|
-
*/
|
|
921
|
-
/**
|
|
922
|
-
* Calculates distance between two colors without square root
|
|
923
|
-
*
|
|
924
|
-
* @param color1 first color
|
|
925
|
-
* @param color2 second color
|
|
926
|
-
*
|
|
927
|
-
* @public exported from `@promptbook/color`
|
|
928
|
-
*/
|
|
929
|
-
function colorDistanceSquared(color1, color2) {
|
|
930
|
-
const rmean = (color1.red + color2.red) / 2;
|
|
931
|
-
const r = color1.red - color2.red;
|
|
932
|
-
const g = color1.green - color2.green;
|
|
933
|
-
const b = color1.blue - color2.blue;
|
|
934
|
-
const weightR = 2 + rmean / 256;
|
|
935
|
-
const weightG = 4.0;
|
|
936
|
-
const weightB = 2 + (255 - rmean) / 256;
|
|
937
|
-
const distance = weightR * r * r + weightG * g * g + weightB * b * b;
|
|
938
|
-
return distance;
|
|
939
|
-
}
|
|
940
|
-
|
|
941
|
-
/**
|
|
942
|
-
* Makes color transformer which finds the nearest color from the given list
|
|
943
|
-
*
|
|
944
|
-
* @param colors array of colors to choose from
|
|
945
|
-
*
|
|
946
|
-
* @public exported from `@promptbook/color`
|
|
947
|
-
*/
|
|
948
|
-
function nearest(...colors) {
|
|
949
|
-
return (color) => {
|
|
950
|
-
const distances = colors.map((c) => colorDistanceSquared(c, color));
|
|
951
|
-
const minDistance = Math.min(...distances);
|
|
952
|
-
const minIndex = distances.indexOf(minDistance);
|
|
953
|
-
const nearestColor = colors[minIndex];
|
|
954
|
-
return nearestColor;
|
|
955
|
-
};
|
|
956
|
-
}
|
|
957
|
-
|
|
958
|
-
/**
|
|
959
|
-
* Color transformer which returns the negative color
|
|
960
|
-
*
|
|
961
|
-
* @public exported from `@promptbook/color`
|
|
962
|
-
*/
|
|
963
|
-
function negative(color) {
|
|
964
|
-
const r = 255 - color.red;
|
|
965
|
-
const g = 255 - color.green;
|
|
966
|
-
const b = 255 - color.blue;
|
|
967
|
-
return Color.fromValues(r, g, b, color.alpha);
|
|
968
|
-
}
|
|
969
|
-
|
|
970
|
-
/**
|
|
971
|
-
* Makes color transformer which finds the furthest color from the given list
|
|
972
|
-
*
|
|
973
|
-
* @param colors array of colors to choose from
|
|
974
|
-
*
|
|
975
|
-
* @public exported from `@promptbook/color`
|
|
976
|
-
*/
|
|
977
|
-
function furthest(...colors) {
|
|
978
|
-
return (color) => {
|
|
979
|
-
const furthestColor = negative(nearest(...colors.map(negative))(color));
|
|
980
|
-
return furthestColor;
|
|
981
|
-
};
|
|
982
|
-
}
|
|
983
|
-
/**
|
|
984
|
-
* Makes color transformer which finds the best text color (black or white) for the given background color
|
|
985
|
-
*
|
|
986
|
-
* @public exported from `@promptbook/color`
|
|
987
|
-
*/
|
|
988
|
-
furthest(Color.get('white'), Color.from('black'));
|
|
989
|
-
|
|
990
|
-
/**
|
|
991
|
-
* Makes color transformer which returns a grayscale version of the color
|
|
992
|
-
*
|
|
993
|
-
* @param amount from 0 to 1
|
|
994
|
-
*
|
|
995
|
-
* @public exported from `@promptbook/color`
|
|
996
|
-
*/
|
|
997
|
-
function grayscale(amount) {
|
|
998
|
-
return ({ red, green, blue, alpha }) => {
|
|
999
|
-
const average = (red + green + blue) / 3;
|
|
1000
|
-
red = Math.round(average * amount + red * (1 - amount));
|
|
1001
|
-
green = Math.round(average * amount + green * (1 - amount));
|
|
1002
|
-
blue = Math.round(average * amount + blue * (1 - amount));
|
|
1003
|
-
return Color.fromValues(red, green, blue, alpha);
|
|
1004
|
-
};
|
|
1005
|
-
}
|
|
1006
|
-
|
|
1007
994
|
/**
|
|
1008
995
|
* Makes color transformer which saturate the given color
|
|
1009
996
|
*
|
|
@@ -1052,16 +1039,32 @@
|
|
|
1052
1039
|
*
|
|
1053
1040
|
* @public exported from `@promptbook/core`
|
|
1054
1041
|
*/
|
|
1055
|
-
const PROMPTBOOK_COLOR = Color.
|
|
1056
|
-
// <- TODO: [🧠] Using `Color` here increases the package size approx 3kb, maybe remove it
|
|
1042
|
+
const PROMPTBOOK_COLOR = Color.fromString('promptbook');
|
|
1043
|
+
// <- TODO: [🧠][🈵] Using `Color` here increases the package size approx 3kb, maybe remove it
|
|
1057
1044
|
/**
|
|
1058
|
-
*
|
|
1045
|
+
* Colors for syntax highlighting in the `<BookEditor/>`
|
|
1046
|
+
*
|
|
1047
|
+
* TODO: [🗽] Unite branding and make single place for it
|
|
1048
|
+
*
|
|
1049
|
+
* @public exported from `@promptbook/core`
|
|
1050
|
+
*/
|
|
1051
|
+
({
|
|
1052
|
+
TITLE: Color.fromHex('#244EA8'),
|
|
1053
|
+
LINE: Color.fromHex('#eeeeee'),
|
|
1054
|
+
SEPARATOR: Color.fromHex('#cccccc'),
|
|
1055
|
+
COMMITMENT: Color.fromHex('#DA0F78'),
|
|
1056
|
+
PARAMETER: Color.fromHex('#8e44ad'),
|
|
1057
|
+
});
|
|
1058
|
+
// <- TODO: [🧠][🈵] Using `Color` here increases the package size approx 3kb, maybe remove it
|
|
1059
|
+
/**
|
|
1060
|
+
* Chat color of the Promptbook (in chat)
|
|
1059
1061
|
*
|
|
1060
1062
|
* TODO: [🗽] Unite branding and make single place for it
|
|
1061
1063
|
*
|
|
1062
1064
|
* @public exported from `@promptbook/core`
|
|
1063
1065
|
*/
|
|
1064
1066
|
PROMPTBOOK_COLOR.then(lighten(0.1)).then(saturate(0.9)).then(grayscale(0.9));
|
|
1067
|
+
// <- TODO: [🧠][🈵] Using `Color` and `lighten`, `saturate`,... here increases the package size approx 3kb, maybe remove it
|
|
1065
1068
|
/**
|
|
1066
1069
|
* Color of the user (in chat)
|
|
1067
1070
|
*
|
|
@@ -1194,7 +1197,7 @@
|
|
|
1194
1197
|
*/
|
|
1195
1198
|
class UnexpectedError extends Error {
|
|
1196
1199
|
constructor(message) {
|
|
1197
|
-
super(spaceTrim.spaceTrim((block) => `
|
|
1200
|
+
super(spaceTrim$1.spaceTrim((block) => `
|
|
1198
1201
|
${block(message)}
|
|
1199
1202
|
|
|
1200
1203
|
Note: This error should not happen.
|
|
@@ -1220,7 +1223,7 @@
|
|
|
1220
1223
|
constructor(whatWasThrown) {
|
|
1221
1224
|
const tag = `[🤮]`;
|
|
1222
1225
|
console.error(tag, whatWasThrown);
|
|
1223
|
-
super(spaceTrim.spaceTrim(`
|
|
1226
|
+
super(spaceTrim$1.spaceTrim(`
|
|
1224
1227
|
Non-Error object was thrown
|
|
1225
1228
|
|
|
1226
1229
|
Note: Look for ${tag} in the console for more details
|
|
@@ -1413,7 +1416,7 @@
|
|
|
1413
1416
|
TODO: [🧠] Is there a better implementation?
|
|
1414
1417
|
> const propertyNames = Object.getOwnPropertyNames(objectValue);
|
|
1415
1418
|
> for (const propertyName of propertyNames) {
|
|
1416
|
-
> const value = (objectValue as
|
|
1419
|
+
> const value = (objectValue as chococake)[propertyName];
|
|
1417
1420
|
> if (value && typeof value === 'object') {
|
|
1418
1421
|
> deepClone(value);
|
|
1419
1422
|
> }
|
|
@@ -1517,6 +1520,7 @@
|
|
|
1517
1520
|
/**
|
|
1518
1521
|
* Generates random token
|
|
1519
1522
|
*
|
|
1523
|
+
* Note: `$` is used to indicate that this function is not a pure function - it is not deterministic
|
|
1520
1524
|
* Note: This function is cryptographically secure (it uses crypto.randomBytes internally)
|
|
1521
1525
|
*
|
|
1522
1526
|
* @private internal helper function
|
|
@@ -1526,6 +1530,7 @@
|
|
|
1526
1530
|
return crypto.randomBytes(randomness).toString('hex');
|
|
1527
1531
|
}
|
|
1528
1532
|
/**
|
|
1533
|
+
* TODO: [🤶] Maybe export through `@promptbook/utils` or `@promptbook/random` package
|
|
1529
1534
|
* TODO: Maybe use nanoid instead https://github.com/ai/nanoid
|
|
1530
1535
|
*/
|
|
1531
1536
|
|
|
@@ -1769,7 +1774,7 @@
|
|
|
1769
1774
|
order: [],
|
|
1770
1775
|
value: {
|
|
1771
1776
|
// Note: The „quotes“ are intentional to test AI humanization and Promptbookification
|
|
1772
|
-
content: spaceTrim.spaceTrim((block) => `
|
|
1777
|
+
content: spaceTrim$1.spaceTrim((block) => `
|
|
1773
1778
|
You said:
|
|
1774
1779
|
„${block(rawPromptContent)}“${thread ? ` +${thread.length} other messages` : ''}
|
|
1775
1780
|
|
|
@@ -1808,7 +1813,7 @@
|
|
|
1808
1813
|
message: `Result of \`MockedEchoLlmExecutionTools.callCompletionModel\``,
|
|
1809
1814
|
order: [],
|
|
1810
1815
|
value: {
|
|
1811
|
-
content: spaceTrim.spaceTrim((block) => `
|
|
1816
|
+
content: spaceTrim$1.spaceTrim((block) => `
|
|
1812
1817
|
${block(rawPromptContent)}
|
|
1813
1818
|
And so on...
|
|
1814
1819
|
`),
|
|
@@ -1893,10 +1898,13 @@
|
|
|
1893
1898
|
* @public exported from `@promptbook/utils`
|
|
1894
1899
|
*/
|
|
1895
1900
|
function countLines(text) {
|
|
1901
|
+
if (text === '') {
|
|
1902
|
+
return 0;
|
|
1903
|
+
}
|
|
1896
1904
|
text = text.replace('\r\n', '\n');
|
|
1897
1905
|
text = text.replace('\r', '\n');
|
|
1898
1906
|
const lines = text.split('\n');
|
|
1899
|
-
return lines.reduce((count, line) => count + Math.ceil(line.length / CHARACTERS_PER_STANDARD_LINE), 0);
|
|
1907
|
+
return lines.reduce((count, line) => count + Math.max(Math.ceil(line.length / CHARACTERS_PER_STANDARD_LINE), 1), 0);
|
|
1900
1908
|
}
|
|
1901
1909
|
/**
|
|
1902
1910
|
* TODO: [🥴] Implement counting in formats - like JSON, CSV, XML,...
|
|
@@ -2304,6 +2312,8 @@
|
|
|
2304
2312
|
/**
|
|
2305
2313
|
* Normalizes a given text to camelCase format.
|
|
2306
2314
|
*
|
|
2315
|
+
* Note: [🔂] This function is idempotent.
|
|
2316
|
+
*
|
|
2307
2317
|
* @param text The text to be normalized.
|
|
2308
2318
|
* @param _isFirstLetterCapital Whether the first letter should be capitalized.
|
|
2309
2319
|
* @returns The camelCase formatted string.
|
|
@@ -2356,6 +2366,8 @@
|
|
|
2356
2366
|
/**
|
|
2357
2367
|
* Converts a given text to kebab-case format.
|
|
2358
2368
|
*
|
|
2369
|
+
* Note: [🔂] This function is idempotent.
|
|
2370
|
+
*
|
|
2359
2371
|
* @param text The text to be converted.
|
|
2360
2372
|
* @returns The kebab-case formatted string.
|
|
2361
2373
|
* @example 'hello-world'
|
|
@@ -2668,6 +2680,9 @@
|
|
|
2668
2680
|
}
|
|
2669
2681
|
|
|
2670
2682
|
/**
|
|
2683
|
+
* Normalizes a given text to PascalCase format.
|
|
2684
|
+
*
|
|
2685
|
+
* Note: [🔂] This function is idempotent.
|
|
2671
2686
|
*
|
|
2672
2687
|
* @param text @public exported from `@promptbook/utils`
|
|
2673
2688
|
* @returns
|
|
@@ -2747,7 +2762,7 @@
|
|
|
2747
2762
|
let trimmedText = text;
|
|
2748
2763
|
// Remove leading and trailing spaces and newlines
|
|
2749
2764
|
if (isTrimmed) {
|
|
2750
|
-
trimmedText = spaceTrim.spaceTrim(trimmedText);
|
|
2765
|
+
trimmedText = spaceTrim$1.spaceTrim(trimmedText);
|
|
2751
2766
|
}
|
|
2752
2767
|
let processedText = trimmedText;
|
|
2753
2768
|
if (isIntroduceSentenceRemoved) {
|
|
@@ -2756,7 +2771,7 @@
|
|
|
2756
2771
|
// Remove the introduce sentence and quotes by replacing it with an empty string
|
|
2757
2772
|
processedText = processedText.replace(introduceSentenceRegex, '');
|
|
2758
2773
|
}
|
|
2759
|
-
processedText = spaceTrim.spaceTrim(processedText);
|
|
2774
|
+
processedText = spaceTrim$1.spaceTrim(processedText);
|
|
2760
2775
|
}
|
|
2761
2776
|
if (processedText.length < 3) {
|
|
2762
2777
|
return trimmedText;
|
|
@@ -2938,13 +2953,13 @@
|
|
|
2938
2953
|
* @public exported from `@promptbook/markdown-utils`
|
|
2939
2954
|
*/
|
|
2940
2955
|
function trimCodeBlock(value) {
|
|
2941
|
-
value = spaceTrim.spaceTrim(value);
|
|
2956
|
+
value = spaceTrim$1.spaceTrim(value);
|
|
2942
2957
|
if (!/^```[a-z]*(.*)```$/is.test(value)) {
|
|
2943
2958
|
return value;
|
|
2944
2959
|
}
|
|
2945
2960
|
value = value.replace(/^```[a-z]*/i, '');
|
|
2946
2961
|
value = value.replace(/```$/i, '');
|
|
2947
|
-
value = spaceTrim.spaceTrim(value);
|
|
2962
|
+
value = spaceTrim$1.spaceTrim(value);
|
|
2948
2963
|
return value;
|
|
2949
2964
|
}
|
|
2950
2965
|
|
|
@@ -2957,9 +2972,9 @@
|
|
|
2957
2972
|
* @public exported from `@promptbook/markdown-utils`
|
|
2958
2973
|
*/
|
|
2959
2974
|
function trimEndOfCodeBlock(value) {
|
|
2960
|
-
value = spaceTrim.spaceTrim(value);
|
|
2975
|
+
value = spaceTrim$1.spaceTrim(value);
|
|
2961
2976
|
value = value.replace(/```$/g, '');
|
|
2962
|
-
value = spaceTrim.spaceTrim(value);
|
|
2977
|
+
value = spaceTrim$1.spaceTrim(value);
|
|
2963
2978
|
return value;
|
|
2964
2979
|
}
|
|
2965
2980
|
|
|
@@ -3243,7 +3258,7 @@
|
|
|
3243
3258
|
text += (text ? ' ' : '') + nextWord;
|
|
3244
3259
|
}
|
|
3245
3260
|
}
|
|
3246
|
-
throw new LimitReachedError(spaceTrim.spaceTrim((block) => `
|
|
3261
|
+
throw new LimitReachedError(spaceTrim$1.spaceTrim((block) => `
|
|
3247
3262
|
Can not generate fake text to met the expectations
|
|
3248
3263
|
|
|
3249
3264
|
Loop limit reached
|