@promptbook/anthropic-claude 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 +93 -66
- package/esm/index.es.js +181 -122
- 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 +8 -8
- package/umd/index.umd.js +179 -120
- 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/esm/index.es.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import spaceTrim, { spaceTrim as spaceTrim$1 } from 'spacetrim';
|
|
1
|
+
import spaceTrim$2, { spaceTrim as spaceTrim$1 } from 'spacetrim';
|
|
2
2
|
import Anthropic from '@anthropic-ai/sdk';
|
|
3
3
|
import Bottleneck from 'bottleneck';
|
|
4
4
|
import colors from 'colors';
|
|
@@ -12,14 +12,14 @@ import { io } from 'socket.io-client';
|
|
|
12
12
|
* @generated
|
|
13
13
|
* @see https://github.com/webgptorg/book
|
|
14
14
|
*/
|
|
15
|
-
const BOOK_LANGUAGE_VERSION = '
|
|
15
|
+
const BOOK_LANGUAGE_VERSION = '2.0.0';
|
|
16
16
|
/**
|
|
17
17
|
* The version of the Promptbook engine
|
|
18
18
|
*
|
|
19
19
|
* @generated
|
|
20
20
|
* @see https://github.com/webgptorg/promptbook
|
|
21
21
|
*/
|
|
22
|
-
const PROMPTBOOK_ENGINE_VERSION = '0.103.0
|
|
22
|
+
const PROMPTBOOK_ENGINE_VERSION = '0.103.0';
|
|
23
23
|
/**
|
|
24
24
|
* TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
|
|
25
25
|
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
@@ -67,6 +67,17 @@ function $deepFreeze(objectValue) {
|
|
|
67
67
|
* TODO: [🧠] Is there a way how to meaningfully test this utility
|
|
68
68
|
*/
|
|
69
69
|
|
|
70
|
+
/**
|
|
71
|
+
* Trims string from all 4 sides
|
|
72
|
+
*
|
|
73
|
+
* Note: This is a re-exported function from the `spacetrim` package which is
|
|
74
|
+
* Developed by same author @hejny as this package
|
|
75
|
+
*
|
|
76
|
+
* @public exported from `@promptbook/utils`
|
|
77
|
+
* @see https://github.com/hejny/spacetrim#usage
|
|
78
|
+
*/
|
|
79
|
+
const spaceTrim = spaceTrim$1;
|
|
80
|
+
|
|
70
81
|
/**
|
|
71
82
|
* @private util of `@promptbook/color`
|
|
72
83
|
* @de
|
|
@@ -115,6 +126,7 @@ function take(initialValue) {
|
|
|
115
126
|
* @public exported from `@promptbook/color`
|
|
116
127
|
*/
|
|
117
128
|
const CSS_COLORS = {
|
|
129
|
+
promptbook: '#79EAFD',
|
|
118
130
|
transparent: 'rgba(0,0,0,0)',
|
|
119
131
|
aliceblue: '#f0f8ff',
|
|
120
132
|
antiquewhite: '#faebd7',
|
|
@@ -296,9 +308,6 @@ function checkChannelValue(channelName, value) {
|
|
|
296
308
|
throw new Error(`${channelName} channel is greater than 255, it is ${value}`);
|
|
297
309
|
}
|
|
298
310
|
}
|
|
299
|
-
/**
|
|
300
|
-
* TODO: [🧠][🚓] Is/which combination it better to use asserts/check, validate or is utility function?
|
|
301
|
-
*/
|
|
302
311
|
|
|
303
312
|
/**
|
|
304
313
|
* Color object represents an RGB color with alpha channel
|
|
@@ -318,21 +327,61 @@ class Color {
|
|
|
318
327
|
* @param color
|
|
319
328
|
* @returns Color object
|
|
320
329
|
*/
|
|
321
|
-
static from(color) {
|
|
322
|
-
if (color
|
|
330
|
+
static from(color, _isSingleValue = false) {
|
|
331
|
+
if (color === '') {
|
|
332
|
+
throw new Error(`Can not create color from empty string`);
|
|
333
|
+
}
|
|
334
|
+
else if (color instanceof Color) {
|
|
323
335
|
return take(color);
|
|
324
336
|
}
|
|
325
337
|
else if (Color.isColor(color)) {
|
|
326
338
|
return take(color);
|
|
327
339
|
}
|
|
328
340
|
else if (typeof color === 'string') {
|
|
329
|
-
|
|
341
|
+
try {
|
|
342
|
+
return Color.fromString(color);
|
|
343
|
+
}
|
|
344
|
+
catch (error) {
|
|
345
|
+
// <- Note: Can not use `assertsError(error)` here because it causes circular dependency
|
|
346
|
+
if (_isSingleValue) {
|
|
347
|
+
throw error;
|
|
348
|
+
}
|
|
349
|
+
const parts = color.split(/[\s+,;|]/);
|
|
350
|
+
if (parts.length > 0) {
|
|
351
|
+
return Color.from(parts[0].trim(), true);
|
|
352
|
+
}
|
|
353
|
+
else {
|
|
354
|
+
throw new Error(`Can not create color from given string "${color}"`);
|
|
355
|
+
}
|
|
356
|
+
}
|
|
330
357
|
}
|
|
331
358
|
else {
|
|
332
359
|
console.error({ color });
|
|
333
360
|
throw new Error(`Can not create color from given object`);
|
|
334
361
|
}
|
|
335
362
|
}
|
|
363
|
+
/**
|
|
364
|
+
* Creates a new Color instance from miscellaneous formats
|
|
365
|
+
* It just does not throw error when it fails, it returns PROMPTBOOK_COLOR instead
|
|
366
|
+
*
|
|
367
|
+
* @param color
|
|
368
|
+
* @returns Color object
|
|
369
|
+
*/
|
|
370
|
+
static fromSafe(color) {
|
|
371
|
+
try {
|
|
372
|
+
return Color.from(color);
|
|
373
|
+
}
|
|
374
|
+
catch (error) {
|
|
375
|
+
// <- Note: Can not use `assertsError(error)` here because it causes circular dependency
|
|
376
|
+
console.warn(spaceTrim((block) => `
|
|
377
|
+
Color.fromSafe error:
|
|
378
|
+
${block(error.message)}
|
|
379
|
+
|
|
380
|
+
Returning default PROMPTBOOK_COLOR.
|
|
381
|
+
`));
|
|
382
|
+
return Color.fromString('promptbook');
|
|
383
|
+
}
|
|
384
|
+
}
|
|
336
385
|
/**
|
|
337
386
|
* Creates a new Color instance from miscellaneous string formats
|
|
338
387
|
*
|
|
@@ -400,6 +449,9 @@ class Color {
|
|
|
400
449
|
if (hex.length === 3) {
|
|
401
450
|
return Color.fromHex3(hex);
|
|
402
451
|
}
|
|
452
|
+
if (hex.length === 4) {
|
|
453
|
+
return Color.fromHex4(hex);
|
|
454
|
+
}
|
|
403
455
|
if (hex.length === 6) {
|
|
404
456
|
return Color.fromHex6(hex);
|
|
405
457
|
}
|
|
@@ -420,6 +472,19 @@ class Color {
|
|
|
420
472
|
const b = parseInt(hex.substr(2, 1), 16) * 16;
|
|
421
473
|
return take(new Color(r, g, b));
|
|
422
474
|
}
|
|
475
|
+
/**
|
|
476
|
+
* Creates a new Color instance from color in hex format with 4 digits (with alpha channel)
|
|
477
|
+
*
|
|
478
|
+
* @param color in hex for example `09df`
|
|
479
|
+
* @returns Color object
|
|
480
|
+
*/
|
|
481
|
+
static fromHex4(hex) {
|
|
482
|
+
const r = parseInt(hex.substr(0, 1), 16) * 16;
|
|
483
|
+
const g = parseInt(hex.substr(1, 1), 16) * 16;
|
|
484
|
+
const b = parseInt(hex.substr(2, 1), 16) * 16;
|
|
485
|
+
const a = parseInt(hex.substr(3, 1), 16) * 16;
|
|
486
|
+
return take(new Color(r, g, b, a));
|
|
487
|
+
}
|
|
423
488
|
/**
|
|
424
489
|
* Creates a new Color instance from color in hex format with 6 color digits (without alpha channel)
|
|
425
490
|
*
|
|
@@ -610,7 +675,8 @@ class Color {
|
|
|
610
675
|
* @returns true if the value is a valid hex color string (e.g., `#009edd`, `#fff`, etc.)
|
|
611
676
|
*/
|
|
612
677
|
static isHexColorString(value) {
|
|
613
|
-
return typeof value === 'string' &&
|
|
678
|
+
return (typeof value === 'string' &&
|
|
679
|
+
/^#(?:[0-9a-fA-F]{3}|[0-9a-fA-F]{4}|[0-9a-fA-F]{6}|[0-9a-fA-F]{8})$/.test(value));
|
|
614
680
|
}
|
|
615
681
|
/**
|
|
616
682
|
* Creates new Color object
|
|
@@ -725,6 +791,23 @@ class Color {
|
|
|
725
791
|
* TODO: Maybe connect with textures
|
|
726
792
|
*/
|
|
727
793
|
|
|
794
|
+
/**
|
|
795
|
+
* Makes color transformer which returns a grayscale version of the color
|
|
796
|
+
*
|
|
797
|
+
* @param amount from 0 to 1
|
|
798
|
+
*
|
|
799
|
+
* @public exported from `@promptbook/color`
|
|
800
|
+
*/
|
|
801
|
+
function grayscale(amount) {
|
|
802
|
+
return ({ red, green, blue, alpha }) => {
|
|
803
|
+
const average = (red + green + blue) / 3;
|
|
804
|
+
red = Math.round(average * amount + red * (1 - amount));
|
|
805
|
+
green = Math.round(average * amount + green * (1 - amount));
|
|
806
|
+
blue = Math.round(average * amount + blue * (1 - amount));
|
|
807
|
+
return Color.fromValues(red, green, blue, alpha);
|
|
808
|
+
};
|
|
809
|
+
}
|
|
810
|
+
|
|
728
811
|
/**
|
|
729
812
|
* Converts HSL values to RGB values
|
|
730
813
|
*
|
|
@@ -840,102 +923,6 @@ function lighten(amount) {
|
|
|
840
923
|
* TODO: Maybe implement by mix+hsl
|
|
841
924
|
*/
|
|
842
925
|
|
|
843
|
-
/**
|
|
844
|
-
* Calculates distance between two colors
|
|
845
|
-
*
|
|
846
|
-
* @param color1 first color
|
|
847
|
-
* @param color2 second color
|
|
848
|
-
*
|
|
849
|
-
* Note: This function is inefficient. Use colorDistanceSquared instead if possible.
|
|
850
|
-
*
|
|
851
|
-
* @public exported from `@promptbook/color`
|
|
852
|
-
*/
|
|
853
|
-
/**
|
|
854
|
-
* Calculates distance between two colors without square root
|
|
855
|
-
*
|
|
856
|
-
* @param color1 first color
|
|
857
|
-
* @param color2 second color
|
|
858
|
-
*
|
|
859
|
-
* @public exported from `@promptbook/color`
|
|
860
|
-
*/
|
|
861
|
-
function colorDistanceSquared(color1, color2) {
|
|
862
|
-
const rmean = (color1.red + color2.red) / 2;
|
|
863
|
-
const r = color1.red - color2.red;
|
|
864
|
-
const g = color1.green - color2.green;
|
|
865
|
-
const b = color1.blue - color2.blue;
|
|
866
|
-
const weightR = 2 + rmean / 256;
|
|
867
|
-
const weightG = 4.0;
|
|
868
|
-
const weightB = 2 + (255 - rmean) / 256;
|
|
869
|
-
const distance = weightR * r * r + weightG * g * g + weightB * b * b;
|
|
870
|
-
return distance;
|
|
871
|
-
}
|
|
872
|
-
|
|
873
|
-
/**
|
|
874
|
-
* Makes color transformer which finds the nearest color from the given list
|
|
875
|
-
*
|
|
876
|
-
* @param colors array of colors to choose from
|
|
877
|
-
*
|
|
878
|
-
* @public exported from `@promptbook/color`
|
|
879
|
-
*/
|
|
880
|
-
function nearest(...colors) {
|
|
881
|
-
return (color) => {
|
|
882
|
-
const distances = colors.map((c) => colorDistanceSquared(c, color));
|
|
883
|
-
const minDistance = Math.min(...distances);
|
|
884
|
-
const minIndex = distances.indexOf(minDistance);
|
|
885
|
-
const nearestColor = colors[minIndex];
|
|
886
|
-
return nearestColor;
|
|
887
|
-
};
|
|
888
|
-
}
|
|
889
|
-
|
|
890
|
-
/**
|
|
891
|
-
* Color transformer which returns the negative color
|
|
892
|
-
*
|
|
893
|
-
* @public exported from `@promptbook/color`
|
|
894
|
-
*/
|
|
895
|
-
function negative(color) {
|
|
896
|
-
const r = 255 - color.red;
|
|
897
|
-
const g = 255 - color.green;
|
|
898
|
-
const b = 255 - color.blue;
|
|
899
|
-
return Color.fromValues(r, g, b, color.alpha);
|
|
900
|
-
}
|
|
901
|
-
|
|
902
|
-
/**
|
|
903
|
-
* Makes color transformer which finds the furthest color from the given list
|
|
904
|
-
*
|
|
905
|
-
* @param colors array of colors to choose from
|
|
906
|
-
*
|
|
907
|
-
* @public exported from `@promptbook/color`
|
|
908
|
-
*/
|
|
909
|
-
function furthest(...colors) {
|
|
910
|
-
return (color) => {
|
|
911
|
-
const furthestColor = negative(nearest(...colors.map(negative))(color));
|
|
912
|
-
return furthestColor;
|
|
913
|
-
};
|
|
914
|
-
}
|
|
915
|
-
/**
|
|
916
|
-
* Makes color transformer which finds the best text color (black or white) for the given background color
|
|
917
|
-
*
|
|
918
|
-
* @public exported from `@promptbook/color`
|
|
919
|
-
*/
|
|
920
|
-
furthest(Color.get('white'), Color.from('black'));
|
|
921
|
-
|
|
922
|
-
/**
|
|
923
|
-
* Makes color transformer which returns a grayscale version of the color
|
|
924
|
-
*
|
|
925
|
-
* @param amount from 0 to 1
|
|
926
|
-
*
|
|
927
|
-
* @public exported from `@promptbook/color`
|
|
928
|
-
*/
|
|
929
|
-
function grayscale(amount) {
|
|
930
|
-
return ({ red, green, blue, alpha }) => {
|
|
931
|
-
const average = (red + green + blue) / 3;
|
|
932
|
-
red = Math.round(average * amount + red * (1 - amount));
|
|
933
|
-
green = Math.round(average * amount + green * (1 - amount));
|
|
934
|
-
blue = Math.round(average * amount + blue * (1 - amount));
|
|
935
|
-
return Color.fromValues(red, green, blue, alpha);
|
|
936
|
-
};
|
|
937
|
-
}
|
|
938
|
-
|
|
939
926
|
/**
|
|
940
927
|
* Makes color transformer which saturate the given color
|
|
941
928
|
*
|
|
@@ -984,16 +971,32 @@ const ADMIN_GITHUB_NAME = 'hejny';
|
|
|
984
971
|
*
|
|
985
972
|
* @public exported from `@promptbook/core`
|
|
986
973
|
*/
|
|
987
|
-
const PROMPTBOOK_COLOR = Color.
|
|
988
|
-
// <- TODO: [🧠] Using `Color` here increases the package size approx 3kb, maybe remove it
|
|
974
|
+
const PROMPTBOOK_COLOR = Color.fromString('promptbook');
|
|
975
|
+
// <- TODO: [🧠][🈵] Using `Color` here increases the package size approx 3kb, maybe remove it
|
|
989
976
|
/**
|
|
990
|
-
*
|
|
977
|
+
* Colors for syntax highlighting in the `<BookEditor/>`
|
|
978
|
+
*
|
|
979
|
+
* TODO: [🗽] Unite branding and make single place for it
|
|
980
|
+
*
|
|
981
|
+
* @public exported from `@promptbook/core`
|
|
982
|
+
*/
|
|
983
|
+
({
|
|
984
|
+
TITLE: Color.fromHex('#244EA8'),
|
|
985
|
+
LINE: Color.fromHex('#eeeeee'),
|
|
986
|
+
SEPARATOR: Color.fromHex('#cccccc'),
|
|
987
|
+
COMMITMENT: Color.fromHex('#DA0F78'),
|
|
988
|
+
PARAMETER: Color.fromHex('#8e44ad'),
|
|
989
|
+
});
|
|
990
|
+
// <- TODO: [🧠][🈵] Using `Color` here increases the package size approx 3kb, maybe remove it
|
|
991
|
+
/**
|
|
992
|
+
* Chat color of the Promptbook (in chat)
|
|
991
993
|
*
|
|
992
994
|
* TODO: [🗽] Unite branding and make single place for it
|
|
993
995
|
*
|
|
994
996
|
* @public exported from `@promptbook/core`
|
|
995
997
|
*/
|
|
996
998
|
PROMPTBOOK_COLOR.then(lighten(0.1)).then(saturate(0.9)).then(grayscale(0.9));
|
|
999
|
+
// <- TODO: [🧠][🈵] Using `Color` and `lighten`, `saturate`,... here increases the package size approx 3kb, maybe remove it
|
|
997
1000
|
/**
|
|
998
1001
|
* Color of the user (in chat)
|
|
999
1002
|
*
|
|
@@ -1083,7 +1086,7 @@ parseInt(process.env.API_REQUEST_TIMEOUT || '90000');
|
|
|
1083
1086
|
function getErrorReportUrl(error) {
|
|
1084
1087
|
const report = {
|
|
1085
1088
|
title: `🐜 Error report from ${NAME}`,
|
|
1086
|
-
body: spaceTrim((block) => `
|
|
1089
|
+
body: spaceTrim$2((block) => `
|
|
1087
1090
|
|
|
1088
1091
|
|
|
1089
1092
|
\`${error.name || 'Error'}\` has occurred in the [${NAME}], please look into it @${ADMIN_GITHUB_NAME}.
|
|
@@ -1241,7 +1244,7 @@ function checkSerializableAsJson(options) {
|
|
|
1241
1244
|
}
|
|
1242
1245
|
else if (typeof value === 'object') {
|
|
1243
1246
|
if (value instanceof Date) {
|
|
1244
|
-
throw new UnexpectedError(spaceTrim((block) => `
|
|
1247
|
+
throw new UnexpectedError(spaceTrim$2((block) => `
|
|
1245
1248
|
\`${name}\` is Date
|
|
1246
1249
|
|
|
1247
1250
|
Use \`string_date_iso8601\` instead
|
|
@@ -1260,7 +1263,7 @@ function checkSerializableAsJson(options) {
|
|
|
1260
1263
|
throw new UnexpectedError(`${name} is RegExp`);
|
|
1261
1264
|
}
|
|
1262
1265
|
else if (value instanceof Error) {
|
|
1263
|
-
throw new UnexpectedError(spaceTrim((block) => `
|
|
1266
|
+
throw new UnexpectedError(spaceTrim$2((block) => `
|
|
1264
1267
|
\`${name}\` is unserialized Error
|
|
1265
1268
|
|
|
1266
1269
|
Use function \`serializeError\`
|
|
@@ -1283,7 +1286,7 @@ function checkSerializableAsJson(options) {
|
|
|
1283
1286
|
}
|
|
1284
1287
|
catch (error) {
|
|
1285
1288
|
assertsError(error);
|
|
1286
|
-
throw new UnexpectedError(spaceTrim((block) => `
|
|
1289
|
+
throw new UnexpectedError(spaceTrim$2((block) => `
|
|
1287
1290
|
\`${name}\` is not serializable
|
|
1288
1291
|
|
|
1289
1292
|
${block(error.stack || error.message)}
|
|
@@ -1315,7 +1318,7 @@ function checkSerializableAsJson(options) {
|
|
|
1315
1318
|
}
|
|
1316
1319
|
}
|
|
1317
1320
|
else {
|
|
1318
|
-
throw new UnexpectedError(spaceTrim((block) => `
|
|
1321
|
+
throw new UnexpectedError(spaceTrim$2((block) => `
|
|
1319
1322
|
\`${name}\` is unknown type
|
|
1320
1323
|
|
|
1321
1324
|
Additional message for \`${name}\`:
|
|
@@ -1345,7 +1348,7 @@ function deepClone(objectValue) {
|
|
|
1345
1348
|
TODO: [🧠] Is there a better implementation?
|
|
1346
1349
|
> const propertyNames = Object.getOwnPropertyNames(objectValue);
|
|
1347
1350
|
> for (const propertyName of propertyNames) {
|
|
1348
|
-
> const value = (objectValue as
|
|
1351
|
+
> const value = (objectValue as chococake)[propertyName];
|
|
1349
1352
|
> if (value && typeof value === 'object') {
|
|
1350
1353
|
> deepClone(value);
|
|
1351
1354
|
> }
|
|
@@ -1404,7 +1407,7 @@ function pricing(value) {
|
|
|
1404
1407
|
/**
|
|
1405
1408
|
* List of available Anthropic Claude models with pricing
|
|
1406
1409
|
*
|
|
1407
|
-
* Note: Synced with official API docs at 2025-
|
|
1410
|
+
* Note: Synced with official API docs at 2025-11-19
|
|
1408
1411
|
*
|
|
1409
1412
|
* @see https://docs.anthropic.com/en/docs/models-overview
|
|
1410
1413
|
* @public exported from `@promptbook/anthropic-claude`
|
|
@@ -1412,6 +1415,26 @@ function pricing(value) {
|
|
|
1412
1415
|
const ANTHROPIC_CLAUDE_MODELS = exportJson({
|
|
1413
1416
|
name: 'ANTHROPIC_CLAUDE_MODELS',
|
|
1414
1417
|
value: [
|
|
1418
|
+
{
|
|
1419
|
+
modelVariant: 'CHAT',
|
|
1420
|
+
modelTitle: 'Claude Sonnet 4.5',
|
|
1421
|
+
modelName: 'claude-sonnet-4-5-20250929',
|
|
1422
|
+
modelDescription: 'Our smartest model for complex agents and coding',
|
|
1423
|
+
pricing: {
|
|
1424
|
+
prompt: pricing(`$3.00 / 1M tokens`),
|
|
1425
|
+
output: pricing(`$15.00 / 1M tokens`),
|
|
1426
|
+
},
|
|
1427
|
+
},
|
|
1428
|
+
{
|
|
1429
|
+
modelVariant: 'CHAT',
|
|
1430
|
+
modelTitle: 'Claude Haiku 4.5',
|
|
1431
|
+
modelName: 'claude-haiku-4-5-20251001',
|
|
1432
|
+
modelDescription: 'Our fastest model with near-frontier intelligence',
|
|
1433
|
+
pricing: {
|
|
1434
|
+
prompt: pricing(`$1.00 / 1M tokens`),
|
|
1435
|
+
output: pricing(`$5.00 / 1M tokens`),
|
|
1436
|
+
},
|
|
1437
|
+
},
|
|
1415
1438
|
{
|
|
1416
1439
|
modelVariant: 'CHAT',
|
|
1417
1440
|
modelTitle: 'Claude Opus 4.1',
|
|
@@ -1426,7 +1449,7 @@ const ANTHROPIC_CLAUDE_MODELS = exportJson({
|
|
|
1426
1449
|
modelVariant: 'CHAT',
|
|
1427
1450
|
modelTitle: 'Claude Opus 4',
|
|
1428
1451
|
modelName: 'claude-opus-4-20250514',
|
|
1429
|
-
modelDescription: 'Previous flagship Claude model with 200K token context window. Features very high intelligence and capability with exceptional performance across reasoning, coding, and creative tasks. Maintains strong safety guardrails while delivering sophisticated outputs for complex professional applications.',
|
|
1452
|
+
modelDescription: 'Previous flagship Claude model with 200K token context window. Features very high intelligence and capability with exceptional performance across reasoning, coding, and creative tasks. Maintains strong safety guardrails while delivering sophisticated outputs for complex professional applications. DEPRECATED: Use Claude Opus 4.1 instead.',
|
|
1430
1453
|
pricing: {
|
|
1431
1454
|
prompt: pricing(`$15.00 / 1M tokens`),
|
|
1432
1455
|
output: pricing(`$75.00 / 1M tokens`),
|
|
@@ -1436,7 +1459,7 @@ const ANTHROPIC_CLAUDE_MODELS = exportJson({
|
|
|
1436
1459
|
modelVariant: 'CHAT',
|
|
1437
1460
|
modelTitle: 'Claude Sonnet 4',
|
|
1438
1461
|
modelName: 'claude-sonnet-4-20250514',
|
|
1439
|
-
modelDescription: 'High-performance Claude model with exceptional reasoning capabilities and 200K token context window (1M context beta available). Features balanced intelligence and efficiency with enhanced multimodal understanding. Offers optimal performance for most enterprise applications requiring sophisticated AI capabilities.',
|
|
1462
|
+
modelDescription: 'High-performance Claude model with exceptional reasoning capabilities and 200K token context window (1M context beta available). Features balanced intelligence and efficiency with enhanced multimodal understanding. Offers optimal performance for most enterprise applications requiring sophisticated AI capabilities. DEPRECATED: Use Claude Sonnet 4.5 instead.',
|
|
1440
1463
|
pricing: {
|
|
1441
1464
|
prompt: pricing(`$3.00 / 1M tokens`),
|
|
1442
1465
|
output: pricing(`$15.00 / 1M tokens`),
|
|
@@ -1577,6 +1600,7 @@ const ANTHROPIC_CLAUDE_MODELS = exportJson({
|
|
|
1577
1600
|
/**
|
|
1578
1601
|
* Generates random token
|
|
1579
1602
|
*
|
|
1603
|
+
* Note: `$` is used to indicate that this function is not a pure function - it is not deterministic
|
|
1580
1604
|
* Note: This function is cryptographically secure (it uses crypto.randomBytes internally)
|
|
1581
1605
|
*
|
|
1582
1606
|
* @private internal helper function
|
|
@@ -1586,6 +1610,7 @@ function $randomToken(randomness) {
|
|
|
1586
1610
|
return randomBytes(randomness).toString('hex');
|
|
1587
1611
|
}
|
|
1588
1612
|
/**
|
|
1613
|
+
* TODO: [🤶] Maybe export through `@promptbook/utils` or `@promptbook/random` package
|
|
1589
1614
|
* TODO: Maybe use nanoid instead https://github.com/ai/nanoid
|
|
1590
1615
|
*/
|
|
1591
1616
|
|
|
@@ -1871,10 +1896,13 @@ const LINES_PER_STANDARD_PAGE = 44;
|
|
|
1871
1896
|
* @public exported from `@promptbook/utils`
|
|
1872
1897
|
*/
|
|
1873
1898
|
function countLines(text) {
|
|
1899
|
+
if (text === '') {
|
|
1900
|
+
return 0;
|
|
1901
|
+
}
|
|
1874
1902
|
text = text.replace('\r\n', '\n');
|
|
1875
1903
|
text = text.replace('\r', '\n');
|
|
1876
1904
|
const lines = text.split('\n');
|
|
1877
|
-
return lines.reduce((count, line) => count + Math.ceil(line.length / CHARACTERS_PER_STANDARD_LINE), 0);
|
|
1905
|
+
return lines.reduce((count, line) => count + Math.max(Math.ceil(line.length / CHARACTERS_PER_STANDARD_LINE), 1), 0);
|
|
1878
1906
|
}
|
|
1879
1907
|
/**
|
|
1880
1908
|
* TODO: [🥴] Implement counting in formats - like JSON, CSV, XML,...
|
|
@@ -2513,7 +2541,7 @@ class AnthropicClaudeExecutionTools {
|
|
|
2513
2541
|
getDefaultModel(defaultModelName) {
|
|
2514
2542
|
const model = ANTHROPIC_CLAUDE_MODELS.find(({ modelName }) => modelName.startsWith(defaultModelName));
|
|
2515
2543
|
if (model === undefined) {
|
|
2516
|
-
throw new UnexpectedError(spaceTrim((block) => `
|
|
2544
|
+
throw new UnexpectedError(spaceTrim$2((block) => `
|
|
2517
2545
|
Cannot find model in Anthropic Claude models with name "${defaultModelName}" which should be used as default.
|
|
2518
2546
|
|
|
2519
2547
|
Available models:
|
|
@@ -2596,6 +2624,22 @@ class CollectionError extends Error {
|
|
|
2596
2624
|
}
|
|
2597
2625
|
}
|
|
2598
2626
|
|
|
2627
|
+
/**
|
|
2628
|
+
* This error indicates error from the database
|
|
2629
|
+
*
|
|
2630
|
+
* @public exported from `@promptbook/core`
|
|
2631
|
+
*/
|
|
2632
|
+
class DatabaseError extends Error {
|
|
2633
|
+
constructor(message) {
|
|
2634
|
+
super(message);
|
|
2635
|
+
this.name = 'DatabaseError';
|
|
2636
|
+
Object.setPrototypeOf(this, DatabaseError.prototype);
|
|
2637
|
+
}
|
|
2638
|
+
}
|
|
2639
|
+
/**
|
|
2640
|
+
* TODO: [🐱🚀] Explain that NotFoundError ([🐱🚀] and other specific errors) has priority over DatabaseError in some contexts
|
|
2641
|
+
*/
|
|
2642
|
+
|
|
2599
2643
|
/**
|
|
2600
2644
|
* This error type indicates that you try to use a feature that is not available in the current environment
|
|
2601
2645
|
*
|
|
@@ -2656,6 +2700,19 @@ class MissingToolsError extends Error {
|
|
|
2656
2700
|
}
|
|
2657
2701
|
}
|
|
2658
2702
|
|
|
2703
|
+
/**
|
|
2704
|
+
* This error indicates that promptbook operation is not allowed
|
|
2705
|
+
*
|
|
2706
|
+
* @public exported from `@promptbook/core`
|
|
2707
|
+
*/
|
|
2708
|
+
class NotAllowed extends Error {
|
|
2709
|
+
constructor(message) {
|
|
2710
|
+
super(message);
|
|
2711
|
+
this.name = 'NotAllowed';
|
|
2712
|
+
Object.setPrototypeOf(this, NotAllowed.prototype);
|
|
2713
|
+
}
|
|
2714
|
+
}
|
|
2715
|
+
|
|
2659
2716
|
/**
|
|
2660
2717
|
* This error indicates that promptbook not found in the collection
|
|
2661
2718
|
*
|
|
@@ -2771,6 +2828,8 @@ const PROMPTBOOK_ERRORS = {
|
|
|
2771
2828
|
PromptbookFetchError,
|
|
2772
2829
|
UnexpectedError,
|
|
2773
2830
|
WrappedError,
|
|
2831
|
+
NotAllowed,
|
|
2832
|
+
DatabaseError,
|
|
2774
2833
|
// TODO: [🪑]> VersionMismatchError,
|
|
2775
2834
|
};
|
|
2776
2835
|
/**
|
|
@@ -2823,7 +2882,7 @@ function deserializeError(error) {
|
|
|
2823
2882
|
message = `${name}: ${message}`;
|
|
2824
2883
|
}
|
|
2825
2884
|
if (stack !== undefined && stack !== '') {
|
|
2826
|
-
message = spaceTrim((block) => `
|
|
2885
|
+
message = spaceTrim$2((block) => `
|
|
2827
2886
|
${block(message)}
|
|
2828
2887
|
|
|
2829
2888
|
Original stack trace:
|
|
@@ -2880,7 +2939,7 @@ async function createRemoteClient(options) {
|
|
|
2880
2939
|
const remoteServerUrlParsed = new URL(remoteServerUrl);
|
|
2881
2940
|
if (remoteServerUrlParsed.pathname !== '/' && remoteServerUrlParsed.pathname !== '') {
|
|
2882
2941
|
remoteServerUrlParsed.pathname = '/';
|
|
2883
|
-
throw new Error(spaceTrim((block) => `
|
|
2942
|
+
throw new Error(spaceTrim$2((block) => `
|
|
2884
2943
|
Remote server requires root url \`/\`
|
|
2885
2944
|
|
|
2886
2945
|
You have provided \`remoteServerUrl\`:
|