@promptbook/remote-client 0.103.0-9 → 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 +266 -176
- 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 +229 -139
- 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
2
|
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('spacetrim'), require('crypto'), require('socket.io-client'), require('crypto-js'), require('crypto-js/enc-hex'), require('papaparse'), require('path')) :
|
|
3
3
|
typeof define === 'function' && define.amd ? define(['exports', 'spacetrim', 'crypto', 'socket.io-client', 'crypto-js', 'crypto-js/enc-hex', 'papaparse', 'path'], factory) :
|
|
4
|
-
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global["promptbook-remote-client"] = {}, global.spaceTrim, global.crypto, global.socket_ioClient, global.cryptoJs, global.hexEncoder, global.papaparse, global.path));
|
|
5
|
-
})(this, (function (exports, spaceTrim, crypto, socket_ioClient, cryptoJs, hexEncoder, papaparse, path) { 'use strict';
|
|
4
|
+
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global["promptbook-remote-client"] = {}, global.spaceTrim$1, global.crypto, global.socket_ioClient, global.cryptoJs, global.hexEncoder, global.papaparse, global.path));
|
|
5
|
+
})(this, (function (exports, spaceTrim$1, crypto, socket_ioClient, cryptoJs, hexEncoder, papaparse, path) { '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
|
var hexEncoder__default = /*#__PURE__*/_interopDefaultLegacy(hexEncoder);
|
|
11
11
|
|
|
12
12
|
// ⚠️ WARNING: This code has been generated so that any manual changes will be overwritten
|
|
@@ -16,14 +16,14 @@
|
|
|
16
16
|
* @generated
|
|
17
17
|
* @see https://github.com/webgptorg/book
|
|
18
18
|
*/
|
|
19
|
-
const BOOK_LANGUAGE_VERSION = '
|
|
19
|
+
const BOOK_LANGUAGE_VERSION = '2.0.0';
|
|
20
20
|
/**
|
|
21
21
|
* The version of the Promptbook engine
|
|
22
22
|
*
|
|
23
23
|
* @generated
|
|
24
24
|
* @see https://github.com/webgptorg/promptbook
|
|
25
25
|
*/
|
|
26
|
-
const PROMPTBOOK_ENGINE_VERSION = '0.103.0
|
|
26
|
+
const PROMPTBOOK_ENGINE_VERSION = '0.103.0';
|
|
27
27
|
/**
|
|
28
28
|
* TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
|
|
29
29
|
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
@@ -85,6 +85,22 @@
|
|
|
85
85
|
}
|
|
86
86
|
}
|
|
87
87
|
|
|
88
|
+
/**
|
|
89
|
+
* This error indicates error from the database
|
|
90
|
+
*
|
|
91
|
+
* @public exported from `@promptbook/core`
|
|
92
|
+
*/
|
|
93
|
+
class DatabaseError extends Error {
|
|
94
|
+
constructor(message) {
|
|
95
|
+
super(message);
|
|
96
|
+
this.name = 'DatabaseError';
|
|
97
|
+
Object.setPrototypeOf(this, DatabaseError.prototype);
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* TODO: [🐱🚀] Explain that NotFoundError ([🐱🚀] and other specific errors) has priority over DatabaseError in some contexts
|
|
102
|
+
*/
|
|
103
|
+
|
|
88
104
|
/**
|
|
89
105
|
* This error type indicates that you try to use a feature that is not available in the current environment
|
|
90
106
|
*
|
|
@@ -147,7 +163,7 @@
|
|
|
147
163
|
*/
|
|
148
164
|
class MissingToolsError extends Error {
|
|
149
165
|
constructor(message) {
|
|
150
|
-
super(spaceTrim.spaceTrim((block) => `
|
|
166
|
+
super(spaceTrim$1.spaceTrim((block) => `
|
|
151
167
|
${block(message)}
|
|
152
168
|
|
|
153
169
|
Note: You have probably forgot to provide some tools for pipeline execution or preparation
|
|
@@ -158,6 +174,19 @@
|
|
|
158
174
|
}
|
|
159
175
|
}
|
|
160
176
|
|
|
177
|
+
/**
|
|
178
|
+
* This error indicates that promptbook operation is not allowed
|
|
179
|
+
*
|
|
180
|
+
* @public exported from `@promptbook/core`
|
|
181
|
+
*/
|
|
182
|
+
class NotAllowed extends Error {
|
|
183
|
+
constructor(message) {
|
|
184
|
+
super(message);
|
|
185
|
+
this.name = 'NotAllowed';
|
|
186
|
+
Object.setPrototypeOf(this, NotAllowed.prototype);
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
|
|
161
190
|
/**
|
|
162
191
|
* This error indicates that promptbook not found in the collection
|
|
163
192
|
*
|
|
@@ -178,7 +207,7 @@
|
|
|
178
207
|
*/
|
|
179
208
|
class NotYetImplementedError extends Error {
|
|
180
209
|
constructor(message) {
|
|
181
|
-
super(spaceTrim.spaceTrim((block) => `
|
|
210
|
+
super(spaceTrim$1.spaceTrim((block) => `
|
|
182
211
|
${block(message)}
|
|
183
212
|
|
|
184
213
|
Note: This feature is not implemented yet but it will be soon.
|
|
@@ -213,6 +242,7 @@
|
|
|
213
242
|
/**
|
|
214
243
|
* Generates random token
|
|
215
244
|
*
|
|
245
|
+
* Note: `$` is used to indicate that this function is not a pure function - it is not deterministic
|
|
216
246
|
* Note: This function is cryptographically secure (it uses crypto.randomBytes internally)
|
|
217
247
|
*
|
|
218
248
|
* @private internal helper function
|
|
@@ -222,6 +252,7 @@
|
|
|
222
252
|
return crypto.randomBytes(randomness).toString('hex');
|
|
223
253
|
}
|
|
224
254
|
/**
|
|
255
|
+
* TODO: [🤶] Maybe export through `@promptbook/utils` or `@promptbook/random` package
|
|
225
256
|
* TODO: Maybe use nanoid instead https://github.com/ai/nanoid
|
|
226
257
|
*/
|
|
227
258
|
|
|
@@ -283,6 +314,17 @@
|
|
|
283
314
|
}
|
|
284
315
|
}
|
|
285
316
|
|
|
317
|
+
/**
|
|
318
|
+
* Trims string from all 4 sides
|
|
319
|
+
*
|
|
320
|
+
* Note: This is a re-exported function from the `spacetrim` package which is
|
|
321
|
+
* Developed by same author @hejny as this package
|
|
322
|
+
*
|
|
323
|
+
* @public exported from `@promptbook/utils`
|
|
324
|
+
* @see https://github.com/hejny/spacetrim#usage
|
|
325
|
+
*/
|
|
326
|
+
const spaceTrim = spaceTrim$1.spaceTrim;
|
|
327
|
+
|
|
286
328
|
/**
|
|
287
329
|
* @private util of `@promptbook/color`
|
|
288
330
|
* @de
|
|
@@ -331,6 +373,7 @@
|
|
|
331
373
|
* @public exported from `@promptbook/color`
|
|
332
374
|
*/
|
|
333
375
|
const CSS_COLORS = {
|
|
376
|
+
promptbook: '#79EAFD',
|
|
334
377
|
transparent: 'rgba(0,0,0,0)',
|
|
335
378
|
aliceblue: '#f0f8ff',
|
|
336
379
|
antiquewhite: '#faebd7',
|
|
@@ -512,9 +555,6 @@
|
|
|
512
555
|
throw new Error(`${channelName} channel is greater than 255, it is ${value}`);
|
|
513
556
|
}
|
|
514
557
|
}
|
|
515
|
-
/**
|
|
516
|
-
* TODO: [🧠][🚓] Is/which combination it better to use asserts/check, validate or is utility function?
|
|
517
|
-
*/
|
|
518
558
|
|
|
519
559
|
/**
|
|
520
560
|
* Color object represents an RGB color with alpha channel
|
|
@@ -534,21 +574,61 @@
|
|
|
534
574
|
* @param color
|
|
535
575
|
* @returns Color object
|
|
536
576
|
*/
|
|
537
|
-
static from(color) {
|
|
538
|
-
if (color
|
|
577
|
+
static from(color, _isSingleValue = false) {
|
|
578
|
+
if (color === '') {
|
|
579
|
+
throw new Error(`Can not create color from empty string`);
|
|
580
|
+
}
|
|
581
|
+
else if (color instanceof Color) {
|
|
539
582
|
return take(color);
|
|
540
583
|
}
|
|
541
584
|
else if (Color.isColor(color)) {
|
|
542
585
|
return take(color);
|
|
543
586
|
}
|
|
544
587
|
else if (typeof color === 'string') {
|
|
545
|
-
|
|
588
|
+
try {
|
|
589
|
+
return Color.fromString(color);
|
|
590
|
+
}
|
|
591
|
+
catch (error) {
|
|
592
|
+
// <- Note: Can not use `assertsError(error)` here because it causes circular dependency
|
|
593
|
+
if (_isSingleValue) {
|
|
594
|
+
throw error;
|
|
595
|
+
}
|
|
596
|
+
const parts = color.split(/[\s+,;|]/);
|
|
597
|
+
if (parts.length > 0) {
|
|
598
|
+
return Color.from(parts[0].trim(), true);
|
|
599
|
+
}
|
|
600
|
+
else {
|
|
601
|
+
throw new Error(`Can not create color from given string "${color}"`);
|
|
602
|
+
}
|
|
603
|
+
}
|
|
546
604
|
}
|
|
547
605
|
else {
|
|
548
606
|
console.error({ color });
|
|
549
607
|
throw new Error(`Can not create color from given object`);
|
|
550
608
|
}
|
|
551
609
|
}
|
|
610
|
+
/**
|
|
611
|
+
* Creates a new Color instance from miscellaneous formats
|
|
612
|
+
* It just does not throw error when it fails, it returns PROMPTBOOK_COLOR instead
|
|
613
|
+
*
|
|
614
|
+
* @param color
|
|
615
|
+
* @returns Color object
|
|
616
|
+
*/
|
|
617
|
+
static fromSafe(color) {
|
|
618
|
+
try {
|
|
619
|
+
return Color.from(color);
|
|
620
|
+
}
|
|
621
|
+
catch (error) {
|
|
622
|
+
// <- Note: Can not use `assertsError(error)` here because it causes circular dependency
|
|
623
|
+
console.warn(spaceTrim((block) => `
|
|
624
|
+
Color.fromSafe error:
|
|
625
|
+
${block(error.message)}
|
|
626
|
+
|
|
627
|
+
Returning default PROMPTBOOK_COLOR.
|
|
628
|
+
`));
|
|
629
|
+
return Color.fromString('promptbook');
|
|
630
|
+
}
|
|
631
|
+
}
|
|
552
632
|
/**
|
|
553
633
|
* Creates a new Color instance from miscellaneous string formats
|
|
554
634
|
*
|
|
@@ -616,6 +696,9 @@
|
|
|
616
696
|
if (hex.length === 3) {
|
|
617
697
|
return Color.fromHex3(hex);
|
|
618
698
|
}
|
|
699
|
+
if (hex.length === 4) {
|
|
700
|
+
return Color.fromHex4(hex);
|
|
701
|
+
}
|
|
619
702
|
if (hex.length === 6) {
|
|
620
703
|
return Color.fromHex6(hex);
|
|
621
704
|
}
|
|
@@ -636,6 +719,19 @@
|
|
|
636
719
|
const b = parseInt(hex.substr(2, 1), 16) * 16;
|
|
637
720
|
return take(new Color(r, g, b));
|
|
638
721
|
}
|
|
722
|
+
/**
|
|
723
|
+
* Creates a new Color instance from color in hex format with 4 digits (with alpha channel)
|
|
724
|
+
*
|
|
725
|
+
* @param color in hex for example `09df`
|
|
726
|
+
* @returns Color object
|
|
727
|
+
*/
|
|
728
|
+
static fromHex4(hex) {
|
|
729
|
+
const r = parseInt(hex.substr(0, 1), 16) * 16;
|
|
730
|
+
const g = parseInt(hex.substr(1, 1), 16) * 16;
|
|
731
|
+
const b = parseInt(hex.substr(2, 1), 16) * 16;
|
|
732
|
+
const a = parseInt(hex.substr(3, 1), 16) * 16;
|
|
733
|
+
return take(new Color(r, g, b, a));
|
|
734
|
+
}
|
|
639
735
|
/**
|
|
640
736
|
* Creates a new Color instance from color in hex format with 6 color digits (without alpha channel)
|
|
641
737
|
*
|
|
@@ -826,7 +922,8 @@
|
|
|
826
922
|
* @returns true if the value is a valid hex color string (e.g., `#009edd`, `#fff`, etc.)
|
|
827
923
|
*/
|
|
828
924
|
static isHexColorString(value) {
|
|
829
|
-
return typeof value === 'string' &&
|
|
925
|
+
return (typeof value === 'string' &&
|
|
926
|
+
/^#(?:[0-9a-fA-F]{3}|[0-9a-fA-F]{4}|[0-9a-fA-F]{6}|[0-9a-fA-F]{8})$/.test(value));
|
|
830
927
|
}
|
|
831
928
|
/**
|
|
832
929
|
* Creates new Color object
|
|
@@ -941,6 +1038,23 @@
|
|
|
941
1038
|
* TODO: Maybe connect with textures
|
|
942
1039
|
*/
|
|
943
1040
|
|
|
1041
|
+
/**
|
|
1042
|
+
* Makes color transformer which returns a grayscale version of the color
|
|
1043
|
+
*
|
|
1044
|
+
* @param amount from 0 to 1
|
|
1045
|
+
*
|
|
1046
|
+
* @public exported from `@promptbook/color`
|
|
1047
|
+
*/
|
|
1048
|
+
function grayscale(amount) {
|
|
1049
|
+
return ({ red, green, blue, alpha }) => {
|
|
1050
|
+
const average = (red + green + blue) / 3;
|
|
1051
|
+
red = Math.round(average * amount + red * (1 - amount));
|
|
1052
|
+
green = Math.round(average * amount + green * (1 - amount));
|
|
1053
|
+
blue = Math.round(average * amount + blue * (1 - amount));
|
|
1054
|
+
return Color.fromValues(red, green, blue, alpha);
|
|
1055
|
+
};
|
|
1056
|
+
}
|
|
1057
|
+
|
|
944
1058
|
/**
|
|
945
1059
|
* Converts HSL values to RGB values
|
|
946
1060
|
*
|
|
@@ -1056,102 +1170,6 @@
|
|
|
1056
1170
|
* TODO: Maybe implement by mix+hsl
|
|
1057
1171
|
*/
|
|
1058
1172
|
|
|
1059
|
-
/**
|
|
1060
|
-
* Calculates distance between two colors
|
|
1061
|
-
*
|
|
1062
|
-
* @param color1 first color
|
|
1063
|
-
* @param color2 second color
|
|
1064
|
-
*
|
|
1065
|
-
* Note: This function is inefficient. Use colorDistanceSquared instead if possible.
|
|
1066
|
-
*
|
|
1067
|
-
* @public exported from `@promptbook/color`
|
|
1068
|
-
*/
|
|
1069
|
-
/**
|
|
1070
|
-
* Calculates distance between two colors without square root
|
|
1071
|
-
*
|
|
1072
|
-
* @param color1 first color
|
|
1073
|
-
* @param color2 second color
|
|
1074
|
-
*
|
|
1075
|
-
* @public exported from `@promptbook/color`
|
|
1076
|
-
*/
|
|
1077
|
-
function colorDistanceSquared(color1, color2) {
|
|
1078
|
-
const rmean = (color1.red + color2.red) / 2;
|
|
1079
|
-
const r = color1.red - color2.red;
|
|
1080
|
-
const g = color1.green - color2.green;
|
|
1081
|
-
const b = color1.blue - color2.blue;
|
|
1082
|
-
const weightR = 2 + rmean / 256;
|
|
1083
|
-
const weightG = 4.0;
|
|
1084
|
-
const weightB = 2 + (255 - rmean) / 256;
|
|
1085
|
-
const distance = weightR * r * r + weightG * g * g + weightB * b * b;
|
|
1086
|
-
return distance;
|
|
1087
|
-
}
|
|
1088
|
-
|
|
1089
|
-
/**
|
|
1090
|
-
* Makes color transformer which finds the nearest color from the given list
|
|
1091
|
-
*
|
|
1092
|
-
* @param colors array of colors to choose from
|
|
1093
|
-
*
|
|
1094
|
-
* @public exported from `@promptbook/color`
|
|
1095
|
-
*/
|
|
1096
|
-
function nearest(...colors) {
|
|
1097
|
-
return (color) => {
|
|
1098
|
-
const distances = colors.map((c) => colorDistanceSquared(c, color));
|
|
1099
|
-
const minDistance = Math.min(...distances);
|
|
1100
|
-
const minIndex = distances.indexOf(minDistance);
|
|
1101
|
-
const nearestColor = colors[minIndex];
|
|
1102
|
-
return nearestColor;
|
|
1103
|
-
};
|
|
1104
|
-
}
|
|
1105
|
-
|
|
1106
|
-
/**
|
|
1107
|
-
* Color transformer which returns the negative color
|
|
1108
|
-
*
|
|
1109
|
-
* @public exported from `@promptbook/color`
|
|
1110
|
-
*/
|
|
1111
|
-
function negative(color) {
|
|
1112
|
-
const r = 255 - color.red;
|
|
1113
|
-
const g = 255 - color.green;
|
|
1114
|
-
const b = 255 - color.blue;
|
|
1115
|
-
return Color.fromValues(r, g, b, color.alpha);
|
|
1116
|
-
}
|
|
1117
|
-
|
|
1118
|
-
/**
|
|
1119
|
-
* Makes color transformer which finds the furthest color from the given list
|
|
1120
|
-
*
|
|
1121
|
-
* @param colors array of colors to choose from
|
|
1122
|
-
*
|
|
1123
|
-
* @public exported from `@promptbook/color`
|
|
1124
|
-
*/
|
|
1125
|
-
function furthest(...colors) {
|
|
1126
|
-
return (color) => {
|
|
1127
|
-
const furthestColor = negative(nearest(...colors.map(negative))(color));
|
|
1128
|
-
return furthestColor;
|
|
1129
|
-
};
|
|
1130
|
-
}
|
|
1131
|
-
/**
|
|
1132
|
-
* Makes color transformer which finds the best text color (black or white) for the given background color
|
|
1133
|
-
*
|
|
1134
|
-
* @public exported from `@promptbook/color`
|
|
1135
|
-
*/
|
|
1136
|
-
furthest(Color.get('white'), Color.from('black'));
|
|
1137
|
-
|
|
1138
|
-
/**
|
|
1139
|
-
* Makes color transformer which returns a grayscale version of the color
|
|
1140
|
-
*
|
|
1141
|
-
* @param amount from 0 to 1
|
|
1142
|
-
*
|
|
1143
|
-
* @public exported from `@promptbook/color`
|
|
1144
|
-
*/
|
|
1145
|
-
function grayscale(amount) {
|
|
1146
|
-
return ({ red, green, blue, alpha }) => {
|
|
1147
|
-
const average = (red + green + blue) / 3;
|
|
1148
|
-
red = Math.round(average * amount + red * (1 - amount));
|
|
1149
|
-
green = Math.round(average * amount + green * (1 - amount));
|
|
1150
|
-
blue = Math.round(average * amount + blue * (1 - amount));
|
|
1151
|
-
return Color.fromValues(red, green, blue, alpha);
|
|
1152
|
-
};
|
|
1153
|
-
}
|
|
1154
|
-
|
|
1155
1173
|
/**
|
|
1156
1174
|
* Makes color transformer which saturate the given color
|
|
1157
1175
|
*
|
|
@@ -1220,16 +1238,32 @@
|
|
|
1220
1238
|
*
|
|
1221
1239
|
* @public exported from `@promptbook/core`
|
|
1222
1240
|
*/
|
|
1223
|
-
const PROMPTBOOK_COLOR = Color.
|
|
1224
|
-
// <- TODO: [🧠] Using `Color` here increases the package size approx 3kb, maybe remove it
|
|
1241
|
+
const PROMPTBOOK_COLOR = Color.fromString('promptbook');
|
|
1242
|
+
// <- TODO: [🧠][🈵] Using `Color` here increases the package size approx 3kb, maybe remove it
|
|
1225
1243
|
/**
|
|
1226
|
-
*
|
|
1244
|
+
* Colors for syntax highlighting in the `<BookEditor/>`
|
|
1245
|
+
*
|
|
1246
|
+
* TODO: [🗽] Unite branding and make single place for it
|
|
1247
|
+
*
|
|
1248
|
+
* @public exported from `@promptbook/core`
|
|
1249
|
+
*/
|
|
1250
|
+
({
|
|
1251
|
+
TITLE: Color.fromHex('#244EA8'),
|
|
1252
|
+
LINE: Color.fromHex('#eeeeee'),
|
|
1253
|
+
SEPARATOR: Color.fromHex('#cccccc'),
|
|
1254
|
+
COMMITMENT: Color.fromHex('#DA0F78'),
|
|
1255
|
+
PARAMETER: Color.fromHex('#8e44ad'),
|
|
1256
|
+
});
|
|
1257
|
+
// <- TODO: [🧠][🈵] Using `Color` here increases the package size approx 3kb, maybe remove it
|
|
1258
|
+
/**
|
|
1259
|
+
* Chat color of the Promptbook (in chat)
|
|
1227
1260
|
*
|
|
1228
1261
|
* TODO: [🗽] Unite branding and make single place for it
|
|
1229
1262
|
*
|
|
1230
1263
|
* @public exported from `@promptbook/core`
|
|
1231
1264
|
*/
|
|
1232
1265
|
PROMPTBOOK_COLOR.then(lighten(0.1)).then(saturate(0.9)).then(grayscale(0.9));
|
|
1266
|
+
// <- TODO: [🧠][🈵] Using `Color` and `lighten`, `saturate`,... here increases the package size approx 3kb, maybe remove it
|
|
1233
1267
|
/**
|
|
1234
1268
|
* Color of the user (in chat)
|
|
1235
1269
|
*
|
|
@@ -1238,6 +1272,7 @@
|
|
|
1238
1272
|
* @public exported from `@promptbook/core`
|
|
1239
1273
|
*/
|
|
1240
1274
|
Color.fromHex('#1D4ED8');
|
|
1275
|
+
// <- TODO: [🧠][🈵] Using `Color` here increases the package size approx 3kb, maybe remove it
|
|
1241
1276
|
/**
|
|
1242
1277
|
* When the title is not provided, the default title is used
|
|
1243
1278
|
*
|
|
@@ -1351,7 +1386,7 @@
|
|
|
1351
1386
|
*/
|
|
1352
1387
|
class UnexpectedError extends Error {
|
|
1353
1388
|
constructor(message) {
|
|
1354
|
-
super(spaceTrim.spaceTrim((block) => `
|
|
1389
|
+
super(spaceTrim$1.spaceTrim((block) => `
|
|
1355
1390
|
${block(message)}
|
|
1356
1391
|
|
|
1357
1392
|
Note: This error should not happen.
|
|
@@ -1377,7 +1412,7 @@
|
|
|
1377
1412
|
constructor(whatWasThrown) {
|
|
1378
1413
|
const tag = `[🤮]`;
|
|
1379
1414
|
console.error(tag, whatWasThrown);
|
|
1380
|
-
super(spaceTrim.spaceTrim(`
|
|
1415
|
+
super(spaceTrim$1.spaceTrim(`
|
|
1381
1416
|
Non-Error object was thrown
|
|
1382
1417
|
|
|
1383
1418
|
Note: Look for ${tag} in the console for more details
|
|
@@ -1412,6 +1447,8 @@
|
|
|
1412
1447
|
PromptbookFetchError,
|
|
1413
1448
|
UnexpectedError,
|
|
1414
1449
|
WrappedError,
|
|
1450
|
+
NotAllowed,
|
|
1451
|
+
DatabaseError,
|
|
1415
1452
|
// TODO: [🪑]> VersionMismatchError,
|
|
1416
1453
|
};
|
|
1417
1454
|
/**
|
|
@@ -1946,6 +1983,8 @@
|
|
|
1946
1983
|
/**
|
|
1947
1984
|
* Converts a given text to kebab-case format.
|
|
1948
1985
|
*
|
|
1986
|
+
* Note: [🔂] This function is idempotent.
|
|
1987
|
+
*
|
|
1949
1988
|
* @param text The text to be converted.
|
|
1950
1989
|
* @returns The kebab-case formatted string.
|
|
1951
1990
|
* @example 'hello-world'
|
|
@@ -3328,7 +3367,7 @@
|
|
|
3328
3367
|
TODO: [🧠] Is there a better implementation?
|
|
3329
3368
|
> const propertyNames = Object.getOwnPropertyNames(objectValue);
|
|
3330
3369
|
> for (const propertyName of propertyNames) {
|
|
3331
|
-
> const value = (objectValue as
|
|
3370
|
+
> const value = (objectValue as chococake)[propertyName];
|
|
3332
3371
|
> if (value && typeof value === 'object') {
|
|
3333
3372
|
> deepClone(value);
|
|
3334
3373
|
> }
|
|
@@ -3421,6 +3460,8 @@
|
|
|
3421
3460
|
/**
|
|
3422
3461
|
* Normalizes a given text to camelCase format.
|
|
3423
3462
|
*
|
|
3463
|
+
* Note: [🔂] This function is idempotent.
|
|
3464
|
+
*
|
|
3424
3465
|
* @param text The text to be normalized.
|
|
3425
3466
|
* @param _isFirstLetterCapital Whether the first letter should be capitalized.
|
|
3426
3467
|
* @returns The camelCase formatted string.
|
|
@@ -3516,6 +3557,8 @@
|
|
|
3516
3557
|
* Function `validateParameterName` will normalize and validate a parameter name for use in pipelines.
|
|
3517
3558
|
* It removes diacritics, emojis, and quotes, normalizes to camelCase, and checks for reserved names and invalid characters.
|
|
3518
3559
|
*
|
|
3560
|
+
* Note: [🔂] This function is idempotent.
|
|
3561
|
+
*
|
|
3519
3562
|
* @param parameterName The parameter name to validate and normalize.
|
|
3520
3563
|
* @returns The validated and normalized parameter name.
|
|
3521
3564
|
* @throws {ParseError} If the parameter name is empty, reserved, or contains invalid characters.
|
|
@@ -4268,7 +4311,7 @@
|
|
|
4268
4311
|
* @see {@link ModelVariant}
|
|
4269
4312
|
* @public exported from `@promptbook/core`
|
|
4270
4313
|
*/
|
|
4271
|
-
const MODEL_VARIANTS = ['COMPLETION', 'CHAT', 'EMBEDDING' /* <- TODO [🏳] */ /* <- [🤖] */];
|
|
4314
|
+
const MODEL_VARIANTS = ['COMPLETION', 'CHAT', 'IMAGE_GENERATION', 'EMBEDDING' /* <- TODO [🏳] */ /* <- [🤖] */];
|
|
4272
4315
|
|
|
4273
4316
|
/**
|
|
4274
4317
|
* Parses the model command
|
|
@@ -5090,7 +5133,7 @@
|
|
|
5090
5133
|
function getParserForCommand(command) {
|
|
5091
5134
|
const commandParser = COMMANDS.find((commandParser) => commandParser.name === command.type);
|
|
5092
5135
|
if (commandParser === undefined) {
|
|
5093
|
-
throw new UnexpectedError(spaceTrim.spaceTrim((block) => `
|
|
5136
|
+
throw new UnexpectedError(spaceTrim$1.spaceTrim((block) => `
|
|
5094
5137
|
Command ${command.type} parser is not found
|
|
5095
5138
|
|
|
5096
5139
|
${block(JSON.stringify(command, null, 4)
|
|
@@ -5166,7 +5209,7 @@
|
|
|
5166
5209
|
.map(removeMarkdownFormatting)
|
|
5167
5210
|
.map((item) => item.trim());
|
|
5168
5211
|
if (items.length === 0 || items[0] === '') {
|
|
5169
|
-
throw new ParseError(spaceTrim.spaceTrim((block) => `
|
|
5212
|
+
throw new ParseError(spaceTrim$1.spaceTrim((block) => `
|
|
5170
5213
|
Malformed command:
|
|
5171
5214
|
- ${raw}
|
|
5172
5215
|
|
|
@@ -5202,7 +5245,7 @@
|
|
|
5202
5245
|
return command;
|
|
5203
5246
|
}
|
|
5204
5247
|
}
|
|
5205
|
-
throw new ParseError(spaceTrim.spaceTrim((block) => `
|
|
5248
|
+
throw new ParseError(spaceTrim$1.spaceTrim((block) => `
|
|
5206
5249
|
Malformed or unknown command:
|
|
5207
5250
|
- ${raw}
|
|
5208
5251
|
|
|
@@ -5253,7 +5296,7 @@
|
|
|
5253
5296
|
if (!(error instanceof ParseError)) {
|
|
5254
5297
|
throw error;
|
|
5255
5298
|
}
|
|
5256
|
-
throw new ParseError(spaceTrim.spaceTrim((block) => `
|
|
5299
|
+
throw new ParseError(spaceTrim$1.spaceTrim((block) => `
|
|
5257
5300
|
Invalid ${commandName} command:
|
|
5258
5301
|
|
|
5259
5302
|
Your command:
|
|
@@ -5530,6 +5573,8 @@
|
|
|
5530
5573
|
* Function `validatePipelineString` will validate the if the string is a valid pipeline string
|
|
5531
5574
|
* It does not check if the string is fully logically correct, but if it is a string that can be a pipeline string or the string looks completely different.
|
|
5532
5575
|
*
|
|
5576
|
+
* Note: [🔂] This function is idempotent.
|
|
5577
|
+
*
|
|
5533
5578
|
* @param {string} pipelineString the candidate for a pipeline string
|
|
5534
5579
|
* @returns {PipelineString} the same string as input, but validated as valid
|
|
5535
5580
|
* @throws {ParseError} if the string is not a valid pipeline string
|
|
@@ -5563,6 +5608,48 @@
|
|
|
5563
5608
|
const SUPPORTED_SCRIPT_LANGUAGES = ['javascript', 'typescript', 'python'];
|
|
5564
5609
|
// <- TODO: [🏥] DRY
|
|
5565
5610
|
|
|
5611
|
+
/**
|
|
5612
|
+
* Number of padding lines to add at the end of the book content
|
|
5613
|
+
*
|
|
5614
|
+
* @public exported from `@promptbook/core`
|
|
5615
|
+
*/
|
|
5616
|
+
const PADDING_LINES = 11;
|
|
5617
|
+
/**
|
|
5618
|
+
* A function that adds padding to the book content
|
|
5619
|
+
*
|
|
5620
|
+
* Note: [🔂] This function is idempotent.
|
|
5621
|
+
*
|
|
5622
|
+
* @public exported from `@promptbook/core`
|
|
5623
|
+
*/
|
|
5624
|
+
function padBook(content) {
|
|
5625
|
+
if (!content) {
|
|
5626
|
+
return '\n'.repeat(PADDING_LINES);
|
|
5627
|
+
}
|
|
5628
|
+
const lines = content.split('\n');
|
|
5629
|
+
let trailingEmptyLines = 0;
|
|
5630
|
+
for (let i = lines.length - 1; i >= 0; i--) {
|
|
5631
|
+
const line = lines[i];
|
|
5632
|
+
if (line === undefined) {
|
|
5633
|
+
// Note: This should not happen in reality, but it's here to satisfy TypeScript's noUncheckedIndexedAccess option
|
|
5634
|
+
continue;
|
|
5635
|
+
}
|
|
5636
|
+
if (line.trim() === '') {
|
|
5637
|
+
trailingEmptyLines++;
|
|
5638
|
+
}
|
|
5639
|
+
else {
|
|
5640
|
+
break;
|
|
5641
|
+
}
|
|
5642
|
+
}
|
|
5643
|
+
if (trailingEmptyLines >= PADDING_LINES) {
|
|
5644
|
+
return content;
|
|
5645
|
+
}
|
|
5646
|
+
const linesToAdd = PADDING_LINES - trailingEmptyLines;
|
|
5647
|
+
return (content + '\n'.repeat(linesToAdd));
|
|
5648
|
+
}
|
|
5649
|
+
/**
|
|
5650
|
+
* TODO: [🧠] Maybe export
|
|
5651
|
+
*/
|
|
5652
|
+
|
|
5566
5653
|
/**
|
|
5567
5654
|
* Removes Markdown (or HTML) comments
|
|
5568
5655
|
*
|
|
@@ -5571,7 +5658,7 @@
|
|
|
5571
5658
|
* @public exported from `@promptbook/markdown-utils`
|
|
5572
5659
|
*/
|
|
5573
5660
|
function removeMarkdownComments(content) {
|
|
5574
|
-
return spaceTrim.spaceTrim(content.replace(/<!--(.*?)-->/gs, ''));
|
|
5661
|
+
return spaceTrim$1.spaceTrim(content.replace(/<!--(.*?)-->/gs, ''));
|
|
5575
5662
|
}
|
|
5576
5663
|
|
|
5577
5664
|
/**
|
|
@@ -5608,6 +5695,7 @@
|
|
|
5608
5695
|
if (!isFlatPipeline(pipelineString)) {
|
|
5609
5696
|
return pipelineString;
|
|
5610
5697
|
}
|
|
5698
|
+
pipelineString = spaceTrim__default["default"](pipelineString);
|
|
5611
5699
|
const pipelineStringLines = pipelineString.split('\n');
|
|
5612
5700
|
const potentialReturnStatement = pipelineStringLines.pop();
|
|
5613
5701
|
let returnStatement;
|
|
@@ -5642,7 +5730,7 @@
|
|
|
5642
5730
|
${returnStatement}
|
|
5643
5731
|
`));
|
|
5644
5732
|
// <- TODO: Maybe use book` notation
|
|
5645
|
-
return pipelineString;
|
|
5733
|
+
return padBook(pipelineString);
|
|
5646
5734
|
}
|
|
5647
5735
|
/**
|
|
5648
5736
|
* TODO: Unit test
|
|
@@ -5914,6 +6002,8 @@
|
|
|
5914
6002
|
/**
|
|
5915
6003
|
* Converts a title string into a normalized name.
|
|
5916
6004
|
*
|
|
6005
|
+
* Note: [🔂] This function is idempotent.
|
|
6006
|
+
*
|
|
5917
6007
|
* @param value The title string to be converted to a name.
|
|
5918
6008
|
* @returns A normalized name derived from the input title.
|
|
5919
6009
|
* @example 'Hello World!' -> 'hello-world'
|
|
@@ -5987,7 +6077,7 @@
|
|
|
5987
6077
|
}
|
|
5988
6078
|
catch (error) {
|
|
5989
6079
|
assertsError(error);
|
|
5990
|
-
throw new ParseError(spaceTrim.spaceTrim((block) => `
|
|
6080
|
+
throw new ParseError(spaceTrim$1.spaceTrim((block) => `
|
|
5991
6081
|
Can not extract variables from the script
|
|
5992
6082
|
${block(error.stack || error.message)}
|
|
5993
6083
|
|
|
@@ -6129,7 +6219,7 @@
|
|
|
6129
6219
|
if (pipelineString.startsWith('#!')) {
|
|
6130
6220
|
const [shebangLine, ...restLines] = pipelineString.split('\n');
|
|
6131
6221
|
if (!(shebangLine || '').includes('ptbk')) {
|
|
6132
|
-
throw new ParseError(spaceTrim.spaceTrim((block) => `
|
|
6222
|
+
throw new ParseError(spaceTrim$1.spaceTrim((block) => `
|
|
6133
6223
|
It seems that you try to parse a book file which has non-standard shebang line for book files:
|
|
6134
6224
|
Shebang line must contain 'ptbk'
|
|
6135
6225
|
|
|
@@ -6145,7 +6235,7 @@
|
|
|
6145
6235
|
pipelineString = validatePipelineString(restLines.join('\n'));
|
|
6146
6236
|
}
|
|
6147
6237
|
pipelineString = removeMarkdownComments(pipelineString);
|
|
6148
|
-
pipelineString = spaceTrim.spaceTrim(pipelineString);
|
|
6238
|
+
pipelineString = spaceTrim$1.spaceTrim(pipelineString);
|
|
6149
6239
|
// <- TODO: [😧] `spaceTrim` should preserve discriminated type *(or at lease `PipelineString`)*
|
|
6150
6240
|
pipelineString = deflatePipeline(pipelineString);
|
|
6151
6241
|
// ==============
|
|
@@ -6157,7 +6247,7 @@
|
|
|
6157
6247
|
// ==============
|
|
6158
6248
|
// Note: 1️⃣◽4️⃣ Check markdown structure
|
|
6159
6249
|
if (pipelineHead === undefined) {
|
|
6160
|
-
throw new UnexpectedError(spaceTrim.spaceTrim((block) => `
|
|
6250
|
+
throw new UnexpectedError(spaceTrim$1.spaceTrim((block) => `
|
|
6161
6251
|
Pipeline head is not defined
|
|
6162
6252
|
|
|
6163
6253
|
${block(getPipelineIdentification())}
|
|
@@ -6166,7 +6256,7 @@
|
|
|
6166
6256
|
`));
|
|
6167
6257
|
}
|
|
6168
6258
|
if (pipelineHead.level !== 1) {
|
|
6169
|
-
throw new UnexpectedError(spaceTrim.spaceTrim((block) => `
|
|
6259
|
+
throw new UnexpectedError(spaceTrim$1.spaceTrim((block) => `
|
|
6170
6260
|
Pipeline head is not h1
|
|
6171
6261
|
|
|
6172
6262
|
${block(getPipelineIdentification())}
|
|
@@ -6175,7 +6265,7 @@
|
|
|
6175
6265
|
`));
|
|
6176
6266
|
}
|
|
6177
6267
|
if (!pipelineSections.every((section) => section.level === 2)) {
|
|
6178
|
-
throw new UnexpectedError(spaceTrim.spaceTrim((block) => `
|
|
6268
|
+
throw new UnexpectedError(spaceTrim$1.spaceTrim((block) => `
|
|
6179
6269
|
Not every pipeline section is h2
|
|
6180
6270
|
|
|
6181
6271
|
${block(getPipelineIdentification())}
|
|
@@ -6188,7 +6278,7 @@
|
|
|
6188
6278
|
const defineParam = (parameterCommand) => {
|
|
6189
6279
|
const { parameterName, parameterDescription, isInput, isOutput } = parameterCommand;
|
|
6190
6280
|
if (RESERVED_PARAMETER_NAMES.includes(parameterName)) {
|
|
6191
|
-
throw new ParseError(spaceTrim.spaceTrim((block) => `
|
|
6281
|
+
throw new ParseError(spaceTrim$1.spaceTrim((block) => `
|
|
6192
6282
|
Parameter name {${parameterName}} is reserved and cannot be used as resulting parameter name
|
|
6193
6283
|
|
|
6194
6284
|
${block(getPipelineIdentification())}
|
|
@@ -6199,7 +6289,7 @@
|
|
|
6199
6289
|
existingParameter.description &&
|
|
6200
6290
|
existingParameter.description !== parameterDescription &&
|
|
6201
6291
|
parameterDescription) {
|
|
6202
|
-
throw new ParseError(spaceTrim.spaceTrim((block) => `
|
|
6292
|
+
throw new ParseError(spaceTrim$1.spaceTrim((block) => `
|
|
6203
6293
|
Parameter \`{${parameterName}}\` is defined multiple times with different description:
|
|
6204
6294
|
|
|
6205
6295
|
${block(getPipelineIdentification())}
|
|
@@ -6237,7 +6327,7 @@
|
|
|
6237
6327
|
description = description.split(/^>.*$/gm).join('');
|
|
6238
6328
|
//Note: Remove lists and return statement - TODO: [🎾] Make util (exported from `@promptbool/utils`)
|
|
6239
6329
|
description = description.split(/^(?:(?:-)|(?:\d\))|(?:`?->))\s+.*$/gm).join('');
|
|
6240
|
-
description = spaceTrim.spaceTrim(description);
|
|
6330
|
+
description = spaceTrim$1.spaceTrim(description);
|
|
6241
6331
|
if (description === '') {
|
|
6242
6332
|
description = undefined;
|
|
6243
6333
|
}
|
|
@@ -6248,7 +6338,7 @@
|
|
|
6248
6338
|
const command = parseCommand(listItem, 'PIPELINE_HEAD');
|
|
6249
6339
|
const commandParser = getParserForCommand(command);
|
|
6250
6340
|
if (commandParser.isUsedInPipelineHead !== true /* <- Note: [🦦][4] */) {
|
|
6251
|
-
throw new ParseError(spaceTrim.spaceTrim((block) => `
|
|
6341
|
+
throw new ParseError(spaceTrim$1.spaceTrim((block) => `
|
|
6252
6342
|
Command \`${command.type}\` is not allowed in the head of the pipeline ONLY at the pipeline task
|
|
6253
6343
|
|
|
6254
6344
|
${block(getPipelineIdentification())}
|
|
@@ -6262,7 +6352,7 @@
|
|
|
6262
6352
|
if (!(error instanceof ParseError)) {
|
|
6263
6353
|
throw error;
|
|
6264
6354
|
}
|
|
6265
|
-
throw new ParseError(spaceTrim.spaceTrim((block) => `
|
|
6355
|
+
throw new ParseError(spaceTrim$1.spaceTrim((block) => `
|
|
6266
6356
|
Command ${command.type} failed to apply to the pipeline
|
|
6267
6357
|
|
|
6268
6358
|
The error:
|
|
@@ -6315,7 +6405,7 @@
|
|
|
6315
6405
|
description = description.split(/^>.*$/gm).join('');
|
|
6316
6406
|
//Note: Remove lists and return statement - TODO: [🎾]
|
|
6317
6407
|
description = description.split(/^(?:(?:-)|(?:\d\))|(?:`?->))\s+.*$/gm).join('');
|
|
6318
|
-
description = spaceTrim.spaceTrim(description);
|
|
6408
|
+
description = spaceTrim$1.spaceTrim(description);
|
|
6319
6409
|
if (description === '') {
|
|
6320
6410
|
description = undefined;
|
|
6321
6411
|
}
|
|
@@ -6349,7 +6439,7 @@
|
|
|
6349
6439
|
for (const { listItem, command } of commands) {
|
|
6350
6440
|
const commandParser = getParserForCommand(command);
|
|
6351
6441
|
if (commandParser.isUsedInPipelineTask !== true /* <- Note: [🦦][4] */) {
|
|
6352
|
-
throw new ParseError(spaceTrim.spaceTrim((block) => `
|
|
6442
|
+
throw new ParseError(spaceTrim$1.spaceTrim((block) => `
|
|
6353
6443
|
Command \`${command.type}\` is not allowed in the task of the promptbook ONLY at the pipeline head
|
|
6354
6444
|
|
|
6355
6445
|
${block(getPipelineIdentification())}
|
|
@@ -6364,7 +6454,7 @@
|
|
|
6364
6454
|
if (!(error instanceof ParseError)) {
|
|
6365
6455
|
throw error;
|
|
6366
6456
|
}
|
|
6367
|
-
throw new ParseError(spaceTrim.spaceTrim((block) => `
|
|
6457
|
+
throw new ParseError(spaceTrim$1.spaceTrim((block) => `
|
|
6368
6458
|
Command \`${command.type}\` failed to apply to the task
|
|
6369
6459
|
|
|
6370
6460
|
The error:
|
|
@@ -6395,14 +6485,14 @@
|
|
|
6395
6485
|
// TODO: [🍧] Should be done in SECTION command
|
|
6396
6486
|
if ($taskJson.taskType === 'SCRIPT_TASK') {
|
|
6397
6487
|
if (!language) {
|
|
6398
|
-
throw new ParseError(spaceTrim.spaceTrim((block) => `
|
|
6488
|
+
throw new ParseError(spaceTrim$1.spaceTrim((block) => `
|
|
6399
6489
|
You must specify the language of the script in the \`SCRIPT\` task
|
|
6400
6490
|
|
|
6401
6491
|
${block(getPipelineIdentification())}
|
|
6402
6492
|
`));
|
|
6403
6493
|
}
|
|
6404
6494
|
if (!SUPPORTED_SCRIPT_LANGUAGES.includes(language)) {
|
|
6405
|
-
throw new ParseError(spaceTrim.spaceTrim((block) => `
|
|
6495
|
+
throw new ParseError(spaceTrim$1.spaceTrim((block) => `
|
|
6406
6496
|
Script language ${language} is not supported.
|
|
6407
6497
|
|
|
6408
6498
|
Supported languages are:
|