@promptbook/node 0.112.0-34 → 0.112.0-35
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 +18 -0
- package/esm/index.es.js +776 -764
- package/esm/index.es.js.map +1 -1
- package/esm/src/_packages/types.index.d.ts +45 -45
- package/esm/src/book-2.0/agent-source/AgentBasicInformation.d.ts +3 -4
- package/esm/src/book-2.0/agent-source/AgentModelRequirements.d.ts +0 -4
- package/esm/src/book-2.0/agent-source/createAgentModelRequirements.d.ts +7 -0
- package/esm/src/book-2.0/agent-source/createTeamToolName.d.ts +1 -0
- package/esm/src/book-2.0/agent-source/extractOpenTeacherInstructions.d.ts +1 -0
- package/esm/src/book-2.0/agent-source/padBook.d.ts +1 -4
- package/esm/src/book-2.0/agent-source/parseAgentSource.d.ts +0 -3
- package/esm/src/book-2.0/agent-source/parseAgentSourcePrelude.d.ts +1 -0
- package/esm/src/book-2.0/agent-source/parseParameters.d.ts +1 -0
- package/esm/src/book-2.0/agent-source/parseTeamCommitment.d.ts +0 -3
- package/esm/src/book-2.0/agent-source/pseudoAgentReferences.d.ts +8 -3
- package/esm/src/book-2.0/agent-source/string_book.d.ts +1 -0
- package/esm/src/book-2.0/utils/generatePlaceholderAgentProfileImageUrl.d.ts +0 -3
- package/esm/src/book-components/AvatarProfile/AvatarChip/AvatarChip.d.ts +0 -3
- package/esm/src/book-components/AvatarProfile/AvatarProfile/AvatarProfile.d.ts +0 -3
- package/esm/src/book-components/AvatarProfile/AvatarProfile/AvatarProfileTooltip.d.ts +4 -0
- package/esm/src/book-components/BookEditor/BookEditor.d.ts +0 -3
- package/esm/src/book-components/BookEditor/BookEditorActionbar.d.ts +4 -0
- package/esm/src/book-components/BookEditor/BookEditorMonaco.d.ts +2 -0
- package/esm/src/book-components/BookEditor/BookEditorMonacoUploadPanel.d.ts +3 -0
- package/esm/src/book-components/BookEditor/createDeprecatedCommitmentDiagnostics.d.ts +1 -0
- package/esm/src/book-components/BookEditor/useBookEditorMonacoDecorations.d.ts +6 -0
- package/esm/src/book-components/BookEditor/useBookEditorMonacoDiagnostics.d.ts +9 -0
- package/esm/src/book-components/BookEditor/useBookEditorMonacoLanguage.d.ts +7 -0
- package/esm/src/book-components/BookEditor/useBookEditorMonacoStyles.d.ts +3 -0
- package/esm/src/book-components/BookEditor/useBookEditorMonacoUploads.d.ts +24 -0
- package/esm/src/book-components/Chat/AgentChat/AgentChat.d.ts +0 -3
- package/esm/src/book-components/Chat/AgentChip/AgentChip.d.ts +6 -5
- package/esm/src/book-components/Chat/Chat/ChatInputAreaDictationPanel.d.ts +4 -8
- package/esm/src/book-components/Chat/Chat/ChatProps.d.ts +2 -3
- package/esm/src/book-components/Chat/Chat/ChatSelfLearningSummary.d.ts +0 -3
- package/esm/src/book-components/Chat/Chat/ChatToolCallModalComponents.d.ts +0 -3
- package/esm/src/book-components/Chat/Chat/StreamingFeaturePlaceholder.d.ts +1 -0
- package/esm/src/book-components/Chat/Chat/TeamToolCallModalContent.d.ts +1 -0
- package/esm/src/book-components/Chat/Chat/chatCssClassNames.d.ts +1 -0
- package/esm/src/book-components/Chat/Chat/constants.d.ts +4 -3
- package/esm/src/book-components/Chat/Chat/insertDictationChunk.d.ts +16 -0
- package/esm/src/book-components/Chat/Chat/learnDictationDictionary.d.ts +7 -0
- package/esm/src/book-components/Chat/Chat/refineFinalDictationChunk.d.ts +36 -0
- package/esm/src/book-components/Chat/Chat/renderAdvancedToolCallDetails.d.ts +3 -0
- package/esm/src/book-components/Chat/Chat/renderEmailToolCallDetails.d.ts +1 -0
- package/esm/src/book-components/Chat/Chat/renderMemoryToolCallDetails.d.ts +1 -0
- package/esm/src/book-components/Chat/Chat/renderPopupToolCallDetails.d.ts +1 -0
- package/esm/src/book-components/Chat/Chat/renderRunBrowserToolCallDetails.d.ts +1 -0
- package/esm/src/book-components/Chat/Chat/renderSearchToolCallDetails.d.ts +1 -0
- package/esm/src/book-components/Chat/Chat/renderSelfLearningToolCallDetails.d.ts +1 -0
- package/esm/src/book-components/Chat/Chat/renderTimeToolCallDetails.d.ts +1 -0
- package/esm/src/book-components/Chat/Chat/renderTimeoutToolCallDetails.d.ts +1 -0
- package/esm/src/book-components/Chat/Chat/renderToolCallClockPanel.d.ts +1 -0
- package/esm/src/book-components/Chat/Chat/renderToolCallDetails.d.ts +1 -0
- package/esm/src/book-components/Chat/Chat/renderToolCallProgressPlaceholder.d.ts +1 -0
- package/esm/src/book-components/Chat/Chat/renderWalletCredentialToolCallDetails.d.ts +1 -0
- package/esm/src/book-components/Chat/Chat/resolveSpeechRecognitionUiDescriptor.d.ts +30 -0
- package/esm/src/book-components/Chat/Chat/resolveToolCallProgressMessage.d.ts +1 -0
- package/esm/src/book-components/Chat/Chat/useChatInputAreaDictation.d.ts +7 -30
- package/esm/src/book-components/Chat/Chat/useChatInputAreaDictationPersistence.d.ts +20 -0
- package/esm/src/book-components/Chat/Chat/useChatInputAreaDictationSupport.d.ts +29 -0
- package/esm/src/book-components/Chat/LlmChat/defaults.d.ts +0 -3
- package/esm/src/book-components/Chat/MarkdownContent/MarkdownContent.d.ts +3 -3
- package/esm/src/book-components/Chat/MockedChat/constants.d.ts +0 -3
- package/esm/src/book-components/Chat/SourceChip/SourceChip.d.ts +4 -3
- package/esm/src/book-components/Chat/effects/components/ConfettiEffect.d.ts +3 -0
- package/esm/src/book-components/Chat/effects/components/HeartsEffect.d.ts +3 -0
- package/esm/src/book-components/Chat/effects/index.d.ts +0 -4
- package/esm/src/book-components/Chat/effects/utils/detectEffects.d.ts +1 -0
- package/esm/src/book-components/Chat/hooks/useSendMessageToLlmChat.d.ts +4 -4
- package/esm/src/book-components/Chat/save/_common/string_chat_format_name.d.ts +1 -0
- package/esm/src/book-components/Chat/save/html/htmlSaveFormatDefinition.d.ts +0 -3
- package/esm/src/book-components/Chat/save/index.d.ts +0 -3
- package/esm/src/book-components/Chat/save/pdf/buildChatPdf.d.ts +1 -0
- package/esm/src/book-components/Chat/save/pdf/pdfSaveFormatDefinition.d.ts +0 -4
- package/esm/src/book-components/Chat/types/ChatMessage.d.ts +3 -5
- package/esm/src/book-components/Chat/types/ChatParticipant.d.ts +0 -3
- package/esm/src/book-components/Chat/utils/ExportFormat.d.ts +2 -0
- package/esm/src/book-components/Chat/utils/citationHelpers.d.ts +4 -3
- package/esm/src/book-components/Chat/utils/collectTeamToolCallSummary.d.ts +1 -0
- package/esm/src/book-components/Chat/utils/createCitationFootnoteRenderModel.d.ts +1 -0
- package/esm/src/book-components/Chat/utils/exportChatHistory.d.ts +0 -3
- package/esm/src/book-components/Chat/utils/formatToolCallLocalTime.d.ts +2 -1
- package/esm/src/book-components/Chat/utils/loadAgentProfile.d.ts +12 -0
- package/esm/src/book-components/Chat/utils/parseCitationsFromContent.d.ts +0 -3
- package/esm/src/book-components/Chat/utils/parseImagePrompts.d.ts +1 -3
- package/esm/src/book-components/Chat/utils/sanitizeStreamingMessageContent.d.ts +14 -0
- package/esm/src/book-components/Chat/utils/thinkingMessageVariants.d.ts +3 -0
- package/esm/src/book-components/Chat/utils/timeoutToolCallPresentation.d.ts +0 -3
- package/esm/src/book-components/Chat/utils/toolCallParsing/extractSearchResults.d.ts +1 -0
- package/esm/src/book-components/Chat/utils/toolCallParsing/getToolCallResultDate.d.ts +1 -0
- package/esm/src/book-components/Chat/utils/toolCallParsing/getToolCallTimestamp.d.ts +1 -0
- package/esm/src/book-components/Chat/utils/toolCallParsing/parseRunBrowserToolResult.d.ts +1 -0
- package/esm/src/book-components/Chat/utils/toolCallParsing/parseTeamToolResult.d.ts +1 -0
- package/esm/src/book-components/Chat/utils/toolCallParsing/parseToolCallArguments.d.ts +1 -0
- package/esm/src/book-components/Chat/utils/toolCallParsing/parseToolCallResult.d.ts +1 -0
- package/esm/src/book-components/Chat/utils/toolCallParsing/resolveRunBrowserArtifactUrl.d.ts +1 -0
- package/esm/src/book-components/Chat/utils/walletCredentialToolCall.d.ts +3 -3
- package/esm/src/book-components/PromptbookAgent/PromptbookAgentIntegration.d.ts +3 -5
- package/esm/src/book-components/PromptbookAgent/PromptbookAgentSeamlessIntegration.d.ts +3 -5
- package/esm/src/book-components/Qr/BrandedQrCode.d.ts +5 -0
- package/esm/src/book-components/Qr/GenericQrCode.d.ts +5 -0
- package/esm/src/book-components/Qr/PromptbookQrCode.d.ts +5 -0
- package/esm/src/book-components/Qr/useQrCode.d.ts +4 -1
- package/esm/src/book-components/_common/Dropdown/Dropdown.d.ts +4 -0
- package/esm/src/book-components/_common/HamburgerMenu/HamburgerMenu.d.ts +4 -0
- package/esm/src/book-components/_common/MenuHoisting/MenuHoistingContext.d.ts +3 -3
- package/esm/src/book-components/_common/Modal/Modal.d.ts +1 -3
- package/esm/src/book-components/_common/Tooltip/Tooltip.d.ts +3 -0
- package/esm/src/book-components/icons/AboutIcon.d.ts +1 -0
- package/esm/src/book-components/icons/AttachmentIcon.d.ts +4 -0
- package/esm/src/book-components/icons/CameraIcon.d.ts +4 -0
- package/esm/src/book-components/icons/DownloadIcon.d.ts +1 -0
- package/esm/src/book-components/icons/EmailIcon.d.ts +1 -0
- package/esm/src/book-components/icons/MenuIcon.d.ts +1 -3
- package/esm/src/book-components/icons/SaveIcon.d.ts +1 -0
- package/esm/src/book-components/icons/SendIcon.d.ts +0 -3
- package/esm/src/book-components/icons/TeacherIcon.d.ts +1 -0
- package/esm/src/cli/$runPromptbookCli.d.ts +0 -1
- package/esm/src/cli/cli-commands/_boilerplate.d.ts +0 -2
- package/esm/src/cli/cli-commands/about.d.ts +0 -6
- package/esm/src/cli/cli-commands/coder/ThinkingLevel.d.ts +18 -0
- package/esm/src/cli/cli-commands/coder/find-fresh-emoji-tags.d.ts +0 -2
- package/esm/src/cli/cli-commands/coder/find-refactor-candidates.d.ts +0 -2
- package/esm/src/cli/cli-commands/coder/generate-boilerplates.d.ts +0 -2
- package/esm/src/cli/cli-commands/coder/init.d.ts +0 -2
- package/esm/src/cli/cli-commands/coder/run.d.ts +1 -3
- package/esm/src/cli/cli-commands/coder/run.test.d.ts +1 -0
- package/esm/src/cli/cli-commands/coder/verify.d.ts +0 -2
- package/esm/src/cli/cli-commands/coder.d.ts +0 -2
- package/esm/src/cli/cli-commands/common/handleActionErrors.d.ts +4 -0
- package/esm/src/cli/cli-commands/hello.d.ts +0 -5
- package/esm/src/cli/cli-commands/list-models.d.ts +0 -2
- package/esm/src/cli/cli-commands/list-scrapers.d.ts +0 -2
- package/esm/src/cli/cli-commands/login.d.ts +0 -5
- package/esm/src/cli/cli-commands/prettify.d.ts +0 -6
- package/esm/src/cli/cli-commands/run.d.ts +0 -8
- package/esm/src/cli/cli-commands/runInteractiveChatbot.d.ts +1 -5
- package/esm/src/cli/cli-commands/start-agents-server.d.ts +0 -2
- package/esm/src/cli/cli-commands/start-pipelines-server.d.ts +0 -5
- package/esm/src/cli/cli-commands/test-command.d.ts +0 -7
- package/esm/src/cli/common/$provideLlmToolsForCli.d.ts +5 -0
- package/esm/src/cli/main.d.ts +0 -2
- package/esm/src/cli/promptbookCli.d.ts +0 -7
- package/esm/src/collection/agent-collection/AgentCollection.d.ts +0 -3
- package/esm/src/collection/agent-collection/constructors/agent-collection-in-supabase/AgentCollectionInSupabase.d.ts +2 -6
- package/esm/src/collection/agent-collection/constructors/agent-collection-in-supabase/AgentCollectionInSupabaseOptions.d.ts +3 -0
- package/esm/src/collection/pipeline-collection/SimplePipelineCollection.d.ts +2 -1
- package/esm/src/collection/pipeline-collection/constructors/createPipelineCollectionFromDirectory.d.ts +2 -5
- package/esm/src/collection/pipeline-collection/constructors/createPipelineCollectionFromJson.d.ts +1 -0
- package/esm/src/collection/pipeline-collection/constructors/createPipelineCollectionFromPromise.d.ts +4 -3
- package/esm/src/collection/pipeline-collection/constructors/createPipelineCollectionFromUrl.d.ts +2 -3
- package/esm/src/collection/pipeline-collection/constructors/createPipelineSubcollection.d.ts +1 -0
- package/esm/src/collection/pipeline-collection/pipelineCollectionToJson.d.ts +0 -3
- package/esm/src/commands/BOOK_VERSION/BookVersionCommand.d.ts +1 -0
- package/esm/src/commands/BOOK_VERSION/bookVersionCommandParser.d.ts +1 -0
- package/esm/src/commands/EXPECT/ExpectCommand.d.ts +0 -3
- package/esm/src/commands/EXPECT/expectCommandParser.d.ts +3 -2
- package/esm/src/commands/FOREACH/ForeachCommand.d.ts +1 -0
- package/esm/src/commands/FOREACH/foreachCommandParser.d.ts +1 -3
- package/esm/src/commands/FORMAT/formatCommandParser.d.ts +1 -0
- package/esm/src/commands/FORMFACTOR/FormfactorCommand.d.ts +1 -0
- package/esm/src/commands/FORMFACTOR/formfactorCommandParser.d.ts +1 -0
- package/esm/src/commands/JOKER/JokerCommand.d.ts +1 -0
- package/esm/src/commands/JOKER/jokerCommandParser.d.ts +1 -0
- package/esm/src/commands/KNOWLEDGE/KnowledgeCommand.d.ts +1 -0
- package/esm/src/commands/KNOWLEDGE/knowledgeCommandParser.d.ts +1 -3
- package/esm/src/commands/KNOWLEDGE/utils/knowledgeSourceContentToName.d.ts +0 -3
- package/esm/src/commands/KNOWLEDGE/utils/knowledgeSourceContentToName.test.d.ts +0 -3
- package/esm/src/commands/MODEL/ModelCommand.d.ts +1 -0
- package/esm/src/commands/MODEL/modelCommandParser.d.ts +1 -0
- package/esm/src/commands/PARAMETER/ParameterCommand.d.ts +1 -0
- package/esm/src/commands/PARAMETER/parameterCommandParser.d.ts +1 -0
- package/esm/src/commands/PERSONA/PersonaCommand.d.ts +1 -0
- package/esm/src/commands/PERSONA/personaCommandParser.d.ts +1 -0
- package/esm/src/commands/POSTPROCESS/PostprocessCommand.d.ts +1 -0
- package/esm/src/commands/POSTPROCESS/postprocessCommandParser.d.ts +1 -0
- package/esm/src/commands/SECTION/SectionCommand.d.ts +1 -0
- package/esm/src/commands/SECTION/sectionCommandParser.d.ts +1 -0
- package/esm/src/commands/URL/UrlCommand.d.ts +1 -0
- package/esm/src/commands/URL/urlCommandParser.d.ts +1 -0
- package/esm/src/commands/X_ACTION/ActionCommand.d.ts +1 -0
- package/esm/src/commands/X_ACTION/actionCommandParser.d.ts +1 -3
- package/esm/src/commands/X_INSTRUMENT/InstrumentCommand.d.ts +1 -0
- package/esm/src/commands/X_INSTRUMENT/instrumentCommandParser.d.ts +1 -3
- package/esm/src/commands/_BOILERPLATE/BoilerplateCommand.d.ts +1 -0
- package/esm/src/commands/_BOILERPLATE/boilerplateCommandParser.d.ts +1 -0
- package/esm/src/commands/_common/stringifyCommand.d.ts +1 -1
- package/esm/src/commands/_common/types/CommandParser.d.ts +0 -4
- package/esm/src/commands/index.d.ts +0 -3
- package/esm/src/commitments/ACTION/ACTION.d.ts +0 -3
- package/esm/src/commitments/CLOSED/CLOSED.d.ts +0 -3
- package/esm/src/commitments/CLOSED/CLOSED.test.d.ts +0 -3
- package/esm/src/commitments/COMPONENT/COMPONENT.d.ts +0 -3
- package/esm/src/commitments/DELETE/DELETE.d.ts +0 -3
- package/esm/src/commitments/DICTIONARY/DICTIONARY.d.ts +0 -3
- package/esm/src/commitments/FORMAT/FORMAT.d.ts +0 -3
- package/esm/src/commitments/FROM/FROM.d.ts +0 -3
- package/esm/src/commitments/GOAL/GOAL.d.ts +0 -3
- package/esm/src/commitments/IMPORT/IMPORT.d.ts +0 -3
- package/esm/src/commitments/LANGUAGE/LANGUAGE.d.ts +0 -3
- package/esm/src/commitments/MEMORY/MEMORY.d.ts +0 -3
- package/esm/src/commitments/MESSAGE/MESSAGE.d.ts +0 -3
- package/esm/src/commitments/MESSAGE_SUFFIX/MESSAGE_SUFFIX.d.ts +0 -3
- package/esm/src/commitments/META/META.d.ts +0 -3
- package/esm/src/commitments/META/META_DESCRIPTION.d.ts +0 -3
- package/esm/src/commitments/META_COLOR/META_COLOR.d.ts +0 -3
- package/esm/src/commitments/META_DISCLAIMER/META_DISCLAIMER.d.ts +0 -3
- package/esm/src/commitments/META_DOMAIN/META_DOMAIN.d.ts +0 -3
- package/esm/src/commitments/META_FONT/META_FONT.d.ts +0 -3
- package/esm/src/commitments/META_IMAGE/META_IMAGE.d.ts +0 -3
- package/esm/src/commitments/META_INPUT_PLACEHOLDER/META_INPUT_PLACEHOLDER.d.ts +0 -3
- package/esm/src/commitments/META_LINK/META_LINK.d.ts +0 -3
- package/esm/src/commitments/META_VOICE/META_VOICE.d.ts +0 -3
- package/esm/src/commitments/MODEL/MODEL.d.ts +0 -3
- package/esm/src/commitments/OPEN/OPEN.d.ts +0 -3
- package/esm/src/commitments/PERSONA/PERSONA.d.ts +0 -3
- package/esm/src/commitments/RULE/RULE.d.ts +0 -3
- package/esm/src/commitments/SAMPLE/SAMPLE.d.ts +0 -3
- package/esm/src/commitments/SCENARIO/SCENARIO.d.ts +0 -3
- package/esm/src/commitments/TEAM/TEAM.d.ts +0 -3
- package/esm/src/commitments/TEMPLATE/TEMPLATE.d.ts +0 -3
- package/esm/src/commitments/USE/USE.d.ts +0 -3
- package/esm/src/commitments/USE/aggregateUseCommitmentSystemMessages.d.ts +2 -0
- package/esm/src/commitments/USE_BROWSER/USE_BROWSER.d.ts +0 -3
- package/esm/src/commitments/USE_BROWSER/fetchUrlContent.d.ts +4 -5
- package/esm/src/commitments/USE_CALENDAR/USE_CALENDAR.d.ts +0 -3
- package/esm/src/commitments/USE_CALENDAR/calendarReference.d.ts +0 -3
- package/esm/src/commitments/USE_EMAIL/USE_EMAIL.d.ts +0 -3
- package/esm/src/commitments/USE_IMAGE_GENERATOR/USE_IMAGE_GENERATOR.d.ts +0 -3
- package/esm/src/commitments/USE_MCP/USE_MCP.d.ts +0 -3
- package/esm/src/commitments/USE_POPUP/USE_POPUP.d.ts +0 -3
- package/esm/src/commitments/USE_PRIVACY/USE_PRIVACY.d.ts +0 -3
- package/esm/src/commitments/USE_PROJECT/USE_PROJECT.d.ts +0 -3
- package/esm/src/commitments/USE_PROJECT/projectReference.d.ts +0 -3
- package/esm/src/commitments/USE_SEARCH_ENGINE/USE_SEARCH_ENGINE.d.ts +0 -3
- package/esm/src/commitments/USE_SPAWN/USE_SPAWN.d.ts +0 -3
- package/esm/src/commitments/USE_TIME/USE_TIME.d.ts +0 -3
- package/esm/src/commitments/USE_TIMEOUT/USE_TIMEOUT.d.ts +0 -3
- package/esm/src/commitments/USE_USER_LOCATION/USE_USER_LOCATION.d.ts +0 -3
- package/esm/src/commitments/WALLET/WALLET.d.ts +0 -3
- package/esm/src/commitments/WRITING_RULES/WRITING_RULES.d.ts +0 -3
- package/esm/src/commitments/WRITING_SAMPLE/WRITING_SAMPLE.d.ts +0 -3
- package/esm/src/commitments/_base/createEmptyAgentModelRequirements.d.ts +0 -3
- package/esm/src/commitments/_common/commitmentToolFunctions.d.ts +2 -3
- package/esm/src/commitments/_common/createWritingCommitmentSections.d.ts +2 -3
- package/esm/src/commitments/_common/getAllCommitmentDefinitions.d.ts +1 -0
- package/esm/src/commitments/_common/getAllCommitmentTypes.d.ts +1 -0
- package/esm/src/commitments/_common/getAllCommitmentsToolFunctionsForNode.d.ts +0 -4
- package/esm/src/commitments/_common/getCommitmentDefinition.d.ts +1 -0
- package/esm/src/commitments/_common/isCommitmentSupported.d.ts +1 -0
- package/esm/src/commitments/_common/toolExecutionEnvelope.d.ts +0 -3
- package/esm/src/commitments/_common/toolRuntimeContext.d.ts +3 -3
- package/esm/src/commitments/index.d.ts +0 -4
- package/esm/src/config.test.d.ts +0 -3
- package/esm/src/constants/streaming.d.ts +0 -3
- package/esm/src/constants.d.ts +0 -3
- package/esm/src/conversion/archive/loadArchive.d.ts +0 -1
- package/esm/src/conversion/archive/saveArchive.d.ts +0 -5
- package/esm/src/conversion/compilePipeline.d.ts +2 -7
- package/esm/src/conversion/compilePipelineOnRemoteServer.d.ts +2 -5
- package/esm/src/conversion/parsePipeline.d.ts +1 -11
- package/esm/src/conversion/pipelineJsonToString.d.ts +1 -7
- package/esm/src/conversion/prettify/prettifyPipelineString.d.ts +0 -4
- package/esm/src/conversion/prettify/renderPipelineMermaidOptions.d.ts +0 -7
- package/esm/src/conversion/utils/extractParameterNamesFromTask.d.ts +1 -3
- package/esm/src/conversion/validation/_importPipeline.d.ts +6 -2
- package/esm/src/conversion/validation/pipelineStringToJson-parseErrors.test.d.ts +0 -3
- package/esm/src/conversion/validation/validatePipeline-logicErrors.test.d.ts +0 -3
- package/esm/src/conversion/validation/validatePipeline.d.ts +3 -9
- package/esm/src/conversion/validation/validatePipeline.test.d.ts +0 -3
- package/esm/src/dialogs/simple-prompt/SimplePromptInterfaceTools.d.ts +1 -2
- package/esm/src/errors/0-BoilerplateError.d.ts +0 -3
- package/esm/src/errors/0-index.d.ts +0 -3
- package/esm/src/errors/DatabaseError.d.ts +0 -3
- package/esm/src/errors/ExpectError.d.ts +2 -1
- package/esm/src/errors/ParseError.d.ts +0 -3
- package/esm/src/errors/PipelineExecutionError.d.ts +0 -3
- package/esm/src/executables/$provideExecutablesForNode.d.ts +0 -5
- package/esm/src/executables/apps/locateLibreoffice.d.ts +0 -2
- package/esm/src/executables/apps/locatePandoc.d.ts +0 -2
- package/esm/src/executables/browsers/locateBrowser.d.ts +0 -1
- package/esm/src/executables/browsers/locateDefaultSystemBrowser.d.ts +0 -1
- package/esm/src/executables/locateApp.d.ts +0 -2
- package/esm/src/executables/platforms/locateAppOnLinux.d.ts +0 -2
- package/esm/src/executables/platforms/locateAppOnMacOs.d.ts +0 -2
- package/esm/src/executables/platforms/locateAppOnWindows.d.ts +0 -2
- package/esm/src/execution/AbstractTaskResult.d.ts +0 -4
- package/esm/src/execution/AvailableModel.d.ts +0 -4
- package/esm/src/execution/CommonToolsOptions.d.ts +0 -5
- package/esm/src/execution/ExecutionTask.d.ts +4 -4
- package/esm/src/execution/FilesystemTools.d.ts +0 -3
- package/esm/src/execution/LlmExecutionTools.d.ts +3 -9
- package/esm/src/execution/LlmExecutionToolsConstructor.d.ts +0 -3
- package/esm/src/execution/PipelineExecutor.d.ts +0 -3
- package/esm/src/execution/PipelineExecutorResult.d.ts +0 -3
- package/esm/src/execution/PromptResult.d.ts +1 -9
- package/esm/src/execution/PromptbookFetch.test-type.d.ts +0 -4
- package/esm/src/execution/ScriptExecutionTools.d.ts +0 -4
- package/esm/src/execution/Usage.d.ts +0 -3
- package/esm/src/execution/UserInterfaceTools.d.ts +3 -0
- package/esm/src/execution/assertsTaskSuccessful.d.ts +1 -3
- package/esm/src/execution/createPipelineExecutor/00-createPipelineExecutor.d.ts +1 -0
- package/esm/src/execution/createPipelineExecutor/20-executeTask.d.ts +0 -3
- package/esm/src/execution/createPipelineExecutor/40-executeAttempts.d.ts +1 -3
- package/esm/src/execution/createPipelineExecutor/getContextForTask.d.ts +1 -0
- package/esm/src/execution/createPipelineExecutor/getKnowledgeForTask.d.ts +0 -4
- package/esm/src/execution/createPipelineExecutor/knowledgePiecesToString.d.ts +0 -1
- package/esm/src/execution/execution-report/ExecutionReportJson.d.ts +1 -0
- package/esm/src/execution/execution-report/ExecutionReportString.d.ts +0 -3
- package/esm/src/execution/execution-report/executionReportJsonToString.d.ts +0 -5
- package/esm/src/execution/translation/automatic-translate/automatic-translators/AutomaticTranslator.d.ts +3 -1
- package/esm/src/execution/translation/automatic-translate/automatic-translators/FakeAutomaticTranslator.d.ts +3 -1
- package/esm/src/execution/translation/automatic-translate/automatic-translators/TranslatorOptions.d.ts +3 -1
- package/esm/src/execution/translation/automatic-translate/automatic-translators/utils/extractMultiplicatedOccurrence.d.ts +2 -0
- package/esm/src/execution/translation/automatic-translate/translateMessages.d.ts +3 -3
- package/esm/src/execution/utils/$provideExecutionToolsForNode.d.ts +2 -4
- package/esm/src/execution/utils/checkExpectations.d.ts +2 -5
- package/esm/src/execution/utils/forEachAsync.d.ts +5 -1
- package/esm/src/execution/utils/usage-constants.d.ts +0 -3
- package/esm/src/execution/utils/usageToHuman.d.ts +0 -8
- package/esm/src/execution/utils/validatePromptResult.d.ts +1 -0
- package/esm/src/file-security-checkers/virustotal/VirusTotalFileSecurityChecker.d.ts +1 -0
- package/esm/src/formats/_common/FormatParser.d.ts +2 -9
- package/esm/src/formats/_common/FormatSubvalueParser.d.ts +0 -3
- package/esm/src/formats/csv/CsvFormatParser.d.ts +2 -8
- package/esm/src/formats/index.d.ts +0 -3
- package/esm/src/formats/json/JsonFormatParser.d.ts +0 -11
- package/esm/src/formats/text/TextFormatParser.d.ts +0 -9
- package/esm/src/formats/xml/XmlFormatParser.d.ts +0 -11
- package/esm/src/formfactors/_common/AbstractFormfactorDefinition.d.ts +1 -3
- package/esm/src/formfactors/_common/FormfactorDefinition.d.ts +1 -0
- package/esm/src/formfactors/index.d.ts +0 -3
- package/esm/src/high-level-abstractions/_common/HighLevelAbstraction.d.ts +0 -5
- package/esm/src/high-level-abstractions/index.d.ts +0 -4
- package/esm/src/high-level-abstractions/quick-chatbot/QuickChatbotHla.d.ts +0 -3
- package/esm/src/llm-providers/_common/register/$llmToolsMetadataRegister.d.ts +2 -3
- package/esm/src/llm-providers/_common/register/$llmToolsRegister.d.ts +2 -3
- package/esm/src/llm-providers/_common/register/$provideEnvFilename.d.ts +0 -1
- package/esm/src/llm-providers/_common/register/$provideLlmToolsConfigurationFromEnv.d.ts +1 -1
- package/esm/src/llm-providers/_common/register/$provideLlmToolsForTestingAndScriptsAndPlayground.d.ts +3 -6
- package/esm/src/llm-providers/_common/register/$provideLlmToolsForWizardOrCli.d.ts +3 -7
- package/esm/src/llm-providers/_common/register/$provideLlmToolsFromEnv.d.ts +1 -16
- package/esm/src/llm-providers/_common/register/$registeredLlmToolsMessage.d.ts +0 -4
- package/esm/src/llm-providers/_common/register/LlmToolsConfiguration.d.ts +0 -5
- package/esm/src/llm-providers/_common/register/LlmToolsMetadata.d.ts +0 -6
- package/esm/src/llm-providers/_common/register/LlmToolsOptions.d.ts +0 -4
- package/esm/src/llm-providers/_common/register/createLlmToolsFromConfiguration.d.ts +1 -0
- package/esm/src/llm-providers/_common/utils/assertUniqueModels.d.ts +0 -3
- package/esm/src/llm-providers/_common/utils/cache/CacheItem.d.ts +0 -3
- package/esm/src/llm-providers/_common/utils/cache/cacheLlmTools.d.ts +1 -0
- package/esm/src/llm-providers/_common/utils/count-total-usage/LlmExecutionToolsWithTotalUsage.d.ts +0 -4
- package/esm/src/llm-providers/_common/utils/count-total-usage/countUsage.d.ts +1 -0
- package/esm/src/llm-providers/_common/utils/count-total-usage/limitTotalUsage.d.ts +0 -7
- package/esm/src/llm-providers/_common/utils/removeUnsupportedModelRequirements.d.ts +4 -0
- package/esm/src/llm-providers/_multiple/MultipleLlmExecutionTools.d.ts +1 -0
- package/esm/src/llm-providers/_multiple/getSingleLlmExecutionTools.d.ts +0 -4
- package/esm/src/llm-providers/_multiple/joinLlmExecutionTools.d.ts +3 -7
- package/esm/src/llm-providers/_multiple/playground/playground.d.ts +0 -1
- package/esm/src/llm-providers/agent/Agent.d.ts +0 -3
- package/esm/src/llm-providers/agent/AgentLlmExecutionTools.d.ts +0 -4
- package/esm/src/llm-providers/agent/RemoteAgent.d.ts +0 -4
- package/esm/src/llm-providers/agent/playground/playground.d.ts +0 -6
- package/esm/src/llm-providers/agent/register-configuration.d.ts +0 -5
- package/esm/src/llm-providers/agent/register-constructor.d.ts +0 -4
- package/esm/src/llm-providers/anthropic-claude/AnthropicClaudeExecutionTools.d.ts +2 -10
- package/esm/src/llm-providers/anthropic-claude/AnthropicClaudeExecutionToolsOptions.d.ts +3 -3
- package/esm/src/llm-providers/anthropic-claude/anthropic-claude-models.d.ts +1 -8
- package/esm/src/llm-providers/anthropic-claude/computeAnthropicClaudeUsage.d.ts +1 -3
- package/esm/src/llm-providers/anthropic-claude/computeAnthropicClaudeUsage.test.d.ts +0 -3
- package/esm/src/llm-providers/anthropic-claude/createAnthropicClaudeExecutionTools.d.ts +0 -7
- package/esm/src/llm-providers/anthropic-claude/playground/playground.d.ts +0 -5
- package/esm/src/llm-providers/anthropic-claude/register-configuration.d.ts +0 -3
- package/esm/src/llm-providers/anthropic-claude/register-constructor.d.ts +0 -5
- package/esm/src/llm-providers/azure-openai/AzureOpenAiExecutionTools.d.ts +0 -6
- package/esm/src/llm-providers/azure-openai/AzureOpenAiExecutionToolsOptions.d.ts +1 -0
- package/esm/src/llm-providers/azure-openai/createAzureOpenAiExecutionTools.d.ts +0 -4
- package/esm/src/llm-providers/azure-openai/playground/playground.d.ts +0 -2
- package/esm/src/llm-providers/azure-openai/register-configuration.d.ts +0 -3
- package/esm/src/llm-providers/azure-openai/register-constructor.d.ts +0 -4
- package/esm/src/llm-providers/deepseek/DeepseekExecutionToolsOptions.d.ts +1 -0
- package/esm/src/llm-providers/deepseek/createDeepseekExecutionTools.d.ts +0 -3
- package/esm/src/llm-providers/deepseek/deepseek-models.d.ts +1 -6
- package/esm/src/llm-providers/deepseek/register-configuration.d.ts +0 -3
- package/esm/src/llm-providers/deepseek/register-constructor.d.ts +0 -4
- package/esm/src/llm-providers/google/GoogleExecutionToolsOptions.d.ts +1 -0
- package/esm/src/llm-providers/google/createGoogleExecutionTools.d.ts +0 -4
- package/esm/src/llm-providers/google/google-models.d.ts +1 -6
- package/esm/src/llm-providers/google/register-configuration.d.ts +0 -3
- package/esm/src/llm-providers/google/register-constructor.d.ts +0 -4
- package/esm/src/llm-providers/mocked/$fakeTextToExpectations.d.ts +1 -5
- package/esm/src/llm-providers/mocked/MockedEchoLlmExecutionTools.d.ts +0 -4
- package/esm/src/llm-providers/mocked/MockedFackedLlmExecutionTools.d.ts +0 -3
- package/esm/src/llm-providers/mocked/test/joker.test.d.ts +0 -3
- package/esm/src/llm-providers/mocked/test/mocked-chat.test.d.ts +0 -4
- package/esm/src/llm-providers/mocked/test/mocked-completion.test.d.ts +0 -3
- package/esm/src/llm-providers/ollama/OllamaExecutionTools.d.ts +0 -3
- package/esm/src/llm-providers/ollama/OllamaExecutionToolsOptions.d.ts +1 -0
- package/esm/src/llm-providers/ollama/ollama-models.d.ts +1 -4
- package/esm/src/llm-providers/ollama/playground/playground.d.ts +0 -2
- package/esm/src/llm-providers/ollama/register-configuration.d.ts +0 -3
- package/esm/src/llm-providers/ollama/register-constructor.d.ts +0 -4
- package/esm/src/llm-providers/openai/OpenAiAgentKitExecutionTools.d.ts +10 -0
- package/esm/src/llm-providers/openai/OpenAiAssistantExecutionTools.d.ts +1 -8
- package/esm/src/llm-providers/openai/OpenAiCompatibleExecutionTools.d.ts +0 -7
- package/esm/src/llm-providers/openai/OpenAiCompatibleExecutionToolsOptions.d.ts +2 -0
- package/esm/src/llm-providers/openai/computeOpenAiUsage.d.ts +1 -3
- package/esm/src/llm-providers/openai/computeOpenAiUsage.test.d.ts +0 -3
- package/esm/src/llm-providers/openai/createOpenAiAssistantExecutionTools.d.ts +0 -4
- package/esm/src/llm-providers/openai/createOpenAiCompatibleExecutionTools.d.ts +0 -4
- package/esm/src/llm-providers/openai/createOpenAiExecutionTools.d.ts +0 -4
- package/esm/src/llm-providers/openai/openai-models.d.ts +1 -0
- package/esm/src/llm-providers/openai/openai-models.test.d.ts +0 -3
- package/esm/src/llm-providers/openai/playground/playground.d.ts +0 -2
- package/esm/src/llm-providers/openai/register-configuration.d.ts +0 -3
- package/esm/src/llm-providers/openai/register-constructor.d.ts +0 -4
- package/esm/src/llm-providers/remote/RemoteLlmExecutionTools.d.ts +1 -9
- package/esm/src/llm-providers/remote/playground/playground.d.ts +0 -1
- package/esm/src/llm-providers/vercel/playground/playground.d.ts +0 -2
- package/esm/src/other/templates/getBookTemplates.d.ts +2 -5
- package/esm/src/personas/preparePersona.d.ts +1 -7
- package/esm/src/pipeline/PipelineInterface/PipelineInterface.d.ts +1 -0
- package/esm/src/pipeline/PipelineInterface/constants.d.ts +0 -3
- package/esm/src/pipeline/PipelineJson/CommonTaskJson.d.ts +0 -4
- package/esm/src/pipeline/PipelineJson/DialogTaskJson.d.ts +1 -3
- package/esm/src/pipeline/PipelineJson/Expectations.d.ts +4 -3
- package/esm/src/pipeline/PipelineJson/KnowledgePieceJson.d.ts +0 -4
- package/esm/src/pipeline/PipelineJson/KnowledgeSourceJson.d.ts +0 -3
- package/esm/src/pipeline/PipelineJson/PersonaJson.d.ts +0 -3
- package/esm/src/pipeline/PipelineJson/PreparationJson.d.ts +3 -5
- package/esm/src/pipeline/PipelineJson/ScriptTaskJson.d.ts +1 -4
- package/esm/src/pipeline/PipelineJson/SimpleTaskJson.d.ts +1 -3
- package/esm/src/pipeline/book-notation.d.ts +1 -4
- package/esm/src/pipeline/isValidPipelineString.d.ts +1 -3
- package/esm/src/pipeline/isValidPipelineString.test.d.ts +0 -3
- package/esm/src/pipeline/prompt-notation/helpers/ParameterEscaping.d.ts +5 -0
- package/esm/src/pipeline/prompt-notation/helpers/ParameterNaming.d.ts +1 -0
- package/esm/src/pipeline/prompt-notation/helpers/ParameterSection.d.ts +2 -0
- package/esm/src/pipeline/prompt-notation.d.ts +2 -5
- package/esm/src/pipeline/prompt-notation.test.d.ts +0 -3
- package/esm/src/pipeline/validatePipelineString.d.ts +1 -3
- package/esm/src/playground/permanent/_boilerplate.d.ts +0 -1
- package/esm/src/playground/permanent/agent-with-browser-playground.d.ts +0 -1
- package/esm/src/playground/permanent/error-handling-playground.d.ts +0 -1
- package/esm/src/playground/playground.d.ts +0 -2
- package/esm/src/postprocessing/utils/extractBlock.d.ts +2 -1
- package/esm/src/postprocessing/utils/extractJsonBlock.d.ts +2 -5
- package/esm/src/prepare/PrepareAndScrapeOptions.d.ts +0 -4
- package/esm/src/prepare/preparePipeline.d.ts +3 -2
- package/esm/src/prepare/preparePipelineOnRemoteServer.d.ts +2 -5
- package/esm/src/prepare/prepareTasks.d.ts +6 -10
- package/esm/src/prepare/unpreparePipeline.d.ts +1 -5
- package/esm/src/remote-server/RemoteServer.d.ts +3 -0
- package/esm/src/remote-server/openapi.d.ts +3 -4
- package/esm/src/remote-server/socket-types/_subtypes/Identification.d.ts +1 -5
- package/esm/src/remote-server/socket-types/listModels/PromptbookServer_ListModels_Request.d.ts +0 -3
- package/esm/src/remote-server/socket-types/listModels/PromptbookServer_ListModels_Response.d.ts +0 -3
- package/esm/src/remote-server/startAgentServer.d.ts +6 -2
- package/esm/src/remote-server/startRemoteServer.d.ts +1 -15
- package/esm/src/remote-server/types/RemoteClientOptions.d.ts +0 -5
- package/esm/src/remote-server/types/RemoteServerOptions.d.ts +10 -4
- package/esm/src/remote-server/ui/ServerApp.d.ts +1 -0
- package/esm/src/remote-server/ui/types.d.ts +3 -0
- package/esm/src/scrapers/_boilerplate/BoilerplateScraper.d.ts +1 -4
- package/esm/src/scrapers/_boilerplate/createBoilerplateScraper.d.ts +0 -3
- package/esm/src/scrapers/_boilerplate/playground/boilerplate-scraper-playground.d.ts +0 -1
- package/esm/src/scrapers/_boilerplate/register-constructor.d.ts +0 -4
- package/esm/src/scrapers/_boilerplate/register-metadata.d.ts +0 -3
- package/esm/src/scrapers/_common/Scraper.d.ts +0 -5
- package/esm/src/scrapers/_common/ScraperIntermediateSource.d.ts +0 -3
- package/esm/src/scrapers/_common/prepareKnowledgePieces.d.ts +1 -0
- package/esm/src/scrapers/_common/register/$provideFilesystemForNode.d.ts +0 -2
- package/esm/src/scrapers/_common/register/$provideScrapersForNode.d.ts +1 -2
- package/esm/src/scrapers/_common/register/$provideScriptingForNode.d.ts +0 -2
- package/esm/src/scrapers/_common/register/$registeredScrapersMessage.d.ts +0 -3
- package/esm/src/scrapers/_common/register/$scrapersMetadataRegister.d.ts +2 -3
- package/esm/src/scrapers/_common/register/$scrapersRegister.d.ts +2 -3
- package/esm/src/scrapers/_common/register/ScraperConstructor.d.ts +0 -3
- package/esm/src/scrapers/_common/utils/getScraperIntermediateSource.d.ts +0 -7
- package/esm/src/scrapers/_common/utils/getScraperIntermediateSource.test.d.ts +0 -3
- package/esm/src/scrapers/_common/utils/promptbookFetch.d.ts +0 -3
- package/esm/src/scrapers/document/DocumentScraper.d.ts +1 -6
- package/esm/src/scrapers/document/DocumentScraper.test.d.ts +0 -3
- package/esm/src/scrapers/document/createDocumentScraper.d.ts +0 -3
- package/esm/src/scrapers/document/playground/document-scraper-playground.d.ts +0 -1
- package/esm/src/scrapers/document/register-constructor.d.ts +0 -4
- package/esm/src/scrapers/document/register-metadata.d.ts +0 -3
- package/esm/src/scrapers/document-legacy/LegacyDocumentScraper.d.ts +1 -6
- package/esm/src/scrapers/document-legacy/LegacyDocumentScraper.test.d.ts +0 -3
- package/esm/src/scrapers/document-legacy/createLegacyDocumentScraper.d.ts +0 -3
- package/esm/src/scrapers/document-legacy/playground/legacy-document-scraper-playground.d.ts +0 -1
- package/esm/src/scrapers/document-legacy/register-constructor.d.ts +0 -4
- package/esm/src/scrapers/document-legacy/register-metadata.d.ts +0 -3
- package/esm/src/scrapers/markdown/MarkdownScraper.d.ts +1 -4
- package/esm/src/scrapers/markdown/MarkdownScraper.test.d.ts +0 -3
- package/esm/src/scrapers/markdown/createMarkdownScraper.d.ts +0 -3
- package/esm/src/scrapers/markdown/playground/markdown-scraper-playground.d.ts +0 -1
- package/esm/src/scrapers/markdown/register-constructor.d.ts +0 -4
- package/esm/src/scrapers/markdown/register-metadata.d.ts +0 -3
- package/esm/src/scrapers/markitdown/MarkitdownScraper.d.ts +1 -7
- package/esm/src/scrapers/markitdown/createMarkitdownScraper.d.ts +0 -4
- package/esm/src/scrapers/markitdown/playground/markitdown-scraper-playground.d.ts +0 -1
- package/esm/src/scrapers/markitdown/register-constructor.d.ts +0 -5
- package/esm/src/scrapers/markitdown/register-metadata.d.ts +0 -3
- package/esm/src/scrapers/pdf/PdfScraper.d.ts +1 -6
- package/esm/src/scrapers/pdf/createPdfScraper.d.ts +0 -3
- package/esm/src/scrapers/pdf/playground/pdf-scraper-playground.d.ts +0 -1
- package/esm/src/scrapers/pdf/register-constructor.d.ts +0 -4
- package/esm/src/scrapers/pdf/register-metadata.d.ts +0 -3
- package/esm/src/scrapers/website/WebsiteScraper.d.ts +1 -6
- package/esm/src/scrapers/website/createWebsiteScraper.d.ts +0 -3
- package/esm/src/scrapers/website/playground/website-scraper-playground.d.ts +0 -1
- package/esm/src/scrapers/website/register-constructor.d.ts +0 -4
- package/esm/src/scrapers/website/register-metadata.d.ts +0 -3
- package/esm/src/scripting/javascript/JavascriptEvalExecutionTools.d.ts +1 -5
- package/esm/src/scripting/javascript/JavascriptEvalExecutionTools.test.d.ts +0 -3
- package/esm/src/scripting/javascript/JavascriptExecutionTools.d.ts +1 -0
- package/esm/src/scripting/javascript/JavascriptExecutionToolsOptions.d.ts +0 -3
- package/esm/src/scripting/javascript/postprocessing-functions.d.ts +0 -4
- package/esm/src/scripting/javascript/utils/extractVariablesFromJavascript.d.ts +1 -3
- package/esm/src/search-engines/SearchEngine.d.ts +3 -0
- package/esm/src/speech-recognition/BrowserSpeechRecognition.d.ts +0 -2
- package/esm/src/speech-recognition/OpenAiSpeechRecognition.d.ts +2 -2
- package/esm/src/storage/_common/PromptbookStorage.d.ts +0 -4
- package/esm/src/storage/_common/PromptbookStorage.test-type.d.ts +0 -4
- package/esm/src/storage/env-storage/$EnvStorage.d.ts +0 -3
- package/esm/src/storage/file-cache-storage/FileCacheStorage.d.ts +0 -2
- package/esm/src/storage/local-storage/getIndexedDbStorage.d.ts +0 -1
- package/esm/src/storage/local-storage/getLocalStorage.d.ts +0 -1
- package/esm/src/storage/local-storage/getSessionStorage.d.ts +0 -1
- package/esm/src/storage/local-storage/utils/makePromptbookStorageFromIndexedDb.d.ts +1 -0
- package/esm/src/storage/local-storage/utils/makePromptbookStorageFromWebStorage.d.ts +0 -4
- package/esm/src/transpilers/_common/register/$bookTranspilersRegister.d.ts +1 -3
- package/esm/src/transpilers/formatted-book-in-markdown/register.d.ts +2 -5
- package/esm/src/transpilers/openai-sdk/playground/playground.d.ts +0 -1
- package/esm/src/transpilers/openai-sdk/register.d.ts +2 -5
- package/esm/src/types/Arrayable.d.ts +1 -0
- package/esm/src/types/InputParameters_private.d.ts +4 -2
- package/esm/src/types/IntermediateFilesStrategy.d.ts +0 -3
- package/esm/src/types/LlmCall.d.ts +0 -3
- package/esm/src/types/ModelRequirements.d.ts +1 -0
- package/esm/src/types/ModelVariant.d.ts +3 -0
- package/esm/src/types/Parameters.d.ts +31 -0
- package/esm/src/types/Parameters_private.d.ts +4 -2
- package/esm/src/types/Prompt.d.ts +1 -6
- package/esm/src/types/ReservedParameters_private.d.ts +2 -1
- package/esm/src/types/ToolCall.d.ts +0 -2
- package/esm/src/types/Updatable.d.ts +1 -3
- package/esm/src/types/string_agent_hash_private.d.ts +1 -1
- package/esm/src/types/string_agent_name.d.ts +32 -0
- package/esm/src/types/string_agent_name_in_book_private.d.ts +1 -1
- package/esm/src/types/string_agent_name_private.d.ts +2 -1
- package/esm/src/types/string_agent_permanent_id_private.d.ts +2 -1
- package/esm/src/types/string_business_category_name.d.ts +5 -0
- package/esm/src/types/string_business_category_name_private.d.ts +1 -1
- package/esm/src/types/string_char_private.d.ts +1 -1
- package/esm/src/types/string_chat_prompt_private.d.ts +1 -1
- package/esm/src/types/string_completion_prompt_private.d.ts +1 -1
- package/esm/src/types/string_markdown.d.ts +0 -1
- package/esm/src/types/string_mime_type_private.d.ts +1 -0
- package/esm/src/types/string_model_description_private.d.ts +1 -1
- package/esm/src/types/string_model_name.d.ts +7 -0
- package/esm/src/types/string_model_name_private.d.ts +1 -1
- package/esm/src/types/string_name.d.ts +31 -0
- package/esm/src/types/string_name_private.d.ts +1 -1
- package/esm/src/types/string_page.d.ts +15 -0
- package/esm/src/types/string_page_private.d.ts +1 -1
- package/esm/src/types/string_parameter_name.d.ts +11 -210
- package/esm/src/types/string_parameter_value_private.d.ts +1 -1
- package/esm/src/types/string_persona_description.d.ts +14 -0
- package/esm/src/types/string_persona_description_private.d.ts +1 -1
- package/esm/src/types/string_prompt.d.ts +49 -0
- package/esm/src/types/string_prompt_image_private.d.ts +1 -1
- package/esm/src/types/string_prompt_private.d.ts +1 -1
- package/esm/src/types/string_reserved_parameter_name_private.d.ts +1 -1
- package/esm/src/types/string_sha256.d.ts +2 -2
- package/esm/src/types/string_system_message_private.d.ts +1 -1
- package/esm/src/types/string_template_private.d.ts +1 -1
- package/esm/src/types/string_text_prompt_private.d.ts +1 -1
- package/esm/src/types/string_title.d.ts +8 -0
- package/esm/src/types/string_title_private.d.ts +1 -1
- package/esm/src/types/typeAliasEmoji.d.ts +0 -3
- package/esm/src/types/typeAliases.d.ts +0 -6
- package/esm/src/utils/DEFAULT_THINKING_MESSAGES.d.ts +5 -1
- package/esm/src/utils/chat/chatAttachments/appendChatAttachmentContext.d.ts +1 -0
- package/esm/src/utils/chat/chatAttachments/appendChatAttachmentContextWithContent.d.ts +1 -0
- package/esm/src/utils/chat/chatAttachments/formatChatAttachmentContentContext.d.ts +1 -0
- package/esm/src/utils/chat/chatAttachments/formatChatAttachmentContext.d.ts +1 -0
- package/esm/src/utils/chat/chatAttachments/normalizeChatAttachments.d.ts +1 -0
- package/esm/src/utils/chat/chatAttachments/resolveChatAttachmentContent.d.ts +1 -0
- package/esm/src/utils/chat/chatAttachments/resolveChatAttachmentContents.d.ts +1 -0
- package/esm/src/utils/chat/chatAttachments.d.ts +0 -3
- package/esm/src/utils/chat/constants.d.ts +0 -3
- package/esm/src/utils/clientVersion.d.ts +0 -3
- package/esm/src/utils/color/$randomColor.d.ts +0 -5
- package/esm/src/utils/color/css-colors.d.ts +0 -3
- package/esm/src/utils/color/internal-utils/hslToRgb.d.ts +0 -3
- package/esm/src/utils/color/internal-utils/rgbToHsl.d.ts +0 -3
- package/esm/src/utils/color/operators/ColorTransformer.d.ts +2 -0
- package/esm/src/utils/color/operators/lighten.d.ts +0 -3
- package/esm/src/utils/color/operators/saturate.d.ts +0 -3
- package/esm/src/utils/color/utils/areColorsEqual.d.ts +0 -3
- package/esm/src/utils/color/utils/colorDistance.d.ts +2 -2
- package/esm/src/utils/color/utils/colorHue.d.ts +0 -1
- package/esm/src/utils/color/utils/colorHueDistance.d.ts +0 -1
- package/esm/src/utils/color/utils/colorToDataUrl.d.ts +0 -3
- package/esm/src/utils/database/uniqueConstraint.d.ts +1 -3
- package/esm/src/utils/editable/edit-pipeline-string/addPipelineCommand.d.ts +3 -4
- package/esm/src/utils/editable/edit-pipeline-string/deflatePipeline.d.ts +0 -3
- package/esm/src/utils/editable/types/PipelineEditableSerialized.d.ts +2 -2
- package/esm/src/utils/editable/utils/renamePipelineParameter.d.ts +4 -3
- package/esm/src/utils/editable/utils/stringifyPipelineJson.d.ts +0 -6
- package/esm/src/utils/environment/$detectRuntimeEnvironment.d.ts +0 -3
- package/esm/src/utils/environment/$getGlobalScope.d.ts +1 -1
- package/esm/src/utils/environment/$isRunningInBrowser.d.ts +0 -3
- package/esm/src/utils/environment/$isRunningInJest.d.ts +0 -3
- package/esm/src/utils/environment/$isRunningInNode.d.ts +0 -3
- package/esm/src/utils/environment/$isRunningInWebWorker.d.ts +0 -3
- package/esm/src/utils/execCommand/$execCommand.d.ts +0 -2
- package/esm/src/utils/execCommand/$execCommands.d.ts +0 -1
- package/esm/src/utils/execCommand/ExecCommandOptions.d.ts +3 -4
- package/esm/src/utils/expectation-counters/constants.d.ts +0 -4
- package/esm/src/utils/expectation-counters/countCharacters.d.ts +0 -4
- package/esm/src/utils/expectation-counters/countLines.d.ts +0 -4
- package/esm/src/utils/expectation-counters/countPages.d.ts +0 -4
- package/esm/src/utils/expectation-counters/countParagraphs.d.ts +0 -4
- package/esm/src/utils/expectation-counters/countSentences.d.ts +0 -4
- package/esm/src/utils/expectation-counters/countWords.d.ts +0 -5
- package/esm/src/utils/expectation-counters/index.d.ts +0 -4
- package/esm/src/utils/files/$induceBookDownload.d.ts +0 -1
- package/esm/src/utils/files/$induceFileDownload.d.ts +0 -1
- package/esm/src/utils/files/ObjectUrl.d.ts +0 -1
- package/esm/src/utils/files/isDirectoryExisting.d.ts +0 -6
- package/esm/src/utils/files/isExecutable.d.ts +0 -4
- package/esm/src/utils/files/isFileExisting.d.ts +0 -5
- package/esm/src/utils/files/listAllFiles.d.ts +1 -5
- package/esm/src/utils/files/readResponseBytes.d.ts +1 -0
- package/esm/src/utils/knowledge/inlineKnowledgeSource.d.ts +11 -6
- package/esm/src/utils/knowledge/simplifyKnowledgeLabel.d.ts +2 -0
- package/esm/src/utils/linguistic-hash/linguisticHash.d.ts +2 -1
- package/esm/src/utils/linguistic-hash/linguisticHashTypes.d.ts +0 -3
- package/esm/src/utils/linguistic-hash/linguisticHashWords.cs.d.ts +0 -3
- package/esm/src/utils/linguistic-hash/linguisticHashWords.en.d.ts +0 -3
- package/esm/src/utils/markdown/addAutoGeneratedSection.d.ts +0 -3
- package/esm/src/utils/markdown/createMarkdownTable.d.ts +0 -3
- package/esm/src/utils/markdown/escapeMarkdownBlock.d.ts +0 -3
- package/esm/src/utils/markdown/extractAllBlocksFromMarkdown.d.ts +1 -3
- package/esm/src/utils/markdown/extractAllListItemsFromMarkdown.d.ts +1 -0
- package/esm/src/utils/markdown/extractOneBlockFromMarkdown.d.ts +2 -4
- package/esm/src/utils/markdown/humanizeAiText.d.ts +0 -3
- package/esm/src/utils/markdown/humanizeAiTextEllipsis.d.ts +0 -3
- package/esm/src/utils/markdown/humanizeAiTextEmdashed.d.ts +0 -3
- package/esm/src/utils/markdown/humanizeAiTextQuotes.d.ts +0 -3
- package/esm/src/utils/markdown/humanizeAiTextSources.d.ts +0 -3
- package/esm/src/utils/markdown/humanizeAiTextWhitespace.d.ts +0 -3
- package/esm/src/utils/markdown/prettifyMarkdown.d.ts +4 -2
- package/esm/src/utils/markdown/promptbookifyAiText.d.ts +0 -3
- package/esm/src/utils/markdown/removeMarkdownComments.d.ts +1 -0
- package/esm/src/utils/markdown/removeMarkdownFormatting.d.ts +1 -0
- package/esm/src/utils/markdown/removeMarkdownLinks.d.ts +1 -0
- package/esm/src/utils/markdown/trimCodeBlock.d.ts +1 -1
- package/esm/src/utils/markdown/trimEndOfCodeBlock.d.ts +1 -1
- package/esm/src/utils/misc/$getCurrentDate.d.ts +1 -0
- package/esm/src/utils/misc/aboutPromptbookInformation.d.ts +3 -3
- package/esm/src/utils/misc/computeHash.d.ts +0 -3
- package/esm/src/utils/misc/debounce.d.ts +2 -0
- package/esm/src/utils/misc/emojis.d.ts +3 -8
- package/esm/src/utils/misc/injectCssModuleIntoShadowRoot.d.ts +7 -2
- package/esm/src/utils/misc/parseNumber.d.ts +0 -4
- package/esm/src/utils/misc/xAboutPromptbookInformation.d.ts +3 -4
- package/esm/src/utils/normalization/IKeywords.d.ts +0 -3
- package/esm/src/utils/normalization/nameToUriPart.d.ts +1 -0
- package/esm/src/utils/normalization/nameToUriParts.d.ts +1 -0
- package/esm/src/utils/normalization/normalize-to-kebab-case.d.ts +2 -3
- package/esm/src/utils/normalization/normalizeTo_PascalCase.d.ts +2 -0
- package/esm/src/utils/normalization/normalizeTo_SCREAMING_CASE.d.ts +2 -0
- package/esm/src/utils/normalization/normalizeTo_camelCase.d.ts +2 -3
- package/esm/src/utils/normalization/normalizeTo_snake_case.d.ts +1 -0
- package/esm/src/utils/normalization/orderJson.d.ts +1 -0
- package/esm/src/utils/normalization/orderJson.test.d.ts +0 -3
- package/esm/src/utils/normalization/parseKeywords.d.ts +1 -4
- package/esm/src/utils/normalization/parseKeywordsFromString.d.ts +1 -0
- package/esm/src/utils/normalization/removeDiacritics.d.ts +1 -3
- package/esm/src/utils/normalization/removeEmojis.d.ts +1 -0
- package/esm/src/utils/normalization/removeQuotes.d.ts +1 -0
- package/esm/src/utils/normalization/searchKeywords.d.ts +1 -3
- package/esm/src/utils/normalization/titleToName.d.ts +1 -0
- package/esm/src/utils/normalization/unwrapResult.d.ts +1 -3
- package/esm/src/utils/organization/$sideEffect.d.ts +1 -0
- package/esm/src/utils/organization/TODO_USE.d.ts +1 -0
- package/esm/src/utils/organization/just.d.ts +1 -0
- package/esm/src/utils/organization/keepImported.d.ts +1 -0
- package/esm/src/utils/organization/keepTypeImported.d.ts +1 -0
- package/esm/src/utils/organization/keepUnused.d.ts +1 -0
- package/esm/src/utils/organization/preserve.d.ts +1 -3
- package/esm/src/utils/organization/really_any.d.ts +1 -0
- package/esm/src/utils/organization/spaceTrim.d.ts +3 -2
- package/esm/src/utils/parameters/extractParameterNames.d.ts +1 -0
- package/esm/src/utils/parameters/mapAvailableToExpectedParameters.d.ts +1 -0
- package/esm/src/utils/parameters/templateParameters.d.ts +2 -1
- package/esm/src/utils/parameters/valueToString.d.ts +2 -2
- package/esm/src/utils/random/$generateBookBoilerplate.d.ts +3 -3
- package/esm/src/utils/random/$randomAgentPersona.d.ts +1 -3
- package/esm/src/utils/random/$randomAgentRule.d.ts +1 -3
- package/esm/src/utils/random/$randomFullnameWithColor.d.ts +4 -3
- package/esm/src/utils/random/$randomItem.d.ts +0 -3
- package/esm/src/utils/random/$randomSeed.d.ts +0 -3
- package/esm/src/utils/random/$randomToken.d.ts +2 -5
- package/esm/src/utils/random/EnglishNamePool.d.ts +1 -0
- package/esm/src/utils/serialization/$deepFreeze.d.ts +1 -3
- package/esm/src/utils/serialization/checkSerializableAsJson.d.ts +1 -5
- package/esm/src/utils/serialization/clonePipeline.d.ts +1 -3
- package/esm/src/utils/serialization/deepClone.d.ts +1 -3
- package/esm/src/utils/serialization/exportJson.d.ts +1 -3
- package/esm/src/utils/serialization/isSerializableAsJson.d.ts +0 -5
- package/esm/src/utils/serialization/jsonStringsToJsons.d.ts +1 -4
- package/esm/src/utils/serialization/serializeToPromptbookJavascript.d.ts +3 -3
- package/esm/src/utils/sets/difference.d.ts +1 -3
- package/esm/src/utils/sets/intersection.d.ts +1 -0
- package/esm/src/utils/sets/union.d.ts +1 -0
- package/esm/src/utils/take/classes/TakeChain.d.ts +4 -1
- package/esm/src/utils/take/interfaces/ITakeChain.d.ts +5 -1
- package/esm/src/utils/take/interfaces/Takeable.d.ts +2 -1
- package/esm/src/utils/take/take.d.ts +1 -1
- package/esm/src/utils/validators/filePath/isRootPath.d.ts +1 -3
- package/esm/src/utils/validators/filePath/isRootPath.test.d.ts +0 -3
- package/esm/src/utils/validators/filePath/isValidFilePath.d.ts +1 -3
- package/esm/src/utils/validators/javascriptName/isValidJavascriptName.d.ts +1 -0
- package/esm/src/utils/validators/parameterName/validateParameterName.d.ts +1 -0
- package/esm/src/utils/validators/semanticVersion/isValidPromptbookVersion.d.ts +2 -1
- package/esm/src/utils/validators/url/extractUrlsFromText.d.ts +1 -0
- package/esm/src/utils/validators/url/isUrlOnPrivateNetwork.d.ts +1 -0
- package/esm/src/utils/validators/url/isValidAgentUrl.d.ts +0 -3
- package/esm/src/utils/validators/url/isValidPipelineUrl.d.ts +0 -3
- package/esm/src/utils/validators/url/normalizeDomainForMatching.d.ts +1 -0
- package/esm/src/version.d.ts +1 -1
- package/esm/src/wizard/$getCompiledBook.d.ts +0 -2
- package/esm/src/wizard/wizard.d.ts +1 -2
- package/package.json +2 -2
- package/umd/index.umd.js +776 -764
- package/umd/index.umd.js.map +1 -1
- package/umd/src/_packages/types.index.d.ts +45 -45
- package/umd/src/book-2.0/agent-source/AgentBasicInformation.d.ts +3 -4
- package/umd/src/book-2.0/agent-source/AgentModelRequirements.d.ts +0 -4
- package/umd/src/book-2.0/agent-source/createAgentModelRequirements.d.ts +7 -0
- package/umd/src/book-2.0/agent-source/createTeamToolName.d.ts +1 -0
- package/umd/src/book-2.0/agent-source/extractOpenTeacherInstructions.d.ts +1 -0
- package/umd/src/book-2.0/agent-source/padBook.d.ts +1 -4
- package/umd/src/book-2.0/agent-source/parseAgentSource.d.ts +0 -3
- package/umd/src/book-2.0/agent-source/parseAgentSourcePrelude.d.ts +1 -0
- package/umd/src/book-2.0/agent-source/parseParameters.d.ts +1 -0
- package/umd/src/book-2.0/agent-source/parseTeamCommitment.d.ts +0 -3
- package/umd/src/book-2.0/agent-source/pseudoAgentReferences.d.ts +8 -3
- package/umd/src/book-2.0/agent-source/string_book.d.ts +1 -0
- package/umd/src/book-2.0/utils/generatePlaceholderAgentProfileImageUrl.d.ts +0 -3
- package/umd/src/book-components/AvatarProfile/AvatarChip/AvatarChip.d.ts +0 -3
- package/umd/src/book-components/AvatarProfile/AvatarProfile/AvatarProfile.d.ts +0 -3
- package/umd/src/book-components/AvatarProfile/AvatarProfile/AvatarProfileTooltip.d.ts +4 -0
- package/umd/src/book-components/BookEditor/BookEditor.d.ts +0 -3
- package/umd/src/book-components/BookEditor/BookEditorActionbar.d.ts +4 -0
- package/umd/src/book-components/BookEditor/BookEditorMonaco.d.ts +2 -0
- package/umd/src/book-components/BookEditor/BookEditorMonacoUploadPanel.d.ts +3 -0
- package/umd/src/book-components/BookEditor/createDeprecatedCommitmentDiagnostics.d.ts +1 -0
- package/umd/src/book-components/BookEditor/useBookEditorMonacoDecorations.d.ts +6 -0
- package/umd/src/book-components/BookEditor/useBookEditorMonacoDiagnostics.d.ts +9 -0
- package/umd/src/book-components/BookEditor/useBookEditorMonacoLanguage.d.ts +7 -0
- package/umd/src/book-components/BookEditor/useBookEditorMonacoStyles.d.ts +3 -0
- package/umd/src/book-components/BookEditor/useBookEditorMonacoUploads.d.ts +24 -0
- package/umd/src/book-components/Chat/AgentChat/AgentChat.d.ts +0 -3
- package/umd/src/book-components/Chat/AgentChip/AgentChip.d.ts +6 -5
- package/umd/src/book-components/Chat/Chat/ChatInputAreaDictationPanel.d.ts +4 -8
- package/umd/src/book-components/Chat/Chat/ChatProps.d.ts +2 -3
- package/umd/src/book-components/Chat/Chat/ChatSelfLearningSummary.d.ts +0 -3
- package/umd/src/book-components/Chat/Chat/ChatToolCallModalComponents.d.ts +0 -3
- package/umd/src/book-components/Chat/Chat/StreamingFeaturePlaceholder.d.ts +1 -0
- package/umd/src/book-components/Chat/Chat/TeamToolCallModalContent.d.ts +1 -0
- package/umd/src/book-components/Chat/Chat/chatCssClassNames.d.ts +1 -0
- package/umd/src/book-components/Chat/Chat/constants.d.ts +4 -3
- package/umd/src/book-components/Chat/Chat/insertDictationChunk.d.ts +16 -0
- package/umd/src/book-components/Chat/Chat/learnDictationDictionary.d.ts +7 -0
- package/umd/src/book-components/Chat/Chat/refineFinalDictationChunk.d.ts +36 -0
- package/umd/src/book-components/Chat/Chat/renderAdvancedToolCallDetails.d.ts +3 -0
- package/umd/src/book-components/Chat/Chat/renderEmailToolCallDetails.d.ts +1 -0
- package/umd/src/book-components/Chat/Chat/renderMemoryToolCallDetails.d.ts +1 -0
- package/umd/src/book-components/Chat/Chat/renderPopupToolCallDetails.d.ts +1 -0
- package/umd/src/book-components/Chat/Chat/renderRunBrowserToolCallDetails.d.ts +1 -0
- package/umd/src/book-components/Chat/Chat/renderSearchToolCallDetails.d.ts +1 -0
- package/umd/src/book-components/Chat/Chat/renderSelfLearningToolCallDetails.d.ts +1 -0
- package/umd/src/book-components/Chat/Chat/renderTimeToolCallDetails.d.ts +1 -0
- package/umd/src/book-components/Chat/Chat/renderTimeoutToolCallDetails.d.ts +1 -0
- package/umd/src/book-components/Chat/Chat/renderToolCallClockPanel.d.ts +1 -0
- package/umd/src/book-components/Chat/Chat/renderToolCallDetails.d.ts +1 -0
- package/umd/src/book-components/Chat/Chat/renderToolCallProgressPlaceholder.d.ts +1 -0
- package/umd/src/book-components/Chat/Chat/renderWalletCredentialToolCallDetails.d.ts +1 -0
- package/umd/src/book-components/Chat/Chat/resolveSpeechRecognitionUiDescriptor.d.ts +30 -0
- package/umd/src/book-components/Chat/Chat/resolveToolCallProgressMessage.d.ts +1 -0
- package/umd/src/book-components/Chat/Chat/useChatInputAreaDictation.d.ts +7 -30
- package/umd/src/book-components/Chat/Chat/useChatInputAreaDictationPersistence.d.ts +20 -0
- package/umd/src/book-components/Chat/Chat/useChatInputAreaDictationSupport.d.ts +29 -0
- package/umd/src/book-components/Chat/LlmChat/defaults.d.ts +0 -3
- package/umd/src/book-components/Chat/MarkdownContent/MarkdownContent.d.ts +3 -3
- package/umd/src/book-components/Chat/MockedChat/constants.d.ts +0 -3
- package/umd/src/book-components/Chat/SourceChip/SourceChip.d.ts +4 -3
- package/umd/src/book-components/Chat/effects/components/ConfettiEffect.d.ts +3 -0
- package/umd/src/book-components/Chat/effects/components/HeartsEffect.d.ts +3 -0
- package/umd/src/book-components/Chat/effects/index.d.ts +0 -4
- package/umd/src/book-components/Chat/effects/utils/detectEffects.d.ts +1 -0
- package/umd/src/book-components/Chat/hooks/useSendMessageToLlmChat.d.ts +4 -4
- package/umd/src/book-components/Chat/save/_common/string_chat_format_name.d.ts +1 -0
- package/umd/src/book-components/Chat/save/html/htmlSaveFormatDefinition.d.ts +0 -3
- package/umd/src/book-components/Chat/save/index.d.ts +0 -3
- package/umd/src/book-components/Chat/save/pdf/buildChatPdf.d.ts +1 -0
- package/umd/src/book-components/Chat/save/pdf/pdfSaveFormatDefinition.d.ts +0 -4
- package/umd/src/book-components/Chat/types/ChatMessage.d.ts +3 -5
- package/umd/src/book-components/Chat/types/ChatParticipant.d.ts +0 -3
- package/umd/src/book-components/Chat/utils/ExportFormat.d.ts +2 -0
- package/umd/src/book-components/Chat/utils/citationHelpers.d.ts +4 -3
- package/umd/src/book-components/Chat/utils/collectTeamToolCallSummary.d.ts +1 -0
- package/umd/src/book-components/Chat/utils/createCitationFootnoteRenderModel.d.ts +1 -0
- package/umd/src/book-components/Chat/utils/exportChatHistory.d.ts +0 -3
- package/umd/src/book-components/Chat/utils/formatToolCallLocalTime.d.ts +2 -1
- package/umd/src/book-components/Chat/utils/loadAgentProfile.d.ts +12 -0
- package/umd/src/book-components/Chat/utils/parseCitationsFromContent.d.ts +0 -3
- package/umd/src/book-components/Chat/utils/parseImagePrompts.d.ts +1 -3
- package/umd/src/book-components/Chat/utils/sanitizeStreamingMessageContent.d.ts +14 -0
- package/umd/src/book-components/Chat/utils/thinkingMessageVariants.d.ts +3 -0
- package/umd/src/book-components/Chat/utils/timeoutToolCallPresentation.d.ts +0 -3
- package/umd/src/book-components/Chat/utils/toolCallParsing/extractSearchResults.d.ts +1 -0
- package/umd/src/book-components/Chat/utils/toolCallParsing/getToolCallResultDate.d.ts +1 -0
- package/umd/src/book-components/Chat/utils/toolCallParsing/getToolCallTimestamp.d.ts +1 -0
- package/umd/src/book-components/Chat/utils/toolCallParsing/parseRunBrowserToolResult.d.ts +1 -0
- package/umd/src/book-components/Chat/utils/toolCallParsing/parseTeamToolResult.d.ts +1 -0
- package/umd/src/book-components/Chat/utils/toolCallParsing/parseToolCallArguments.d.ts +1 -0
- package/umd/src/book-components/Chat/utils/toolCallParsing/parseToolCallResult.d.ts +1 -0
- package/umd/src/book-components/Chat/utils/toolCallParsing/resolveRunBrowserArtifactUrl.d.ts +1 -0
- package/umd/src/book-components/Chat/utils/walletCredentialToolCall.d.ts +3 -3
- package/umd/src/book-components/PromptbookAgent/PromptbookAgentIntegration.d.ts +3 -5
- package/umd/src/book-components/PromptbookAgent/PromptbookAgentSeamlessIntegration.d.ts +3 -5
- package/umd/src/book-components/Qr/BrandedQrCode.d.ts +5 -0
- package/umd/src/book-components/Qr/GenericQrCode.d.ts +5 -0
- package/umd/src/book-components/Qr/PromptbookQrCode.d.ts +5 -0
- package/umd/src/book-components/Qr/useQrCode.d.ts +4 -1
- package/umd/src/book-components/_common/Dropdown/Dropdown.d.ts +4 -0
- package/umd/src/book-components/_common/HamburgerMenu/HamburgerMenu.d.ts +4 -0
- package/umd/src/book-components/_common/MenuHoisting/MenuHoistingContext.d.ts +3 -3
- package/umd/src/book-components/_common/Modal/Modal.d.ts +1 -3
- package/umd/src/book-components/_common/Tooltip/Tooltip.d.ts +3 -0
- package/umd/src/book-components/icons/AboutIcon.d.ts +1 -0
- package/umd/src/book-components/icons/AttachmentIcon.d.ts +4 -0
- package/umd/src/book-components/icons/CameraIcon.d.ts +4 -0
- package/umd/src/book-components/icons/DownloadIcon.d.ts +1 -0
- package/umd/src/book-components/icons/EmailIcon.d.ts +1 -0
- package/umd/src/book-components/icons/MenuIcon.d.ts +1 -3
- package/umd/src/book-components/icons/SaveIcon.d.ts +1 -0
- package/umd/src/book-components/icons/SendIcon.d.ts +0 -3
- package/umd/src/book-components/icons/TeacherIcon.d.ts +1 -0
- package/umd/src/cli/$runPromptbookCli.d.ts +0 -1
- package/umd/src/cli/cli-commands/_boilerplate.d.ts +0 -2
- package/umd/src/cli/cli-commands/about.d.ts +0 -6
- package/umd/src/cli/cli-commands/coder/ThinkingLevel.d.ts +18 -0
- package/umd/src/cli/cli-commands/coder/find-fresh-emoji-tags.d.ts +0 -2
- package/umd/src/cli/cli-commands/coder/find-refactor-candidates.d.ts +0 -2
- package/umd/src/cli/cli-commands/coder/generate-boilerplates.d.ts +0 -2
- package/umd/src/cli/cli-commands/coder/init.d.ts +0 -2
- package/umd/src/cli/cli-commands/coder/run.d.ts +1 -3
- package/umd/src/cli/cli-commands/coder/run.test.d.ts +1 -0
- package/umd/src/cli/cli-commands/coder/verify.d.ts +0 -2
- package/umd/src/cli/cli-commands/coder.d.ts +0 -2
- package/umd/src/cli/cli-commands/common/handleActionErrors.d.ts +4 -0
- package/umd/src/cli/cli-commands/hello.d.ts +0 -5
- package/umd/src/cli/cli-commands/list-models.d.ts +0 -2
- package/umd/src/cli/cli-commands/list-scrapers.d.ts +0 -2
- package/umd/src/cli/cli-commands/login.d.ts +0 -5
- package/umd/src/cli/cli-commands/prettify.d.ts +0 -6
- package/umd/src/cli/cli-commands/run.d.ts +0 -8
- package/umd/src/cli/cli-commands/runInteractiveChatbot.d.ts +1 -5
- package/umd/src/cli/cli-commands/start-agents-server.d.ts +0 -2
- package/umd/src/cli/cli-commands/start-pipelines-server.d.ts +0 -5
- package/umd/src/cli/cli-commands/test-command.d.ts +0 -7
- package/umd/src/cli/common/$provideLlmToolsForCli.d.ts +5 -0
- package/umd/src/cli/main.d.ts +0 -2
- package/umd/src/cli/promptbookCli.d.ts +0 -7
- package/umd/src/collection/agent-collection/AgentCollection.d.ts +0 -3
- package/umd/src/collection/agent-collection/constructors/agent-collection-in-supabase/AgentCollectionInSupabase.d.ts +2 -6
- package/umd/src/collection/agent-collection/constructors/agent-collection-in-supabase/AgentCollectionInSupabaseOptions.d.ts +3 -0
- package/umd/src/collection/pipeline-collection/SimplePipelineCollection.d.ts +2 -1
- package/umd/src/collection/pipeline-collection/constructors/createPipelineCollectionFromDirectory.d.ts +2 -5
- package/umd/src/collection/pipeline-collection/constructors/createPipelineCollectionFromJson.d.ts +1 -0
- package/umd/src/collection/pipeline-collection/constructors/createPipelineCollectionFromPromise.d.ts +4 -3
- package/umd/src/collection/pipeline-collection/constructors/createPipelineCollectionFromUrl.d.ts +2 -3
- package/umd/src/collection/pipeline-collection/constructors/createPipelineSubcollection.d.ts +1 -0
- package/umd/src/collection/pipeline-collection/pipelineCollectionToJson.d.ts +0 -3
- package/umd/src/commands/BOOK_VERSION/BookVersionCommand.d.ts +1 -0
- package/umd/src/commands/BOOK_VERSION/bookVersionCommandParser.d.ts +1 -0
- package/umd/src/commands/EXPECT/ExpectCommand.d.ts +0 -3
- package/umd/src/commands/EXPECT/expectCommandParser.d.ts +3 -2
- package/umd/src/commands/FOREACH/ForeachCommand.d.ts +1 -0
- package/umd/src/commands/FOREACH/foreachCommandParser.d.ts +1 -3
- package/umd/src/commands/FORMAT/formatCommandParser.d.ts +1 -0
- package/umd/src/commands/FORMFACTOR/FormfactorCommand.d.ts +1 -0
- package/umd/src/commands/FORMFACTOR/formfactorCommandParser.d.ts +1 -0
- package/umd/src/commands/JOKER/JokerCommand.d.ts +1 -0
- package/umd/src/commands/JOKER/jokerCommandParser.d.ts +1 -0
- package/umd/src/commands/KNOWLEDGE/KnowledgeCommand.d.ts +1 -0
- package/umd/src/commands/KNOWLEDGE/knowledgeCommandParser.d.ts +1 -3
- package/umd/src/commands/KNOWLEDGE/utils/knowledgeSourceContentToName.d.ts +0 -3
- package/umd/src/commands/KNOWLEDGE/utils/knowledgeSourceContentToName.test.d.ts +0 -3
- package/umd/src/commands/MODEL/ModelCommand.d.ts +1 -0
- package/umd/src/commands/MODEL/modelCommandParser.d.ts +1 -0
- package/umd/src/commands/PARAMETER/ParameterCommand.d.ts +1 -0
- package/umd/src/commands/PARAMETER/parameterCommandParser.d.ts +1 -0
- package/umd/src/commands/PERSONA/PersonaCommand.d.ts +1 -0
- package/umd/src/commands/PERSONA/personaCommandParser.d.ts +1 -0
- package/umd/src/commands/POSTPROCESS/PostprocessCommand.d.ts +1 -0
- package/umd/src/commands/POSTPROCESS/postprocessCommandParser.d.ts +1 -0
- package/umd/src/commands/SECTION/SectionCommand.d.ts +1 -0
- package/umd/src/commands/SECTION/sectionCommandParser.d.ts +1 -0
- package/umd/src/commands/URL/UrlCommand.d.ts +1 -0
- package/umd/src/commands/URL/urlCommandParser.d.ts +1 -0
- package/umd/src/commands/X_ACTION/ActionCommand.d.ts +1 -0
- package/umd/src/commands/X_ACTION/actionCommandParser.d.ts +1 -3
- package/umd/src/commands/X_INSTRUMENT/InstrumentCommand.d.ts +1 -0
- package/umd/src/commands/X_INSTRUMENT/instrumentCommandParser.d.ts +1 -3
- package/umd/src/commands/_BOILERPLATE/BoilerplateCommand.d.ts +1 -0
- package/umd/src/commands/_BOILERPLATE/boilerplateCommandParser.d.ts +1 -0
- package/umd/src/commands/_common/stringifyCommand.d.ts +1 -1
- package/umd/src/commands/_common/types/CommandParser.d.ts +0 -4
- package/umd/src/commands/index.d.ts +0 -3
- package/umd/src/commitments/ACTION/ACTION.d.ts +0 -3
- package/umd/src/commitments/CLOSED/CLOSED.d.ts +0 -3
- package/umd/src/commitments/CLOSED/CLOSED.test.d.ts +0 -3
- package/umd/src/commitments/COMPONENT/COMPONENT.d.ts +0 -3
- package/umd/src/commitments/DELETE/DELETE.d.ts +0 -3
- package/umd/src/commitments/DICTIONARY/DICTIONARY.d.ts +0 -3
- package/umd/src/commitments/FORMAT/FORMAT.d.ts +0 -3
- package/umd/src/commitments/FROM/FROM.d.ts +0 -3
- package/umd/src/commitments/GOAL/GOAL.d.ts +0 -3
- package/umd/src/commitments/IMPORT/IMPORT.d.ts +0 -3
- package/umd/src/commitments/LANGUAGE/LANGUAGE.d.ts +0 -3
- package/umd/src/commitments/MEMORY/MEMORY.d.ts +0 -3
- package/umd/src/commitments/MESSAGE/MESSAGE.d.ts +0 -3
- package/umd/src/commitments/MESSAGE_SUFFIX/MESSAGE_SUFFIX.d.ts +0 -3
- package/umd/src/commitments/META/META.d.ts +0 -3
- package/umd/src/commitments/META/META_DESCRIPTION.d.ts +0 -3
- package/umd/src/commitments/META_COLOR/META_COLOR.d.ts +0 -3
- package/umd/src/commitments/META_DISCLAIMER/META_DISCLAIMER.d.ts +0 -3
- package/umd/src/commitments/META_DOMAIN/META_DOMAIN.d.ts +0 -3
- package/umd/src/commitments/META_FONT/META_FONT.d.ts +0 -3
- package/umd/src/commitments/META_IMAGE/META_IMAGE.d.ts +0 -3
- package/umd/src/commitments/META_INPUT_PLACEHOLDER/META_INPUT_PLACEHOLDER.d.ts +0 -3
- package/umd/src/commitments/META_LINK/META_LINK.d.ts +0 -3
- package/umd/src/commitments/META_VOICE/META_VOICE.d.ts +0 -3
- package/umd/src/commitments/MODEL/MODEL.d.ts +0 -3
- package/umd/src/commitments/OPEN/OPEN.d.ts +0 -3
- package/umd/src/commitments/PERSONA/PERSONA.d.ts +0 -3
- package/umd/src/commitments/RULE/RULE.d.ts +0 -3
- package/umd/src/commitments/SAMPLE/SAMPLE.d.ts +0 -3
- package/umd/src/commitments/SCENARIO/SCENARIO.d.ts +0 -3
- package/umd/src/commitments/TEAM/TEAM.d.ts +0 -3
- package/umd/src/commitments/TEMPLATE/TEMPLATE.d.ts +0 -3
- package/umd/src/commitments/USE/USE.d.ts +0 -3
- package/umd/src/commitments/USE/aggregateUseCommitmentSystemMessages.d.ts +2 -0
- package/umd/src/commitments/USE_BROWSER/USE_BROWSER.d.ts +0 -3
- package/umd/src/commitments/USE_BROWSER/fetchUrlContent.d.ts +4 -5
- package/umd/src/commitments/USE_CALENDAR/USE_CALENDAR.d.ts +0 -3
- package/umd/src/commitments/USE_CALENDAR/calendarReference.d.ts +0 -3
- package/umd/src/commitments/USE_EMAIL/USE_EMAIL.d.ts +0 -3
- package/umd/src/commitments/USE_IMAGE_GENERATOR/USE_IMAGE_GENERATOR.d.ts +0 -3
- package/umd/src/commitments/USE_MCP/USE_MCP.d.ts +0 -3
- package/umd/src/commitments/USE_POPUP/USE_POPUP.d.ts +0 -3
- package/umd/src/commitments/USE_PRIVACY/USE_PRIVACY.d.ts +0 -3
- package/umd/src/commitments/USE_PROJECT/USE_PROJECT.d.ts +0 -3
- package/umd/src/commitments/USE_PROJECT/projectReference.d.ts +0 -3
- package/umd/src/commitments/USE_SEARCH_ENGINE/USE_SEARCH_ENGINE.d.ts +0 -3
- package/umd/src/commitments/USE_SPAWN/USE_SPAWN.d.ts +0 -3
- package/umd/src/commitments/USE_TIME/USE_TIME.d.ts +0 -3
- package/umd/src/commitments/USE_TIMEOUT/USE_TIMEOUT.d.ts +0 -3
- package/umd/src/commitments/USE_USER_LOCATION/USE_USER_LOCATION.d.ts +0 -3
- package/umd/src/commitments/WALLET/WALLET.d.ts +0 -3
- package/umd/src/commitments/WRITING_RULES/WRITING_RULES.d.ts +0 -3
- package/umd/src/commitments/WRITING_SAMPLE/WRITING_SAMPLE.d.ts +0 -3
- package/umd/src/commitments/_base/createEmptyAgentModelRequirements.d.ts +0 -3
- package/umd/src/commitments/_common/commitmentToolFunctions.d.ts +2 -3
- package/umd/src/commitments/_common/createWritingCommitmentSections.d.ts +2 -3
- package/umd/src/commitments/_common/getAllCommitmentDefinitions.d.ts +1 -0
- package/umd/src/commitments/_common/getAllCommitmentTypes.d.ts +1 -0
- package/umd/src/commitments/_common/getAllCommitmentsToolFunctionsForNode.d.ts +0 -4
- package/umd/src/commitments/_common/getCommitmentDefinition.d.ts +1 -0
- package/umd/src/commitments/_common/isCommitmentSupported.d.ts +1 -0
- package/umd/src/commitments/_common/toolExecutionEnvelope.d.ts +0 -3
- package/umd/src/commitments/_common/toolRuntimeContext.d.ts +3 -3
- package/umd/src/commitments/index.d.ts +0 -4
- package/umd/src/config.test.d.ts +0 -3
- package/umd/src/constants/streaming.d.ts +0 -3
- package/umd/src/constants.d.ts +0 -3
- package/umd/src/conversion/archive/loadArchive.d.ts +0 -1
- package/umd/src/conversion/archive/saveArchive.d.ts +0 -5
- package/umd/src/conversion/compilePipeline.d.ts +2 -7
- package/umd/src/conversion/compilePipelineOnRemoteServer.d.ts +2 -5
- package/umd/src/conversion/parsePipeline.d.ts +1 -11
- package/umd/src/conversion/pipelineJsonToString.d.ts +1 -7
- package/umd/src/conversion/prettify/prettifyPipelineString.d.ts +0 -4
- package/umd/src/conversion/prettify/renderPipelineMermaidOptions.d.ts +0 -7
- package/umd/src/conversion/utils/extractParameterNamesFromTask.d.ts +1 -3
- package/umd/src/conversion/validation/_importPipeline.d.ts +6 -2
- package/umd/src/conversion/validation/pipelineStringToJson-parseErrors.test.d.ts +0 -3
- package/umd/src/conversion/validation/validatePipeline-logicErrors.test.d.ts +0 -3
- package/umd/src/conversion/validation/validatePipeline.d.ts +3 -9
- package/umd/src/conversion/validation/validatePipeline.test.d.ts +0 -3
- package/umd/src/dialogs/simple-prompt/SimplePromptInterfaceTools.d.ts +1 -2
- package/umd/src/errors/0-BoilerplateError.d.ts +0 -3
- package/umd/src/errors/0-index.d.ts +0 -3
- package/umd/src/errors/DatabaseError.d.ts +0 -3
- package/umd/src/errors/ExpectError.d.ts +2 -1
- package/umd/src/errors/ParseError.d.ts +0 -3
- package/umd/src/errors/PipelineExecutionError.d.ts +0 -3
- package/umd/src/executables/$provideExecutablesForNode.d.ts +0 -5
- package/umd/src/executables/apps/locateLibreoffice.d.ts +0 -2
- package/umd/src/executables/apps/locatePandoc.d.ts +0 -2
- package/umd/src/executables/browsers/locateBrowser.d.ts +0 -1
- package/umd/src/executables/browsers/locateDefaultSystemBrowser.d.ts +0 -1
- package/umd/src/executables/locateApp.d.ts +0 -2
- package/umd/src/executables/platforms/locateAppOnLinux.d.ts +0 -2
- package/umd/src/executables/platforms/locateAppOnMacOs.d.ts +0 -2
- package/umd/src/executables/platforms/locateAppOnWindows.d.ts +0 -2
- package/umd/src/execution/AbstractTaskResult.d.ts +0 -4
- package/umd/src/execution/AvailableModel.d.ts +0 -4
- package/umd/src/execution/CommonToolsOptions.d.ts +0 -5
- package/umd/src/execution/ExecutionTask.d.ts +4 -4
- package/umd/src/execution/FilesystemTools.d.ts +0 -3
- package/umd/src/execution/LlmExecutionTools.d.ts +3 -9
- package/umd/src/execution/LlmExecutionToolsConstructor.d.ts +0 -3
- package/umd/src/execution/PipelineExecutor.d.ts +0 -3
- package/umd/src/execution/PipelineExecutorResult.d.ts +0 -3
- package/umd/src/execution/PromptResult.d.ts +1 -9
- package/umd/src/execution/PromptbookFetch.test-type.d.ts +0 -4
- package/umd/src/execution/ScriptExecutionTools.d.ts +0 -4
- package/umd/src/execution/Usage.d.ts +0 -3
- package/umd/src/execution/UserInterfaceTools.d.ts +3 -0
- package/umd/src/execution/assertsTaskSuccessful.d.ts +1 -3
- package/umd/src/execution/createPipelineExecutor/00-createPipelineExecutor.d.ts +1 -0
- package/umd/src/execution/createPipelineExecutor/20-executeTask.d.ts +0 -3
- package/umd/src/execution/createPipelineExecutor/40-executeAttempts.d.ts +1 -3
- package/umd/src/execution/createPipelineExecutor/getContextForTask.d.ts +1 -0
- package/umd/src/execution/createPipelineExecutor/getKnowledgeForTask.d.ts +0 -4
- package/umd/src/execution/createPipelineExecutor/knowledgePiecesToString.d.ts +0 -1
- package/umd/src/execution/execution-report/ExecutionReportJson.d.ts +1 -0
- package/umd/src/execution/execution-report/ExecutionReportString.d.ts +0 -3
- package/umd/src/execution/execution-report/executionReportJsonToString.d.ts +0 -5
- package/umd/src/execution/translation/automatic-translate/automatic-translators/AutomaticTranslator.d.ts +3 -1
- package/umd/src/execution/translation/automatic-translate/automatic-translators/FakeAutomaticTranslator.d.ts +3 -1
- package/umd/src/execution/translation/automatic-translate/automatic-translators/TranslatorOptions.d.ts +3 -1
- package/umd/src/execution/translation/automatic-translate/automatic-translators/utils/extractMultiplicatedOccurrence.d.ts +2 -0
- package/umd/src/execution/translation/automatic-translate/translateMessages.d.ts +3 -3
- package/umd/src/execution/utils/$provideExecutionToolsForNode.d.ts +2 -4
- package/umd/src/execution/utils/checkExpectations.d.ts +2 -5
- package/umd/src/execution/utils/forEachAsync.d.ts +5 -1
- package/umd/src/execution/utils/usage-constants.d.ts +0 -3
- package/umd/src/execution/utils/usageToHuman.d.ts +0 -8
- package/umd/src/execution/utils/validatePromptResult.d.ts +1 -0
- package/umd/src/file-security-checkers/virustotal/VirusTotalFileSecurityChecker.d.ts +1 -0
- package/umd/src/formats/_common/FormatParser.d.ts +2 -9
- package/umd/src/formats/_common/FormatSubvalueParser.d.ts +0 -3
- package/umd/src/formats/csv/CsvFormatParser.d.ts +2 -8
- package/umd/src/formats/index.d.ts +0 -3
- package/umd/src/formats/json/JsonFormatParser.d.ts +0 -11
- package/umd/src/formats/text/TextFormatParser.d.ts +0 -9
- package/umd/src/formats/xml/XmlFormatParser.d.ts +0 -11
- package/umd/src/formfactors/_common/AbstractFormfactorDefinition.d.ts +1 -3
- package/umd/src/formfactors/_common/FormfactorDefinition.d.ts +1 -0
- package/umd/src/formfactors/index.d.ts +0 -3
- package/umd/src/high-level-abstractions/_common/HighLevelAbstraction.d.ts +0 -5
- package/umd/src/high-level-abstractions/index.d.ts +0 -4
- package/umd/src/high-level-abstractions/quick-chatbot/QuickChatbotHla.d.ts +0 -3
- package/umd/src/llm-providers/_common/register/$llmToolsMetadataRegister.d.ts +2 -3
- package/umd/src/llm-providers/_common/register/$llmToolsRegister.d.ts +2 -3
- package/umd/src/llm-providers/_common/register/$provideEnvFilename.d.ts +0 -1
- package/umd/src/llm-providers/_common/register/$provideLlmToolsConfigurationFromEnv.d.ts +1 -1
- package/umd/src/llm-providers/_common/register/$provideLlmToolsForTestingAndScriptsAndPlayground.d.ts +3 -6
- package/umd/src/llm-providers/_common/register/$provideLlmToolsForWizardOrCli.d.ts +3 -7
- package/umd/src/llm-providers/_common/register/$provideLlmToolsFromEnv.d.ts +1 -16
- package/umd/src/llm-providers/_common/register/$registeredLlmToolsMessage.d.ts +0 -4
- package/umd/src/llm-providers/_common/register/LlmToolsConfiguration.d.ts +0 -5
- package/umd/src/llm-providers/_common/register/LlmToolsMetadata.d.ts +0 -6
- package/umd/src/llm-providers/_common/register/LlmToolsOptions.d.ts +0 -4
- package/umd/src/llm-providers/_common/register/createLlmToolsFromConfiguration.d.ts +1 -0
- package/umd/src/llm-providers/_common/utils/assertUniqueModels.d.ts +0 -3
- package/umd/src/llm-providers/_common/utils/cache/CacheItem.d.ts +0 -3
- package/umd/src/llm-providers/_common/utils/cache/cacheLlmTools.d.ts +1 -0
- package/umd/src/llm-providers/_common/utils/count-total-usage/LlmExecutionToolsWithTotalUsage.d.ts +0 -4
- package/umd/src/llm-providers/_common/utils/count-total-usage/countUsage.d.ts +1 -0
- package/umd/src/llm-providers/_common/utils/count-total-usage/limitTotalUsage.d.ts +0 -7
- package/umd/src/llm-providers/_common/utils/removeUnsupportedModelRequirements.d.ts +4 -0
- package/umd/src/llm-providers/_multiple/MultipleLlmExecutionTools.d.ts +1 -0
- package/umd/src/llm-providers/_multiple/getSingleLlmExecutionTools.d.ts +0 -4
- package/umd/src/llm-providers/_multiple/joinLlmExecutionTools.d.ts +3 -7
- package/umd/src/llm-providers/_multiple/playground/playground.d.ts +0 -1
- package/umd/src/llm-providers/agent/Agent.d.ts +0 -3
- package/umd/src/llm-providers/agent/AgentLlmExecutionTools.d.ts +0 -4
- package/umd/src/llm-providers/agent/RemoteAgent.d.ts +0 -4
- package/umd/src/llm-providers/agent/playground/playground.d.ts +0 -6
- package/umd/src/llm-providers/agent/register-configuration.d.ts +0 -5
- package/umd/src/llm-providers/agent/register-constructor.d.ts +0 -4
- package/umd/src/llm-providers/anthropic-claude/AnthropicClaudeExecutionTools.d.ts +2 -10
- package/umd/src/llm-providers/anthropic-claude/AnthropicClaudeExecutionToolsOptions.d.ts +3 -3
- package/umd/src/llm-providers/anthropic-claude/anthropic-claude-models.d.ts +1 -8
- package/umd/src/llm-providers/anthropic-claude/computeAnthropicClaudeUsage.d.ts +1 -3
- package/umd/src/llm-providers/anthropic-claude/computeAnthropicClaudeUsage.test.d.ts +0 -3
- package/umd/src/llm-providers/anthropic-claude/createAnthropicClaudeExecutionTools.d.ts +0 -7
- package/umd/src/llm-providers/anthropic-claude/playground/playground.d.ts +0 -5
- package/umd/src/llm-providers/anthropic-claude/register-configuration.d.ts +0 -3
- package/umd/src/llm-providers/anthropic-claude/register-constructor.d.ts +0 -5
- package/umd/src/llm-providers/azure-openai/AzureOpenAiExecutionTools.d.ts +0 -6
- package/umd/src/llm-providers/azure-openai/AzureOpenAiExecutionToolsOptions.d.ts +1 -0
- package/umd/src/llm-providers/azure-openai/createAzureOpenAiExecutionTools.d.ts +0 -4
- package/umd/src/llm-providers/azure-openai/playground/playground.d.ts +0 -2
- package/umd/src/llm-providers/azure-openai/register-configuration.d.ts +0 -3
- package/umd/src/llm-providers/azure-openai/register-constructor.d.ts +0 -4
- package/umd/src/llm-providers/deepseek/DeepseekExecutionToolsOptions.d.ts +1 -0
- package/umd/src/llm-providers/deepseek/createDeepseekExecutionTools.d.ts +0 -3
- package/umd/src/llm-providers/deepseek/deepseek-models.d.ts +1 -6
- package/umd/src/llm-providers/deepseek/register-configuration.d.ts +0 -3
- package/umd/src/llm-providers/deepseek/register-constructor.d.ts +0 -4
- package/umd/src/llm-providers/google/GoogleExecutionToolsOptions.d.ts +1 -0
- package/umd/src/llm-providers/google/createGoogleExecutionTools.d.ts +0 -4
- package/umd/src/llm-providers/google/google-models.d.ts +1 -6
- package/umd/src/llm-providers/google/register-configuration.d.ts +0 -3
- package/umd/src/llm-providers/google/register-constructor.d.ts +0 -4
- package/umd/src/llm-providers/mocked/$fakeTextToExpectations.d.ts +1 -5
- package/umd/src/llm-providers/mocked/MockedEchoLlmExecutionTools.d.ts +0 -4
- package/umd/src/llm-providers/mocked/MockedFackedLlmExecutionTools.d.ts +0 -3
- package/umd/src/llm-providers/mocked/test/joker.test.d.ts +0 -3
- package/umd/src/llm-providers/mocked/test/mocked-chat.test.d.ts +0 -4
- package/umd/src/llm-providers/mocked/test/mocked-completion.test.d.ts +0 -3
- package/umd/src/llm-providers/ollama/OllamaExecutionTools.d.ts +0 -3
- package/umd/src/llm-providers/ollama/OllamaExecutionToolsOptions.d.ts +1 -0
- package/umd/src/llm-providers/ollama/ollama-models.d.ts +1 -4
- package/umd/src/llm-providers/ollama/playground/playground.d.ts +0 -2
- package/umd/src/llm-providers/ollama/register-configuration.d.ts +0 -3
- package/umd/src/llm-providers/ollama/register-constructor.d.ts +0 -4
- package/umd/src/llm-providers/openai/OpenAiAgentKitExecutionTools.d.ts +10 -0
- package/umd/src/llm-providers/openai/OpenAiAssistantExecutionTools.d.ts +1 -8
- package/umd/src/llm-providers/openai/OpenAiCompatibleExecutionTools.d.ts +0 -7
- package/umd/src/llm-providers/openai/OpenAiCompatibleExecutionToolsOptions.d.ts +2 -0
- package/umd/src/llm-providers/openai/computeOpenAiUsage.d.ts +1 -3
- package/umd/src/llm-providers/openai/computeOpenAiUsage.test.d.ts +0 -3
- package/umd/src/llm-providers/openai/createOpenAiAssistantExecutionTools.d.ts +0 -4
- package/umd/src/llm-providers/openai/createOpenAiCompatibleExecutionTools.d.ts +0 -4
- package/umd/src/llm-providers/openai/createOpenAiExecutionTools.d.ts +0 -4
- package/umd/src/llm-providers/openai/openai-models.d.ts +1 -0
- package/umd/src/llm-providers/openai/openai-models.test.d.ts +0 -3
- package/umd/src/llm-providers/openai/playground/playground.d.ts +0 -2
- package/umd/src/llm-providers/openai/register-configuration.d.ts +0 -3
- package/umd/src/llm-providers/openai/register-constructor.d.ts +0 -4
- package/umd/src/llm-providers/remote/RemoteLlmExecutionTools.d.ts +1 -9
- package/umd/src/llm-providers/remote/playground/playground.d.ts +0 -1
- package/umd/src/llm-providers/vercel/playground/playground.d.ts +0 -2
- package/umd/src/other/templates/getBookTemplates.d.ts +2 -5
- package/umd/src/personas/preparePersona.d.ts +1 -7
- package/umd/src/pipeline/PipelineInterface/PipelineInterface.d.ts +1 -0
- package/umd/src/pipeline/PipelineInterface/constants.d.ts +0 -3
- package/umd/src/pipeline/PipelineJson/CommonTaskJson.d.ts +0 -4
- package/umd/src/pipeline/PipelineJson/DialogTaskJson.d.ts +1 -3
- package/umd/src/pipeline/PipelineJson/Expectations.d.ts +4 -3
- package/umd/src/pipeline/PipelineJson/KnowledgePieceJson.d.ts +0 -4
- package/umd/src/pipeline/PipelineJson/KnowledgeSourceJson.d.ts +0 -3
- package/umd/src/pipeline/PipelineJson/PersonaJson.d.ts +0 -3
- package/umd/src/pipeline/PipelineJson/PreparationJson.d.ts +3 -5
- package/umd/src/pipeline/PipelineJson/ScriptTaskJson.d.ts +1 -4
- package/umd/src/pipeline/PipelineJson/SimpleTaskJson.d.ts +1 -3
- package/umd/src/pipeline/book-notation.d.ts +1 -4
- package/umd/src/pipeline/isValidPipelineString.d.ts +1 -3
- package/umd/src/pipeline/isValidPipelineString.test.d.ts +0 -3
- package/umd/src/pipeline/prompt-notation/helpers/ParameterEscaping.d.ts +5 -0
- package/umd/src/pipeline/prompt-notation/helpers/ParameterNaming.d.ts +1 -0
- package/umd/src/pipeline/prompt-notation/helpers/ParameterSection.d.ts +2 -0
- package/umd/src/pipeline/prompt-notation.d.ts +2 -5
- package/umd/src/pipeline/prompt-notation.test.d.ts +0 -3
- package/umd/src/pipeline/validatePipelineString.d.ts +1 -3
- package/umd/src/playground/permanent/_boilerplate.d.ts +0 -1
- package/umd/src/playground/permanent/agent-with-browser-playground.d.ts +0 -1
- package/umd/src/playground/permanent/error-handling-playground.d.ts +0 -1
- package/umd/src/playground/playground.d.ts +0 -2
- package/umd/src/postprocessing/utils/extractBlock.d.ts +2 -1
- package/umd/src/postprocessing/utils/extractJsonBlock.d.ts +2 -5
- package/umd/src/prepare/PrepareAndScrapeOptions.d.ts +0 -4
- package/umd/src/prepare/preparePipeline.d.ts +3 -2
- package/umd/src/prepare/preparePipelineOnRemoteServer.d.ts +2 -5
- package/umd/src/prepare/prepareTasks.d.ts +6 -10
- package/umd/src/prepare/unpreparePipeline.d.ts +1 -5
- package/umd/src/remote-server/RemoteServer.d.ts +3 -0
- package/umd/src/remote-server/openapi.d.ts +3 -4
- package/umd/src/remote-server/socket-types/_subtypes/Identification.d.ts +1 -5
- package/umd/src/remote-server/socket-types/listModels/PromptbookServer_ListModels_Request.d.ts +0 -3
- package/umd/src/remote-server/socket-types/listModels/PromptbookServer_ListModels_Response.d.ts +0 -3
- package/umd/src/remote-server/startAgentServer.d.ts +6 -2
- package/umd/src/remote-server/startRemoteServer.d.ts +1 -15
- package/umd/src/remote-server/types/RemoteClientOptions.d.ts +0 -5
- package/umd/src/remote-server/types/RemoteServerOptions.d.ts +10 -4
- package/umd/src/remote-server/ui/ServerApp.d.ts +1 -0
- package/umd/src/remote-server/ui/types.d.ts +3 -0
- package/umd/src/scrapers/_boilerplate/BoilerplateScraper.d.ts +1 -4
- package/umd/src/scrapers/_boilerplate/createBoilerplateScraper.d.ts +0 -3
- package/umd/src/scrapers/_boilerplate/playground/boilerplate-scraper-playground.d.ts +0 -1
- package/umd/src/scrapers/_boilerplate/register-constructor.d.ts +0 -4
- package/umd/src/scrapers/_boilerplate/register-metadata.d.ts +0 -3
- package/umd/src/scrapers/_common/Scraper.d.ts +0 -5
- package/umd/src/scrapers/_common/ScraperIntermediateSource.d.ts +0 -3
- package/umd/src/scrapers/_common/prepareKnowledgePieces.d.ts +1 -0
- package/umd/src/scrapers/_common/register/$provideFilesystemForNode.d.ts +0 -2
- package/umd/src/scrapers/_common/register/$provideScrapersForNode.d.ts +1 -2
- package/umd/src/scrapers/_common/register/$provideScriptingForNode.d.ts +0 -2
- package/umd/src/scrapers/_common/register/$registeredScrapersMessage.d.ts +0 -3
- package/umd/src/scrapers/_common/register/$scrapersMetadataRegister.d.ts +2 -3
- package/umd/src/scrapers/_common/register/$scrapersRegister.d.ts +2 -3
- package/umd/src/scrapers/_common/register/ScraperConstructor.d.ts +0 -3
- package/umd/src/scrapers/_common/utils/getScraperIntermediateSource.d.ts +0 -7
- package/umd/src/scrapers/_common/utils/getScraperIntermediateSource.test.d.ts +0 -3
- package/umd/src/scrapers/_common/utils/promptbookFetch.d.ts +0 -3
- package/umd/src/scrapers/document/DocumentScraper.d.ts +1 -6
- package/umd/src/scrapers/document/DocumentScraper.test.d.ts +0 -3
- package/umd/src/scrapers/document/createDocumentScraper.d.ts +0 -3
- package/umd/src/scrapers/document/playground/document-scraper-playground.d.ts +0 -1
- package/umd/src/scrapers/document/register-constructor.d.ts +0 -4
- package/umd/src/scrapers/document/register-metadata.d.ts +0 -3
- package/umd/src/scrapers/document-legacy/LegacyDocumentScraper.d.ts +1 -6
- package/umd/src/scrapers/document-legacy/LegacyDocumentScraper.test.d.ts +0 -3
- package/umd/src/scrapers/document-legacy/createLegacyDocumentScraper.d.ts +0 -3
- package/umd/src/scrapers/document-legacy/playground/legacy-document-scraper-playground.d.ts +0 -1
- package/umd/src/scrapers/document-legacy/register-constructor.d.ts +0 -4
- package/umd/src/scrapers/document-legacy/register-metadata.d.ts +0 -3
- package/umd/src/scrapers/markdown/MarkdownScraper.d.ts +1 -4
- package/umd/src/scrapers/markdown/MarkdownScraper.test.d.ts +0 -3
- package/umd/src/scrapers/markdown/createMarkdownScraper.d.ts +0 -3
- package/umd/src/scrapers/markdown/playground/markdown-scraper-playground.d.ts +0 -1
- package/umd/src/scrapers/markdown/register-constructor.d.ts +0 -4
- package/umd/src/scrapers/markdown/register-metadata.d.ts +0 -3
- package/umd/src/scrapers/markitdown/MarkitdownScraper.d.ts +1 -7
- package/umd/src/scrapers/markitdown/createMarkitdownScraper.d.ts +0 -4
- package/umd/src/scrapers/markitdown/playground/markitdown-scraper-playground.d.ts +0 -1
- package/umd/src/scrapers/markitdown/register-constructor.d.ts +0 -5
- package/umd/src/scrapers/markitdown/register-metadata.d.ts +0 -3
- package/umd/src/scrapers/pdf/PdfScraper.d.ts +1 -6
- package/umd/src/scrapers/pdf/createPdfScraper.d.ts +0 -3
- package/umd/src/scrapers/pdf/playground/pdf-scraper-playground.d.ts +0 -1
- package/umd/src/scrapers/pdf/register-constructor.d.ts +0 -4
- package/umd/src/scrapers/pdf/register-metadata.d.ts +0 -3
- package/umd/src/scrapers/website/WebsiteScraper.d.ts +1 -6
- package/umd/src/scrapers/website/createWebsiteScraper.d.ts +0 -3
- package/umd/src/scrapers/website/playground/website-scraper-playground.d.ts +0 -1
- package/umd/src/scrapers/website/register-constructor.d.ts +0 -4
- package/umd/src/scrapers/website/register-metadata.d.ts +0 -3
- package/umd/src/scripting/javascript/JavascriptEvalExecutionTools.d.ts +1 -5
- package/umd/src/scripting/javascript/JavascriptEvalExecutionTools.test.d.ts +0 -3
- package/umd/src/scripting/javascript/JavascriptExecutionTools.d.ts +1 -0
- package/umd/src/scripting/javascript/JavascriptExecutionToolsOptions.d.ts +0 -3
- package/umd/src/scripting/javascript/postprocessing-functions.d.ts +0 -4
- package/umd/src/scripting/javascript/utils/extractVariablesFromJavascript.d.ts +1 -3
- package/umd/src/search-engines/SearchEngine.d.ts +3 -0
- package/umd/src/speech-recognition/BrowserSpeechRecognition.d.ts +0 -2
- package/umd/src/speech-recognition/OpenAiSpeechRecognition.d.ts +2 -2
- package/umd/src/storage/_common/PromptbookStorage.d.ts +0 -4
- package/umd/src/storage/_common/PromptbookStorage.test-type.d.ts +0 -4
- package/umd/src/storage/env-storage/$EnvStorage.d.ts +0 -3
- package/umd/src/storage/file-cache-storage/FileCacheStorage.d.ts +0 -2
- package/umd/src/storage/local-storage/getIndexedDbStorage.d.ts +0 -1
- package/umd/src/storage/local-storage/getLocalStorage.d.ts +0 -1
- package/umd/src/storage/local-storage/getSessionStorage.d.ts +0 -1
- package/umd/src/storage/local-storage/utils/makePromptbookStorageFromIndexedDb.d.ts +1 -0
- package/umd/src/storage/local-storage/utils/makePromptbookStorageFromWebStorage.d.ts +0 -4
- package/umd/src/transpilers/_common/register/$bookTranspilersRegister.d.ts +1 -3
- package/umd/src/transpilers/formatted-book-in-markdown/register.d.ts +2 -5
- package/umd/src/transpilers/openai-sdk/playground/playground.d.ts +0 -1
- package/umd/src/transpilers/openai-sdk/register.d.ts +2 -5
- package/umd/src/types/Arrayable.d.ts +1 -0
- package/umd/src/types/InputParameters_private.d.ts +4 -2
- package/umd/src/types/IntermediateFilesStrategy.d.ts +0 -3
- package/umd/src/types/LlmCall.d.ts +0 -3
- package/umd/src/types/ModelRequirements.d.ts +1 -0
- package/umd/src/types/ModelVariant.d.ts +3 -0
- package/umd/src/types/Parameters.d.ts +31 -0
- package/umd/src/types/Parameters_private.d.ts +4 -2
- package/umd/src/types/Prompt.d.ts +1 -6
- package/umd/src/types/ReservedParameters_private.d.ts +2 -1
- package/umd/src/types/ToolCall.d.ts +0 -2
- package/umd/src/types/Updatable.d.ts +1 -3
- package/umd/src/types/string_agent_hash_private.d.ts +1 -1
- package/umd/src/types/string_agent_name.d.ts +32 -0
- package/umd/src/types/string_agent_name_in_book_private.d.ts +1 -1
- package/umd/src/types/string_agent_name_private.d.ts +2 -1
- package/umd/src/types/string_agent_permanent_id_private.d.ts +2 -1
- package/umd/src/types/string_business_category_name.d.ts +5 -0
- package/umd/src/types/string_business_category_name_private.d.ts +1 -1
- package/umd/src/types/string_char_private.d.ts +1 -1
- package/umd/src/types/string_chat_prompt_private.d.ts +1 -1
- package/umd/src/types/string_completion_prompt_private.d.ts +1 -1
- package/umd/src/types/string_markdown.d.ts +0 -1
- package/umd/src/types/string_mime_type_private.d.ts +1 -0
- package/umd/src/types/string_model_description_private.d.ts +1 -1
- package/umd/src/types/string_model_name.d.ts +7 -0
- package/umd/src/types/string_model_name_private.d.ts +1 -1
- package/umd/src/types/string_name.d.ts +31 -0
- package/umd/src/types/string_name_private.d.ts +1 -1
- package/umd/src/types/string_page.d.ts +15 -0
- package/umd/src/types/string_page_private.d.ts +1 -1
- package/umd/src/types/string_parameter_name.d.ts +11 -210
- package/umd/src/types/string_parameter_value_private.d.ts +1 -1
- package/umd/src/types/string_persona_description.d.ts +14 -0
- package/umd/src/types/string_persona_description_private.d.ts +1 -1
- package/umd/src/types/string_prompt.d.ts +49 -0
- package/umd/src/types/string_prompt_image_private.d.ts +1 -1
- package/umd/src/types/string_prompt_private.d.ts +1 -1
- package/umd/src/types/string_reserved_parameter_name_private.d.ts +1 -1
- package/umd/src/types/string_sha256.d.ts +2 -2
- package/umd/src/types/string_system_message_private.d.ts +1 -1
- package/umd/src/types/string_template_private.d.ts +1 -1
- package/umd/src/types/string_text_prompt_private.d.ts +1 -1
- package/umd/src/types/string_title.d.ts +8 -0
- package/umd/src/types/string_title_private.d.ts +1 -1
- package/umd/src/types/typeAliasEmoji.d.ts +0 -3
- package/umd/src/types/typeAliases.d.ts +0 -6
- package/umd/src/utils/DEFAULT_THINKING_MESSAGES.d.ts +5 -1
- package/umd/src/utils/chat/chatAttachments/appendChatAttachmentContext.d.ts +1 -0
- package/umd/src/utils/chat/chatAttachments/appendChatAttachmentContextWithContent.d.ts +1 -0
- package/umd/src/utils/chat/chatAttachments/formatChatAttachmentContentContext.d.ts +1 -0
- package/umd/src/utils/chat/chatAttachments/formatChatAttachmentContext.d.ts +1 -0
- package/umd/src/utils/chat/chatAttachments/normalizeChatAttachments.d.ts +1 -0
- package/umd/src/utils/chat/chatAttachments/resolveChatAttachmentContent.d.ts +1 -0
- package/umd/src/utils/chat/chatAttachments/resolveChatAttachmentContents.d.ts +1 -0
- package/umd/src/utils/chat/chatAttachments.d.ts +0 -3
- package/umd/src/utils/chat/constants.d.ts +0 -3
- package/umd/src/utils/clientVersion.d.ts +0 -3
- package/umd/src/utils/color/$randomColor.d.ts +0 -5
- package/umd/src/utils/color/css-colors.d.ts +0 -3
- package/umd/src/utils/color/internal-utils/hslToRgb.d.ts +0 -3
- package/umd/src/utils/color/internal-utils/rgbToHsl.d.ts +0 -3
- package/umd/src/utils/color/operators/ColorTransformer.d.ts +2 -0
- package/umd/src/utils/color/operators/lighten.d.ts +0 -3
- package/umd/src/utils/color/operators/saturate.d.ts +0 -3
- package/umd/src/utils/color/utils/areColorsEqual.d.ts +0 -3
- package/umd/src/utils/color/utils/colorDistance.d.ts +2 -2
- package/umd/src/utils/color/utils/colorHue.d.ts +0 -1
- package/umd/src/utils/color/utils/colorHueDistance.d.ts +0 -1
- package/umd/src/utils/color/utils/colorToDataUrl.d.ts +0 -3
- package/umd/src/utils/database/uniqueConstraint.d.ts +1 -3
- package/umd/src/utils/editable/edit-pipeline-string/addPipelineCommand.d.ts +3 -4
- package/umd/src/utils/editable/edit-pipeline-string/deflatePipeline.d.ts +0 -3
- package/umd/src/utils/editable/types/PipelineEditableSerialized.d.ts +2 -2
- package/umd/src/utils/editable/utils/renamePipelineParameter.d.ts +4 -3
- package/umd/src/utils/editable/utils/stringifyPipelineJson.d.ts +0 -6
- package/umd/src/utils/environment/$detectRuntimeEnvironment.d.ts +0 -3
- package/umd/src/utils/environment/$getGlobalScope.d.ts +1 -1
- package/umd/src/utils/environment/$isRunningInBrowser.d.ts +0 -3
- package/umd/src/utils/environment/$isRunningInJest.d.ts +0 -3
- package/umd/src/utils/environment/$isRunningInNode.d.ts +0 -3
- package/umd/src/utils/environment/$isRunningInWebWorker.d.ts +0 -3
- package/umd/src/utils/execCommand/$execCommand.d.ts +0 -2
- package/umd/src/utils/execCommand/$execCommands.d.ts +0 -1
- package/umd/src/utils/execCommand/ExecCommandOptions.d.ts +3 -4
- package/umd/src/utils/expectation-counters/constants.d.ts +0 -4
- package/umd/src/utils/expectation-counters/countCharacters.d.ts +0 -4
- package/umd/src/utils/expectation-counters/countLines.d.ts +0 -4
- package/umd/src/utils/expectation-counters/countPages.d.ts +0 -4
- package/umd/src/utils/expectation-counters/countParagraphs.d.ts +0 -4
- package/umd/src/utils/expectation-counters/countSentences.d.ts +0 -4
- package/umd/src/utils/expectation-counters/countWords.d.ts +0 -5
- package/umd/src/utils/expectation-counters/index.d.ts +0 -4
- package/umd/src/utils/files/$induceBookDownload.d.ts +0 -1
- package/umd/src/utils/files/$induceFileDownload.d.ts +0 -1
- package/umd/src/utils/files/ObjectUrl.d.ts +0 -1
- package/umd/src/utils/files/isDirectoryExisting.d.ts +0 -6
- package/umd/src/utils/files/isExecutable.d.ts +0 -4
- package/umd/src/utils/files/isFileExisting.d.ts +0 -5
- package/umd/src/utils/files/listAllFiles.d.ts +1 -5
- package/umd/src/utils/files/readResponseBytes.d.ts +1 -0
- package/umd/src/utils/knowledge/inlineKnowledgeSource.d.ts +11 -6
- package/umd/src/utils/knowledge/simplifyKnowledgeLabel.d.ts +2 -0
- package/umd/src/utils/linguistic-hash/linguisticHash.d.ts +2 -1
- package/umd/src/utils/linguistic-hash/linguisticHashTypes.d.ts +0 -3
- package/umd/src/utils/linguistic-hash/linguisticHashWords.cs.d.ts +0 -3
- package/umd/src/utils/linguistic-hash/linguisticHashWords.en.d.ts +0 -3
- package/umd/src/utils/markdown/addAutoGeneratedSection.d.ts +0 -3
- package/umd/src/utils/markdown/createMarkdownTable.d.ts +0 -3
- package/umd/src/utils/markdown/escapeMarkdownBlock.d.ts +0 -3
- package/umd/src/utils/markdown/extractAllBlocksFromMarkdown.d.ts +1 -3
- package/umd/src/utils/markdown/extractAllListItemsFromMarkdown.d.ts +1 -0
- package/umd/src/utils/markdown/extractOneBlockFromMarkdown.d.ts +2 -4
- package/umd/src/utils/markdown/humanizeAiText.d.ts +0 -3
- package/umd/src/utils/markdown/humanizeAiTextEllipsis.d.ts +0 -3
- package/umd/src/utils/markdown/humanizeAiTextEmdashed.d.ts +0 -3
- package/umd/src/utils/markdown/humanizeAiTextQuotes.d.ts +0 -3
- package/umd/src/utils/markdown/humanizeAiTextSources.d.ts +0 -3
- package/umd/src/utils/markdown/humanizeAiTextWhitespace.d.ts +0 -3
- package/umd/src/utils/markdown/prettifyMarkdown.d.ts +4 -2
- package/umd/src/utils/markdown/promptbookifyAiText.d.ts +0 -3
- package/umd/src/utils/markdown/removeMarkdownComments.d.ts +1 -0
- package/umd/src/utils/markdown/removeMarkdownFormatting.d.ts +1 -0
- package/umd/src/utils/markdown/removeMarkdownLinks.d.ts +1 -0
- package/umd/src/utils/markdown/trimCodeBlock.d.ts +1 -1
- package/umd/src/utils/markdown/trimEndOfCodeBlock.d.ts +1 -1
- package/umd/src/utils/misc/$getCurrentDate.d.ts +1 -0
- package/umd/src/utils/misc/aboutPromptbookInformation.d.ts +3 -3
- package/umd/src/utils/misc/computeHash.d.ts +0 -3
- package/umd/src/utils/misc/debounce.d.ts +2 -0
- package/umd/src/utils/misc/emojis.d.ts +3 -8
- package/umd/src/utils/misc/injectCssModuleIntoShadowRoot.d.ts +7 -2
- package/umd/src/utils/misc/parseNumber.d.ts +0 -4
- package/umd/src/utils/misc/xAboutPromptbookInformation.d.ts +3 -4
- package/umd/src/utils/normalization/IKeywords.d.ts +0 -3
- package/umd/src/utils/normalization/nameToUriPart.d.ts +1 -0
- package/umd/src/utils/normalization/nameToUriParts.d.ts +1 -0
- package/umd/src/utils/normalization/normalize-to-kebab-case.d.ts +2 -3
- package/umd/src/utils/normalization/normalizeTo_PascalCase.d.ts +2 -0
- package/umd/src/utils/normalization/normalizeTo_SCREAMING_CASE.d.ts +2 -0
- package/umd/src/utils/normalization/normalizeTo_camelCase.d.ts +2 -3
- package/umd/src/utils/normalization/normalizeTo_snake_case.d.ts +1 -0
- package/umd/src/utils/normalization/orderJson.d.ts +1 -0
- package/umd/src/utils/normalization/orderJson.test.d.ts +0 -3
- package/umd/src/utils/normalization/parseKeywords.d.ts +1 -4
- package/umd/src/utils/normalization/parseKeywordsFromString.d.ts +1 -0
- package/umd/src/utils/normalization/removeDiacritics.d.ts +1 -3
- package/umd/src/utils/normalization/removeEmojis.d.ts +1 -0
- package/umd/src/utils/normalization/removeQuotes.d.ts +1 -0
- package/umd/src/utils/normalization/searchKeywords.d.ts +1 -3
- package/umd/src/utils/normalization/titleToName.d.ts +1 -0
- package/umd/src/utils/normalization/unwrapResult.d.ts +1 -3
- package/umd/src/utils/organization/$sideEffect.d.ts +1 -0
- package/umd/src/utils/organization/TODO_USE.d.ts +1 -0
- package/umd/src/utils/organization/just.d.ts +1 -0
- package/umd/src/utils/organization/keepImported.d.ts +1 -0
- package/umd/src/utils/organization/keepTypeImported.d.ts +1 -0
- package/umd/src/utils/organization/keepUnused.d.ts +1 -0
- package/umd/src/utils/organization/preserve.d.ts +1 -3
- package/umd/src/utils/organization/really_any.d.ts +1 -0
- package/umd/src/utils/organization/spaceTrim.d.ts +3 -2
- package/umd/src/utils/parameters/extractParameterNames.d.ts +1 -0
- package/umd/src/utils/parameters/mapAvailableToExpectedParameters.d.ts +1 -0
- package/umd/src/utils/parameters/templateParameters.d.ts +2 -1
- package/umd/src/utils/parameters/valueToString.d.ts +2 -2
- package/umd/src/utils/random/$generateBookBoilerplate.d.ts +3 -3
- package/umd/src/utils/random/$randomAgentPersona.d.ts +1 -3
- package/umd/src/utils/random/$randomAgentRule.d.ts +1 -3
- package/umd/src/utils/random/$randomFullnameWithColor.d.ts +4 -3
- package/umd/src/utils/random/$randomItem.d.ts +0 -3
- package/umd/src/utils/random/$randomSeed.d.ts +0 -3
- package/umd/src/utils/random/$randomToken.d.ts +2 -5
- package/umd/src/utils/random/EnglishNamePool.d.ts +1 -0
- package/umd/src/utils/serialization/$deepFreeze.d.ts +1 -3
- package/umd/src/utils/serialization/checkSerializableAsJson.d.ts +1 -5
- package/umd/src/utils/serialization/clonePipeline.d.ts +1 -3
- package/umd/src/utils/serialization/deepClone.d.ts +1 -3
- package/umd/src/utils/serialization/exportJson.d.ts +1 -3
- package/umd/src/utils/serialization/isSerializableAsJson.d.ts +0 -5
- package/umd/src/utils/serialization/jsonStringsToJsons.d.ts +1 -4
- package/umd/src/utils/serialization/serializeToPromptbookJavascript.d.ts +3 -3
- package/umd/src/utils/sets/difference.d.ts +1 -3
- package/umd/src/utils/sets/intersection.d.ts +1 -0
- package/umd/src/utils/sets/union.d.ts +1 -0
- package/umd/src/utils/take/classes/TakeChain.d.ts +4 -1
- package/umd/src/utils/take/interfaces/ITakeChain.d.ts +5 -1
- package/umd/src/utils/take/interfaces/Takeable.d.ts +2 -1
- package/umd/src/utils/take/take.d.ts +1 -1
- package/umd/src/utils/validators/filePath/isRootPath.d.ts +1 -3
- package/umd/src/utils/validators/filePath/isRootPath.test.d.ts +0 -3
- package/umd/src/utils/validators/filePath/isValidFilePath.d.ts +1 -3
- package/umd/src/utils/validators/javascriptName/isValidJavascriptName.d.ts +1 -0
- package/umd/src/utils/validators/parameterName/validateParameterName.d.ts +1 -0
- package/umd/src/utils/validators/semanticVersion/isValidPromptbookVersion.d.ts +2 -1
- package/umd/src/utils/validators/url/extractUrlsFromText.d.ts +1 -0
- package/umd/src/utils/validators/url/isUrlOnPrivateNetwork.d.ts +1 -0
- package/umd/src/utils/validators/url/isValidAgentUrl.d.ts +0 -3
- package/umd/src/utils/validators/url/isValidPipelineUrl.d.ts +0 -3
- package/umd/src/utils/validators/url/normalizeDomainForMatching.d.ts +1 -0
- package/umd/src/version.d.ts +1 -1
- package/umd/src/wizard/$getCompiledBook.d.ts +0 -2
- package/umd/src/wizard/wizard.d.ts +1 -2
package/esm/index.es.js
CHANGED
|
@@ -35,7 +35,7 @@ const BOOK_LANGUAGE_VERSION = '2.0.0';
|
|
|
35
35
|
* @generated
|
|
36
36
|
* @see https://github.com/webgptorg/promptbook
|
|
37
37
|
*/
|
|
38
|
-
const PROMPTBOOK_ENGINE_VERSION = '0.112.0-
|
|
38
|
+
const PROMPTBOOK_ENGINE_VERSION = '0.112.0-35';
|
|
39
39
|
/**
|
|
40
40
|
* TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
|
|
41
41
|
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
@@ -45,16 +45,20 @@ const PROMPTBOOK_ENGINE_VERSION = '0.112.0-34';
|
|
|
45
45
|
* Trims string from all 4 sides
|
|
46
46
|
*
|
|
47
47
|
* Note: This is a re-exported function from the `spacetrim` package which is
|
|
48
|
-
*
|
|
48
|
+
* Developed by same author @hejny as this package
|
|
49
49
|
*
|
|
50
|
-
* @public exported from `@promptbook/utils`
|
|
51
50
|
* @see https://github.com/hejny/spacetrim#usage
|
|
51
|
+
*
|
|
52
|
+
* @public exported from `@promptbook/utils`
|
|
52
53
|
*/
|
|
53
54
|
const spaceTrim = spaceTrim$1;
|
|
54
55
|
|
|
55
56
|
/**
|
|
56
|
-
*
|
|
57
|
+
* Class implementing take chain.
|
|
58
|
+
*
|
|
57
59
|
* @de
|
|
60
|
+
*
|
|
61
|
+
* @private util of `@promptbook/color`
|
|
58
62
|
*/
|
|
59
63
|
class TakeChain {
|
|
60
64
|
constructor(value) {
|
|
@@ -71,9 +75,9 @@ class TakeChain {
|
|
|
71
75
|
*
|
|
72
76
|
* @param {*} initialValue - The initial value.
|
|
73
77
|
* @returns {Proxy<WithTake<TValue>>} - A proxy object with a `take` method.
|
|
78
|
+
* @deprecated [🤡] Use some better functional library instead of `TakeChain`
|
|
74
79
|
*
|
|
75
80
|
* @private util of `@promptbook/color`
|
|
76
|
-
* @deprecated [🤡] Use some better functional library instead of `TakeChain`
|
|
77
81
|
*/
|
|
78
82
|
function take(initialValue) {
|
|
79
83
|
if (initialValue instanceof TakeChain) {
|
|
@@ -251,9 +255,7 @@ const CSS_COLORS = {
|
|
|
251
255
|
yellow: '#ffff00',
|
|
252
256
|
yellowgreen: '#9acd32',
|
|
253
257
|
};
|
|
254
|
-
|
|
255
|
-
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
256
|
-
*/
|
|
258
|
+
// Note: [💞] Ignore a discrepancy between file name and entity name
|
|
257
259
|
|
|
258
260
|
/**
|
|
259
261
|
* Validates that a channel value is a valid number within the range of 0 to 255.
|
|
@@ -283,7 +285,13 @@ function checkChannelValue(channelName, value) {
|
|
|
283
285
|
}
|
|
284
286
|
}
|
|
285
287
|
|
|
288
|
+
/**
|
|
289
|
+
* Constant for short hex lengths.
|
|
290
|
+
*/
|
|
286
291
|
const SHORT_HEX_LENGTHS = new Set([3, 4]);
|
|
292
|
+
/**
|
|
293
|
+
* Constant for long hex lengths.
|
|
294
|
+
*/
|
|
287
295
|
const LONG_HEX_LENGTHS = new Set([6, 8]);
|
|
288
296
|
/**
|
|
289
297
|
* Parses a hex string into RGBA channel values.
|
|
@@ -316,6 +324,9 @@ function parseHexColor(hex) {
|
|
|
316
324
|
}
|
|
317
325
|
return throwInvalidHex();
|
|
318
326
|
}
|
|
327
|
+
/**
|
|
328
|
+
* Parses short hex channel.
|
|
329
|
+
*/
|
|
319
330
|
function parseShortHexChannel(char, onError) {
|
|
320
331
|
if (!char) {
|
|
321
332
|
return onError();
|
|
@@ -326,6 +337,9 @@ function parseShortHexChannel(char, onError) {
|
|
|
326
337
|
}
|
|
327
338
|
return parsed * 16;
|
|
328
339
|
}
|
|
340
|
+
/**
|
|
341
|
+
* Parses long hex channel.
|
|
342
|
+
*/
|
|
329
343
|
function parseLongHexChannel(hex, start, onError) {
|
|
330
344
|
const segment = hex.substr(start, 2);
|
|
331
345
|
if (segment.length < 2) {
|
|
@@ -338,6 +352,9 @@ function parseLongHexChannel(hex, start, onError) {
|
|
|
338
352
|
return parsed;
|
|
339
353
|
}
|
|
340
354
|
|
|
355
|
+
/**
|
|
356
|
+
* Pattern matching hsl.
|
|
357
|
+
*/
|
|
341
358
|
const HSL_REGEX = /^hsl\(\s*([0-9.]+)\s*,\s*([0-9.]+)%\s*,\s*([0-9.]+)%\s*\)$/;
|
|
342
359
|
/**
|
|
343
360
|
* Parses an HSL string into RGBA channel values.
|
|
@@ -363,6 +380,9 @@ function parseHslColor(hsl) {
|
|
|
363
380
|
alpha: 255,
|
|
364
381
|
};
|
|
365
382
|
}
|
|
383
|
+
/**
|
|
384
|
+
* Handles convert hsl to Rgb.
|
|
385
|
+
*/
|
|
366
386
|
function convertHslToRgb(h, s, l) {
|
|
367
387
|
const c = (1 - Math.abs(2 * l - 1)) * s;
|
|
368
388
|
const x = c * (1 - Math.abs(((h / 60) % 2) - 1));
|
|
@@ -401,7 +421,13 @@ function convertHslToRgb(h, s, l) {
|
|
|
401
421
|
};
|
|
402
422
|
}
|
|
403
423
|
|
|
424
|
+
/**
|
|
425
|
+
* Pattern matching RGB.
|
|
426
|
+
*/
|
|
404
427
|
const RGB_REGEX = /^rgb\(\s*([0-9.%-]+)\s*,\s*([0-9.%-]+)\s*,\s*([0-9.%-]+)\s*\)$/;
|
|
428
|
+
/**
|
|
429
|
+
* Pattern matching rgba.
|
|
430
|
+
*/
|
|
405
431
|
const RGBA_REGEX = /^rgba\(\s*([0-9.%-]+)\s*,\s*([0-9.%-]+)\s*,\s*([0-9.%-]+)\s*,\s*([0-9.%-]+)\s*\)$/;
|
|
406
432
|
/**
|
|
407
433
|
* Parses an RGB string into RGBA channel values.
|
|
@@ -443,6 +469,9 @@ function parseRgbaColor(rgba) {
|
|
|
443
469
|
alpha: parseAlphaValue(match[4]),
|
|
444
470
|
};
|
|
445
471
|
}
|
|
472
|
+
/**
|
|
473
|
+
* Parses channel value.
|
|
474
|
+
*/
|
|
446
475
|
function parseChannelValue(value) {
|
|
447
476
|
if (value.endsWith('%')) {
|
|
448
477
|
const percent = parseFloat(value);
|
|
@@ -450,6 +479,9 @@ function parseChannelValue(value) {
|
|
|
450
479
|
}
|
|
451
480
|
return Math.round(parseFloat(value));
|
|
452
481
|
}
|
|
482
|
+
/**
|
|
483
|
+
* Parses alpha value.
|
|
484
|
+
*/
|
|
453
485
|
function parseAlphaValue(value) {
|
|
454
486
|
if (value.endsWith('%')) {
|
|
455
487
|
const percent = parseFloat(value);
|
|
@@ -462,8 +494,17 @@ function parseAlphaValue(value) {
|
|
|
462
494
|
return Math.round(parsed);
|
|
463
495
|
}
|
|
464
496
|
|
|
497
|
+
/**
|
|
498
|
+
* Pattern matching hsl regex.
|
|
499
|
+
*/
|
|
465
500
|
const HSL_REGEX_PATTERN = /^hsl\(\s*([0-9.]+)\s*,\s*([0-9.]+)%\s*,\s*([0-9.]+)%\s*\)$/;
|
|
501
|
+
/**
|
|
502
|
+
* Pattern matching RGB regex.
|
|
503
|
+
*/
|
|
466
504
|
const RGB_REGEX_PATTERN = /^rgb\(\s*([0-9.%-]+)\s*,\s*([0-9.%-]+)\s*,\s*([0-9.%-]+)\s*\)$/;
|
|
505
|
+
/**
|
|
506
|
+
* Pattern matching rgba regex.
|
|
507
|
+
*/
|
|
467
508
|
const RGBA_REGEX_PATTERN = /^rgba\(\s*([0-9.%-]+)\s*,\s*([0-9.%-]+)\s*,\s*([0-9.%-]+)\s*,\s*([0-9.%-]+)\s*\)$/;
|
|
468
509
|
/**
|
|
469
510
|
* Color object represents an RGB color with alpha channel
|
|
@@ -829,9 +870,7 @@ function hslToRgb(hue, saturation, lightness) {
|
|
|
829
870
|
}
|
|
830
871
|
return [Math.round(red * 255), Math.round(green * 255), Math.round(blue * 255)];
|
|
831
872
|
}
|
|
832
|
-
|
|
833
|
-
* TODO: Properly name all used internal variables
|
|
834
|
-
*/
|
|
873
|
+
// TODO: Properly name all used internal variables
|
|
835
874
|
|
|
836
875
|
/**
|
|
837
876
|
* Converts RGB values to HSL values
|
|
@@ -877,9 +916,7 @@ function rgbToHsl(red, green, blue) {
|
|
|
877
916
|
}
|
|
878
917
|
return [hue, saturation, lightness];
|
|
879
918
|
}
|
|
880
|
-
|
|
881
|
-
* TODO: Properly name all used internal variables
|
|
882
|
-
*/
|
|
919
|
+
// TODO: Properly name all used internal variables
|
|
883
920
|
|
|
884
921
|
/**
|
|
885
922
|
* Makes color transformer which lighten the given color
|
|
@@ -897,9 +934,7 @@ function lighten(amount) {
|
|
|
897
934
|
return Color.fromValues(r, g, b, alpha);
|
|
898
935
|
};
|
|
899
936
|
}
|
|
900
|
-
|
|
901
|
-
* TODO: Maybe implement by mix+hsl
|
|
902
|
-
*/
|
|
937
|
+
// TODO: Maybe implement by mix+hsl
|
|
903
938
|
|
|
904
939
|
/**
|
|
905
940
|
* Makes color transformer which saturate the given color
|
|
@@ -917,9 +952,7 @@ function saturate(amount) {
|
|
|
917
952
|
return Color.fromValues(r, g, b, alpha);
|
|
918
953
|
};
|
|
919
954
|
}
|
|
920
|
-
|
|
921
|
-
* TODO: Maybe implement by mix+hsl
|
|
922
|
-
*/
|
|
955
|
+
// TODO: Maybe implement by mix+hsl
|
|
923
956
|
|
|
924
957
|
/**
|
|
925
958
|
* Returns the same value that is passed as argument.
|
|
@@ -932,6 +965,7 @@ function saturate(amount) {
|
|
|
932
965
|
*
|
|
933
966
|
* @param value any values
|
|
934
967
|
* @returns the same values
|
|
968
|
+
*
|
|
935
969
|
* @private within the repository
|
|
936
970
|
*/
|
|
937
971
|
function just(value) {
|
|
@@ -1313,6 +1347,7 @@ function jsonParse(value) {
|
|
|
1313
1347
|
* Orders JSON object by keys
|
|
1314
1348
|
*
|
|
1315
1349
|
* @returns The same type of object as the input re-ordered
|
|
1350
|
+
*
|
|
1316
1351
|
* @public exported from `@promptbook/utils`
|
|
1317
1352
|
*/
|
|
1318
1353
|
function orderJson(options) {
|
|
@@ -1331,6 +1366,7 @@ function orderJson(options) {
|
|
|
1331
1366
|
* Note: This function mutates the object and returns the original (but mutated-deep-freezed) object
|
|
1332
1367
|
*
|
|
1333
1368
|
* @returns The same object as the input, but deeply frozen
|
|
1369
|
+
*
|
|
1334
1370
|
* @public exported from `@promptbook/utils`
|
|
1335
1371
|
*/
|
|
1336
1372
|
function $deepFreeze(objectValue) {
|
|
@@ -1347,9 +1383,7 @@ function $deepFreeze(objectValue) {
|
|
|
1347
1383
|
Object.freeze(objectValue);
|
|
1348
1384
|
return objectValue;
|
|
1349
1385
|
}
|
|
1350
|
-
|
|
1351
|
-
* TODO: [🧠] Is there a way how to meaningfully test this utility
|
|
1352
|
-
*/
|
|
1386
|
+
// TODO: [🧠] Is there a way how to meaningfully test this utility
|
|
1353
1387
|
|
|
1354
1388
|
/**
|
|
1355
1389
|
* This error type indicates that somewhere in the code non-Error object was thrown and it was wrapped into the `WrappedError`
|
|
@@ -1417,6 +1451,7 @@ function assertsError(whatWasThrown) {
|
|
|
1417
1451
|
* - And much more...
|
|
1418
1452
|
*
|
|
1419
1453
|
* @throws UnexpectedError if the value is not serializable as JSON
|
|
1454
|
+
*
|
|
1420
1455
|
* @public exported from `@promptbook/utils`
|
|
1421
1456
|
*/
|
|
1422
1457
|
function checkSerializableAsJson(options) {
|
|
@@ -1531,11 +1566,9 @@ function checkSerializableAsJson(options) {
|
|
|
1531
1566
|
`));
|
|
1532
1567
|
}
|
|
1533
1568
|
}
|
|
1534
|
-
|
|
1535
|
-
|
|
1536
|
-
|
|
1537
|
-
* Note: [🐠] This is how `checkSerializableAsJson` + `isSerializableAsJson` together can just retun true/false or rich error message
|
|
1538
|
-
*/
|
|
1569
|
+
// TODO: Can be return type more type-safe? like `asserts options.value is JsonValue`
|
|
1570
|
+
// TODO: [🧠][main] !!3 In-memory cache of same values to prevent multiple checks
|
|
1571
|
+
// Note: [🐠] This is how `checkSerializableAsJson` + `isSerializableAsJson` together can just retun true/false or rich error message
|
|
1539
1572
|
|
|
1540
1573
|
/**
|
|
1541
1574
|
* Creates a deep clone of the given object
|
|
@@ -1545,6 +1578,7 @@ function checkSerializableAsJson(options) {
|
|
|
1545
1578
|
*
|
|
1546
1579
|
* @param objectValue The object to clone.
|
|
1547
1580
|
* @returns A deep, writable clone of the input object.
|
|
1581
|
+
*
|
|
1548
1582
|
* @public exported from `@promptbook/utils`
|
|
1549
1583
|
*/
|
|
1550
1584
|
function deepClone(objectValue) {
|
|
@@ -1561,9 +1595,7 @@ function deepClone(objectValue) {
|
|
|
1561
1595
|
> return Object.assign({}, objectValue);
|
|
1562
1596
|
*/
|
|
1563
1597
|
}
|
|
1564
|
-
|
|
1565
|
-
* TODO: [🧠] Is there a way how to meaningfully test this utility
|
|
1566
|
-
*/
|
|
1598
|
+
// TODO: [🧠] Is there a way how to meaningfully test this utility
|
|
1567
1599
|
|
|
1568
1600
|
/**
|
|
1569
1601
|
* Utility to export a JSON object from a function
|
|
@@ -1576,6 +1608,7 @@ function deepClone(objectValue) {
|
|
|
1576
1608
|
* Note: This function does not mutates the given object
|
|
1577
1609
|
*
|
|
1578
1610
|
* @returns The same type of object as the input but read-only and re-ordered
|
|
1611
|
+
*
|
|
1579
1612
|
* @public exported from `@promptbook/utils`
|
|
1580
1613
|
*/
|
|
1581
1614
|
function exportJson(options) {
|
|
@@ -1595,9 +1628,7 @@ function exportJson(options) {
|
|
|
1595
1628
|
$deepFreeze(orderedValue);
|
|
1596
1629
|
return orderedValue;
|
|
1597
1630
|
}
|
|
1598
|
-
|
|
1599
|
-
* TODO: [🧠] Is there a way how to meaningfully test this utility
|
|
1600
|
-
*/
|
|
1631
|
+
// TODO: [🧠] Is there a way how to meaningfully test this utility
|
|
1601
1632
|
|
|
1602
1633
|
/**
|
|
1603
1634
|
* Order of keys in the pipeline JSON
|
|
@@ -1708,9 +1739,7 @@ const LIMITS = {
|
|
|
1708
1739
|
*/
|
|
1709
1740
|
SHORT_NAME_LENGTH: 6,
|
|
1710
1741
|
};
|
|
1711
|
-
|
|
1712
|
-
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
1713
|
-
*/
|
|
1742
|
+
// Note: [💞] Ignore a discrepancy between file name and entity name
|
|
1714
1743
|
|
|
1715
1744
|
/**
|
|
1716
1745
|
* This error indicates that the promptbook in a markdown format cannot be parsed into a valid promptbook object
|
|
@@ -1724,9 +1753,7 @@ class ParseError extends Error {
|
|
|
1724
1753
|
Object.setPrototypeOf(this, ParseError.prototype);
|
|
1725
1754
|
}
|
|
1726
1755
|
}
|
|
1727
|
-
|
|
1728
|
-
* TODO: Maybe split `ParseError` and `ApplyError`
|
|
1729
|
-
*/
|
|
1756
|
+
// TODO: Maybe split `ParseError` and `ApplyError`
|
|
1730
1757
|
|
|
1731
1758
|
/**
|
|
1732
1759
|
* This error indicates that the promptbook object has valid syntax (=can be parsed) but contains logical errors (like circular dependencies)
|
|
@@ -1764,12 +1791,13 @@ function isValidSemanticVersion(version) {
|
|
|
1764
1791
|
* Tests if given string is valid promptbook version
|
|
1765
1792
|
* It looks into list of known promptbook versions.
|
|
1766
1793
|
*
|
|
1767
|
-
* @see https://www.npmjs.com/package/promptbook?activeTab=versions
|
|
1768
1794
|
* Note: When you are using for example promptbook 2.0.0 and there already is promptbook 3.0.0 it don`t know about it.
|
|
1769
1795
|
* Note: There are two similar functions:
|
|
1770
1796
|
* - `isValidSemanticVersion` which tests any semantic version
|
|
1771
1797
|
* - `isValidPromptbookVersion` *(this one)* which tests just Promptbook versions
|
|
1772
1798
|
*
|
|
1799
|
+
* @see https://www.npmjs.com/package/promptbook?activeTab=versions
|
|
1800
|
+
*
|
|
1773
1801
|
* @public exported from `@promptbook/utils`
|
|
1774
1802
|
*/
|
|
1775
1803
|
function isValidPromptbookVersion(version) {
|
|
@@ -1843,9 +1871,7 @@ function isValidPipelineUrl(url) {
|
|
|
1843
1871
|
*/
|
|
1844
1872
|
return true;
|
|
1845
1873
|
}
|
|
1846
|
-
|
|
1847
|
-
* TODO: [🐠] Maybe more info why the URL is invalid
|
|
1848
|
-
*/
|
|
1874
|
+
// TODO: [🐠] Maybe more info why the URL is invalid
|
|
1849
1875
|
|
|
1850
1876
|
/**
|
|
1851
1877
|
* Validates PipelineJson if it is logically valid
|
|
@@ -1862,6 +1888,7 @@ function isValidPipelineUrl(url) {
|
|
|
1862
1888
|
* @param pipeline valid or invalid PipelineJson
|
|
1863
1889
|
* @returns the same pipeline if it is logically valid
|
|
1864
1890
|
* @throws {PipelineLogicError} on logical error in the pipeline
|
|
1891
|
+
*
|
|
1865
1892
|
* @public exported from `@promptbook/core`
|
|
1866
1893
|
*/
|
|
1867
1894
|
function validatePipeline(pipeline) {
|
|
@@ -1886,6 +1913,8 @@ function validatePipeline(pipeline) {
|
|
|
1886
1913
|
return pipeline;
|
|
1887
1914
|
}
|
|
1888
1915
|
/**
|
|
1916
|
+
* Validates pipeline inner function.
|
|
1917
|
+
*
|
|
1889
1918
|
* @private internal function for `validatePipeline`
|
|
1890
1919
|
*/
|
|
1891
1920
|
function validatePipeline_InnerFunction(pipeline) {
|
|
@@ -2130,15 +2159,13 @@ function validatePipeline_InnerFunction(pipeline) {
|
|
|
2130
2159
|
* > * - ...
|
|
2131
2160
|
* > ex port function validatePipeline(promptbook: really_unknown): asserts promptbook is PipelineJson {
|
|
2132
2161
|
*/
|
|
2133
|
-
|
|
2134
|
-
|
|
2135
|
-
|
|
2136
|
-
|
|
2137
|
-
|
|
2138
|
-
|
|
2139
|
-
|
|
2140
|
-
* TODO: [🛠] Actions, instruments (and maybe knowledge) => Functions and tools
|
|
2141
|
-
*/
|
|
2162
|
+
// TODO: [🧳][main] !!4 Validate that all examples match expectations
|
|
2163
|
+
// TODO: [🧳][🐝][main] !!4 Validate that knowledge is valid (non-void)
|
|
2164
|
+
// TODO: [🧳][main] !!4 Validate that persona can be used only with CHAT variant
|
|
2165
|
+
// TODO: [🧳][main] !!4 Validate that parameter with reserved name not used RESERVED_PARAMETER_NAMES
|
|
2166
|
+
// TODO: [🧳][main] !!4 Validate that reserved parameter is not used as joker
|
|
2167
|
+
// TODO: [🧠] Validation not only logic itself but imports around - files and websites and rerefenced pipelines exists
|
|
2168
|
+
// TODO: [🛠] Actions, instruments (and maybe knowledge) => Functions and tools
|
|
2142
2169
|
|
|
2143
2170
|
/**
|
|
2144
2171
|
* Loads the books from the archive file with `.bookc` extension
|
|
@@ -2165,7 +2192,7 @@ async function loadArchive(filePath, fs) {
|
|
|
2165
2192
|
}
|
|
2166
2193
|
return collectionJson;
|
|
2167
2194
|
}
|
|
2168
|
-
|
|
2195
|
+
// Note: [🟢] Code for Node archive helper [loadArchive](src/conversion/archive/loadArchive.ts) should never be published into packages that could be imported into browser environment
|
|
2169
2196
|
|
|
2170
2197
|
var PipelineCollection = [{title:"Prepare Knowledge from Markdown",pipelineUrl:"https://promptbook.studio/promptbook/prepare-knowledge-from-markdown.book",formfactorName:"GENERIC",parameters:[{name:"knowledgeContent",description:"Markdown document content",isInput:true,isOutput:false},{name:"knowledgePieces",description:"The knowledge JSON object",isInput:false,isOutput:true}],tasks:[{taskType:"PROMPT_TASK",name:"knowledge",title:"Knowledge",content:"You are experienced data researcher, extract the important knowledge from the document.\n\n# Rules\n\n- Make pieces of information concise, clear, and easy to understand\n- One piece of information should be approximately 1 paragraph\n- Divide the paragraphs by markdown horizontal lines ---\n- Omit irrelevant information\n- Group redundant information\n- Write just extracted information, nothing else\n\n# The document\n\nTake information from this document:\n\n> {knowledgeContent}",resultingParameterName:"knowledgePieces",dependentParameterNames:["knowledgeContent"]}],personas:[],preparations:[],knowledgeSources:[],knowledgePieces:[],sources:[{type:"BOOK",path:null,content:"# Prepare Knowledge from Markdown\n\n- PIPELINE URL `https://promptbook.studio/promptbook/prepare-knowledge-from-markdown.book`\n- INPUT PARAMETER `{knowledgeContent}` Markdown document content\n- OUTPUT PARAMETER `{knowledgePieces}` The knowledge JSON object\n\n## Knowledge\n\n<!-- TODO: [🍆] -FORMAT JSON -->\n\n```markdown\nYou are experienced data researcher, extract the important knowledge from the document.\n\n# Rules\n\n- Make pieces of information concise, clear, and easy to understand\n- One piece of information should be approximately 1 paragraph\n- Divide the paragraphs by markdown horizontal lines ---\n- Omit irrelevant information\n- Group redundant information\n- Write just extracted information, nothing else\n\n# The document\n\nTake information from this document:\n\n> {knowledgeContent}\n```\n\n`-> {knowledgePieces}`\n"}],sourceFile:"./books/prepare-knowledge-from-markdown.book"},{title:"Prepare Keywords",pipelineUrl:"https://promptbook.studio/promptbook/prepare-knowledge-keywords.book",formfactorName:"GENERIC",parameters:[{name:"knowledgePieceContent",description:"The content",isInput:true,isOutput:false},{name:"keywords",description:"Keywords separated by comma",isInput:false,isOutput:true}],tasks:[{taskType:"PROMPT_TASK",name:"knowledge",title:"Knowledge",content:"You are experienced data researcher, detect the important keywords in the document.\n\n# Rules\n\n- Write just keywords separated by comma\n\n# The document\n\nTake information from this document:\n\n> {knowledgePieceContent}",resultingParameterName:"keywords",dependentParameterNames:["knowledgePieceContent"]}],personas:[],preparations:[],knowledgeSources:[],knowledgePieces:[],sources:[{type:"BOOK",path:null,content:"# Prepare Keywords\n\n- PIPELINE URL `https://promptbook.studio/promptbook/prepare-knowledge-keywords.book`\n- INPUT PARAMETER `{knowledgePieceContent}` The content\n- OUTPUT PARAMETER `{keywords}` Keywords separated by comma\n\n## Knowledge\n\n<!-- TODO: [🍆] -FORMAT JSON -->\n\n```markdown\nYou are experienced data researcher, detect the important keywords in the document.\n\n# Rules\n\n- Write just keywords separated by comma\n\n# The document\n\nTake information from this document:\n\n> {knowledgePieceContent}\n```\n\n`-> {keywords}`\n"}],sourceFile:"./books/prepare-knowledge-keywords.book"},{title:"Prepare Knowledge-piece Title",pipelineUrl:"https://promptbook.studio/promptbook/prepare-knowledge-title.book",formfactorName:"GENERIC",parameters:[{name:"knowledgePieceContent",description:"The content",isInput:true,isOutput:false},{name:"title",description:"The title of the document",isInput:false,isOutput:true}],tasks:[{taskType:"PROMPT_TASK",name:"knowledge",title:"Knowledge",content:"You are experienced content creator, write best title for the document.\n\n# Rules\n\n- Write just title, nothing else\n- Write maximum 5 words for the title\n\n# The document\n\n> {knowledgePieceContent}",resultingParameterName:"title",expectations:{words:{min:1,max:8}},dependentParameterNames:["knowledgePieceContent"]}],personas:[],preparations:[],knowledgeSources:[],knowledgePieces:[],sources:[{type:"BOOK",path:null,content:"# Prepare Knowledge-piece Title\n\n- PIPELINE URL `https://promptbook.studio/promptbook/prepare-knowledge-title.book`\n- INPUT PARAMETER `{knowledgePieceContent}` The content\n- OUTPUT PARAMETER `{title}` The title of the document\n\n## Knowledge\n\n- EXPECT MIN 1 WORD\n- EXPECT MAX 8 WORDS\n\n```markdown\nYou are experienced content creator, write best title for the document.\n\n# Rules\n\n- Write just title, nothing else\n- Write maximum 5 words for the title\n\n# The document\n\n> {knowledgePieceContent}\n```\n\n`-> {title}`\n"}],sourceFile:"./books/prepare-knowledge-title.book"},{title:"Prepare Persona",pipelineUrl:"https://promptbook.studio/promptbook/prepare-persona.book",formfactorName:"GENERIC",parameters:[{name:"availableModels",description:"List of available model names together with their descriptions as JSON",isInput:true,isOutput:false},{name:"personaDescription",description:"Description of the persona",isInput:true,isOutput:false},{name:"modelsRequirements",description:"Specific requirements for the model",isInput:false,isOutput:true}],tasks:[{taskType:"PROMPT_TASK",name:"make-model-requirements",title:"Make modelRequirements",content:"You are an experienced AI engineer, you need to find the best models for virtual assistants:\n\n## Example\n\n```json\n[\n {\n \"modelName\": \"gpt-4o\",\n \"systemMessage\": \"You are experienced AI engineer and helpful assistant.\",\n \"temperature\": 0.7\n },\n {\n \"modelName\": \"claude-3-5-sonnet\",\n \"systemMessage\": \"You are a friendly and knowledgeable chatbot.\",\n \"temperature\": 0.5\n }\n]\n```\n\n## Instructions\n\n- Your output format is JSON array\n- Sort best-fitting models first\n- Omit any models that are not suitable\n- Write just the JSON, no other text should be present\n- Array contain items with following keys:\n - `modelName`: The name of the model to use\n - `systemMessage`: The system message to provide context to the model\n - `temperature`: The sampling temperature to use\n\n### Key `modelName`\n\nHere are the available models:\n\n```json\n{availableModels}\n```\n\n### Key `systemMessage`\n\nThe system message is used to communicate instructions or provide context to the model at the beginning of a conversation. It is displayed in a different format compared to user messages, helping the model understand its role in the conversation. The system message typically guides the model's behavior, sets the tone, or specifies desired output from the model. By utilizing the system message effectively, users can steer the model towards generating more accurate and relevant responses.\n\nFor example:\n\n> You are an experienced AI engineer and helpful assistant.\n\n> You are a friendly and knowledgeable chatbot.\n\n### Key `temperature`\n\nThe sampling temperature, between 0 and 1. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic. If set to 0, the model will use log probability to automatically increase the temperature until certain thresholds are hit.\n\nYou can pick a value between 0 and 2. For example:\n\n- `0.1`: Low temperature, extremely conservative and deterministic\n- `0.5`: Medium temperature, balanced between conservative and creative\n- `1.0`: High temperature, creative and bit random\n- `1.5`: Very high temperature, extremely creative and often chaotic and unpredictable\n- `2.0`: Maximum temperature, completely random and unpredictable, for some extreme creative use cases\n\n# The assistant\n\nTake this description of the persona:\n\n> {personaDescription}",resultingParameterName:"modelsRequirements",format:"JSON",dependentParameterNames:["availableModels","personaDescription"]}],personas:[],preparations:[],knowledgeSources:[],knowledgePieces:[],sources:[{type:"BOOK",path:null,content:"# Prepare Persona\n\n- PIPELINE URL `https://promptbook.studio/promptbook/prepare-persona.book`\n- INPUT PARAMETER `{availableModels}` List of available model names together with their descriptions as JSON\n- INPUT PARAMETER `{personaDescription}` Description of the persona\n- OUTPUT PARAMETER `{modelsRequirements}` Specific requirements for the model\n\n## Make modelRequirements\n\n- FORMAT JSON\n\n```markdown\nYou are an experienced AI engineer, you need to find the best models for virtual assistants:\n\n## Example\n\n\\`\\`\\`json\n[\n {\n \"modelName\": \"gpt-4o\",\n \"systemMessage\": \"You are experienced AI engineer and helpful assistant.\",\n \"temperature\": 0.7\n },\n {\n \"modelName\": \"claude-3-5-sonnet\",\n \"systemMessage\": \"You are a friendly and knowledgeable chatbot.\",\n \"temperature\": 0.5\n }\n]\n\\`\\`\\`\n\n## Instructions\n\n- Your output format is JSON array\n- Sort best-fitting models first\n- Omit any models that are not suitable\n- Write just the JSON, no other text should be present\n- Array contain items with following keys:\n - `modelName`: The name of the model to use\n - `systemMessage`: The system message to provide context to the model\n - `temperature`: The sampling temperature to use\n\n### Key `modelName`\n\nHere are the available models:\n\n\\`\\`\\`json\n{availableModels}\n\\`\\`\\`\n\n### Key `systemMessage`\n\nThe system message is used to communicate instructions or provide context to the model at the beginning of a conversation. It is displayed in a different format compared to user messages, helping the model understand its role in the conversation. The system message typically guides the model's behavior, sets the tone, or specifies desired output from the model. By utilizing the system message effectively, users can steer the model towards generating more accurate and relevant responses.\n\nFor example:\n\n> You are an experienced AI engineer and helpful assistant.\n\n> You are a friendly and knowledgeable chatbot.\n\n### Key `temperature`\n\nThe sampling temperature, between 0 and 1. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic. If set to 0, the model will use log probability to automatically increase the temperature until certain thresholds are hit.\n\nYou can pick a value between 0 and 2. For example:\n\n- `0.1`: Low temperature, extremely conservative and deterministic\n- `0.5`: Medium temperature, balanced between conservative and creative\n- `1.0`: High temperature, creative and bit random\n- `1.5`: Very high temperature, extremely creative and often chaotic and unpredictable\n- `2.0`: Maximum temperature, completely random and unpredictable, for some extreme creative use cases\n\n# The assistant\n\nTake this description of the persona:\n\n> {personaDescription}\n```\n\n`-> {modelsRequirements}`\n"}],sourceFile:"./books/prepare-persona.book"},{title:"Prepare Title",pipelineUrl:"https://promptbook.studio/promptbook/prepare-title.book",formfactorName:"GENERIC",parameters:[{name:"book",description:"The book to prepare the title for",isInput:true,isOutput:false},{name:"title",description:"Best title for the book",isInput:false,isOutput:true}],tasks:[{taskType:"PROMPT_TASK",name:"make-title",title:"Make title",content:"Make best title for given text which describes the workflow:\n\n## Rules\n\n- Write just title, nothing else\n- Title should be concise and clear - Write maximum ideally 2 words, maximum 5 words\n- Title starts with emoticon\n- Title should not mention the input and output of the workflow but the main purpose of the workflow\n _For example, not \"✍ Convert Knowledge-piece to title\" but \"✍ Title\"_\n\n## The workflow\n\n> {book}",resultingParameterName:"title",expectations:{words:{min:1,max:8},lines:{min:1,max:1}},dependentParameterNames:["book"]}],personas:[],preparations:[],knowledgeSources:[],knowledgePieces:[],sources:[{type:"BOOK",path:null,content:"# Prepare Title\n\n- PIPELINE URL `https://promptbook.studio/promptbook/prepare-title.book`\n- INPUT PARAMETER `{book}` The book to prepare the title for\n- OUTPUT PARAMETER `{title}` Best title for the book\n\n## Make title\n\n- EXPECT MIN 1 Word\n- EXPECT MAX 8 Words\n- EXPECT EXACTLY 1 Line\n\n```markdown\nMake best title for given text which describes the workflow:\n\n## Rules\n\n- Write just title, nothing else\n- Title should be concise and clear - Write maximum ideally 2 words, maximum 5 words\n- Title starts with emoticon\n- Title should not mention the input and output of the workflow but the main purpose of the workflow\n _For example, not \"✍ Convert Knowledge-piece to title\" but \"✍ Title\"_\n\n## The workflow\n\n> {book}\n```\n\n`-> {title}`\n"}],sourceFile:"./books/prepare-title.book"}];
|
|
2171
2198
|
|
|
@@ -2188,6 +2215,7 @@ function isValidEmail(email) {
|
|
|
2188
2215
|
* Tests if given string is valid file path.
|
|
2189
2216
|
*
|
|
2190
2217
|
* Note: This does not check if the file exists only if the path is valid
|
|
2218
|
+
*
|
|
2191
2219
|
* @public exported from `@promptbook/utils`
|
|
2192
2220
|
*/
|
|
2193
2221
|
function isValidFilePath(filename) {
|
|
@@ -2236,9 +2264,7 @@ function isValidFilePath(filename) {
|
|
|
2236
2264
|
}
|
|
2237
2265
|
return false;
|
|
2238
2266
|
}
|
|
2239
|
-
|
|
2240
|
-
* TODO: [🍏] Implement for MacOs
|
|
2241
|
-
*/
|
|
2267
|
+
// TODO: [🍏] Implement for MacOs
|
|
2242
2268
|
|
|
2243
2269
|
/**
|
|
2244
2270
|
* Function isValidJsonString will tell you if the string is valid JSON or not
|
|
@@ -2271,6 +2297,7 @@ function isValidJsonString(value /* <- [👨⚖️] */) {
|
|
|
2271
2297
|
* @param {string} pipelineString the candidate for a pipeline string
|
|
2272
2298
|
* @returns {PipelineString} the same string as input, but validated as valid
|
|
2273
2299
|
* @throws {ParseError} if the string is not a valid pipeline string
|
|
2300
|
+
*
|
|
2274
2301
|
* @public exported from `@promptbook/core`
|
|
2275
2302
|
*/
|
|
2276
2303
|
function validatePipelineString(pipelineString) {
|
|
@@ -2289,17 +2316,16 @@ function validatePipelineString(pipelineString) {
|
|
|
2289
2316
|
// <- TODO: Implement the validation + add tests when the pipeline logic considered as invalid
|
|
2290
2317
|
return pipelineString;
|
|
2291
2318
|
}
|
|
2292
|
-
|
|
2293
|
-
* TODO: [🧠][🈴] Where is the best location for this file
|
|
2294
|
-
*/
|
|
2319
|
+
// TODO: [🧠][🈴] Where is the best location for this file
|
|
2295
2320
|
|
|
2296
2321
|
/**
|
|
2297
2322
|
* Prettify the html code
|
|
2298
2323
|
*
|
|
2299
2324
|
* @param content raw html code
|
|
2300
2325
|
* @returns formatted html code
|
|
2301
|
-
* @private withing the package because of HUGE size of prettier dependency
|
|
2302
2326
|
* @deprecated Prettier removed from Promptbook due to package size
|
|
2327
|
+
*
|
|
2328
|
+
* @private withing the package because of HUGE size of prettier dependency
|
|
2303
2329
|
*/
|
|
2304
2330
|
function prettifyMarkdown(content) {
|
|
2305
2331
|
return (content + `\n\n<!-- Note: Prettier removed from Promptbook -->`);
|
|
@@ -2322,6 +2348,7 @@ function capitalize(word) {
|
|
|
2322
2348
|
* @deprecated TODO: [🥍][🧠] Backup original files in `PipelineJson` same as in Promptbook.studio
|
|
2323
2349
|
* @param pipelineJson Promptbook in JSON format (.bookc)
|
|
2324
2350
|
* @returns Promptbook in string format (.book.md)
|
|
2351
|
+
*
|
|
2325
2352
|
* @public exported from `@promptbook/core`
|
|
2326
2353
|
*/
|
|
2327
2354
|
function pipelineJsonToString(pipelineJson) {
|
|
@@ -2438,6 +2465,8 @@ function pipelineJsonToString(pipelineJson) {
|
|
|
2438
2465
|
return validatePipelineString(pipelineString);
|
|
2439
2466
|
}
|
|
2440
2467
|
/**
|
|
2468
|
+
* Handles task parameter Json to string.
|
|
2469
|
+
*
|
|
2441
2470
|
* @private internal utility of `pipelineJsonToString`
|
|
2442
2471
|
*/
|
|
2443
2472
|
function taskParameterJsonToString(taskParameterJson) {
|
|
@@ -2448,13 +2477,11 @@ function taskParameterJsonToString(taskParameterJson) {
|
|
|
2448
2477
|
}
|
|
2449
2478
|
return parameterString;
|
|
2450
2479
|
}
|
|
2451
|
-
|
|
2452
|
-
|
|
2453
|
-
|
|
2454
|
-
|
|
2455
|
-
|
|
2456
|
-
* TODO: [🧠] Should be in generated .book.md file GENERATOR_WARNING
|
|
2457
|
-
*/
|
|
2480
|
+
// TODO: [🛋] Implement new features and commands into `pipelineJsonToString` + `taskParameterJsonToString` , use `stringifyCommand`
|
|
2481
|
+
// TODO: [🧠] Is there a way to auto-detect missing features in pipelineJsonToString
|
|
2482
|
+
// TODO: [🏛] Maybe make some markdown builder
|
|
2483
|
+
// TODO: [🏛] Escape all
|
|
2484
|
+
// TODO: [🧠] Should be in generated .book.md file GENERATOR_WARNING
|
|
2458
2485
|
|
|
2459
2486
|
/**
|
|
2460
2487
|
* This error indicates that promptbook not found in the collection
|
|
@@ -2487,6 +2514,7 @@ class PipelineUrlError extends Error {
|
|
|
2487
2514
|
*
|
|
2488
2515
|
* @param template the string template with parameters in {curly} braces
|
|
2489
2516
|
* @returns the list of parameter names
|
|
2517
|
+
*
|
|
2490
2518
|
* @public exported from `@promptbook/utils`
|
|
2491
2519
|
*/
|
|
2492
2520
|
function extractParameterNames(template) {
|
|
@@ -2503,6 +2531,7 @@ function extractParameterNames(template) {
|
|
|
2503
2531
|
* Unprepare just strips the preparation data of the pipeline
|
|
2504
2532
|
*
|
|
2505
2533
|
* @deprecated In future version this function will be removed or deprecated
|
|
2534
|
+
*
|
|
2506
2535
|
* @public exported from `@promptbook/core`
|
|
2507
2536
|
*/
|
|
2508
2537
|
function unpreparePipeline(pipeline) {
|
|
@@ -2531,18 +2560,17 @@ function unpreparePipeline(pipeline) {
|
|
|
2531
2560
|
},
|
|
2532
2561
|
});
|
|
2533
2562
|
}
|
|
2534
|
-
|
|
2535
|
-
|
|
2536
|
-
|
|
2537
|
-
* TODO: [🍙] Make some standard order of json properties
|
|
2538
|
-
*/
|
|
2563
|
+
// TODO: [🧿] Maybe do same process with same granularity and subfinctions as `preparePipeline`
|
|
2564
|
+
// TODO: Write tests for `preparePipeline`
|
|
2565
|
+
// TODO: [🍙] Make some standard order of json properties
|
|
2539
2566
|
|
|
2540
2567
|
/**
|
|
2541
2568
|
* Library of pipelines that groups together pipelines for an application.
|
|
2542
2569
|
* This implementation is a very thin wrapper around the Array / Map of pipelines.
|
|
2543
2570
|
*
|
|
2544
|
-
* @private internal function of `createPipelineCollectionFromJson`, use `createPipelineCollectionFromJson` instead
|
|
2545
2571
|
* @see https://github.com/webgptorg/pipeline#pipeline-collection
|
|
2572
|
+
*
|
|
2573
|
+
* @private internal function of `createPipelineCollectionFromJson`, use `createPipelineCollectionFromJson` instead
|
|
2546
2574
|
*/
|
|
2547
2575
|
class SimplePipelineCollection {
|
|
2548
2576
|
/**
|
|
@@ -2646,6 +2674,7 @@ class SimplePipelineCollection {
|
|
|
2646
2674
|
*
|
|
2647
2675
|
* @param promptbookSources
|
|
2648
2676
|
* @returns PipelineCollection
|
|
2677
|
+
*
|
|
2649
2678
|
* @public exported from `@promptbook/core`
|
|
2650
2679
|
*/
|
|
2651
2680
|
function createPipelineCollectionFromJson(...promptbooks) {
|
|
@@ -2791,9 +2820,7 @@ class DatabaseError extends Error {
|
|
|
2791
2820
|
Object.setPrototypeOf(this, DatabaseError.prototype);
|
|
2792
2821
|
}
|
|
2793
2822
|
}
|
|
2794
|
-
|
|
2795
|
-
* TODO: [🐱🚀] Explain that NotFoundError ([🐱🚀] and other specific errors) has priority over DatabaseError in some contexts
|
|
2796
|
-
*/
|
|
2823
|
+
// TODO: [🐱🚀] Explain that NotFoundError ([🐱🚀] and other specific errors) has priority over DatabaseError in some contexts
|
|
2797
2824
|
|
|
2798
2825
|
/**
|
|
2799
2826
|
* This error type indicates that you try to use a feature that is not available in the current environment
|
|
@@ -2811,10 +2838,11 @@ class EnvironmentMismatchError extends Error {
|
|
|
2811
2838
|
/**
|
|
2812
2839
|
* This error occurs when some expectation is not met in the execution of the pipeline
|
|
2813
2840
|
*
|
|
2814
|
-
* @public exported from `@promptbook/core`
|
|
2815
2841
|
* Note: Do not throw this error, its reserved for `checkExpectations` and `createPipelineExecutor` and public ONLY to be serializable through remote server
|
|
2816
2842
|
* Note: Always thrown in `checkExpectations` and catched in `createPipelineExecutor` and rethrown as `PipelineExecutionError`
|
|
2817
2843
|
* Note: This is a kindof subtype of PipelineExecutionError
|
|
2844
|
+
*
|
|
2845
|
+
* @public exported from `@promptbook/core`
|
|
2818
2846
|
*/
|
|
2819
2847
|
class ExpectError extends Error {
|
|
2820
2848
|
constructor(message) {
|
|
@@ -2892,16 +2920,15 @@ class NotYetImplementedError extends Error {
|
|
|
2892
2920
|
* Note: `$` is used to indicate that this function is not a pure function - it is not deterministic
|
|
2893
2921
|
* Note: This function is cryptographically secure (it uses crypto.randomBytes internally)
|
|
2894
2922
|
*
|
|
2895
|
-
* @private internal helper function
|
|
2896
2923
|
* @returns secure random token
|
|
2924
|
+
*
|
|
2925
|
+
* @private internal helper function
|
|
2897
2926
|
*/
|
|
2898
2927
|
function $randomToken(randomness) {
|
|
2899
2928
|
return randomBytes(randomness).toString('hex');
|
|
2900
2929
|
}
|
|
2901
|
-
|
|
2902
|
-
|
|
2903
|
-
* TODO: Maybe use nanoid instead https://github.com/ai/nanoid
|
|
2904
|
-
*/
|
|
2930
|
+
// TODO: [🤶] Maybe export through `@promptbook/utils` or `@promptbook/random` package
|
|
2931
|
+
// TODO: Maybe use nanoid instead https://github.com/ai/nanoid
|
|
2905
2932
|
|
|
2906
2933
|
/**
|
|
2907
2934
|
* This error indicates errors during the execution of the pipeline
|
|
@@ -2918,9 +2945,7 @@ class PipelineExecutionError extends Error {
|
|
|
2918
2945
|
Object.setPrototypeOf(this, PipelineExecutionError.prototype);
|
|
2919
2946
|
}
|
|
2920
2947
|
}
|
|
2921
|
-
|
|
2922
|
-
* TODO: [🧠][🌂] Add id to all errors
|
|
2923
|
-
*/
|
|
2948
|
+
// TODO: [🧠][🌂] Add id to all errors
|
|
2924
2949
|
|
|
2925
2950
|
/**
|
|
2926
2951
|
* Error thrown when a fetch request fails
|
|
@@ -2996,9 +3021,7 @@ const ALL_ERRORS = {
|
|
|
2996
3021
|
...PROMPTBOOK_ERRORS,
|
|
2997
3022
|
...COMMON_JAVASCRIPT_ERRORS,
|
|
2998
3023
|
};
|
|
2999
|
-
|
|
3000
|
-
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
3001
|
-
*/
|
|
3024
|
+
// Note: [💞] Ignore a discrepancy between file name and entity name
|
|
3002
3025
|
|
|
3003
3026
|
/**
|
|
3004
3027
|
* Serializes an error into a [🚉] JSON-serializable object
|
|
@@ -3031,7 +3054,7 @@ function serializeError(error) {
|
|
|
3031
3054
|
|
|
3032
3055
|
/**
|
|
3033
3056
|
* Recursively converts JSON strings to JSON objects
|
|
3034
|
-
|
|
3057
|
+
*
|
|
3035
3058
|
* @public exported from `@promptbook/utils`
|
|
3036
3059
|
*/
|
|
3037
3060
|
function jsonStringsToJsons(object) {
|
|
@@ -3055,9 +3078,7 @@ function jsonStringsToJsons(object) {
|
|
|
3055
3078
|
}
|
|
3056
3079
|
return newObject;
|
|
3057
3080
|
}
|
|
3058
|
-
|
|
3059
|
-
* TODO: Type the return type correctly
|
|
3060
|
-
*/
|
|
3081
|
+
// TODO: Type the return type correctly
|
|
3061
3082
|
|
|
3062
3083
|
/**
|
|
3063
3084
|
* Deserializes the error object
|
|
@@ -3092,6 +3113,7 @@ function deserializeError(error, isStackAddedToMessage = true) {
|
|
|
3092
3113
|
*
|
|
3093
3114
|
* @param executionResult - The partial result of the Promptbook execution
|
|
3094
3115
|
* @throws {PipelineExecutionError} If the execution is not successful or if multiple errors occurred
|
|
3116
|
+
*
|
|
3095
3117
|
* @private internal helper function of `asPromise` method of `ExecutionTask`
|
|
3096
3118
|
*/
|
|
3097
3119
|
function assertsTaskSuccessful(executionResult) {
|
|
@@ -3122,9 +3144,7 @@ function assertsTaskSuccessful(executionResult) {
|
|
|
3122
3144
|
`));
|
|
3123
3145
|
}
|
|
3124
3146
|
}
|
|
3125
|
-
|
|
3126
|
-
* TODO: [🧠] Can this return type be better typed than void
|
|
3127
|
-
*/
|
|
3147
|
+
// TODO: [🧠] Can this return type be better typed than void
|
|
3128
3148
|
|
|
3129
3149
|
/**
|
|
3130
3150
|
* Helper to create a new task
|
|
@@ -3315,10 +3335,8 @@ function createTask(options) {
|
|
|
3315
3335
|
},
|
|
3316
3336
|
};
|
|
3317
3337
|
}
|
|
3318
|
-
|
|
3319
|
-
|
|
3320
|
-
* TODO: [🐚] Split into more files and make `PrepareTask` & `RemoteTask` + split the function
|
|
3321
|
-
*/
|
|
3338
|
+
// TODO: Maybe allow to terminate the task and add getter `isFinished` or `status`
|
|
3339
|
+
// TODO: [🐚] Split into more files and make `PrepareTask` & `RemoteTask` + split the function
|
|
3322
3340
|
|
|
3323
3341
|
/**
|
|
3324
3342
|
* Represents the uncertain value
|
|
@@ -3386,9 +3404,7 @@ const UNCERTAIN_USAGE = $deepFreeze({
|
|
|
3386
3404
|
pagesCount: UNCERTAIN_ZERO_VALUE,
|
|
3387
3405
|
},
|
|
3388
3406
|
});
|
|
3389
|
-
|
|
3390
|
-
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
3391
|
-
*/
|
|
3407
|
+
// Note: [💞] Ignore a discrepancy between file name and entity name
|
|
3392
3408
|
|
|
3393
3409
|
/**
|
|
3394
3410
|
* Format either small or big number
|
|
@@ -3423,8 +3439,8 @@ function numberToString(value) {
|
|
|
3423
3439
|
* This is useful and used in the `templateParameters` function
|
|
3424
3440
|
*
|
|
3425
3441
|
* Note: This function is not just calling `toString` method
|
|
3426
|
-
*
|
|
3427
|
-
*
|
|
3442
|
+
* It's more complex and can handle this conversion specifically for LLM models
|
|
3443
|
+
* See `VALUE_STRINGS`
|
|
3428
3444
|
*
|
|
3429
3445
|
* Note: There are 2 similar functions
|
|
3430
3446
|
* - `valueToString` converts value to string for LLM models as human-readable string
|
|
@@ -3531,6 +3547,7 @@ function addUsage(...usageItems) {
|
|
|
3531
3547
|
* @param script from which to extract the variables
|
|
3532
3548
|
* @returns the list of variable names
|
|
3533
3549
|
* @throws {ParseError} if the script is invalid
|
|
3550
|
+
*
|
|
3534
3551
|
* @public exported from `@promptbook/javascript`
|
|
3535
3552
|
*/
|
|
3536
3553
|
function extractVariablesFromJavascript(script) {
|
|
@@ -3596,9 +3613,7 @@ function extractVariablesFromJavascript(script) {
|
|
|
3596
3613
|
}
|
|
3597
3614
|
return variables;
|
|
3598
3615
|
}
|
|
3599
|
-
|
|
3600
|
-
* TODO: [🔣] Support for multiple languages - python, java,...
|
|
3601
|
-
*/
|
|
3616
|
+
// TODO: [🔣] Support for multiple languages - python, java,...
|
|
3602
3617
|
|
|
3603
3618
|
/**
|
|
3604
3619
|
* Parses the task and returns the set of all used parameters
|
|
@@ -3606,6 +3621,7 @@ function extractVariablesFromJavascript(script) {
|
|
|
3606
3621
|
* @param task the task with used parameters
|
|
3607
3622
|
* @returns the set of parameter names
|
|
3608
3623
|
* @throws {ParseError} if the script is invalid
|
|
3624
|
+
*
|
|
3609
3625
|
* @public exported from `@promptbook/core` <- Note: [👖] This utility is so tightly interconnected with the Promptbook that it is not exported as util but in core
|
|
3610
3626
|
*/
|
|
3611
3627
|
function extractParameterNamesFromTask(task) {
|
|
@@ -3646,14 +3662,13 @@ function extractParameterNamesFromTask(task) {
|
|
|
3646
3662
|
}
|
|
3647
3663
|
return parameterNames;
|
|
3648
3664
|
}
|
|
3649
|
-
|
|
3650
|
-
* TODO: [🔣] If script require contentLanguage
|
|
3651
|
-
*/
|
|
3665
|
+
// TODO: [🔣] If script require contentLanguage
|
|
3652
3666
|
|
|
3653
3667
|
/**
|
|
3654
3668
|
* Create difference set of two sets.
|
|
3655
3669
|
*
|
|
3656
3670
|
* @deprecated use new javascript set methods instead @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Set
|
|
3671
|
+
*
|
|
3657
3672
|
* @public exported from `@promptbook/utils`
|
|
3658
3673
|
*/
|
|
3659
3674
|
function difference(a, b, isEqual = (a, b) => a === b) {
|
|
@@ -3665,14 +3680,13 @@ function difference(a, b, isEqual = (a, b) => a === b) {
|
|
|
3665
3680
|
}
|
|
3666
3681
|
return diff;
|
|
3667
3682
|
}
|
|
3668
|
-
|
|
3669
|
-
* TODO: [🧠][💯] Maybe also implement symmetricDifference
|
|
3670
|
-
*/
|
|
3683
|
+
// TODO: [🧠][💯] Maybe also implement symmetricDifference
|
|
3671
3684
|
|
|
3672
3685
|
/**
|
|
3673
3686
|
* Creates a new set with all elements that are present in either set
|
|
3674
3687
|
*
|
|
3675
3688
|
* @deprecated use new javascript set methods instead @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Set
|
|
3689
|
+
*
|
|
3676
3690
|
* @public exported from `@promptbook/utils`
|
|
3677
3691
|
*/
|
|
3678
3692
|
function union(...sets) {
|
|
@@ -3738,8 +3752,9 @@ function isValidCsvString(value) {
|
|
|
3738
3752
|
/**
|
|
3739
3753
|
* Definition for CSV spreadsheet
|
|
3740
3754
|
*
|
|
3755
|
+
* TODO: [🏢] Export from package `@promptbook/csv`
|
|
3756
|
+
*
|
|
3741
3757
|
* @public exported from `@promptbook/core`
|
|
3742
|
-
* <- TODO: [🏢] Export from package `@promptbook/csv`
|
|
3743
3758
|
*/
|
|
3744
3759
|
const CsvFormatParser = {
|
|
3745
3760
|
formatName: 'CSV',
|
|
@@ -3829,13 +3844,11 @@ const CsvFormatParser = {
|
|
|
3829
3844
|
},
|
|
3830
3845
|
],
|
|
3831
3846
|
};
|
|
3832
|
-
|
|
3833
|
-
|
|
3834
|
-
|
|
3835
|
-
|
|
3836
|
-
|
|
3837
|
-
* TODO: [🏢] Allow to expect something inside CSV objects and other formats
|
|
3838
|
-
*/
|
|
3847
|
+
// TODO: [🍓] In `CsvFormatParser` implement simple `isValid`
|
|
3848
|
+
// TODO: [🍓] In `CsvFormatParser` implement partial `canBeValid`
|
|
3849
|
+
// TODO: [🍓] In `CsvFormatParser` implement `heal
|
|
3850
|
+
// TODO: [🍓] In `CsvFormatParser` implement `subvalueParsers`
|
|
3851
|
+
// TODO: [🏢] Allow to expect something inside CSV objects and other formats
|
|
3839
3852
|
|
|
3840
3853
|
/**
|
|
3841
3854
|
* Definition for JSON format
|
|
@@ -3856,17 +3869,15 @@ const JsonFormatParser = {
|
|
|
3856
3869
|
},
|
|
3857
3870
|
subvalueParsers: [],
|
|
3858
3871
|
};
|
|
3859
|
-
|
|
3860
|
-
|
|
3861
|
-
|
|
3862
|
-
|
|
3863
|
-
|
|
3864
|
-
|
|
3865
|
-
|
|
3866
|
-
|
|
3867
|
-
|
|
3868
|
-
* TODO: [🏢] Allow to expect something inside JSON objects and other formats
|
|
3869
|
-
*/
|
|
3872
|
+
// TODO: [🧠] Maybe proper instance of object
|
|
3873
|
+
// TODO: [0] Make string_serialized_json
|
|
3874
|
+
// TODO: [1] Make type for JSON Settings and Schema
|
|
3875
|
+
// TODO: [🧠] What to use for validating JSONs - JSON Schema, ZoD, typescript types/interfaces,...?
|
|
3876
|
+
// TODO: [🍓] In `JsonFormatParser` implement simple `isValid`
|
|
3877
|
+
// TODO: [🍓] In `JsonFormatParser` implement partial `canBeValid`
|
|
3878
|
+
// TODO: [🍓] In `JsonFormatParser` implement `heal
|
|
3879
|
+
// TODO: [🍓] In `JsonFormatParser` implement `subvalueParsers`
|
|
3880
|
+
// TODO: [🏢] Allow to expect something inside JSON objects and other formats
|
|
3870
3881
|
|
|
3871
3882
|
/**
|
|
3872
3883
|
* Definition for any text - this will be always valid
|
|
@@ -3904,15 +3915,13 @@ const TextFormatParser = {
|
|
|
3904
3915
|
// <- TODO: [🧠][🤠] Here should be all words, characters, lines, paragraphs, pages available as subvalues
|
|
3905
3916
|
],
|
|
3906
3917
|
};
|
|
3907
|
-
|
|
3908
|
-
|
|
3909
|
-
|
|
3910
|
-
|
|
3911
|
-
|
|
3912
|
-
|
|
3913
|
-
|
|
3914
|
-
* TODO: [🏢] Allow to expect something inside each item of list and other formats
|
|
3915
|
-
*/
|
|
3918
|
+
// TODO: [1] Make type for XML Text and Schema
|
|
3919
|
+
// TODO: [🧠][🤠] Here should be all words, characters, lines, paragraphs, pages available as subvalues
|
|
3920
|
+
// TODO: [🍓] In `TextFormatParser` implement simple `isValid`
|
|
3921
|
+
// TODO: [🍓] In `TextFormatParser` implement partial `canBeValid`
|
|
3922
|
+
// TODO: [🍓] In `TextFormatParser` implement `heal
|
|
3923
|
+
// TODO: [🍓] In `TextFormatParser` implement `subvalueParsers`
|
|
3924
|
+
// TODO: [🏢] Allow to expect something inside each item of list and other formats
|
|
3916
3925
|
|
|
3917
3926
|
/**
|
|
3918
3927
|
* Function to check if a string is valid XML
|
|
@@ -3957,17 +3966,15 @@ const XmlFormatParser = {
|
|
|
3957
3966
|
},
|
|
3958
3967
|
subvalueParsers: [],
|
|
3959
3968
|
};
|
|
3960
|
-
|
|
3961
|
-
|
|
3962
|
-
|
|
3963
|
-
|
|
3964
|
-
|
|
3965
|
-
|
|
3966
|
-
|
|
3967
|
-
|
|
3968
|
-
|
|
3969
|
-
* TODO: [🏢] Allow to expect something inside XML and other formats
|
|
3970
|
-
*/
|
|
3969
|
+
// TODO: [🧠] Maybe proper instance of object
|
|
3970
|
+
// TODO: [0] Make string_serialized_xml
|
|
3971
|
+
// TODO: [1] Make type for XML Settings and Schema
|
|
3972
|
+
// TODO: [🧠] What to use for validating XMLs - XSD,...
|
|
3973
|
+
// TODO: [🍓] In `XmlFormatParser` implement simple `isValid`
|
|
3974
|
+
// TODO: [🍓] In `XmlFormatParser` implement partial `canBeValid`
|
|
3975
|
+
// TODO: [🍓] In `XmlFormatParser` implement `heal
|
|
3976
|
+
// TODO: [🍓] In `XmlFormatParser` implement `subvalueParsers`
|
|
3977
|
+
// TODO: [🏢] Allow to expect something inside XML and other formats
|
|
3971
3978
|
|
|
3972
3979
|
/**
|
|
3973
3980
|
* Definitions for all formats supported by Promptbook
|
|
@@ -3975,9 +3982,7 @@ const XmlFormatParser = {
|
|
|
3975
3982
|
* @private internal index of `...` <- TODO [🏢]
|
|
3976
3983
|
*/
|
|
3977
3984
|
const FORMAT_DEFINITIONS = [JsonFormatParser, XmlFormatParser, TextFormatParser, CsvFormatParser];
|
|
3978
|
-
|
|
3979
|
-
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
3980
|
-
*/
|
|
3985
|
+
// Note: [💞] Ignore a discrepancy between file name and entity name
|
|
3981
3986
|
|
|
3982
3987
|
/**
|
|
3983
3988
|
* Maps available parameters to expected parameters for a pipeline task.
|
|
@@ -3987,6 +3992,7 @@ const FORMAT_DEFINITIONS = [JsonFormatParser, XmlFormatParser, TextFormatParser,
|
|
|
3987
3992
|
* 2) Then, if there are unmatched expected and available parameters, map them by order.
|
|
3988
3993
|
*
|
|
3989
3994
|
* @throws {PipelineExecutionError} If the number of unmatched expected and available parameters does not match, or mapping is ambiguous.
|
|
3995
|
+
*
|
|
3990
3996
|
* @private within the repository used in `createPipelineExecutor`
|
|
3991
3997
|
*/
|
|
3992
3998
|
function mapAvailableToExpectedParameters(options) {
|
|
@@ -4076,6 +4082,7 @@ const MULTIPLE_PROVIDER_PROFILE = {
|
|
|
4076
4082
|
* Multiple LLM Execution Tools is a proxy server that uses multiple execution tools internally and exposes the executor interface externally.
|
|
4077
4083
|
*
|
|
4078
4084
|
* Note: Internal utility of `joinLlmExecutionTools` but exposed type
|
|
4085
|
+
*
|
|
4079
4086
|
* @public exported from `@promptbook/core`
|
|
4080
4087
|
*/
|
|
4081
4088
|
class MultipleLlmExecutionTools {
|
|
@@ -4238,16 +4245,16 @@ class MultipleLlmExecutionTools {
|
|
|
4238
4245
|
* `MultipleLlmExecutionTools` object. It provides failover and aggregation logic:
|
|
4239
4246
|
*
|
|
4240
4247
|
* 1. **Failover**: When a model call is made, it tries providers in the order they were provided.
|
|
4241
|
-
*
|
|
4248
|
+
* If the first provider doesn't support the requested model or fails, it tries the next one.
|
|
4242
4249
|
* 2. **Aggregation**: `listModels` returns a combined list of all models available from all providers.
|
|
4243
4250
|
* 3. **Empty case**: If no tools are provided, it logs a warning (as Promptbook requires LLMs to function).
|
|
4244
4251
|
*
|
|
4252
|
+
* Tip: You don't have to use this function directly, just pass an array of LlmExecutionTools to the `ExecutionTools`.
|
|
4253
|
+
*
|
|
4245
4254
|
* @param title - A descriptive title for this collection of joined tools
|
|
4246
4255
|
* @param llmExecutionTools - An array of execution tools to be joined
|
|
4247
4256
|
* @returns A single unified execution tool wrapper
|
|
4248
4257
|
*
|
|
4249
|
-
* Tip: You don't have to use this function directly, just pass an array of LlmExecutionTools to the `ExecutionTools`.
|
|
4250
|
-
*
|
|
4251
4258
|
* @public exported from `@promptbook/core`
|
|
4252
4259
|
*/
|
|
4253
4260
|
function joinLlmExecutionTools(title, ...llmExecutionTools) {
|
|
@@ -4284,10 +4291,8 @@ function joinLlmExecutionTools(title, ...llmExecutionTools) {
|
|
|
4284
4291
|
}
|
|
4285
4292
|
return new MultipleLlmExecutionTools(title || 'Multiple LLM Providers joined by `joinLlmExecutionTools`', ...llmExecutionTools);
|
|
4286
4293
|
}
|
|
4287
|
-
|
|
4288
|
-
|
|
4289
|
-
* TODO: [👷♂️] Write a comprehensive manual about how to construct and use LLM execution tools in Promptbook
|
|
4290
|
-
*/
|
|
4294
|
+
// TODO: [🙆] `getSingleLlmExecutionTools` vs `joinLlmExecutionTools` - explain difference or pick one
|
|
4295
|
+
// TODO: [👷♂️] Write a comprehensive manual about how to construct and use LLM execution tools in Promptbook
|
|
4291
4296
|
|
|
4292
4297
|
/**
|
|
4293
4298
|
* Just returns the given `LlmExecutionTools` or joins multiple into one
|
|
@@ -4301,10 +4306,8 @@ function getSingleLlmExecutionTools(oneOrMoreLlmExecutionTools) {
|
|
|
4301
4306
|
: joinLlmExecutionTools('Multiple LLM Providers joined by `getSingleLlmExecutionTools`', ..._llms);
|
|
4302
4307
|
return llmTools;
|
|
4303
4308
|
}
|
|
4304
|
-
|
|
4305
|
-
|
|
4306
|
-
* TODO: [👷♂️] Write a comprehensive manual about how to construct and use LLM execution tools in Promptbook
|
|
4307
|
-
*/
|
|
4309
|
+
// TODO: [🙆] `getSingleLlmExecutionTools` vs `joinLlmExecutionTools` - explain difference or pick one
|
|
4310
|
+
// TODO: [👷♂️] Write a comprehensive manual about how to construct and use LLM execution tools in Promptbook
|
|
4308
4311
|
|
|
4309
4312
|
/**
|
|
4310
4313
|
* Just says that the variable is not used but should be kept
|
|
@@ -4318,6 +4321,7 @@ function getSingleLlmExecutionTools(oneOrMoreLlmExecutionTools) {
|
|
|
4318
4321
|
*
|
|
4319
4322
|
* @param value any values
|
|
4320
4323
|
* @returns void
|
|
4324
|
+
*
|
|
4321
4325
|
* @private within the repository
|
|
4322
4326
|
*/
|
|
4323
4327
|
function keepUnused(...valuesToKeep) {
|
|
@@ -4327,12 +4331,13 @@ function keepUnused(...valuesToKeep) {
|
|
|
4327
4331
|
* Replaces parameters in template with values from parameters object
|
|
4328
4332
|
*
|
|
4329
4333
|
* Note: This function is not places strings into string,
|
|
4330
|
-
*
|
|
4334
|
+
* It's more complex and can handle this operation specifically for LLM models
|
|
4331
4335
|
*
|
|
4332
4336
|
* @param template the template with parameters in {curly} braces
|
|
4333
4337
|
* @param parameters the object with parameters
|
|
4334
4338
|
* @returns the template with replaced parameters
|
|
4335
4339
|
* @throws {PipelineExecutionError} if parameter is not defined, not closed, or not opened
|
|
4340
|
+
*
|
|
4336
4341
|
* @public exported from `@promptbook/utils`
|
|
4337
4342
|
*/
|
|
4338
4343
|
function templateParameters(template, parameters) {
|
|
@@ -4406,6 +4411,7 @@ function templateParameters(template, parameters) {
|
|
|
4406
4411
|
* @param markdown any valid markdown
|
|
4407
4412
|
* @returns code blocks with language and content
|
|
4408
4413
|
* @throws {ParseError} if block is not closed properly
|
|
4414
|
+
*
|
|
4409
4415
|
* @public exported from `@promptbook/markdown-utils`
|
|
4410
4416
|
*/
|
|
4411
4417
|
function extractAllBlocksFromMarkdown(markdown) {
|
|
@@ -4456,9 +4462,7 @@ function extractAllBlocksFromMarkdown(markdown) {
|
|
|
4456
4462
|
}
|
|
4457
4463
|
return codeBlocks;
|
|
4458
4464
|
}
|
|
4459
|
-
|
|
4460
|
-
* TODO: Maybe name for `blockNotation` instead of '```' and '>'
|
|
4461
|
-
*/
|
|
4465
|
+
// TODO: Maybe name for `blockNotation` instead of '```' and '>'
|
|
4462
4466
|
|
|
4463
4467
|
/**
|
|
4464
4468
|
* Extracts extracts exactly one valid JSON code block
|
|
@@ -4474,8 +4478,9 @@ function extractAllBlocksFromMarkdown(markdown) {
|
|
|
4474
4478
|
* - `extractOneBlockFromMarkdown` extracts exactly one code block with language of the code block
|
|
4475
4479
|
* - `extractAllBlocksFromMarkdown` extracts all code blocks with language of the code block
|
|
4476
4480
|
*
|
|
4477
|
-
* @public exported from `@promptbook/markdown-utils`
|
|
4478
4481
|
* @throws {ParseError} if there is no valid JSON block in the markdown
|
|
4482
|
+
*
|
|
4483
|
+
* @public exported from `@promptbook/markdown-utils`
|
|
4479
4484
|
*/
|
|
4480
4485
|
function extractJsonBlock(markdown) {
|
|
4481
4486
|
if (isValidJsonString(markdown)) {
|
|
@@ -4491,10 +4496,8 @@ function extractJsonBlock(markdown) {
|
|
|
4491
4496
|
}
|
|
4492
4497
|
return jsonBlocks[0].content;
|
|
4493
4498
|
}
|
|
4494
|
-
|
|
4495
|
-
|
|
4496
|
-
* TODO: [🏢] Make this logic part of `JsonFormatParser` or `isValidJsonString`
|
|
4497
|
-
*/
|
|
4499
|
+
// TODO: Add some auto-healing logic + extract YAML, JSON5, TOML, etc.
|
|
4500
|
+
// TODO: [🏢] Make this logic part of `JsonFormatParser` or `isValidJsonString`
|
|
4498
4501
|
|
|
4499
4502
|
/**
|
|
4500
4503
|
* Counts number of characters in the text
|
|
@@ -4510,10 +4513,8 @@ function countCharacters(text) {
|
|
|
4510
4513
|
text = text.replace(/\p{Extended_Pictographic}(\u{200D}\p{Extended_Pictographic})*/gu, '-');
|
|
4511
4514
|
return text.length;
|
|
4512
4515
|
}
|
|
4513
|
-
|
|
4514
|
-
|
|
4515
|
-
* TODO: [🧠][✌️] Make some Promptbook-native token system
|
|
4516
|
-
*/
|
|
4516
|
+
// TODO: [🥴] Implement counting in formats - like JSON, CSV, XML,...
|
|
4517
|
+
// TODO: [🧠][✌️] Make some Promptbook-native token system
|
|
4517
4518
|
|
|
4518
4519
|
/**
|
|
4519
4520
|
* Number of characters per standard line with 11pt Arial font size.
|
|
@@ -4527,10 +4528,8 @@ const CHARACTERS_PER_STANDARD_LINE = 63;
|
|
|
4527
4528
|
* @public exported from `@promptbook/utils`
|
|
4528
4529
|
*/
|
|
4529
4530
|
const LINES_PER_STANDARD_PAGE = 44;
|
|
4530
|
-
|
|
4531
|
-
|
|
4532
|
-
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
4533
|
-
*/
|
|
4531
|
+
// TODO: [🧠] Should be this `constants.ts` or `config.ts`?
|
|
4532
|
+
// Note: [💞] Ignore a discrepancy between file name and entity name
|
|
4534
4533
|
|
|
4535
4534
|
/**
|
|
4536
4535
|
* Counts number of lines in the text
|
|
@@ -4548,10 +4547,8 @@ function countLines(text) {
|
|
|
4548
4547
|
const lines = text.split(/\r?\n/);
|
|
4549
4548
|
return lines.reduce((count, line) => count + Math.max(Math.ceil(line.length / CHARACTERS_PER_STANDARD_LINE), 1), 0);
|
|
4550
4549
|
}
|
|
4551
|
-
|
|
4552
|
-
|
|
4553
|
-
* TODO: [🧠][✌️] Make some Promptbook-native token system
|
|
4554
|
-
*/
|
|
4550
|
+
// TODO: [🥴] Implement counting in formats - like JSON, CSV, XML,...
|
|
4551
|
+
// TODO: [🧠][✌️] Make some Promptbook-native token system
|
|
4555
4552
|
|
|
4556
4553
|
/**
|
|
4557
4554
|
* Counts number of pages in the text
|
|
@@ -4563,10 +4560,8 @@ function countLines(text) {
|
|
|
4563
4560
|
function countPages(text) {
|
|
4564
4561
|
return Math.ceil(countLines(text) / LINES_PER_STANDARD_PAGE);
|
|
4565
4562
|
}
|
|
4566
|
-
|
|
4567
|
-
|
|
4568
|
-
* TODO: [🧠][✌️] Make some Promptbook-native token system
|
|
4569
|
-
*/
|
|
4563
|
+
// TODO: [🥴] Implement counting in formats - like JSON, CSV, XML,...
|
|
4564
|
+
// TODO: [🧠][✌️] Make some Promptbook-native token system
|
|
4570
4565
|
|
|
4571
4566
|
/**
|
|
4572
4567
|
* Counts number of paragraphs in the text
|
|
@@ -4576,10 +4571,8 @@ function countPages(text) {
|
|
|
4576
4571
|
function countParagraphs(text) {
|
|
4577
4572
|
return text.split(/\n\s*\n/).filter((paragraph) => paragraph.trim() !== '').length;
|
|
4578
4573
|
}
|
|
4579
|
-
|
|
4580
|
-
|
|
4581
|
-
* TODO: [🧠][✌️] Make some Promptbook-native token system
|
|
4582
|
-
*/
|
|
4574
|
+
// TODO: [🥴] Implement counting in formats - like JSON, CSV, XML,...
|
|
4575
|
+
// TODO: [🧠][✌️] Make some Promptbook-native token system
|
|
4583
4576
|
|
|
4584
4577
|
/**
|
|
4585
4578
|
* Split text into sentences
|
|
@@ -4597,11 +4590,12 @@ function splitIntoSentences(text) {
|
|
|
4597
4590
|
function countSentences(text) {
|
|
4598
4591
|
return splitIntoSentences(text).length;
|
|
4599
4592
|
}
|
|
4593
|
+
// TODO: [🥴] Implement counting in formats - like JSON, CSV, XML,...
|
|
4594
|
+
// TODO: [🧠][✌️] Make some Promptbook-native token system
|
|
4595
|
+
|
|
4600
4596
|
/**
|
|
4601
|
-
*
|
|
4602
|
-
* TODO: [🧠][✌️] Make some Promptbook-native token system
|
|
4597
|
+
* Collection of default diacritics removal map.
|
|
4603
4598
|
*/
|
|
4604
|
-
|
|
4605
4599
|
const defaultDiacriticsRemovalMap = [
|
|
4606
4600
|
{
|
|
4607
4601
|
base: 'A',
|
|
@@ -4853,6 +4847,7 @@ for (let i = 0; i < defaultDiacriticsRemovalMap.length; i++) {
|
|
|
4853
4847
|
*
|
|
4854
4848
|
* @param input The string containing diacritics to be normalized.
|
|
4855
4849
|
* @returns The string with diacritics removed or normalized.
|
|
4850
|
+
*
|
|
4856
4851
|
* @public exported from `@promptbook/utils`
|
|
4857
4852
|
*/
|
|
4858
4853
|
function removeDiacritics(input) {
|
|
@@ -4861,9 +4856,7 @@ function removeDiacritics(input) {
|
|
|
4861
4856
|
return DIACRITIC_VARIANTS_LETTERS[character] || character;
|
|
4862
4857
|
});
|
|
4863
4858
|
}
|
|
4864
|
-
|
|
4865
|
-
* TODO: [Ж] Variant for cyrillic (and in general non-latin) letters
|
|
4866
|
-
*/
|
|
4859
|
+
// TODO: [Ж] Variant for cyrillic (and in general non-latin) letters
|
|
4867
4860
|
|
|
4868
4861
|
/**
|
|
4869
4862
|
* Counts number of words in the text
|
|
@@ -4877,11 +4870,9 @@ function countWords(text) {
|
|
|
4877
4870
|
text = text.replace(/([a-z])([A-Z])/g, '$1 $2');
|
|
4878
4871
|
return text.split(/[^a-zа-я0-9]+/i).filter((word) => word.length > 0).length;
|
|
4879
4872
|
}
|
|
4880
|
-
|
|
4881
|
-
|
|
4882
|
-
|
|
4883
|
-
* TODO: [✌️] `countWords` should be just `splitWords(...).length`, and all other counters should use this pattern as well
|
|
4884
|
-
*/
|
|
4873
|
+
// TODO: [🥴] Implement counting in formats - like JSON, CSV, XML,...
|
|
4874
|
+
// TODO: [🧠][✌️] Make some Promptbook-native token system
|
|
4875
|
+
// TODO: [✌️] `countWords` should be just `splitWords(...).length`, and all other counters should use this pattern as well
|
|
4885
4876
|
|
|
4886
4877
|
/**
|
|
4887
4878
|
* Index of all counter functions
|
|
@@ -4896,10 +4887,8 @@ const CountUtils = {
|
|
|
4896
4887
|
LINES: countLines,
|
|
4897
4888
|
PAGES: countPages,
|
|
4898
4889
|
};
|
|
4899
|
-
|
|
4900
|
-
|
|
4901
|
-
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
4902
|
-
*/
|
|
4890
|
+
// TODO: [🧠][🤠] This should be probably as part of `TextFormatParser`
|
|
4891
|
+
// Note: [💞] Ignore a discrepancy between file name and entity name
|
|
4903
4892
|
|
|
4904
4893
|
/**
|
|
4905
4894
|
* Function checkExpectations will check if the expectations on given value are met
|
|
@@ -4910,6 +4899,7 @@ const CountUtils = {
|
|
|
4910
4899
|
*
|
|
4911
4900
|
* @throws {ExpectError} if the expectations are not met
|
|
4912
4901
|
* @returns {void} Nothing
|
|
4902
|
+
*
|
|
4913
4903
|
* @private internal function of `createPipelineExecutor`
|
|
4914
4904
|
*/
|
|
4915
4905
|
function checkExpectations(expectations, value) {
|
|
@@ -4923,11 +4913,9 @@ function checkExpectations(expectations, value) {
|
|
|
4923
4913
|
}
|
|
4924
4914
|
}
|
|
4925
4915
|
}
|
|
4926
|
-
|
|
4927
|
-
|
|
4928
|
-
|
|
4929
|
-
* Note: [💝] and [🤠] are interconnected together
|
|
4930
|
-
*/
|
|
4916
|
+
// TODO: [💝] Unite object for expecting amount and format
|
|
4917
|
+
// TODO: [🧠][🤠] This should be part of `TextFormatParser`
|
|
4918
|
+
// Note: [💝] and [🤠] are interconnected together
|
|
4931
4919
|
|
|
4932
4920
|
/**
|
|
4933
4921
|
* Validates a prompt result against expectations and format requirements.
|
|
@@ -4938,6 +4926,7 @@ function checkExpectations(expectations, value) {
|
|
|
4938
4926
|
*
|
|
4939
4927
|
* @param options - The validation options including result string, expectations, and format
|
|
4940
4928
|
* @returns Validation result with processed string and validity status
|
|
4929
|
+
*
|
|
4941
4930
|
* @private internal function of `createPipelineExecutor` and `cacheLlmTools`
|
|
4942
4931
|
*/
|
|
4943
4932
|
function validatePromptResult(options) {
|
|
@@ -5000,6 +4989,7 @@ function validatePromptResult(options) {
|
|
|
5000
4989
|
*
|
|
5001
4990
|
* @param options - The options for execution, including task, parameters, pipeline, and configuration.
|
|
5002
4991
|
* @returns The result string of the executed task.
|
|
4992
|
+
*
|
|
5003
4993
|
* @private internal utility of `createPipelineExecutor`
|
|
5004
4994
|
*/
|
|
5005
4995
|
async function executeAttempts(options) {
|
|
@@ -5323,9 +5313,7 @@ async function executeAttempts(options) {
|
|
|
5323
5313
|
}
|
|
5324
5314
|
return $ongoingTaskResult.$resultString;
|
|
5325
5315
|
}
|
|
5326
|
-
|
|
5327
|
-
* TODO: Break into smaller functions
|
|
5328
|
-
*/
|
|
5316
|
+
// TODO: Break into smaller functions
|
|
5329
5317
|
|
|
5330
5318
|
/**
|
|
5331
5319
|
* Executes a pipeline task that requires mapping or iterating over subvalues of a parameter (such as rows in a CSV).
|
|
@@ -5468,6 +5456,7 @@ async function executeFormatSubvalues(options) {
|
|
|
5468
5456
|
*
|
|
5469
5457
|
* @param task - The task for which the context is being generated. This should be a deeply immutable TaskJson object.
|
|
5470
5458
|
* @returns The context as a string, formatted as markdown and parameter value.
|
|
5459
|
+
*
|
|
5471
5460
|
* @private internal utility of `createPipelineExecutor`
|
|
5472
5461
|
*/
|
|
5473
5462
|
async function getContextForTask(task) {
|
|
@@ -5505,7 +5494,6 @@ function computeCosineSimilarity(embeddingVector1, embeddingVector2) {
|
|
|
5505
5494
|
}
|
|
5506
5495
|
|
|
5507
5496
|
/**
|
|
5508
|
-
*
|
|
5509
5497
|
* @param knowledgePieces
|
|
5510
5498
|
* @returns
|
|
5511
5499
|
*
|
|
@@ -5586,10 +5574,8 @@ async function getKnowledgeForTask(options) {
|
|
|
5586
5574
|
return knowledgePiecesToString(preparedPipeline.knowledgePieces);
|
|
5587
5575
|
}
|
|
5588
5576
|
}
|
|
5589
|
-
|
|
5590
|
-
|
|
5591
|
-
* TODO: [♨] Examples of values
|
|
5592
|
-
*/
|
|
5577
|
+
// TODO: [♨] Implement Better - use keyword search
|
|
5578
|
+
// TODO: [♨] Examples of values
|
|
5593
5579
|
|
|
5594
5580
|
/**
|
|
5595
5581
|
* Retrieves all reserved parameters for a given pipeline task, including context, knowledge, examples, and metadata.
|
|
@@ -5742,9 +5728,7 @@ async function executeTask(options) {
|
|
|
5742
5728
|
resultString,
|
|
5743
5729
|
});
|
|
5744
5730
|
}
|
|
5745
|
-
|
|
5746
|
-
* TODO: [🤹♂️]
|
|
5747
|
-
*/
|
|
5731
|
+
// TODO: [🤹♂️]
|
|
5748
5732
|
|
|
5749
5733
|
/**
|
|
5750
5734
|
* Filters and returns only the output parameters from the provided pipeline execution options.
|
|
@@ -6074,6 +6058,7 @@ async function executePipeline(options) {
|
|
|
6074
6058
|
*
|
|
6075
6059
|
* @returns The executor function
|
|
6076
6060
|
* @throws {PipelineLogicError} on logical error in the pipeline
|
|
6061
|
+
*
|
|
6077
6062
|
* @public exported from `@promptbook/core`
|
|
6078
6063
|
*/
|
|
6079
6064
|
function createPipelineExecutor(options) {
|
|
@@ -6229,8 +6214,9 @@ function createPipelineExecutor(options) {
|
|
|
6229
6214
|
* @param array - Array to iterate over
|
|
6230
6215
|
* @param options - Options for the function
|
|
6231
6216
|
* @param callbackfunction - Function to call for each item
|
|
6232
|
-
* @public exported from `@promptbook/utils`
|
|
6233
6217
|
* @deprecated [🪂] Use queues instead
|
|
6218
|
+
*
|
|
6219
|
+
* @public exported from `@promptbook/utils`
|
|
6234
6220
|
*/
|
|
6235
6221
|
async function forEachAsync(array, options, callbackfunction) {
|
|
6236
6222
|
const { maxParallelCount = Infinity } = options;
|
|
@@ -6261,6 +6247,7 @@ async function forEachAsync(array, options, callbackfunction) {
|
|
|
6261
6247
|
*
|
|
6262
6248
|
* @param llmTools - The LLM tools to be intercepted and tracked
|
|
6263
6249
|
* @returns Full proxy of the tools with added usage tracking capabilities
|
|
6250
|
+
*
|
|
6264
6251
|
* @public exported from `@promptbook/core`
|
|
6265
6252
|
*/
|
|
6266
6253
|
function countUsage(llmTools) {
|
|
@@ -6358,6 +6345,7 @@ function countUsage(llmTools) {
|
|
|
6358
6345
|
* Prepares the persona for the pipeline
|
|
6359
6346
|
*
|
|
6360
6347
|
* @see https://github.com/webgptorg/promptbook/discussions/22
|
|
6348
|
+
*
|
|
6361
6349
|
* @public exported from `@promptbook/core`
|
|
6362
6350
|
*/
|
|
6363
6351
|
async function preparePersona(personaDescription, tools, options) {
|
|
@@ -6414,13 +6402,11 @@ async function preparePersona(personaDescription, tools, options) {
|
|
|
6414
6402
|
modelsRequirements,
|
|
6415
6403
|
};
|
|
6416
6404
|
}
|
|
6417
|
-
|
|
6418
|
-
|
|
6419
|
-
|
|
6420
|
-
|
|
6421
|
-
|
|
6422
|
-
* TODO: [🏢] Check validity of `temperature` in pipeline
|
|
6423
|
-
*/
|
|
6405
|
+
// TODO: [😩] DRY `preparePersona` and `selectBestModelFromAvailable`
|
|
6406
|
+
// TODO: [🔃][main] If the persona was prepared with different version or different set of models, prepare it once again
|
|
6407
|
+
// TODO: [🏢] Check validity of `modelName` in pipeline
|
|
6408
|
+
// TODO: [🏢] Check validity of `systemMessage` in pipeline
|
|
6409
|
+
// TODO: [🏢] Check validity of `temperature` in pipeline
|
|
6424
6410
|
|
|
6425
6411
|
/**
|
|
6426
6412
|
* Safely retrieves the global scope object (window in browser, global in Node.js)
|
|
@@ -6428,7 +6414,7 @@ async function preparePersona(personaDescription, tools, options) {
|
|
|
6428
6414
|
*
|
|
6429
6415
|
* Note: `$` is used to indicate that this function is not a pure function - it access global scope
|
|
6430
6416
|
*
|
|
6431
|
-
*
|
|
6417
|
+
* @private internal function of `$Register`
|
|
6432
6418
|
*/
|
|
6433
6419
|
function $getGlobalScope() {
|
|
6434
6420
|
return Function('return this')();
|
|
@@ -6443,6 +6429,7 @@ function $getGlobalScope() {
|
|
|
6443
6429
|
* @returns The normalized text in SCREAMING_CASE format.
|
|
6444
6430
|
* @example 'HELLO_WORLD'
|
|
6445
6431
|
* @example 'I_LOVE_PROMPTBOOK'
|
|
6432
|
+
*
|
|
6446
6433
|
* @public exported from `@promptbook/utils`
|
|
6447
6434
|
*/
|
|
6448
6435
|
function normalizeTo_SCREAMING_CASE(text) {
|
|
@@ -6500,6 +6487,7 @@ function normalizeTo_SCREAMING_CASE(text) {
|
|
|
6500
6487
|
* @returns The normalized text in snake_case format.
|
|
6501
6488
|
* @example 'hello_world'
|
|
6502
6489
|
* @example 'i_love_promptbook'
|
|
6490
|
+
*
|
|
6503
6491
|
* @public exported from `@promptbook/utils`
|
|
6504
6492
|
*/
|
|
6505
6493
|
function normalizeTo_snake_case(text) {
|
|
@@ -6558,26 +6546,26 @@ class $Register {
|
|
|
6558
6546
|
* Global registry for storing metadata about all available scrapers and converters.
|
|
6559
6547
|
*
|
|
6560
6548
|
* Note: `$` is used to indicate that this interacts with the global scope.
|
|
6549
|
+
*
|
|
6561
6550
|
* @singleton Only one instance of each register is created per build, but there can be more in different contexts (e.g., tests).
|
|
6551
|
+
*
|
|
6562
6552
|
* @public exported from `@promptbook/core`
|
|
6563
6553
|
*/
|
|
6564
6554
|
const $scrapersMetadataRegister = new $Register('scrapers_metadata');
|
|
6565
|
-
|
|
6566
|
-
* TODO: [®] DRY Register logic
|
|
6567
|
-
*/
|
|
6555
|
+
// TODO: [®] DRY Register logic
|
|
6568
6556
|
|
|
6569
6557
|
/**
|
|
6570
6558
|
* Registry for all available scrapers in the system.
|
|
6571
6559
|
* Central point for registering and accessing different types of content scrapers.
|
|
6572
6560
|
*
|
|
6573
6561
|
* Note: `$` is used to indicate that this interacts with the global scope
|
|
6562
|
+
*
|
|
6574
6563
|
* @singleton Only one instance of each register is created per build, but there can be more than one in different build modules
|
|
6564
|
+
*
|
|
6575
6565
|
* @public exported from `@promptbook/core`
|
|
6576
6566
|
*/
|
|
6577
6567
|
const $scrapersRegister = new $Register('scraper_constructors');
|
|
6578
|
-
|
|
6579
|
-
* TODO: [®] DRY Register logic
|
|
6580
|
-
*/
|
|
6568
|
+
// TODO: [®] DRY Register logic
|
|
6581
6569
|
|
|
6582
6570
|
/**
|
|
6583
6571
|
* Creates a message with all registered scrapers
|
|
@@ -6662,9 +6650,7 @@ function $registeredScrapersMessage(availableScrapers) {
|
|
|
6662
6650
|
|
|
6663
6651
|
`);
|
|
6664
6652
|
}
|
|
6665
|
-
|
|
6666
|
-
* TODO: [®] DRY Register logic
|
|
6667
|
-
*/
|
|
6653
|
+
// TODO: [®] DRY Register logic
|
|
6668
6654
|
|
|
6669
6655
|
/**
|
|
6670
6656
|
* Converts a given text to kebab-case format.
|
|
@@ -6675,6 +6661,7 @@ function $registeredScrapersMessage(availableScrapers) {
|
|
|
6675
6661
|
* @returns The kebab-case formatted string.
|
|
6676
6662
|
* @example 'hello-world'
|
|
6677
6663
|
* @example 'i-love-promptbook'
|
|
6664
|
+
*
|
|
6678
6665
|
* @public exported from `@promptbook/utils`
|
|
6679
6666
|
*/
|
|
6680
6667
|
function normalizeToKebabCase(text) {
|
|
@@ -6715,9 +6702,7 @@ function normalizeToKebabCase(text) {
|
|
|
6715
6702
|
normalizedName = normalizedName.replace(/-$/, '');
|
|
6716
6703
|
return normalizedName;
|
|
6717
6704
|
}
|
|
6718
|
-
|
|
6719
|
-
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
6720
|
-
*/
|
|
6705
|
+
// Note: [💞] Ignore a discrepancy between file name and entity name
|
|
6721
6706
|
|
|
6722
6707
|
/**
|
|
6723
6708
|
* Creates unique name for the source
|
|
@@ -6736,9 +6721,7 @@ function knowledgeSourceContentToName(knowledgeSourceContent) {
|
|
|
6736
6721
|
// <- TODO: Use MAX_FILENAME_LENGTH
|
|
6737
6722
|
return name;
|
|
6738
6723
|
}
|
|
6739
|
-
|
|
6740
|
-
* TODO: [🐱🐉][🧠] Make some smart crop NOT source-i-m-pavol-a-develop-... BUT source-i-m-pavol-a-developer-...
|
|
6741
|
-
*/
|
|
6724
|
+
// TODO: [🐱🐉][🧠] Make some smart crop NOT source-i-m-pavol-a-develop-... BUT source-i-m-pavol-a-developer-...
|
|
6742
6725
|
|
|
6743
6726
|
/**
|
|
6744
6727
|
* Converts a name to a properly formatted subfolder path for cache storage.
|
|
@@ -6788,11 +6771,9 @@ async function isFileExisting(filename, fs) {
|
|
|
6788
6771
|
.catch(() => false);
|
|
6789
6772
|
return isFile;
|
|
6790
6773
|
}
|
|
6791
|
-
|
|
6792
|
-
|
|
6793
|
-
|
|
6794
|
-
* TODO: [🖇] What about symlinks?
|
|
6795
|
-
*/
|
|
6774
|
+
// Note: Not [~🟢~] because it is not directly dependent on `fs
|
|
6775
|
+
// TODO: [🐠] This can be a validator - with variants that return true/false and variants that throw errors with meaningless messages
|
|
6776
|
+
// TODO: [🖇] What about symlinks?
|
|
6796
6777
|
|
|
6797
6778
|
/**
|
|
6798
6779
|
* Convert mime type to file extension
|
|
@@ -6812,6 +6793,7 @@ function mimeTypeToExtension(value) {
|
|
|
6812
6793
|
*
|
|
6813
6794
|
* @param text with emojis
|
|
6814
6795
|
* @returns text without emojis
|
|
6796
|
+
*
|
|
6815
6797
|
* @public exported from `@promptbook/utils`
|
|
6816
6798
|
*/
|
|
6817
6799
|
function removeEmojis(text) {
|
|
@@ -6831,6 +6813,7 @@ function removeEmojis(text) {
|
|
|
6831
6813
|
* @param value The title string to be converted to a name.
|
|
6832
6814
|
* @returns A normalized name derived from the input title.
|
|
6833
6815
|
* @example 'Hello World!' -> 'hello-world'
|
|
6816
|
+
*
|
|
6834
6817
|
* @public exported from `@promptbook/utils`
|
|
6835
6818
|
*/
|
|
6836
6819
|
function titleToName(value) {
|
|
@@ -6876,9 +6859,7 @@ const promptbookFetch = async (urlOrRequest, init) => {
|
|
|
6876
6859
|
`));
|
|
6877
6860
|
}
|
|
6878
6861
|
};
|
|
6879
|
-
|
|
6880
|
-
* TODO: [🧠] Maybe rename because it is not used only for scrapers but also in `$getCompiledBook`
|
|
6881
|
-
*/
|
|
6862
|
+
// TODO: [🧠] Maybe rename because it is not used only for scrapers but also in `$getCompiledBook`
|
|
6882
6863
|
|
|
6883
6864
|
/**
|
|
6884
6865
|
* Factory function that creates a handler for processing knowledge sources.
|
|
@@ -7098,6 +7079,7 @@ async function makeKnowledgeSourceHandler(knowledgeSource, tools, options) {
|
|
|
7098
7079
|
* Prepares the knowledge pieces
|
|
7099
7080
|
*
|
|
7100
7081
|
* @see https://github.com/webgptorg/promptbook/discussions/41
|
|
7082
|
+
*
|
|
7101
7083
|
* @public exported from `@promptbook/core`
|
|
7102
7084
|
*/
|
|
7103
7085
|
async function prepareKnowledgePieces(knowledgeSources, tools, options) {
|
|
@@ -7239,25 +7221,24 @@ async function prepareTasks(pipeline, tools, options) {
|
|
|
7239
7221
|
});
|
|
7240
7222
|
return { tasksPrepared };
|
|
7241
7223
|
}
|
|
7242
|
-
|
|
7243
|
-
|
|
7244
|
-
|
|
7245
|
-
|
|
7246
|
-
|
|
7247
|
-
|
|
7248
|
-
|
|
7249
|
-
|
|
7250
|
-
* TODO: [🛠] Actions, instruments (and maybe knowledge) => Functions and tools
|
|
7251
|
-
*/
|
|
7224
|
+
// TODO: [😂] Adding knowledge should be convert to async high-level abstractions, similar thing with expectations to sync high-level abstractions
|
|
7225
|
+
// TODO: [🧠] Add context to each task (if missing)
|
|
7226
|
+
// TODO: [🧠] What is better name `prepareTask` or `prepareTaskAndParameters`
|
|
7227
|
+
// TODO: [♨][main] !!3 Prepare index the examples and maybe tasks
|
|
7228
|
+
// TODO: Write tests for `preparePipeline`
|
|
7229
|
+
// TODO: [🏏] Leverage the batch API and build queues @see https://platform.openai.com/docs/guides/batch
|
|
7230
|
+
// TODO: [🧊] In future one preparation can take data from previous preparation and save tokens and time
|
|
7231
|
+
// TODO: [🛠] Actions, instruments (and maybe knowledge) => Functions and tools
|
|
7252
7232
|
|
|
7253
7233
|
/**
|
|
7254
7234
|
* Prepare pipeline locally
|
|
7255
7235
|
*
|
|
7256
|
-
* @see https://github.com/webgptorg/promptbook/discussions/196
|
|
7257
|
-
*
|
|
7258
7236
|
* Note: This function does not validate logic of the pipeline
|
|
7259
7237
|
* Note: This function acts as part of compilation process
|
|
7260
7238
|
* Note: When the pipeline is already prepared, it returns the same pipeline
|
|
7239
|
+
*
|
|
7240
|
+
* @see https://github.com/webgptorg/promptbook/discussions/196
|
|
7241
|
+
*
|
|
7261
7242
|
* @public exported from `@promptbook/core`
|
|
7262
7243
|
*/
|
|
7263
7244
|
async function preparePipeline(pipeline, tools, options) {
|
|
@@ -7436,6 +7417,7 @@ const SectionTypes = [
|
|
|
7436
7417
|
* Parses the knowledge command
|
|
7437
7418
|
*
|
|
7438
7419
|
* @see `documentationUrl` for more details
|
|
7420
|
+
*
|
|
7439
7421
|
* @public exported from `@promptbook/editable`
|
|
7440
7422
|
*/
|
|
7441
7423
|
const knowledgeCommandParser = {
|
|
@@ -7522,14 +7504,13 @@ const knowledgeCommandParser = {
|
|
|
7522
7504
|
throw new NotYetImplementedError(`[🛋] Not implemented yet`); // <- TODO: [🛋] Implement
|
|
7523
7505
|
},
|
|
7524
7506
|
};
|
|
7525
|
-
|
|
7526
|
-
* Note: [⛱] There are two types of KNOWLEDGE commands *...(read more in [⛱])*
|
|
7527
|
-
*/
|
|
7507
|
+
// Note: [⛱] There are two types of KNOWLEDGE commands *...(read more in [⛱])*
|
|
7528
7508
|
|
|
7529
7509
|
/**
|
|
7530
7510
|
* Parses the section command
|
|
7531
7511
|
*
|
|
7532
7512
|
* @see `documentationUrl` for more details
|
|
7513
|
+
*
|
|
7533
7514
|
* @public exported from `@promptbook/editable`
|
|
7534
7515
|
*/
|
|
7535
7516
|
const sectionCommandParser = {
|
|
@@ -7721,6 +7702,7 @@ const sectionCommandParser = {
|
|
|
7721
7702
|
* Note: @@ This command is used as boilerplate for new commands - it should NOT be used in any `.book` file
|
|
7722
7703
|
*
|
|
7723
7704
|
* @see `documentationUrl` for more details
|
|
7705
|
+
*
|
|
7724
7706
|
* @private within the commands folder
|
|
7725
7707
|
*/
|
|
7726
7708
|
const boilerplateCommandParser = {
|
|
@@ -7812,6 +7794,7 @@ const boilerplateCommandParser = {
|
|
|
7812
7794
|
* Parses the BOOK_VERSION command
|
|
7813
7795
|
*
|
|
7814
7796
|
* @see `documentationUrl` for more details
|
|
7797
|
+
*
|
|
7815
7798
|
* @public exported from `@promptbook/editable`
|
|
7816
7799
|
*/
|
|
7817
7800
|
const bookVersionCommandParser = {
|
|
@@ -7888,12 +7871,11 @@ const bookVersionCommandParser = {
|
|
|
7888
7871
|
* Units of text measurement
|
|
7889
7872
|
*
|
|
7890
7873
|
* @see https://github.com/webgptorg/promptbook/discussions/30
|
|
7874
|
+
*
|
|
7891
7875
|
* @public exported from `@promptbook/core`
|
|
7892
7876
|
*/
|
|
7893
7877
|
const EXPECTATION_UNITS = ['CHARACTERS', 'WORDS', 'SENTENCES', 'LINES', 'PARAGRAPHS', 'PAGES'];
|
|
7894
|
-
|
|
7895
|
-
* TODO: [💝] Unite object for expecting amount and format - remove format
|
|
7896
|
-
*/
|
|
7878
|
+
// TODO: [💝] Unite object for expecting amount and format - remove format
|
|
7897
7879
|
|
|
7898
7880
|
/**
|
|
7899
7881
|
* Function parseNumber will parse number from string
|
|
@@ -7962,17 +7944,16 @@ function parseNumber(value) {
|
|
|
7962
7944
|
}
|
|
7963
7945
|
return num;
|
|
7964
7946
|
}
|
|
7965
|
-
|
|
7966
|
-
|
|
7967
|
-
* TODO: [🧠][🌻] Maybe export through `@promptbook/markdown-utils` not `@promptbook/utils`
|
|
7968
|
-
*/
|
|
7947
|
+
// TODO: Maybe use sth. like safe-eval in fraction/calculation case @see https://www.npmjs.com/package/safe-eval
|
|
7948
|
+
// TODO: [🧠][🌻] Maybe export through `@promptbook/markdown-utils` not `@promptbook/utils`
|
|
7969
7949
|
|
|
7970
7950
|
/**
|
|
7971
|
-
import { WrappedError } from '../../errors/WrappedError';
|
|
7972
|
-
import { assertsError } from '../../errors/assertsError';
|
|
7951
|
+
* import { WrappedError } from '../../errors/WrappedError';
|
|
7952
|
+
* import { assertsError } from '../../errors/assertsError';
|
|
7973
7953
|
* Parses the expect command
|
|
7974
7954
|
*
|
|
7975
7955
|
* @see `documentationUrl` for more details
|
|
7956
|
+
*
|
|
7976
7957
|
* @public exported from `@promptbook/editable`
|
|
7977
7958
|
*/
|
|
7978
7959
|
const expectCommandParser = {
|
|
@@ -8119,6 +8100,7 @@ const expectCommandParser = {
|
|
|
8119
8100
|
* @returns The camelCase formatted string.
|
|
8120
8101
|
* @example 'helloWorld'
|
|
8121
8102
|
* @example 'iLovePromptbook'
|
|
8103
|
+
*
|
|
8122
8104
|
* @public exported from `@promptbook/utils`
|
|
8123
8105
|
*/
|
|
8124
8106
|
function normalizeTo_camelCase(text, _isFirstLetterCapital = false) {
|
|
@@ -8159,9 +8141,7 @@ function normalizeTo_camelCase(text, _isFirstLetterCapital = false) {
|
|
|
8159
8141
|
}
|
|
8160
8142
|
return normalizedName;
|
|
8161
8143
|
}
|
|
8162
|
-
|
|
8163
|
-
* TODO: [🌺] Use some intermediate util splitWords
|
|
8164
|
-
*/
|
|
8144
|
+
// TODO: [🌺] Use some intermediate util splitWords
|
|
8165
8145
|
|
|
8166
8146
|
/**
|
|
8167
8147
|
* Removes quotes from a string
|
|
@@ -8175,6 +8155,7 @@ function normalizeTo_camelCase(text, _isFirstLetterCapital = false) {
|
|
|
8175
8155
|
*
|
|
8176
8156
|
* @param text optionally quoted text
|
|
8177
8157
|
* @returns text without quotes
|
|
8158
|
+
*
|
|
8178
8159
|
* @public exported from `@promptbook/utils`
|
|
8179
8160
|
*/
|
|
8180
8161
|
function removeQuotes(text) {
|
|
@@ -8196,6 +8177,7 @@ function removeQuotes(text) {
|
|
|
8196
8177
|
* @param parameterName The parameter name to validate and normalize.
|
|
8197
8178
|
* @returns The validated and normalized parameter name.
|
|
8198
8179
|
* @throws {ParseError} If the parameter name is empty, reserved, or contains invalid characters.
|
|
8180
|
+
*
|
|
8199
8181
|
* @private within the repository
|
|
8200
8182
|
*/
|
|
8201
8183
|
function validateParameterName(parameterName) {
|
|
@@ -8266,6 +8248,7 @@ function validateParameterName(parameterName) {
|
|
|
8266
8248
|
* Parses the foreach command
|
|
8267
8249
|
*
|
|
8268
8250
|
* @see `documentationUrl` for more details
|
|
8251
|
+
*
|
|
8269
8252
|
* @public exported from `@promptbook/editable`
|
|
8270
8253
|
*/
|
|
8271
8254
|
const foreachCommandParser = {
|
|
@@ -8424,14 +8407,13 @@ const foreachCommandParser = {
|
|
|
8424
8407
|
throw new NotYetImplementedError(`[🛋] Not implemented yet`); // <- TODO: [🛋] Implement
|
|
8425
8408
|
},
|
|
8426
8409
|
};
|
|
8427
|
-
|
|
8428
|
-
* TODO: [🍭] Make .book.md file with examples of the FOREACH with wrong parsing and logic
|
|
8429
|
-
*/
|
|
8410
|
+
// TODO: [🍭] Make .book.md file with examples of the FOREACH with wrong parsing and logic
|
|
8430
8411
|
|
|
8431
8412
|
/**
|
|
8432
8413
|
* Parses the format command
|
|
8433
8414
|
*
|
|
8434
8415
|
* @see `documentationUrl` for more details
|
|
8416
|
+
*
|
|
8435
8417
|
* @public exported from `@promptbook/editable`
|
|
8436
8418
|
*/
|
|
8437
8419
|
const formatCommandParser = {
|
|
@@ -8616,9 +8598,7 @@ const GENERIC_PIPELINE_INTERFACE = {
|
|
|
8616
8598
|
inputParameters: [],
|
|
8617
8599
|
outputParameters: [],
|
|
8618
8600
|
};
|
|
8619
|
-
|
|
8620
|
-
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
8621
|
-
*/
|
|
8601
|
+
// Note: [💞] Ignore a discrepancy between file name and entity name
|
|
8622
8602
|
|
|
8623
8603
|
/**
|
|
8624
8604
|
* A generic pipeline
|
|
@@ -8770,9 +8750,7 @@ const FORMFACTOR_DEFINITIONS = [
|
|
|
8770
8750
|
CompletionFormfactorDefinition,
|
|
8771
8751
|
// <- [🛬] When making new formfactor, copy the _boilerplate and link it here
|
|
8772
8752
|
];
|
|
8773
|
-
|
|
8774
|
-
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
8775
|
-
*/
|
|
8753
|
+
// Note: [💞] Ignore a discrepancy between file name and entity name
|
|
8776
8754
|
|
|
8777
8755
|
/**
|
|
8778
8756
|
* Parses the formfactor command
|
|
@@ -8780,6 +8758,7 @@ const FORMFACTOR_DEFINITIONS = [
|
|
|
8780
8758
|
* Note: This command is used as a formfactor for new commands and defines the app type format - it should NOT be used in any `.book` file
|
|
8781
8759
|
*
|
|
8782
8760
|
* @see `documentationUrl` for more details
|
|
8761
|
+
*
|
|
8783
8762
|
* @public exported from `@promptbook/editable`
|
|
8784
8763
|
*/
|
|
8785
8764
|
const formfactorCommandParser = {
|
|
@@ -8875,6 +8854,7 @@ const formfactorCommandParser = {
|
|
|
8875
8854
|
* Parses the joker command
|
|
8876
8855
|
*
|
|
8877
8856
|
* @see `documentationUrl` for more details
|
|
8857
|
+
*
|
|
8878
8858
|
* @public exported from `@promptbook/editable`
|
|
8879
8859
|
*/
|
|
8880
8860
|
const jokerCommandParser = {
|
|
@@ -8942,7 +8922,10 @@ const jokerCommandParser = {
|
|
|
8942
8922
|
};
|
|
8943
8923
|
|
|
8944
8924
|
/**
|
|
8925
|
+
* Constant for model variants.
|
|
8926
|
+
*
|
|
8945
8927
|
* @see {@link ModelVariant}
|
|
8928
|
+
*
|
|
8946
8929
|
* @public exported from `@promptbook/core`
|
|
8947
8930
|
*/
|
|
8948
8931
|
const MODEL_VARIANTS = [
|
|
@@ -8957,6 +8940,7 @@ const MODEL_VARIANTS = [
|
|
|
8957
8940
|
*
|
|
8958
8941
|
* @see `documentationUrl` for more details
|
|
8959
8942
|
* @deprecated Option to manually set the model requirements is not recommended to use, use `PERSONA` instead
|
|
8943
|
+
*
|
|
8960
8944
|
* @public exported from `@promptbook/editable`
|
|
8961
8945
|
*/
|
|
8962
8946
|
const modelCommandParser = {
|
|
@@ -9137,6 +9121,7 @@ const modelCommandParser = {
|
|
|
9137
9121
|
* Parses the parameter command
|
|
9138
9122
|
*
|
|
9139
9123
|
* @see `documentationUrl` for more details
|
|
9124
|
+
*
|
|
9140
9125
|
* @public exported from `@promptbook/editable`
|
|
9141
9126
|
*/
|
|
9142
9127
|
const parameterCommandParser = {
|
|
@@ -9247,6 +9232,7 @@ const parameterCommandParser = {
|
|
|
9247
9232
|
* Parses the persona command
|
|
9248
9233
|
*
|
|
9249
9234
|
* @see `documentationUrl` for more details
|
|
9235
|
+
*
|
|
9250
9236
|
* @public exported from `@promptbook/editable`
|
|
9251
9237
|
*/
|
|
9252
9238
|
const personaCommandParser = {
|
|
@@ -9379,6 +9365,7 @@ function $applyToTaskJson(command, $taskJson, $pipelineJson) {
|
|
|
9379
9365
|
*
|
|
9380
9366
|
* @param javascriptName The value to check for JavaScript identifier validity.
|
|
9381
9367
|
* @returns `true` if the value is a valid JavaScript name, false otherwise.
|
|
9368
|
+
*
|
|
9382
9369
|
* @public exported from `@promptbook/utils`
|
|
9383
9370
|
*/
|
|
9384
9371
|
function isValidJavascriptName(javascriptName) {
|
|
@@ -9392,6 +9379,7 @@ function isValidJavascriptName(javascriptName) {
|
|
|
9392
9379
|
* Parses the postprocess command
|
|
9393
9380
|
*
|
|
9394
9381
|
* @see `documentationUrl` for more details
|
|
9382
|
+
*
|
|
9395
9383
|
* @public exported from `@promptbook/editable`
|
|
9396
9384
|
*/
|
|
9397
9385
|
const postprocessCommandParser = {
|
|
@@ -9470,6 +9458,7 @@ const postprocessCommandParser = {
|
|
|
9470
9458
|
* Parses the url command
|
|
9471
9459
|
*
|
|
9472
9460
|
* @see `documentationUrl` for more details
|
|
9461
|
+
*
|
|
9473
9462
|
* @public exported from `@promptbook/editable`
|
|
9474
9463
|
*/
|
|
9475
9464
|
const urlCommandParser = {
|
|
@@ -9571,6 +9560,7 @@ const urlCommandParser = {
|
|
|
9571
9560
|
* Parses the action command
|
|
9572
9561
|
*
|
|
9573
9562
|
* @see `documentationUrl` for more details
|
|
9563
|
+
*
|
|
9574
9564
|
* @public exported from `@promptbook/editable`
|
|
9575
9565
|
*/
|
|
9576
9566
|
const actionCommandParser = {
|
|
@@ -9628,14 +9618,13 @@ const actionCommandParser = {
|
|
|
9628
9618
|
throw new NotYetImplementedError('[🛠] Actions are not implemented yet');
|
|
9629
9619
|
},
|
|
9630
9620
|
};
|
|
9631
|
-
|
|
9632
|
-
* Note: [⛱] There are two types of ACTION commands *...(read more in [⛱])*
|
|
9633
|
-
*/
|
|
9621
|
+
// Note: [⛱] There are two types of ACTION commands *...(read more in [⛱])*
|
|
9634
9622
|
|
|
9635
9623
|
/**
|
|
9636
9624
|
* Parses the instrument command
|
|
9637
9625
|
*
|
|
9638
9626
|
* @see `documentationUrl` for more details
|
|
9627
|
+
*
|
|
9639
9628
|
* @public exported from `@promptbook/editable`
|
|
9640
9629
|
*/
|
|
9641
9630
|
const instrumentCommandParser = {
|
|
@@ -9693,9 +9682,7 @@ const instrumentCommandParser = {
|
|
|
9693
9682
|
throw new NotYetImplementedError('[🛠] Instruments are not implemented yet');
|
|
9694
9683
|
},
|
|
9695
9684
|
};
|
|
9696
|
-
|
|
9697
|
-
* Note: [⛱] There are two types of INSTRUMENT commands *...(read more in [⛱])*
|
|
9698
|
-
*/
|
|
9685
|
+
// Note: [⛱] There are two types of INSTRUMENT commands *...(read more in [⛱])*
|
|
9699
9686
|
|
|
9700
9687
|
/**
|
|
9701
9688
|
* All available command parsers
|
|
@@ -9721,9 +9708,7 @@ const COMMANDS = [
|
|
|
9721
9708
|
boilerplateCommandParser, // <- TODO: Only in development, remove in production
|
|
9722
9709
|
// <- Note: [♓️][💩] This is the order of the commands in the pipeline, BUT its not used in parsing and before usage maybe it should be done better
|
|
9723
9710
|
];
|
|
9724
|
-
|
|
9725
|
-
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
9726
|
-
*/
|
|
9711
|
+
// Note: [💞] Ignore a discrepancy between file name and entity name
|
|
9727
9712
|
|
|
9728
9713
|
/**
|
|
9729
9714
|
* Gets the parser for the command
|
|
@@ -9753,6 +9738,7 @@ function getParserForCommand(command) {
|
|
|
9753
9738
|
*
|
|
9754
9739
|
* @param {string} str - The string to remove Markdown tags from.
|
|
9755
9740
|
* @returns {string} The input string with all Markdown tags removed.
|
|
9741
|
+
*
|
|
9756
9742
|
* @public exported from `@promptbook/markdown-utils`
|
|
9757
9743
|
*/
|
|
9758
9744
|
function removeMarkdownFormatting(str) {
|
|
@@ -10138,9 +10124,7 @@ const QuickChatbotHla = {
|
|
|
10138
10124
|
});
|
|
10139
10125
|
},
|
|
10140
10126
|
};
|
|
10141
|
-
|
|
10142
|
-
* TODO: [🧠][📛] Should this be here?
|
|
10143
|
-
*/
|
|
10127
|
+
// TODO: [🧠][📛] Should this be here?
|
|
10144
10128
|
|
|
10145
10129
|
/**
|
|
10146
10130
|
* All high-level abstractions
|
|
@@ -10152,10 +10136,8 @@ const HIGH_LEVEL_ABSTRACTIONS = [
|
|
|
10152
10136
|
QuickChatbotHla,
|
|
10153
10137
|
// <- Note: [♓️][💩] This is the order of the application of high-level abstractions application on pipeline JSON
|
|
10154
10138
|
];
|
|
10155
|
-
|
|
10156
|
-
|
|
10157
|
-
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
10158
|
-
*/
|
|
10139
|
+
// TODO: Test that all sync high-level abstractions are before async high-level abstractions
|
|
10140
|
+
// Note: [💞] Ignore a discrepancy between file name and entity name
|
|
10159
10141
|
|
|
10160
10142
|
/**
|
|
10161
10143
|
* Supported script languages
|
|
@@ -10166,7 +10148,7 @@ const SUPPORTED_SCRIPT_LANGUAGES = ['javascript', 'typescript', 'python'];
|
|
|
10166
10148
|
// <- TODO: [🏥] DRY
|
|
10167
10149
|
|
|
10168
10150
|
/**
|
|
10169
|
-
*
|
|
10151
|
+
* Number of padding lines to add at the end of the book content
|
|
10170
10152
|
*
|
|
10171
10153
|
* @public exported from `@promptbook/core`
|
|
10172
10154
|
*/
|
|
@@ -10203,15 +10185,14 @@ function padBook(content) {
|
|
|
10203
10185
|
const linesToAdd = PADDING_LINES - trailingEmptyLines;
|
|
10204
10186
|
return (content + '\n'.repeat(linesToAdd));
|
|
10205
10187
|
}
|
|
10206
|
-
|
|
10207
|
-
* TODO: [🧠] Maybe export
|
|
10208
|
-
*/
|
|
10188
|
+
// TODO: [🧠] Maybe export
|
|
10209
10189
|
|
|
10210
10190
|
/**
|
|
10211
10191
|
* Removes Markdown (or HTML) comments
|
|
10212
10192
|
*
|
|
10213
10193
|
* @param {string} content - The string to remove comments from.
|
|
10214
10194
|
* @returns {string} The input string with all comments removed.
|
|
10195
|
+
*
|
|
10215
10196
|
* @public exported from `@promptbook/markdown-utils`
|
|
10216
10197
|
*/
|
|
10217
10198
|
function removeMarkdownComments(content) {
|
|
@@ -10289,9 +10270,7 @@ function deflatePipeline(pipelineString) {
|
|
|
10289
10270
|
// <- TODO: Maybe use book` notation
|
|
10290
10271
|
return padBook(pipelineString);
|
|
10291
10272
|
}
|
|
10292
|
-
|
|
10293
|
-
* TODO: Unit test
|
|
10294
|
-
*/
|
|
10273
|
+
// TODO: Unit test
|
|
10295
10274
|
|
|
10296
10275
|
/**
|
|
10297
10276
|
* Utility function to extract all list items from markdown
|
|
@@ -10303,6 +10282,7 @@ function deflatePipeline(pipelineString) {
|
|
|
10303
10282
|
*
|
|
10304
10283
|
* @param markdown any valid markdown
|
|
10305
10284
|
* @returns An array of strings, each representing an individual list item found in the markdown
|
|
10285
|
+
*
|
|
10306
10286
|
* @public exported from `@promptbook/markdown-utils`
|
|
10307
10287
|
*/
|
|
10308
10288
|
function extractAllListItemsFromMarkdown(markdown) {
|
|
@@ -10335,8 +10315,9 @@ function extractAllListItemsFromMarkdown(markdown) {
|
|
|
10335
10315
|
*
|
|
10336
10316
|
* @param markdown any valid markdown
|
|
10337
10317
|
* @returns code block with language and content
|
|
10338
|
-
* @public exported from `@promptbook/markdown-utils`
|
|
10339
10318
|
* @throws {ParseError} if there is not exactly one code block in the markdown
|
|
10319
|
+
*
|
|
10320
|
+
* @public exported from `@promptbook/markdown-utils`
|
|
10340
10321
|
*/
|
|
10341
10322
|
function extractOneBlockFromMarkdown(markdown) {
|
|
10342
10323
|
const codeBlocks = extractAllBlocksFromMarkdown(markdown);
|
|
@@ -10349,9 +10330,7 @@ function extractOneBlockFromMarkdown(markdown) {
|
|
|
10349
10330
|
}
|
|
10350
10331
|
return codeBlocks[0];
|
|
10351
10332
|
}
|
|
10352
|
-
|
|
10353
|
-
* TODO: [🍓][🌻] Decide of this is internal utility, external util OR validator/postprocessor
|
|
10354
|
-
*/
|
|
10333
|
+
// TODO: [🍓][🌻] Decide of this is internal utility, external util OR validator/postprocessor
|
|
10355
10334
|
|
|
10356
10335
|
/**
|
|
10357
10336
|
* Parses markdown section to title its level and content
|
|
@@ -10493,6 +10472,7 @@ function flattenMarkdown(markdown) {
|
|
|
10493
10472
|
* @param pipelineString {Promptbook} in string markdown format (.book.md)
|
|
10494
10473
|
* @returns {Promptbook} compiled in JSON format (.bookc)
|
|
10495
10474
|
* @throws {ParseError} if the promptbook string is not valid
|
|
10475
|
+
*
|
|
10496
10476
|
* @public exported from `@promptbook/core`
|
|
10497
10477
|
*/
|
|
10498
10478
|
function parsePipeline(pipelineString) {
|
|
@@ -10913,31 +10893,29 @@ function parsePipeline(pipelineString) {
|
|
|
10913
10893
|
},
|
|
10914
10894
|
});
|
|
10915
10895
|
}
|
|
10916
|
-
|
|
10917
|
-
|
|
10918
|
-
|
|
10919
|
-
|
|
10920
|
-
|
|
10921
|
-
|
|
10922
|
-
|
|
10923
|
-
|
|
10924
|
-
|
|
10925
|
-
* TODO: [🍙] Make some standard order of json properties
|
|
10926
|
-
*/
|
|
10896
|
+
// TODO: [🧠] Maybe more things here can be refactored as high-level abstractions
|
|
10897
|
+
// TODO: [main] !!4 Warn if used only sync version
|
|
10898
|
+
// TODO: [🚞] Report here line/column of error
|
|
10899
|
+
// TODO: Use spaceTrim more effectively
|
|
10900
|
+
// TODO: [🧠] Parameter flags - isInput, isOutput, isInternal
|
|
10901
|
+
// TODO: [🥞] Not optimal parsing because `splitMarkdownIntoSections` is executed twice with same string, once through `flattenMarkdown` and second directly here
|
|
10902
|
+
// TODO: [♈] Probably move expectations from tasks to parameters
|
|
10903
|
+
// TODO: [🛠] Actions, instruments (and maybe knowledge) => Functions and tools
|
|
10904
|
+
// TODO: [🍙] Make some standard order of json properties
|
|
10927
10905
|
|
|
10928
10906
|
/**
|
|
10929
10907
|
* Compile pipeline from string (markdown) format to JSON format
|
|
10930
10908
|
*
|
|
10931
|
-
* @see https://github.com/webgptorg/promptbook/discussions/196
|
|
10932
|
-
*
|
|
10933
10909
|
* Note: This function does not validate logic of the pipeline only the parsing
|
|
10934
10910
|
* Note: This function acts as compilation process
|
|
10935
10911
|
*
|
|
10912
|
+
* @see https://github.com/webgptorg/promptbook/discussions/196
|
|
10936
10913
|
* @param pipelineString {Promptbook} in string markdown format (.book.md)
|
|
10937
10914
|
* @param tools - Tools for the preparation and scraping - if not provided together with `llm`, the preparation will be skipped
|
|
10938
10915
|
* @param options - Options and tools for the compilation
|
|
10939
10916
|
* @returns {Promptbook} compiled in JSON format (.bookc)
|
|
10940
10917
|
* @throws {ParseError} if the promptbook string is not valid
|
|
10918
|
+
*
|
|
10941
10919
|
* @public exported from `@promptbook/core`
|
|
10942
10920
|
*/
|
|
10943
10921
|
async function compilePipeline(pipelineString, tools, options) {
|
|
@@ -10950,11 +10928,9 @@ async function compilePipeline(pipelineString, tools, options) {
|
|
|
10950
10928
|
// Note: No need to use `$exportJson` because `parsePipeline` and `preparePipeline` already do that
|
|
10951
10929
|
return pipelineJson;
|
|
10952
10930
|
}
|
|
10953
|
-
|
|
10954
|
-
|
|
10955
|
-
|
|
10956
|
-
* TODO: [🧠] Should be in generated JSON file GENERATOR_WARNING
|
|
10957
|
-
*/
|
|
10931
|
+
// TODO: [🏏] Leverage the batch API and build queues @see https://platform.openai.com/docs/guides/batch
|
|
10932
|
+
// TODO: [🛠] Actions, instruments (and maybe knowledge) => Functions and tools
|
|
10933
|
+
// TODO: [🧠] Should be in generated JSON file GENERATOR_WARNING
|
|
10958
10934
|
|
|
10959
10935
|
/**
|
|
10960
10936
|
* Unsafe characters that prevent an inline parameter.
|
|
@@ -10978,6 +10954,7 @@ const PROMPT_PARAMETER_ESCAPE_WITH_BRACES_PATTERN = /[{}$`]/g;
|
|
|
10978
10954
|
* Normalizes a JSON string so it can be safely rendered without double escaping.
|
|
10979
10955
|
*
|
|
10980
10956
|
* @param value Candidate JSON string.
|
|
10957
|
+
*
|
|
10981
10958
|
* @private function of ParameterEscaping
|
|
10982
10959
|
*/
|
|
10983
10960
|
function normalizeJsonString(value) {
|
|
@@ -10992,6 +10969,7 @@ function normalizeJsonString(value) {
|
|
|
10992
10969
|
* Hides brackets in a string to avoid confusion with template parameters.
|
|
10993
10970
|
*
|
|
10994
10971
|
* @param value Input string with literal brackets.
|
|
10972
|
+
*
|
|
10995
10973
|
* @private function of ParameterEscaping
|
|
10996
10974
|
*/
|
|
10997
10975
|
function hideBrackets(value) {
|
|
@@ -11001,6 +10979,7 @@ function hideBrackets(value) {
|
|
|
11001
10979
|
* Restores hidden brackets.
|
|
11002
10980
|
*
|
|
11003
10981
|
* @param value String with hidden brackets.
|
|
10982
|
+
*
|
|
11004
10983
|
* @private function of ParameterEscaping
|
|
11005
10984
|
*/
|
|
11006
10985
|
function restoreBrackets(value) {
|
|
@@ -11010,6 +10989,7 @@ function restoreBrackets(value) {
|
|
|
11010
10989
|
* Decides whether a parameter can be inlined safely.
|
|
11011
10990
|
*
|
|
11012
10991
|
* @param value Parameter rendered as string.
|
|
10992
|
+
*
|
|
11013
10993
|
* @private function of ParameterEscaping
|
|
11014
10994
|
*/
|
|
11015
10995
|
function shouldInlineParameterValue(value) {
|
|
@@ -11023,6 +11003,7 @@ function shouldInlineParameterValue(value) {
|
|
|
11023
11003
|
*
|
|
11024
11004
|
* @param value Parameter value to escape.
|
|
11025
11005
|
* @param options Escape options for additional characters.
|
|
11006
|
+
*
|
|
11026
11007
|
* @private function of ParameterEscaping
|
|
11027
11008
|
*/
|
|
11028
11009
|
function escapePromptParameterValue(value, options) {
|
|
@@ -11048,6 +11029,7 @@ const ParameterEscaping = {
|
|
|
11048
11029
|
* Builds numeric parameter names (1, 2, ...).
|
|
11049
11030
|
*
|
|
11050
11031
|
* @param index Zero-based parameter index.
|
|
11032
|
+
*
|
|
11051
11033
|
* @private function of ParameterNaming
|
|
11052
11034
|
*/
|
|
11053
11035
|
function buildNumericParameterName(index) {
|
|
@@ -11057,6 +11039,7 @@ function buildNumericParameterName(index) {
|
|
|
11057
11039
|
* Builds alphabetic parameter names (a, b, ..., aa).
|
|
11058
11040
|
*
|
|
11059
11041
|
* @param index Zero-based parameter index.
|
|
11042
|
+
*
|
|
11060
11043
|
* @private function of ParameterNaming
|
|
11061
11044
|
*/
|
|
11062
11045
|
function buildAlphabeticParameterName(index) {
|
|
@@ -11073,6 +11056,7 @@ function buildAlphabeticParameterName(index) {
|
|
|
11073
11056
|
* Converts a positive integer into a Roman numeral string.
|
|
11074
11057
|
*
|
|
11075
11058
|
* @param value Positive integer value.
|
|
11059
|
+
*
|
|
11076
11060
|
* @private function of ParameterNaming
|
|
11077
11061
|
*/
|
|
11078
11062
|
function toRomanNumeral(value) {
|
|
@@ -11105,6 +11089,7 @@ function toRomanNumeral(value) {
|
|
|
11105
11089
|
* Builds Roman numeral parameter names (I, II, ...).
|
|
11106
11090
|
*
|
|
11107
11091
|
* @param index Zero-based parameter index.
|
|
11092
|
+
*
|
|
11108
11093
|
* @private function of ParameterNaming
|
|
11109
11094
|
*/
|
|
11110
11095
|
function buildRomanParameterName(index) {
|
|
@@ -11115,6 +11100,7 @@ function buildRomanParameterName(index) {
|
|
|
11115
11100
|
*
|
|
11116
11101
|
* @param prefix Prefix string.
|
|
11117
11102
|
* @param builder Base builder function.
|
|
11103
|
+
*
|
|
11118
11104
|
* @private function of ParameterNaming
|
|
11119
11105
|
*/
|
|
11120
11106
|
function buildPrefixedParameterName(prefix, builder) {
|
|
@@ -11136,6 +11122,7 @@ const PARAMETER_NAME_STRATEGIES = [
|
|
|
11136
11122
|
* Collects bracketed tokens from parameter values to avoid placeholder collisions.
|
|
11137
11123
|
*
|
|
11138
11124
|
* @param values Parameter values to scan.
|
|
11125
|
+
*
|
|
11139
11126
|
* @private function of ParameterNaming
|
|
11140
11127
|
*/
|
|
11141
11128
|
function collectBracketedParameterTokens(values) {
|
|
@@ -11156,6 +11143,7 @@ function collectBracketedParameterTokens(values) {
|
|
|
11156
11143
|
* Builds placeholder names while avoiding collisions with parameter content.
|
|
11157
11144
|
*
|
|
11158
11145
|
* @param values Parameter values to scan for conflicting tokens.
|
|
11146
|
+
*
|
|
11159
11147
|
* @private function of ParameterNaming
|
|
11160
11148
|
*/
|
|
11161
11149
|
function buildParameterNames(values) {
|
|
@@ -11186,6 +11174,7 @@ const ParameterNaming = {
|
|
|
11186
11174
|
* Formats the placeholder used in the prompt body for a parameter.
|
|
11187
11175
|
*
|
|
11188
11176
|
* @param name Parameter placeholder name.
|
|
11177
|
+
*
|
|
11189
11178
|
* @private function of ParameterSection
|
|
11190
11179
|
*/
|
|
11191
11180
|
function formatParameterPlaceholder(name) {
|
|
@@ -11195,6 +11184,7 @@ function formatParameterPlaceholder(name) {
|
|
|
11195
11184
|
* Formats a single line entry for structured parameters.
|
|
11196
11185
|
*
|
|
11197
11186
|
* @param item Parameter entry data.
|
|
11187
|
+
*
|
|
11198
11188
|
* @private function of ParameterSection
|
|
11199
11189
|
*/
|
|
11200
11190
|
function formatParameterListItem(item) {
|
|
@@ -11206,6 +11196,7 @@ function formatParameterListItem(item) {
|
|
|
11206
11196
|
* Builds the structured parameters section appended to the prompt.
|
|
11207
11197
|
*
|
|
11208
11198
|
* @param items Parameter entries to include.
|
|
11199
|
+
*
|
|
11209
11200
|
* @private function of ParameterSection
|
|
11210
11201
|
*/
|
|
11211
11202
|
function buildParametersSection(items) {
|
|
@@ -11281,6 +11272,7 @@ function isPromptString(value) {
|
|
|
11281
11272
|
* @param strings
|
|
11282
11273
|
* @param values
|
|
11283
11274
|
* @returns prompt content wrapped as a PromptString
|
|
11275
|
+
*
|
|
11284
11276
|
* @public exported from `@promptbook/utils`
|
|
11285
11277
|
*/
|
|
11286
11278
|
function prompt(strings, ...values) {
|
|
@@ -11365,11 +11357,9 @@ function prompt(strings, ...values) {
|
|
|
11365
11357
|
}
|
|
11366
11358
|
return new PromptString(pipelineString);
|
|
11367
11359
|
}
|
|
11368
|
-
|
|
11369
|
-
|
|
11370
|
-
|
|
11371
|
-
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
11372
|
-
*/
|
|
11360
|
+
// TODO: Maybe split into multiple files
|
|
11361
|
+
// TODO: [🧠][🈴] Where is the best location for this file
|
|
11362
|
+
// Note: [💞] Ignore a discrepancy between file name and entity name
|
|
11373
11363
|
|
|
11374
11364
|
/**
|
|
11375
11365
|
* @@@
|
|
@@ -11406,9 +11396,7 @@ function attachClientVersionHeader(headers) {
|
|
|
11406
11396
|
[CLIENT_VERSION_HEADER]: CLIENT_LATEST_VERSION,
|
|
11407
11397
|
};
|
|
11408
11398
|
}
|
|
11409
|
-
|
|
11410
|
-
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
11411
|
-
*/
|
|
11399
|
+
// Note: [💞] Ignore a discrepancy between file name and entity name
|
|
11412
11400
|
|
|
11413
11401
|
/**
|
|
11414
11402
|
* Detects if the code is running in a browser environment in main thread (Not in a web worker)
|
|
@@ -11425,9 +11413,7 @@ function $isRunningInBrowser() {
|
|
|
11425
11413
|
return false;
|
|
11426
11414
|
}
|
|
11427
11415
|
}
|
|
11428
|
-
|
|
11429
|
-
* TODO: [🎺]
|
|
11430
|
-
*/
|
|
11416
|
+
// TODO: [🎺]
|
|
11431
11417
|
|
|
11432
11418
|
/**
|
|
11433
11419
|
* Detects if the code is running in a Node.js environment
|
|
@@ -11444,9 +11430,7 @@ function $isRunningInNode() {
|
|
|
11444
11430
|
return false;
|
|
11445
11431
|
}
|
|
11446
11432
|
}
|
|
11447
|
-
|
|
11448
|
-
* TODO: [🎺]
|
|
11449
|
-
*/
|
|
11433
|
+
// TODO: [🎺]
|
|
11450
11434
|
|
|
11451
11435
|
/**
|
|
11452
11436
|
* Detects if the code is running in a web worker
|
|
@@ -11466,9 +11450,7 @@ function $isRunningInWebWorker() {
|
|
|
11466
11450
|
return false;
|
|
11467
11451
|
}
|
|
11468
11452
|
}
|
|
11469
|
-
|
|
11470
|
-
* TODO: [🎺]
|
|
11471
|
-
*/
|
|
11453
|
+
// TODO: [🎺]
|
|
11472
11454
|
|
|
11473
11455
|
/**
|
|
11474
11456
|
* Computes SHA-256 hash of the given object
|
|
@@ -11478,9 +11460,7 @@ function $isRunningInWebWorker() {
|
|
|
11478
11460
|
function computeHash(value) {
|
|
11479
11461
|
return SHA256(hexEncoder.parse(spaceTrim$1(valueToString(value)))).toString( /* hex */);
|
|
11480
11462
|
}
|
|
11481
|
-
|
|
11482
|
-
* TODO: [🥬][🥬] Use this ACRY
|
|
11483
|
-
*/
|
|
11463
|
+
// TODO: [🥬][🥬] Use this ACRY
|
|
11484
11464
|
|
|
11485
11465
|
// spell-checker: disable
|
|
11486
11466
|
/**
|
|
@@ -11646,6 +11626,9 @@ const ADJECTIVES$1 = [
|
|
|
11646
11626
|
'prvotní',
|
|
11647
11627
|
'hbitý',
|
|
11648
11628
|
];
|
|
11629
|
+
/**
|
|
11630
|
+
* Collection of nouns.
|
|
11631
|
+
*/
|
|
11649
11632
|
const NOUNS$1 = [
|
|
11650
11633
|
'jablko',
|
|
11651
11634
|
'nebe',
|
|
@@ -11859,6 +11842,9 @@ const NOUNS$1 = [
|
|
|
11859
11842
|
'okno',
|
|
11860
11843
|
'chodba',
|
|
11861
11844
|
];
|
|
11845
|
+
/**
|
|
11846
|
+
* Collection of verbs.
|
|
11847
|
+
*/
|
|
11862
11848
|
const VERBS$1 = [
|
|
11863
11849
|
'skáče',
|
|
11864
11850
|
'tančí',
|
|
@@ -12031,9 +12017,7 @@ const LINGUISTIC_HASH_WORD_LISTS_CS = {
|
|
|
12031
12017
|
noun: NOUNS$1,
|
|
12032
12018
|
verb: VERBS$1,
|
|
12033
12019
|
};
|
|
12034
|
-
|
|
12035
|
-
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
12036
|
-
*/
|
|
12020
|
+
// Note: [💞] Ignore a discrepancy between file name and entity name
|
|
12037
12021
|
|
|
12038
12022
|
/**
|
|
12039
12023
|
* @@@
|
|
@@ -12289,6 +12273,9 @@ const ADJECTIVES = [
|
|
|
12289
12273
|
'macro',
|
|
12290
12274
|
'mini',
|
|
12291
12275
|
];
|
|
12276
|
+
/**
|
|
12277
|
+
* Collection of nouns.
|
|
12278
|
+
*/
|
|
12292
12279
|
const NOUNS = [
|
|
12293
12280
|
'apple',
|
|
12294
12281
|
'sky',
|
|
@@ -12528,6 +12515,9 @@ const NOUNS = [
|
|
|
12528
12515
|
'roof',
|
|
12529
12516
|
'floor',
|
|
12530
12517
|
];
|
|
12518
|
+
/**
|
|
12519
|
+
* Collection of verbs.
|
|
12520
|
+
*/
|
|
12531
12521
|
const VERBS = [
|
|
12532
12522
|
'jumping',
|
|
12533
12523
|
'dancing',
|
|
@@ -12723,9 +12713,7 @@ const LINGUISTIC_HASH_WORD_LISTS_EN = {
|
|
|
12723
12713
|
noun: NOUNS,
|
|
12724
12714
|
verb: VERBS,
|
|
12725
12715
|
};
|
|
12726
|
-
|
|
12727
|
-
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
12728
|
-
*/
|
|
12716
|
+
// Note: [💞] Ignore a discrepancy between file name and entity name
|
|
12729
12717
|
|
|
12730
12718
|
/**
|
|
12731
12719
|
* Default language used for linguistic hashes.
|
|
@@ -12900,8 +12888,9 @@ function normalizeLinguisticHashWordCount(wordCount) {
|
|
|
12900
12888
|
/**
|
|
12901
12889
|
* Creates a human-readable hash as a short, story-like phrase.
|
|
12902
12890
|
*
|
|
12903
|
-
* @param wordCount how many words to include (defaults to {@link DEFAULT_LINGUISTIC_HASH_WORD_COUNT}, clamped to
|
|
12904
12891
|
* {@link MIN_LINGUISTIC_HASH_WORD_COUNT}..{@link MAX_LINGUISTIC_HASH_WORD_COUNT})
|
|
12892
|
+
*
|
|
12893
|
+
* @param wordCount how many words to include (defaults to {@link DEFAULT_LINGUISTIC_HASH_WORD_COUNT}, clamped to
|
|
12905
12894
|
* @param language optional language code (defaults to {@link DEFAULT_LINGUISTIC_HASH_LANGUAGE})
|
|
12906
12895
|
*
|
|
12907
12896
|
* @public exported from `@promptbook/utils`
|
|
@@ -12920,6 +12909,7 @@ async function linguisticHash(input, wordCount, language) {
|
|
|
12920
12909
|
* Note: `$` is used to indicate that this function is not a pure function - it is not deterministic because it depends on the current time
|
|
12921
12910
|
*
|
|
12922
12911
|
* @returns string_date branded type
|
|
12912
|
+
*
|
|
12923
12913
|
* @public exported from `@promptbook/utils`
|
|
12924
12914
|
*/
|
|
12925
12915
|
function $getCurrentDate() {
|
|
@@ -12942,6 +12932,7 @@ function decapitalize(word) {
|
|
|
12942
12932
|
*
|
|
12943
12933
|
* @param {string} input
|
|
12944
12934
|
* @returns {Set} of keywords without diacritics in lowercase
|
|
12935
|
+
*
|
|
12945
12936
|
* @public exported from `@promptbook/utils`
|
|
12946
12937
|
*/
|
|
12947
12938
|
function parseKeywordsFromString(input) {
|
|
@@ -12958,6 +12949,7 @@ function parseKeywordsFromString(input) {
|
|
|
12958
12949
|
* @param name The string to be converted to a URI-compatible format.
|
|
12959
12950
|
* @returns A URI-compatible string derived from the input name.
|
|
12960
12951
|
* @example 'Hello World' -> 'hello-world'
|
|
12952
|
+
*
|
|
12961
12953
|
* @public exported from `@promptbook/utils`
|
|
12962
12954
|
*/
|
|
12963
12955
|
function nameToUriPart(name) {
|
|
@@ -12976,6 +12968,7 @@ function nameToUriPart(name) {
|
|
|
12976
12968
|
* @param name The name to be converted into URI parts.
|
|
12977
12969
|
* @returns An array of URI-compatible parts derived from the name.
|
|
12978
12970
|
* @example 'Example Name' -> ['example', 'name']
|
|
12971
|
+
*
|
|
12979
12972
|
* @public exported from `@promptbook/utils`
|
|
12980
12973
|
*/
|
|
12981
12974
|
function nameToUriParts(name) {
|
|
@@ -13005,6 +12998,7 @@ function normalizeMessageText(text) {
|
|
|
13005
12998
|
* @returns
|
|
13006
12999
|
* @example 'HelloWorld'
|
|
13007
13000
|
* @example 'ILovePromptbook'
|
|
13001
|
+
*
|
|
13008
13002
|
* @public exported from `@promptbook/utils`
|
|
13009
13003
|
*/
|
|
13010
13004
|
function normalizeTo_PascalCase(text) {
|
|
@@ -13033,6 +13027,7 @@ function normalizeWhitespaces(sentence) {
|
|
|
13033
13027
|
*
|
|
13034
13028
|
* @param text optionally quoted text
|
|
13035
13029
|
* @returns text without quotes
|
|
13030
|
+
*
|
|
13036
13031
|
* @public exported from `@promptbook/utils`
|
|
13037
13032
|
*/
|
|
13038
13033
|
function unwrapResult(text, options) {
|
|
@@ -13107,9 +13102,7 @@ function unwrapResult(text, options) {
|
|
|
13107
13102
|
return processedText;
|
|
13108
13103
|
}
|
|
13109
13104
|
}
|
|
13110
|
-
|
|
13111
|
-
* TODO: [🧠] Should this also unwrap the (parenthesis)
|
|
13112
|
-
*/
|
|
13105
|
+
// TODO: [🧠] Should this also unwrap the (parenthesis)
|
|
13113
13106
|
|
|
13114
13107
|
// <- TODO: Auto convert to type `import { ... } from 'type-fest';`
|
|
13115
13108
|
/**
|
|
@@ -13128,7 +13121,6 @@ function unwrapResult(text, options) {
|
|
|
13128
13121
|
* - `Symbol` objects are not serializable
|
|
13129
13122
|
* - And much more...
|
|
13130
13123
|
*
|
|
13131
|
-
*
|
|
13132
13124
|
* @public exported from `@promptbook/utils`
|
|
13133
13125
|
*/
|
|
13134
13126
|
function isSerializableAsJson(value) {
|
|
@@ -13140,15 +13132,14 @@ function isSerializableAsJson(value) {
|
|
|
13140
13132
|
return false;
|
|
13141
13133
|
}
|
|
13142
13134
|
}
|
|
13143
|
-
|
|
13144
|
-
|
|
13145
|
-
* TODO: [🧠][💺] Can be done this on type-level?
|
|
13146
|
-
*/
|
|
13135
|
+
// TODO: [🧠][main] !!3 In-memory cache of same values to prevent multiple checks
|
|
13136
|
+
// TODO: [🧠][💺] Can be done this on type-level?
|
|
13147
13137
|
|
|
13148
13138
|
/**
|
|
13149
13139
|
* Determines if the given path is a root path.
|
|
13150
13140
|
*
|
|
13151
13141
|
* Note: This does not check if the file exists only if the path is valid
|
|
13142
|
+
*
|
|
13152
13143
|
* @public exported from `@promptbook/utils`
|
|
13153
13144
|
*/
|
|
13154
13145
|
function isRootPath(value) {
|
|
@@ -13160,9 +13151,7 @@ function isRootPath(value) {
|
|
|
13160
13151
|
}
|
|
13161
13152
|
return false;
|
|
13162
13153
|
}
|
|
13163
|
-
|
|
13164
|
-
* TODO: [🍏] Make for MacOS paths
|
|
13165
|
-
*/
|
|
13154
|
+
// TODO: [🍏] Make for MacOS paths
|
|
13166
13155
|
|
|
13167
13156
|
/**
|
|
13168
13157
|
* Checks if an URL is reserved for private networks or localhost.
|
|
@@ -13208,6 +13197,7 @@ function isHostnameOnPrivateNetwork(hostname, options = {}) {
|
|
|
13208
13197
|
* @param {string} url - The URL to check.
|
|
13209
13198
|
* @param {IsUrlOnPrivateNetworkOptions} options - Options for the check.
|
|
13210
13199
|
* @returns {boolean} Returns true if the IP address is reserved for private networks or localhost, otherwise false.
|
|
13200
|
+
*
|
|
13211
13201
|
* @public exported from `@promptbook/utils`
|
|
13212
13202
|
*/
|
|
13213
13203
|
function isUrlOnPrivateNetwork(url, options = {}) {
|
|
@@ -13246,9 +13236,7 @@ function isValidAgentUrl(url) {
|
|
|
13246
13236
|
*/
|
|
13247
13237
|
return true;
|
|
13248
13238
|
}
|
|
13249
|
-
|
|
13250
|
-
* TODO: [🐠] Maybe more info why the URL is invalid
|
|
13251
|
-
*/
|
|
13239
|
+
// TODO: [🐠] Maybe more info why the URL is invalid
|
|
13252
13240
|
|
|
13253
13241
|
/**
|
|
13254
13242
|
* Provides filesystem access (for example for Node.js-based scrapers)
|
|
@@ -13271,8 +13259,8 @@ function $provideFilesystemForNode(options) {
|
|
|
13271
13259
|
watch,
|
|
13272
13260
|
};
|
|
13273
13261
|
}
|
|
13274
|
-
|
|
13275
|
-
|
|
13262
|
+
// Note: [🟢] Code for Node scraper registration helper [$provideFilesystemForNode](src/scrapers/_common/register/$provideFilesystemForNode.ts) should never be published into packages that could be imported into browser environment
|
|
13263
|
+
// TODO: [🏓] Unite `xxxForServer` and `xxxForNode` naming
|
|
13276
13264
|
|
|
13277
13265
|
/**
|
|
13278
13266
|
* Retrieves an intermediate source for a scraper based on the knowledge source.
|
|
@@ -13336,13 +13324,11 @@ async function getScraperIntermediateSource(source, options) {
|
|
|
13336
13324
|
};
|
|
13337
13325
|
return fileHandler;
|
|
13338
13326
|
}
|
|
13339
|
-
|
|
13340
|
-
|
|
13341
|
-
|
|
13342
|
-
|
|
13343
|
-
|
|
13344
|
-
* TODO: [🐱🐉][🧠] Make some smart crop
|
|
13345
|
-
*/
|
|
13327
|
+
// Note: [🟢] Code for Node scraper helper [getScraperIntermediateSource](src/scrapers/_common/utils/getScraperIntermediateSource.ts) should never be published into packages that could be imported into browser environment
|
|
13328
|
+
// Note: Not using `FileCacheStorage` for two reasons:
|
|
13329
|
+
// 1. Need to store more than serialized JSONs.
|
|
13330
|
+
// 2. Need to switch between a `rootDirname` and `cacheDirname` <- TODO: [😡]
|
|
13331
|
+
// TODO: [🐱🐉][🧠] Make some smart crop
|
|
13346
13332
|
|
|
13347
13333
|
/**
|
|
13348
13334
|
* Metadata of the scraper
|
|
@@ -13369,14 +13355,13 @@ const markdownScraperMetadata = $deepFreeze({
|
|
|
13369
13355
|
* @public exported from `@promptbook/cli`
|
|
13370
13356
|
*/
|
|
13371
13357
|
$scrapersMetadataRegister.register(markdownScraperMetadata);
|
|
13372
|
-
|
|
13373
|
-
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
13374
|
-
*/
|
|
13358
|
+
// Note: [💞] Ignore a discrepancy between file name and entity name
|
|
13375
13359
|
|
|
13376
13360
|
/**
|
|
13377
13361
|
* Scraper for markdown files
|
|
13378
13362
|
*
|
|
13379
13363
|
* @see `documentationUrl` for more details
|
|
13364
|
+
*
|
|
13380
13365
|
* @public exported from `@promptbook/markdown-utils`
|
|
13381
13366
|
*/
|
|
13382
13367
|
class MarkdownScraper {
|
|
@@ -13509,10 +13494,8 @@ class MarkdownScraper {
|
|
|
13509
13494
|
return knowledge;
|
|
13510
13495
|
}
|
|
13511
13496
|
}
|
|
13512
|
-
|
|
13513
|
-
|
|
13514
|
-
* Note: No need to aggregate usage here, it is done by intercepting the llmTools
|
|
13515
|
-
*/
|
|
13497
|
+
// TODO: [🪂] Do it in parallel 11:11
|
|
13498
|
+
// Note: No need to aggregate usage here, it is done by intercepting the llmTools
|
|
13516
13499
|
|
|
13517
13500
|
/**
|
|
13518
13501
|
* Metadata of the scraper
|
|
@@ -13539,9 +13522,7 @@ const websiteScraperMetadata = $deepFreeze({
|
|
|
13539
13522
|
* @public exported from `@promptbook/cli`
|
|
13540
13523
|
*/
|
|
13541
13524
|
$scrapersMetadataRegister.register(websiteScraperMetadata);
|
|
13542
|
-
|
|
13543
|
-
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
13544
|
-
*/
|
|
13525
|
+
// Note: [💞] Ignore a discrepancy between file name and entity name
|
|
13545
13526
|
|
|
13546
13527
|
/**
|
|
13547
13528
|
* Create a new showdown converter instance
|
|
@@ -13570,6 +13551,7 @@ function createShowdownConverter() {
|
|
|
13570
13551
|
* Scraper for websites
|
|
13571
13552
|
*
|
|
13572
13553
|
* @see `documentationUrl` for more details
|
|
13554
|
+
*
|
|
13573
13555
|
* @public exported from `@promptbook/website-crawler`
|
|
13574
13556
|
*/
|
|
13575
13557
|
class WebsiteScraper {
|
|
@@ -13673,12 +13655,10 @@ class WebsiteScraper {
|
|
|
13673
13655
|
return knowledge;
|
|
13674
13656
|
}
|
|
13675
13657
|
}
|
|
13676
|
-
|
|
13677
|
-
|
|
13678
|
-
|
|
13679
|
-
|
|
13680
|
-
* Note: No need to aggregate usage here, it is done by intercepting the llmTools
|
|
13681
|
-
*/
|
|
13658
|
+
// Note: [🟢] Code for Node scraper implementation [WebsiteScraper](src/scrapers/website/WebsiteScraper.ts) should never be published into packages that could be imported into browser environment
|
|
13659
|
+
// TODO: [👣] Scraped website in .md can act as cache item - there is no need to run conversion each time
|
|
13660
|
+
// TODO: [🪂] Do it in parallel 11:11
|
|
13661
|
+
// Note: No need to aggregate usage here, it is done by intercepting the llmTools
|
|
13682
13662
|
|
|
13683
13663
|
/**
|
|
13684
13664
|
* Fetches and scrapes content from a URL (SERVER-SIDE ONLY)
|
|
@@ -13689,14 +13669,14 @@ class WebsiteScraper {
|
|
|
13689
13669
|
* 3. Uses the appropriate scraper to convert to markdown
|
|
13690
13670
|
* 4. Returns the scraped markdown content
|
|
13691
13671
|
*
|
|
13672
|
+
* WARNING: This function should NOT be used directly in browser environments.
|
|
13673
|
+
* For browser environments, use fetchUrlContentViaBrowser which proxies through
|
|
13674
|
+
* the Agents Server API endpoint at /api/scrape
|
|
13675
|
+
*
|
|
13692
13676
|
* @param url The URL to fetch and scrape
|
|
13693
13677
|
* @returns Markdown content from the URL
|
|
13694
13678
|
*
|
|
13695
13679
|
* @private internal utility for USE BROWSER commitment
|
|
13696
|
-
*
|
|
13697
|
-
* WARNING: This function should NOT be used directly in browser environments.
|
|
13698
|
-
* For browser environments, use fetchUrlContentViaBrowser which proxies through
|
|
13699
|
-
* the Agents Server API endpoint at /api/scrape
|
|
13700
13680
|
*/
|
|
13701
13681
|
async function fetchUrlContent(url) {
|
|
13702
13682
|
try {
|
|
@@ -13800,7 +13780,7 @@ async function fetchUrlContent(url) {
|
|
|
13800
13780
|
`);
|
|
13801
13781
|
}
|
|
13802
13782
|
}
|
|
13803
|
-
|
|
13783
|
+
// Note: [🟢] Code for Node browser-fetch helper [fetchUrlContent](src/commitments/USE_BROWSER/fetchUrlContent.ts) should never be published into packages that could be imported into browser environment
|
|
13804
13784
|
|
|
13805
13785
|
/**
|
|
13806
13786
|
* Cached implementation of `run_browser` when it can be resolved.
|
|
@@ -13818,6 +13798,7 @@ let cachedRunBrowserToolError = null;
|
|
|
13818
13798
|
* Attempts to load the server-side `run_browser` tool lazily.
|
|
13819
13799
|
*
|
|
13820
13800
|
* @returns Loaded `run_browser` implementation
|
|
13801
|
+
*
|
|
13821
13802
|
* @private internal utility for USE BROWSER commitment
|
|
13822
13803
|
*/
|
|
13823
13804
|
function loadRunBrowserToolForNode() {
|
|
@@ -14187,9 +14168,7 @@ class ActionCommitmentDefinition extends BaseCommitmentDefinition {
|
|
|
14187
14168
|
return this.appendToSystemMessage(requirements, actionSection, '\n\n');
|
|
14188
14169
|
}
|
|
14189
14170
|
}
|
|
14190
|
-
|
|
14191
|
-
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
14192
|
-
*/
|
|
14171
|
+
// Note: [💞] Ignore a discrepancy between file name and entity name
|
|
14193
14172
|
|
|
14194
14173
|
/**
|
|
14195
14174
|
* CLOSED commitment definition
|
|
@@ -14255,9 +14234,7 @@ class ClosedCommitmentDefinition extends BaseCommitmentDefinition {
|
|
|
14255
14234
|
};
|
|
14256
14235
|
}
|
|
14257
14236
|
}
|
|
14258
|
-
|
|
14259
|
-
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
14260
|
-
*/
|
|
14237
|
+
// Note: [💞] Ignore a discrepancy between file name and entity name
|
|
14261
14238
|
|
|
14262
14239
|
/**
|
|
14263
14240
|
* COMPONENT commitment definition
|
|
@@ -14316,9 +14293,7 @@ class ComponentCommitmentDefinition extends BaseCommitmentDefinition {
|
|
|
14316
14293
|
return this.appendToSystemMessage(requirements, componentSection, '\n\n');
|
|
14317
14294
|
}
|
|
14318
14295
|
}
|
|
14319
|
-
|
|
14320
|
-
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
14321
|
-
*/
|
|
14296
|
+
// Note: [💞] Ignore a discrepancy between file name and entity name
|
|
14322
14297
|
|
|
14323
14298
|
/**
|
|
14324
14299
|
* DELETE commitment definition
|
|
@@ -14440,9 +14415,7 @@ class DeleteCommitmentDefinition extends BaseCommitmentDefinition {
|
|
|
14440
14415
|
return this.appendToSystemMessage(requirements, deleteSection, '\n\n');
|
|
14441
14416
|
}
|
|
14442
14417
|
}
|
|
14443
|
-
|
|
14444
|
-
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
14445
|
-
*/
|
|
14418
|
+
// Note: [💞] Ignore a discrepancy between file name and entity name
|
|
14446
14419
|
|
|
14447
14420
|
/**
|
|
14448
14421
|
* DICTIONARY commitment definition
|
|
@@ -14546,9 +14519,7 @@ class DictionaryCommitmentDefinition extends BaseCommitmentDefinition {
|
|
|
14546
14519
|
};
|
|
14547
14520
|
}
|
|
14548
14521
|
}
|
|
14549
|
-
|
|
14550
|
-
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
14551
|
-
*/
|
|
14522
|
+
// Note: [💞] Ignore a discrepancy between file name and entity name
|
|
14552
14523
|
|
|
14553
14524
|
/**
|
|
14554
14525
|
* FORMAT commitment definition
|
|
@@ -14627,10 +14598,11 @@ class FormatCommitmentDefinition extends BaseCommitmentDefinition {
|
|
|
14627
14598
|
return this.appendToSystemMessage(requirements, formatSection, '\n\n');
|
|
14628
14599
|
}
|
|
14629
14600
|
}
|
|
14601
|
+
// Note: [💞] Ignore a discrepancy between file name and entity name
|
|
14602
|
+
|
|
14630
14603
|
/**
|
|
14631
|
-
*
|
|
14604
|
+
* Collection of firstnames.
|
|
14632
14605
|
*/
|
|
14633
|
-
|
|
14634
14606
|
const FIRSTNAMES = [
|
|
14635
14607
|
'Paul',
|
|
14636
14608
|
'George',
|
|
@@ -14667,6 +14639,9 @@ const FIRSTNAMES = [
|
|
|
14667
14639
|
'Anthony',
|
|
14668
14640
|
'Christopher',
|
|
14669
14641
|
];
|
|
14642
|
+
/**
|
|
14643
|
+
* Collection of lastnames with colors.
|
|
14644
|
+
*/
|
|
14670
14645
|
const LASTNAMES_WITH_COLORS = [
|
|
14671
14646
|
{ lastname: 'Green', color: '#008000' },
|
|
14672
14647
|
{ lastname: 'Brown', color: '#A52A2A' },
|
|
@@ -14694,6 +14669,7 @@ function pickDeterministicItem(hash, startIndex, list) {
|
|
|
14694
14669
|
*
|
|
14695
14670
|
* @param seed - Input seed used to derive a stable pseudonym.
|
|
14696
14671
|
* @returns Deterministic English full name with color metadata.
|
|
14672
|
+
*
|
|
14697
14673
|
* @private internal helper for deterministic pseudonym generation
|
|
14698
14674
|
*/
|
|
14699
14675
|
function generateDeterministicEnglishName(seed) {
|
|
@@ -14735,6 +14711,9 @@ const VOID_PSEUDO_AGENT_ALIAS_KEYS = ['void', 'null', 'none', 'nil'];
|
|
|
14735
14711
|
* Legacy aliases that historically behaved like `FROM VOID`.
|
|
14736
14712
|
*/
|
|
14737
14713
|
const LEGACY_VOID_ALIASES = new Set(VOID_PSEUDO_AGENT_ALIAS_KEYS);
|
|
14714
|
+
/**
|
|
14715
|
+
* Constant for void alias entries.
|
|
14716
|
+
*/
|
|
14738
14717
|
const VOID_ALIAS_ENTRIES = VOID_PSEUDO_AGENT_ALIAS_KEYS.map((alias) => [
|
|
14739
14718
|
alias,
|
|
14740
14719
|
'VOID',
|
|
@@ -14783,6 +14762,7 @@ function normalizePseudoReferenceKey(rawReference) {
|
|
|
14783
14762
|
*
|
|
14784
14763
|
* @param rawReference - Raw reference token or payload.
|
|
14785
14764
|
* @returns Pseudo-agent kind or `null` when the reference is not pseudo.
|
|
14765
|
+
*
|
|
14786
14766
|
* @private internal utility of pseudo-agent resolution
|
|
14787
14767
|
*/
|
|
14788
14768
|
function resolvePseudoAgentKindFromReference(rawReference) {
|
|
@@ -14797,6 +14777,7 @@ function resolvePseudoAgentKindFromReference(rawReference) {
|
|
|
14797
14777
|
*
|
|
14798
14778
|
* @param agentUrl - URL to inspect.
|
|
14799
14779
|
* @returns Pseudo-agent kind or `null` when the URL is not pseudo.
|
|
14780
|
+
*
|
|
14800
14781
|
* @private internal utility of pseudo-agent resolution
|
|
14801
14782
|
*/
|
|
14802
14783
|
function resolvePseudoAgentKindFromUrl(agentUrl) {
|
|
@@ -14817,6 +14798,7 @@ function resolvePseudoAgentKindFromUrl(agentUrl) {
|
|
|
14817
14798
|
*
|
|
14818
14799
|
* @param teamCommitmentContent - TEAM commitment content after reference resolution.
|
|
14819
14800
|
* @returns Deterministic English full name representing pseudo-user in that TEAM context.
|
|
14801
|
+
*
|
|
14820
14802
|
* @private internal utility of TEAM commitment rendering
|
|
14821
14803
|
*/
|
|
14822
14804
|
function createPseudoUserTeammateLabel(teamCommitmentContent) {
|
|
@@ -14832,6 +14814,7 @@ function createPseudoUserTeammateLabel(teamCommitmentContent) {
|
|
|
14832
14814
|
*
|
|
14833
14815
|
* @param rawReference - Raw reference content.
|
|
14834
14816
|
* @returns True when the reference maps to void.
|
|
14817
|
+
*
|
|
14835
14818
|
* @private internal utility of pseudo-agent resolution
|
|
14836
14819
|
*/
|
|
14837
14820
|
function isVoidPseudoAgentReference(rawReference) {
|
|
@@ -14845,9 +14828,7 @@ function isVoidPseudoAgentReference(rawReference) {
|
|
|
14845
14828
|
const normalizedReference = normalizePseudoReferenceKey(rawReference);
|
|
14846
14829
|
return LEGACY_VOID_ALIASES.has(normalizedReference);
|
|
14847
14830
|
}
|
|
14848
|
-
|
|
14849
|
-
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
14850
|
-
*/
|
|
14831
|
+
// Note: [💞] Ignore a discrepancy between file name and entity name
|
|
14851
14832
|
|
|
14852
14833
|
/**
|
|
14853
14834
|
* FROM commitment definition
|
|
@@ -14926,9 +14907,7 @@ class FromCommitmentDefinition extends BaseCommitmentDefinition {
|
|
|
14926
14907
|
};
|
|
14927
14908
|
}
|
|
14928
14909
|
}
|
|
14929
|
-
|
|
14930
|
-
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
14931
|
-
*/
|
|
14910
|
+
// Note: [💞] Ignore a discrepancy between file name and entity name
|
|
14932
14911
|
|
|
14933
14912
|
/**
|
|
14934
14913
|
* GOAL commitment definition
|
|
@@ -15026,9 +15005,7 @@ class GoalCommitmentDefinition extends BaseCommitmentDefinition {
|
|
|
15026
15005
|
return this.appendToPromptSuffix(requirementsWithGoal, goalSection);
|
|
15027
15006
|
}
|
|
15028
15007
|
}
|
|
15029
|
-
|
|
15030
|
-
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
15031
|
-
*/
|
|
15008
|
+
// Note: [💞] Ignore a discrepancy between file name and entity name
|
|
15032
15009
|
|
|
15033
15010
|
/**
|
|
15034
15011
|
* IMPORT commitment definition
|
|
@@ -15107,19 +15084,26 @@ class ImportCommitmentDefinition extends BaseCommitmentDefinition {
|
|
|
15107
15084
|
`));
|
|
15108
15085
|
}
|
|
15109
15086
|
}
|
|
15087
|
+
// Note: [💞] Ignore a discrepancy between file name and entity name
|
|
15088
|
+
|
|
15110
15089
|
/**
|
|
15111
|
-
*
|
|
15090
|
+
* Matches URL-like candidates inside arbitrary text.
|
|
15091
|
+
*
|
|
15092
|
+
* @private
|
|
15112
15093
|
*/
|
|
15113
|
-
|
|
15114
|
-
/** @private Matches URL-like candidates inside arbitrary text. */
|
|
15115
15094
|
const URL_CANDIDATE_PATTERN = /https?:\/\/[^\s<>"'`]+/g;
|
|
15116
|
-
/**
|
|
15095
|
+
/**
|
|
15096
|
+
* Trims punctuation that commonly trails URLs in prose.
|
|
15097
|
+
*
|
|
15098
|
+
* @private
|
|
15099
|
+
*/
|
|
15117
15100
|
const TRAILING_PUNCTUATION_PATTERN = /[.,!?;:'"`]+$/;
|
|
15118
15101
|
/**
|
|
15119
15102
|
* Extracts all valid URLs from arbitrary text while removing common trailing punctuation.
|
|
15120
15103
|
*
|
|
15121
15104
|
* @param text - Input text that may contain one or more URLs.
|
|
15122
15105
|
* @returns Unique URLs in their first-seen order.
|
|
15106
|
+
*
|
|
15123
15107
|
* @private utility of KNOWLEDGE parsing
|
|
15124
15108
|
*/
|
|
15125
15109
|
function extractUrlsFromText(text) {
|
|
@@ -15149,7 +15133,9 @@ function extractUrlsFromText(text) {
|
|
|
15149
15133
|
return urls;
|
|
15150
15134
|
}
|
|
15151
15135
|
/**
|
|
15152
|
-
*
|
|
15136
|
+
* Normalizes one extracted URL candidate by stripping trailing punctuation and unmatched closing wrappers.
|
|
15137
|
+
*
|
|
15138
|
+
* @private
|
|
15153
15139
|
*/
|
|
15154
15140
|
function normalizeUrlCandidate(candidate) {
|
|
15155
15141
|
let normalized = candidate.trim();
|
|
@@ -15169,7 +15155,9 @@ function normalizeUrlCandidate(candidate) {
|
|
|
15169
15155
|
return normalized;
|
|
15170
15156
|
}
|
|
15171
15157
|
/**
|
|
15172
|
-
*
|
|
15158
|
+
* Removes trailing closing wrappers when they are unmatched in the candidate.
|
|
15159
|
+
*
|
|
15160
|
+
* @private
|
|
15173
15161
|
*/
|
|
15174
15162
|
function stripTrailingUnmatchedClosing(candidate, openingChar, closingChar) {
|
|
15175
15163
|
let normalized = candidate;
|
|
@@ -15184,7 +15172,9 @@ function stripTrailingUnmatchedClosing(candidate, openingChar, closingChar) {
|
|
|
15184
15172
|
return normalized;
|
|
15185
15173
|
}
|
|
15186
15174
|
/**
|
|
15187
|
-
*
|
|
15175
|
+
* Counts character occurrences in a string.
|
|
15176
|
+
*
|
|
15177
|
+
* @private
|
|
15188
15178
|
*/
|
|
15189
15179
|
function countOccurrences(value, searchedChar) {
|
|
15190
15180
|
let count = 0;
|
|
@@ -15196,14 +15186,28 @@ function countOccurrences(value, searchedChar) {
|
|
|
15196
15186
|
return count;
|
|
15197
15187
|
}
|
|
15198
15188
|
|
|
15199
|
-
/**
|
|
15189
|
+
/**
|
|
15190
|
+
* The default base name for inline knowledge files when the content lacks identifying text.
|
|
15191
|
+
*
|
|
15192
|
+
* @private
|
|
15193
|
+
*/
|
|
15200
15194
|
const INLINE_KNOWLEDGE_BASE_NAME = 'inline-knowledge';
|
|
15201
|
-
/**
|
|
15195
|
+
/**
|
|
15196
|
+
* The default file extension used for inline knowledge uploads.
|
|
15197
|
+
*
|
|
15198
|
+
* @private
|
|
15199
|
+
*/
|
|
15202
15200
|
const INLINE_KNOWLEDGE_EXTENSION = '.txt';
|
|
15203
|
-
/**
|
|
15201
|
+
/**
|
|
15202
|
+
* Prefix that identifies base64 data URLs.
|
|
15203
|
+
*
|
|
15204
|
+
* @private
|
|
15205
|
+
*/
|
|
15204
15206
|
const DATA_URL_PREFIX = 'data:';
|
|
15205
15207
|
/**
|
|
15206
|
-
*
|
|
15208
|
+
* Retrieves the first meaningful line from the inline content.
|
|
15209
|
+
*
|
|
15210
|
+
* @private
|
|
15207
15211
|
*/
|
|
15208
15212
|
function getFirstNonEmptyLine(content) {
|
|
15209
15213
|
const lines = content.split(/\r?\n/);
|
|
@@ -15216,7 +15220,9 @@ function getFirstNonEmptyLine(content) {
|
|
|
15216
15220
|
return null;
|
|
15217
15221
|
}
|
|
15218
15222
|
/**
|
|
15219
|
-
*
|
|
15223
|
+
* Determines the base file name by normalizing the first non-empty line.
|
|
15224
|
+
*
|
|
15225
|
+
* @private
|
|
15220
15226
|
*/
|
|
15221
15227
|
function deriveBaseFilename(content) {
|
|
15222
15228
|
const firstLine = getFirstNonEmptyLine(content);
|
|
@@ -15227,7 +15233,9 @@ function deriveBaseFilename(content) {
|
|
|
15227
15233
|
return normalized || INLINE_KNOWLEDGE_BASE_NAME;
|
|
15228
15234
|
}
|
|
15229
15235
|
/**
|
|
15230
|
-
*
|
|
15236
|
+
* Converts inline knowledge into the internal metadata form used for uploads.
|
|
15237
|
+
*
|
|
15238
|
+
* @private
|
|
15231
15239
|
*/
|
|
15232
15240
|
function createInlineKnowledgeSourceFile(content) {
|
|
15233
15241
|
const trimmedContent = content.trim();
|
|
@@ -15250,7 +15258,9 @@ function isDataUrlKnowledgeSource(source) {
|
|
|
15250
15258
|
return typeof source === 'string' && source.startsWith(DATA_URL_PREFIX);
|
|
15251
15259
|
}
|
|
15252
15260
|
/**
|
|
15253
|
-
*
|
|
15261
|
+
* Converts a stored inline knowledge file into a data URL for backwards compatibility.
|
|
15262
|
+
*
|
|
15263
|
+
* @private
|
|
15254
15264
|
*/
|
|
15255
15265
|
function inlineKnowledgeSourceToDataUrl(source) {
|
|
15256
15266
|
const base64 = source.buffer.toString('base64');
|
|
@@ -15310,9 +15320,7 @@ function parseDataUrlKnowledgeSource(source) {
|
|
|
15310
15320
|
return null;
|
|
15311
15321
|
}
|
|
15312
15322
|
}
|
|
15313
|
-
|
|
15314
|
-
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
15315
|
-
*/
|
|
15323
|
+
// Note: [💞] Ignore a discrepancy between file name and entity name
|
|
15316
15324
|
|
|
15317
15325
|
/**
|
|
15318
15326
|
* KNOWLEDGE commitment definition
|
|
@@ -15516,9 +15524,7 @@ class LanguageCommitmentDefinition extends BaseCommitmentDefinition {
|
|
|
15516
15524
|
return this.appendToSystemMessage(requirements, languageSection, '\n\n');
|
|
15517
15525
|
}
|
|
15518
15526
|
}
|
|
15519
|
-
|
|
15520
|
-
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
15521
|
-
*/
|
|
15527
|
+
// Note: [💞] Ignore a discrepancy between file name and entity name
|
|
15522
15528
|
|
|
15523
15529
|
/**
|
|
15524
15530
|
* @@@
|
|
@@ -15784,6 +15790,7 @@ function serializeToolRuntimeContext(context) {
|
|
|
15784
15790
|
*
|
|
15785
15791
|
* @param listener - Listener notified about tool progress.
|
|
15786
15792
|
* @returns Hidden token used to route progress updates.
|
|
15793
|
+
*
|
|
15787
15794
|
* @private internal runtime wiring for commitment tools
|
|
15788
15795
|
*/
|
|
15789
15796
|
function registerToolCallProgressListener(listener) {
|
|
@@ -15796,14 +15803,13 @@ function registerToolCallProgressListener(listener) {
|
|
|
15796
15803
|
* Unregisters one in-memory progress listener.
|
|
15797
15804
|
*
|
|
15798
15805
|
* @param token - Token previously created by `registerToolCallProgressListener`.
|
|
15806
|
+
*
|
|
15799
15807
|
* @private internal runtime wiring for commitment tools
|
|
15800
15808
|
*/
|
|
15801
15809
|
function unregisterToolCallProgressListener(token) {
|
|
15802
15810
|
toolCallProgressListeners.delete(token);
|
|
15803
15811
|
}
|
|
15804
|
-
|
|
15805
|
-
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
15806
|
-
*/
|
|
15812
|
+
// Note: [💞] Ignore a discrepancy between file name and entity name
|
|
15807
15813
|
|
|
15808
15814
|
/**
|
|
15809
15815
|
* Resolves runtime context from hidden tool arguments.
|
|
@@ -16164,9 +16170,7 @@ class MemoryCommitmentDefinition extends BaseCommitmentDefinition {
|
|
|
16164
16170
|
return createMemoryToolFunctions();
|
|
16165
16171
|
}
|
|
16166
16172
|
}
|
|
16167
|
-
|
|
16168
|
-
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
16169
|
-
*/
|
|
16173
|
+
// Note: [💞] Ignore a discrepancy between file name and entity name
|
|
16170
16174
|
|
|
16171
16175
|
/**
|
|
16172
16176
|
* AGENT MESSAGE commitment definition
|
|
@@ -16496,9 +16500,7 @@ class MessageCommitmentDefinition extends BaseCommitmentDefinition {
|
|
|
16496
16500
|
return this.appendToSystemMessage(requirements, messageSection, '\n\n');
|
|
16497
16501
|
}
|
|
16498
16502
|
}
|
|
16499
|
-
|
|
16500
|
-
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
16501
|
-
*/
|
|
16503
|
+
// Note: [💞] Ignore a discrepancy between file name and entity name
|
|
16502
16504
|
|
|
16503
16505
|
/**
|
|
16504
16506
|
* USER MESSAGE commitment definition
|
|
@@ -16629,9 +16631,7 @@ class MessageSuffixCommitmentDefinition extends BaseCommitmentDefinition {
|
|
|
16629
16631
|
return requirements;
|
|
16630
16632
|
}
|
|
16631
16633
|
}
|
|
16632
|
-
|
|
16633
|
-
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
16634
|
-
*/
|
|
16634
|
+
// Note: [💞] Ignore a discrepancy between file name and entity name
|
|
16635
16635
|
|
|
16636
16636
|
/**
|
|
16637
16637
|
* META commitment definition
|
|
@@ -16778,9 +16778,7 @@ class MetaCommitmentDefinition extends BaseCommitmentDefinition {
|
|
|
16778
16778
|
return knownTypes.includes(metaType.toUpperCase());
|
|
16779
16779
|
}
|
|
16780
16780
|
}
|
|
16781
|
-
|
|
16782
|
-
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
16783
|
-
*/
|
|
16781
|
+
// Note: [💞] Ignore a discrepancy between file name and entity name
|
|
16784
16782
|
|
|
16785
16783
|
/**
|
|
16786
16784
|
* META COLOR commitment definition
|
|
@@ -16876,9 +16874,7 @@ class MetaColorCommitmentDefinition extends BaseCommitmentDefinition {
|
|
|
16876
16874
|
return trimmedContent || null;
|
|
16877
16875
|
}
|
|
16878
16876
|
}
|
|
16879
|
-
|
|
16880
|
-
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
16881
|
-
*/
|
|
16877
|
+
// Note: [💞] Ignore a discrepancy between file name and entity name
|
|
16882
16878
|
|
|
16883
16879
|
/**
|
|
16884
16880
|
* META DOMAIN commitment definition
|
|
@@ -16943,9 +16939,7 @@ class MetaDomainCommitmentDefinition extends BaseCommitmentDefinition {
|
|
|
16943
16939
|
return trimmedContent || null;
|
|
16944
16940
|
}
|
|
16945
16941
|
}
|
|
16946
|
-
|
|
16947
|
-
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
16948
|
-
*/
|
|
16942
|
+
// Note: [💞] Ignore a discrepancy between file name and entity name
|
|
16949
16943
|
|
|
16950
16944
|
/**
|
|
16951
16945
|
* META DISCLAIMER commitment definition
|
|
@@ -17013,9 +17007,7 @@ class MetaDisclaimerCommitmentDefinition extends BaseCommitmentDefinition {
|
|
|
17013
17007
|
return requirements;
|
|
17014
17008
|
}
|
|
17015
17009
|
}
|
|
17016
|
-
|
|
17017
|
-
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
17018
|
-
*/
|
|
17010
|
+
// Note: [💞] Ignore a discrepancy between file name and entity name
|
|
17019
17011
|
|
|
17020
17012
|
/**
|
|
17021
17013
|
* META FONT commitment definition
|
|
@@ -17098,9 +17090,7 @@ class MetaFontCommitmentDefinition extends BaseCommitmentDefinition {
|
|
|
17098
17090
|
return trimmedContent || null;
|
|
17099
17091
|
}
|
|
17100
17092
|
}
|
|
17101
|
-
|
|
17102
|
-
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
17103
|
-
*/
|
|
17093
|
+
// Note: [💞] Ignore a discrepancy between file name and entity name
|
|
17104
17094
|
|
|
17105
17095
|
/**
|
|
17106
17096
|
* META IMAGE commitment definition
|
|
@@ -17185,9 +17175,7 @@ class MetaImageCommitmentDefinition extends BaseCommitmentDefinition {
|
|
|
17185
17175
|
return trimmedContent || null;
|
|
17186
17176
|
}
|
|
17187
17177
|
}
|
|
17188
|
-
|
|
17189
|
-
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
17190
|
-
*/
|
|
17178
|
+
// Note: [💞] Ignore a discrepancy between file name and entity name
|
|
17191
17179
|
|
|
17192
17180
|
/**
|
|
17193
17181
|
* META INPUT PLACEHOLDER commitment definition.
|
|
@@ -17250,9 +17238,7 @@ class MetaInputPlaceholderCommitmentDefinition extends BaseCommitmentDefinition
|
|
|
17250
17238
|
return trimmedContent || null;
|
|
17251
17239
|
}
|
|
17252
17240
|
}
|
|
17253
|
-
|
|
17254
|
-
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
17255
|
-
*/
|
|
17241
|
+
// Note: [💞] Ignore a discrepancy between file name and entity name
|
|
17256
17242
|
|
|
17257
17243
|
/**
|
|
17258
17244
|
* META LINK commitment definition
|
|
@@ -17359,9 +17345,7 @@ class MetaLinkCommitmentDefinition extends BaseCommitmentDefinition {
|
|
|
17359
17345
|
}
|
|
17360
17346
|
}
|
|
17361
17347
|
}
|
|
17362
|
-
|
|
17363
|
-
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
17364
|
-
*/
|
|
17348
|
+
// Note: [💞] Ignore a discrepancy between file name and entity name
|
|
17365
17349
|
|
|
17366
17350
|
/**
|
|
17367
17351
|
* META VOICE commitment definition
|
|
@@ -17430,9 +17414,7 @@ class MetaVoiceCommitmentDefinition extends BaseCommitmentDefinition {
|
|
|
17430
17414
|
return trimmedContent || null;
|
|
17431
17415
|
}
|
|
17432
17416
|
}
|
|
17433
|
-
|
|
17434
|
-
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
17435
|
-
*/
|
|
17417
|
+
// Note: [💞] Ignore a discrepancy between file name and entity name
|
|
17436
17418
|
|
|
17437
17419
|
/**
|
|
17438
17420
|
* MODEL commitment definition
|
|
@@ -17670,9 +17652,7 @@ class ModelCommitmentDefinition extends BaseCommitmentDefinition {
|
|
|
17670
17652
|
return result;
|
|
17671
17653
|
}
|
|
17672
17654
|
}
|
|
17673
|
-
|
|
17674
|
-
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
17675
|
-
*/
|
|
17655
|
+
// Note: [💞] Ignore a discrepancy between file name and entity name
|
|
17676
17656
|
|
|
17677
17657
|
/**
|
|
17678
17658
|
* NOTE commitment definition
|
|
@@ -17834,9 +17814,7 @@ class OpenCommitmentDefinition extends BaseCommitmentDefinition {
|
|
|
17834
17814
|
};
|
|
17835
17815
|
}
|
|
17836
17816
|
}
|
|
17837
|
-
|
|
17838
|
-
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
17839
|
-
*/
|
|
17817
|
+
// Note: [💞] Ignore a discrepancy between file name and entity name
|
|
17840
17818
|
|
|
17841
17819
|
/**
|
|
17842
17820
|
* PERSONA commitment definition
|
|
@@ -17975,9 +17953,7 @@ class PersonaCommitmentDefinition extends BaseCommitmentDefinition {
|
|
|
17975
17953
|
};
|
|
17976
17954
|
}
|
|
17977
17955
|
}
|
|
17978
|
-
|
|
17979
|
-
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
17980
|
-
*/
|
|
17956
|
+
// Note: [💞] Ignore a discrepancy between file name and entity name
|
|
17981
17957
|
|
|
17982
17958
|
/**
|
|
17983
17959
|
* RULE commitment definition
|
|
@@ -18058,15 +18034,14 @@ class RuleCommitmentDefinition extends BaseCommitmentDefinition {
|
|
|
18058
18034
|
return this.appendToPromptSuffix(requirementsWithRule, ruleSection);
|
|
18059
18035
|
}
|
|
18060
18036
|
}
|
|
18061
|
-
|
|
18062
|
-
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
18063
|
-
*/
|
|
18037
|
+
// Note: [💞] Ignore a discrepancy between file name and entity name
|
|
18064
18038
|
|
|
18065
18039
|
/**
|
|
18066
18040
|
* Creates the canonical system-message body for one writing-sample commitment.
|
|
18067
18041
|
*
|
|
18068
18042
|
* @param content - Explicit 1:1 sample text.
|
|
18069
18043
|
* @returns Writing-sample guidance ready for one system-message section.
|
|
18044
|
+
*
|
|
18070
18045
|
* @private internal utility of writing commitments
|
|
18071
18046
|
*/
|
|
18072
18047
|
function createWritingSampleSection(content) {
|
|
@@ -18084,6 +18059,7 @@ function createWritingSampleSection(content) {
|
|
|
18084
18059
|
*
|
|
18085
18060
|
* @param content - Writing-only instructions.
|
|
18086
18061
|
* @returns Writing-rules guidance ready for one system-message section.
|
|
18062
|
+
*
|
|
18087
18063
|
* @private internal utility of writing commitments
|
|
18088
18064
|
*/
|
|
18089
18065
|
function createWritingRulesSection(content) {
|
|
@@ -18096,9 +18072,7 @@ function createWritingRulesSection(content) {
|
|
|
18096
18072
|
${content}
|
|
18097
18073
|
`);
|
|
18098
18074
|
}
|
|
18099
|
-
|
|
18100
|
-
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
18101
|
-
*/
|
|
18075
|
+
// Note: [💞] Ignore a discrepancy between file name and entity name
|
|
18102
18076
|
|
|
18103
18077
|
/**
|
|
18104
18078
|
* Legacy `SAMPLE` / `EXAMPLE` commitment definition.
|
|
@@ -18177,9 +18151,7 @@ class SampleCommitmentDefinition extends BaseCommitmentDefinition {
|
|
|
18177
18151
|
return this.appendToSystemMessage(requirements, this.createSystemMessageSection('Writing sample', createWritingSampleSection(trimmedContent)), '\n\n');
|
|
18178
18152
|
}
|
|
18179
18153
|
}
|
|
18180
|
-
|
|
18181
|
-
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
18182
|
-
*/
|
|
18154
|
+
// Note: [💞] Ignore a discrepancy between file name and entity name
|
|
18183
18155
|
|
|
18184
18156
|
/**
|
|
18185
18157
|
* SCENARIO commitment definition
|
|
@@ -18301,9 +18273,7 @@ class ScenarioCommitmentDefinition extends BaseCommitmentDefinition {
|
|
|
18301
18273
|
return this.appendToSystemMessage(requirements, scenarioSection, '\n\n');
|
|
18302
18274
|
}
|
|
18303
18275
|
}
|
|
18304
|
-
|
|
18305
|
-
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
18306
|
-
*/
|
|
18276
|
+
// Note: [💞] Ignore a discrepancy between file name and entity name
|
|
18307
18277
|
|
|
18308
18278
|
/**
|
|
18309
18279
|
* STYLE commitment definition
|
|
@@ -18400,6 +18370,7 @@ const TEAM_TOOL_FALLBACK_NAME = 'teammate';
|
|
|
18400
18370
|
*
|
|
18401
18371
|
* @param teammateLabel - Human-readable teammate label.
|
|
18402
18372
|
* @returns Normalized teammate identifier for TEAM tool names.
|
|
18373
|
+
*
|
|
18403
18374
|
* @private internal helper of TEAM tool-name generation
|
|
18404
18375
|
*/
|
|
18405
18376
|
function normalizeTeammateToolNamePart(teammateLabel) {
|
|
@@ -18415,6 +18386,7 @@ function normalizeTeammateToolNamePart(teammateLabel) {
|
|
|
18415
18386
|
* @param _teammateUrl - Canonical teammate URL (kept for API compatibility, not used).
|
|
18416
18387
|
* @param teammateLabel - Human-readable teammate label used as the basis for the name.
|
|
18417
18388
|
* @returns TEAM tool name derived from the label.
|
|
18389
|
+
*
|
|
18418
18390
|
* @private internal utility of TEAM commitments and chat UI mapping
|
|
18419
18391
|
*/
|
|
18420
18392
|
function createTeamToolName(_teammateUrl, teammateLabel) {
|
|
@@ -18422,9 +18394,21 @@ function createTeamToolName(_teammateUrl, teammateLabel) {
|
|
|
18422
18394
|
return `${TEAM_TOOL_PREFIX}${normalizedLabel}`;
|
|
18423
18395
|
}
|
|
18424
18396
|
|
|
18397
|
+
/**
|
|
18398
|
+
* Pattern matching agent URLs inside TEAM commitment content.
|
|
18399
|
+
*/
|
|
18425
18400
|
const urlRegex = /https?:\/\/[^\s]+/gi;
|
|
18401
|
+
/**
|
|
18402
|
+
* Pattern matching punctuation that often trails teammate URLs in prose.
|
|
18403
|
+
*/
|
|
18426
18404
|
const trailingPunctuationRegex = /[),.;!?]+$/;
|
|
18405
|
+
/**
|
|
18406
|
+
* Clause separators used while splitting TEAM instruction context.
|
|
18407
|
+
*/
|
|
18427
18408
|
const clauseSeparators = ['.', '?', '!', ';', ','];
|
|
18409
|
+
/**
|
|
18410
|
+
* Conjunction separators used while splitting TEAM instruction context.
|
|
18411
|
+
*/
|
|
18428
18412
|
const conjunctionSeparators = [' and ', ' or '];
|
|
18429
18413
|
/**
|
|
18430
18414
|
* Parses TEAM commitment content into teammates with instructions.
|
|
@@ -18472,6 +18456,9 @@ function parseTeamCommitmentContent(content, options = {}) {
|
|
|
18472
18456
|
}
|
|
18473
18457
|
return teammates;
|
|
18474
18458
|
}
|
|
18459
|
+
/**
|
|
18460
|
+
* Extracts the instruction fragment associated with one teammate URL.
|
|
18461
|
+
*/
|
|
18475
18462
|
function extractInstructionContext(line, matches, matchIndex) {
|
|
18476
18463
|
var _a;
|
|
18477
18464
|
const match = matches[matchIndex];
|
|
@@ -18497,6 +18484,9 @@ function extractInstructionContext(line, matches, matchIndex) {
|
|
|
18497
18484
|
}
|
|
18498
18485
|
return `${prefix} ${suffix}`.trim();
|
|
18499
18486
|
}
|
|
18487
|
+
/**
|
|
18488
|
+
* Trims content after the last detected clause delimiter.
|
|
18489
|
+
*/
|
|
18500
18490
|
function trimAfterLastDelimiter(text) {
|
|
18501
18491
|
const match = findLastDelimiter(text);
|
|
18502
18492
|
if (!match) {
|
|
@@ -18504,6 +18494,9 @@ function trimAfterLastDelimiter(text) {
|
|
|
18504
18494
|
}
|
|
18505
18495
|
return text.slice(match.index + match.length);
|
|
18506
18496
|
}
|
|
18497
|
+
/**
|
|
18498
|
+
* Trims content before the last detected clause delimiter.
|
|
18499
|
+
*/
|
|
18507
18500
|
function trimBeforeLastDelimiter(text) {
|
|
18508
18501
|
const cleaned = text.replace(/^[,;:]\s*/g, '');
|
|
18509
18502
|
const match = findLastDelimiter(cleaned);
|
|
@@ -18512,6 +18505,9 @@ function trimBeforeLastDelimiter(text) {
|
|
|
18512
18505
|
}
|
|
18513
18506
|
return cleaned.slice(0, match.index);
|
|
18514
18507
|
}
|
|
18508
|
+
/**
|
|
18509
|
+
* Finds the last clause or conjunction delimiter in a string.
|
|
18510
|
+
*/
|
|
18515
18511
|
function findLastDelimiter(text) {
|
|
18516
18512
|
let bestIndex = -1;
|
|
18517
18513
|
let bestLength = 0;
|
|
@@ -18535,6 +18531,9 @@ function findLastDelimiter(text) {
|
|
|
18535
18531
|
}
|
|
18536
18532
|
return { index: bestIndex, length: bestLength };
|
|
18537
18533
|
}
|
|
18534
|
+
/**
|
|
18535
|
+
* Normalizes teammate instruction text after URL extraction.
|
|
18536
|
+
*/
|
|
18538
18537
|
function normalizeInstructionText(text) {
|
|
18539
18538
|
if (!text) {
|
|
18540
18539
|
return '';
|
|
@@ -18548,6 +18547,9 @@ function normalizeInstructionText(text) {
|
|
|
18548
18547
|
normalized = normalizeWhitespaces(normalized).trim();
|
|
18549
18548
|
return normalized;
|
|
18550
18549
|
}
|
|
18550
|
+
/**
|
|
18551
|
+
* Creates a readable teammate label from an agent URL.
|
|
18552
|
+
*/
|
|
18551
18553
|
function createTeammateLabel(url) {
|
|
18552
18554
|
try {
|
|
18553
18555
|
const parsed = new URL(url);
|
|
@@ -18567,12 +18569,19 @@ function createTeammateLabel(url) {
|
|
|
18567
18569
|
return url;
|
|
18568
18570
|
}
|
|
18569
18571
|
}
|
|
18572
|
+
// Note: [💞] Ignore a discrepancy between file name and entity name
|
|
18573
|
+
|
|
18570
18574
|
/**
|
|
18571
|
-
*
|
|
18575
|
+
* Map of team tool functions.
|
|
18572
18576
|
*/
|
|
18573
|
-
|
|
18574
18577
|
const teamToolFunctions = {};
|
|
18578
|
+
/**
|
|
18579
|
+
* Map of team tool titles.
|
|
18580
|
+
*/
|
|
18575
18581
|
const teamToolTitles = {};
|
|
18582
|
+
/**
|
|
18583
|
+
* Constant for remote agents by Url.
|
|
18584
|
+
*/
|
|
18576
18585
|
const remoteAgentsByUrl = new Map();
|
|
18577
18586
|
/**
|
|
18578
18587
|
* TEAM commitment definition
|
|
@@ -18936,9 +18945,7 @@ function createTeamToolFunction(entry) {
|
|
|
18936
18945
|
return JSON.stringify(result);
|
|
18937
18946
|
};
|
|
18938
18947
|
}
|
|
18939
|
-
|
|
18940
|
-
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
18941
|
-
*/
|
|
18948
|
+
// Note: [💞] Ignore a discrepancy between file name and entity name
|
|
18942
18949
|
|
|
18943
18950
|
/**
|
|
18944
18951
|
* TEMPLATE commitment definition
|
|
@@ -19059,9 +19066,7 @@ class TemplateCommitmentDefinition extends BaseCommitmentDefinition {
|
|
|
19059
19066
|
};
|
|
19060
19067
|
}
|
|
19061
19068
|
}
|
|
19062
|
-
|
|
19063
|
-
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
19064
|
-
*/
|
|
19069
|
+
// Note: [💞] Ignore a discrepancy between file name and entity name
|
|
19065
19070
|
|
|
19066
19071
|
/**
|
|
19067
19072
|
* USE commitment definition
|
|
@@ -19173,9 +19178,7 @@ class UseCommitmentDefinition extends BaseCommitmentDefinition {
|
|
|
19173
19178
|
return knownTypes.includes(useType.toUpperCase());
|
|
19174
19179
|
}
|
|
19175
19180
|
}
|
|
19176
|
-
|
|
19177
|
-
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
19178
|
-
*/
|
|
19181
|
+
// Note: [💞] Ignore a discrepancy between file name and entity name
|
|
19179
19182
|
|
|
19180
19183
|
/**
|
|
19181
19184
|
* All `USE` commitment types currently participating in final system-message aggregation.
|
|
@@ -19198,6 +19201,7 @@ const AGGREGATED_USE_COMMITMENT_PLACEHOLDER_PREFIX = '# AGGREGATED USE COMMITMEN
|
|
|
19198
19201
|
*
|
|
19199
19202
|
* @param type - Commitment type to check.
|
|
19200
19203
|
* @returns `true` when the commitment participates in `USE` system-message aggregation.
|
|
19204
|
+
*
|
|
19201
19205
|
* @private internal utility of `aggregateUseCommitmentSystemMessages`
|
|
19202
19206
|
*/
|
|
19203
19207
|
function isAggregatedUseCommitmentType(type) {
|
|
@@ -19208,6 +19212,7 @@ function isAggregatedUseCommitmentType(type) {
|
|
|
19208
19212
|
*
|
|
19209
19213
|
* @param type - Aggregated `USE` commitment type.
|
|
19210
19214
|
* @returns Single-line placeholder comment stored in the interim system message.
|
|
19215
|
+
*
|
|
19211
19216
|
* @private internal utility of `appendAggregatedUseCommitmentPlaceholder`
|
|
19212
19217
|
*/
|
|
19213
19218
|
function getAggregatedUseCommitmentPlaceholder(type) {
|
|
@@ -19218,6 +19223,7 @@ function getAggregatedUseCommitmentPlaceholder(type) {
|
|
|
19218
19223
|
*
|
|
19219
19224
|
* @param additionalInstructions - Deduplicated instruction blocks collected from the agent source.
|
|
19220
19225
|
* @returns Combined instruction text ready for `formatOptionalInstructionBlock`.
|
|
19226
|
+
*
|
|
19221
19227
|
* @private internal utility of `createAggregatedUseCommitmentSystemMessage`
|
|
19222
19228
|
*/
|
|
19223
19229
|
function combineAdditionalInstructions(additionalInstructions) {
|
|
@@ -19229,6 +19235,7 @@ function combineAdditionalInstructions(additionalInstructions) {
|
|
|
19229
19235
|
* @param type - Aggregated `USE` commitment type.
|
|
19230
19236
|
* @param additionalInstructions - Distinct additional instructions in source order.
|
|
19231
19237
|
* @returns Final system-message block for the commitment type.
|
|
19238
|
+
*
|
|
19232
19239
|
* @private internal utility of `aggregateUseCommitmentSystemMessages`
|
|
19233
19240
|
*/
|
|
19234
19241
|
function createAggregatedUseCommitmentSystemMessage(type, additionalInstructions) {
|
|
@@ -19267,6 +19274,7 @@ function createAggregatedUseCommitmentSystemMessage(type, additionalInstructions
|
|
|
19267
19274
|
* @param requirements - Current model requirements.
|
|
19268
19275
|
* @param type - Aggregated `USE` commitment type being applied.
|
|
19269
19276
|
* @returns Requirements with the placeholder inserted when it was not already present.
|
|
19277
|
+
*
|
|
19270
19278
|
* @private internal utility of `USE` commitments
|
|
19271
19279
|
*/
|
|
19272
19280
|
function appendAggregatedUseCommitmentPlaceholder(requirements, type) {
|
|
@@ -19290,6 +19298,7 @@ function appendAggregatedUseCommitmentPlaceholder(requirements, type) {
|
|
|
19290
19298
|
* @param requirements - Model requirements produced by commitment-by-commitment application.
|
|
19291
19299
|
* @param commitments - Filtered commitments in their original source order.
|
|
19292
19300
|
* @returns Requirements with aggregated `USE` system-message sections.
|
|
19301
|
+
*
|
|
19293
19302
|
* @private internal utility of `createAgentModelRequirementsWithCommitments`
|
|
19294
19303
|
*/
|
|
19295
19304
|
function aggregateUseCommitmentSystemMessages(requirements, commitments) {
|
|
@@ -19582,9 +19591,7 @@ class UseBrowserCommitmentDefinition extends BaseCommitmentDefinition {
|
|
|
19582
19591
|
};
|
|
19583
19592
|
}
|
|
19584
19593
|
}
|
|
19585
|
-
|
|
19586
|
-
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
19587
|
-
*/
|
|
19594
|
+
// Note: [💞] Ignore a discrepancy between file name and entity name
|
|
19588
19595
|
|
|
19589
19596
|
/**
|
|
19590
19597
|
* Base Google Calendar API URL.
|
|
@@ -19855,9 +19862,7 @@ function removeTokenFromLine(line, token) {
|
|
|
19855
19862
|
const filteredTokens = tokens.filter((lineToken) => lineToken.replace(/[),.;:!?]+$/g, '') !== token);
|
|
19856
19863
|
return filteredTokens.join(' ').trim();
|
|
19857
19864
|
}
|
|
19858
|
-
|
|
19859
|
-
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
19860
|
-
*/
|
|
19865
|
+
// Note: [💞] Ignore a discrepancy between file name and entity name
|
|
19861
19866
|
|
|
19862
19867
|
/**
|
|
19863
19868
|
* Wallet metadata used by USE CALENDAR when resolving Google Calendar credentials.
|
|
@@ -20808,9 +20813,7 @@ function addConfiguredCalendarIfMissing(configuredCalendars, calendarReference)
|
|
|
20808
20813
|
...(calendarReference.tokenRef ? { tokenRef: calendarReference.tokenRef } : {}),
|
|
20809
20814
|
});
|
|
20810
20815
|
}
|
|
20811
|
-
|
|
20812
|
-
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
20813
|
-
*/
|
|
20816
|
+
// Note: [💞] Ignore a discrepancy between file name and entity name
|
|
20814
20817
|
|
|
20815
20818
|
/**
|
|
20816
20819
|
* Lightweight email token matcher used for `USE EMAIL` first-line parsing.
|
|
@@ -21076,9 +21079,7 @@ function addUseEmailTools(existingTools) {
|
|
|
21076
21079
|
},
|
|
21077
21080
|
];
|
|
21078
21081
|
}
|
|
21079
|
-
|
|
21080
|
-
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
21081
|
-
*/
|
|
21082
|
+
// Note: [💞] Ignore a discrepancy between file name and entity name
|
|
21082
21083
|
|
|
21083
21084
|
/**
|
|
21084
21085
|
* USE IMAGE GENERATOR commitment definition
|
|
@@ -21169,9 +21170,7 @@ class UseImageGeneratorCommitmentDefinition extends BaseCommitmentDefinition {
|
|
|
21169
21170
|
`));
|
|
21170
21171
|
}
|
|
21171
21172
|
}
|
|
21172
|
-
|
|
21173
|
-
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
21174
|
-
*/
|
|
21173
|
+
// Note: [💞] Ignore a discrepancy between file name and entity name
|
|
21175
21174
|
|
|
21176
21175
|
/**
|
|
21177
21176
|
* USE MCP commitment definition
|
|
@@ -21246,9 +21245,7 @@ class UseMcpCommitmentDefinition extends BaseCommitmentDefinition {
|
|
|
21246
21245
|
};
|
|
21247
21246
|
}
|
|
21248
21247
|
}
|
|
21249
|
-
|
|
21250
|
-
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
21251
|
-
*/
|
|
21248
|
+
// Note: [💞] Ignore a discrepancy between file name and entity name
|
|
21252
21249
|
|
|
21253
21250
|
/**
|
|
21254
21251
|
* USE POPUP commitment definition
|
|
@@ -21384,9 +21381,7 @@ class UsePopupCommitmentDefinition extends BaseCommitmentDefinition {
|
|
|
21384
21381
|
};
|
|
21385
21382
|
}
|
|
21386
21383
|
}
|
|
21387
|
-
|
|
21388
|
-
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
21389
|
-
*/
|
|
21384
|
+
// Note: [💞] Ignore a discrepancy between file name and entity name
|
|
21390
21385
|
|
|
21391
21386
|
/**
|
|
21392
21387
|
* Tool name used by the USE PRIVACY commitment.
|
|
@@ -21558,9 +21553,7 @@ class UsePrivacyCommitmentDefinition extends BaseCommitmentDefinition {
|
|
|
21558
21553
|
};
|
|
21559
21554
|
}
|
|
21560
21555
|
}
|
|
21561
|
-
|
|
21562
|
-
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
21563
|
-
*/
|
|
21556
|
+
// Note: [💞] Ignore a discrepancy between file name and entity name
|
|
21564
21557
|
|
|
21565
21558
|
/* eslint-disable no-magic-numbers */
|
|
21566
21559
|
/**
|
|
@@ -22348,9 +22341,7 @@ function createGitHubRepositoryReference(owner, repository, defaultBranch) {
|
|
|
22348
22341
|
defaultBranch,
|
|
22349
22342
|
};
|
|
22350
22343
|
}
|
|
22351
|
-
|
|
22352
|
-
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
22353
|
-
*/
|
|
22344
|
+
// Note: [💞] Ignore a discrepancy between file name and entity name
|
|
22354
22345
|
|
|
22355
22346
|
/**
|
|
22356
22347
|
* Wallet metadata used by USE PROJECT when resolving GitHub credentials.
|
|
@@ -23209,9 +23200,7 @@ function addConfiguredProjectIfMissing(configuredProjects, repositoryReference)
|
|
|
23209
23200
|
defaultBranch: repositoryReference.defaultBranch,
|
|
23210
23201
|
});
|
|
23211
23202
|
}
|
|
23212
|
-
|
|
23213
|
-
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
23214
|
-
*/
|
|
23203
|
+
// Note: [💞] Ignore a discrepancy between file name and entity name
|
|
23215
23204
|
|
|
23216
23205
|
/**
|
|
23217
23206
|
* A search engine implementation that uses the SerpApi to fetch Google search results.
|
|
@@ -23422,9 +23411,7 @@ class UseSearchEngineCommitmentDefinition extends BaseCommitmentDefinition {
|
|
|
23422
23411
|
};
|
|
23423
23412
|
}
|
|
23424
23413
|
}
|
|
23425
|
-
|
|
23426
|
-
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
23427
|
-
*/
|
|
23414
|
+
// Note: [💞] Ignore a discrepancy between file name and entity name
|
|
23428
23415
|
|
|
23429
23416
|
/**
|
|
23430
23417
|
* Maximum allowed source length for create-agent payloads.
|
|
@@ -23621,9 +23608,7 @@ class UseSpawnCommitmentDefinition extends BaseCommitmentDefinition {
|
|
|
23621
23608
|
};
|
|
23622
23609
|
}
|
|
23623
23610
|
}
|
|
23624
|
-
|
|
23625
|
-
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
23626
|
-
*/
|
|
23611
|
+
// Note: [💞] Ignore a discrepancy between file name and entity name
|
|
23627
23612
|
|
|
23628
23613
|
/**
|
|
23629
23614
|
* Creates system-message instructions for `USE TIMEOUT`.
|
|
@@ -23688,9 +23673,7 @@ function parseToolExecutionEnvelope(rawValue) {
|
|
|
23688
23673
|
return null;
|
|
23689
23674
|
}
|
|
23690
23675
|
}
|
|
23691
|
-
|
|
23692
|
-
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
23693
|
-
*/
|
|
23676
|
+
// Note: [💞] Ignore a discrepancy between file name and entity name
|
|
23694
23677
|
|
|
23695
23678
|
/**
|
|
23696
23679
|
* Builds a disabled timeout-tool payload.
|
|
@@ -24424,9 +24407,7 @@ class UseTimeoutCommitmentDefinition extends BaseCommitmentDefinition {
|
|
|
24424
24407
|
return createTimeoutToolFunctions();
|
|
24425
24408
|
}
|
|
24426
24409
|
}
|
|
24427
|
-
|
|
24428
|
-
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
24429
|
-
*/
|
|
24410
|
+
// Note: [💞] Ignore a discrepancy between file name and entity name
|
|
24430
24411
|
|
|
24431
24412
|
/**
|
|
24432
24413
|
* USE TIME commitment definition
|
|
@@ -24573,9 +24554,7 @@ class UseTimeCommitmentDefinition extends BaseCommitmentDefinition {
|
|
|
24573
24554
|
};
|
|
24574
24555
|
}
|
|
24575
24556
|
}
|
|
24576
|
-
|
|
24577
|
-
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
24578
|
-
*/
|
|
24557
|
+
// Note: [💞] Ignore a discrepancy between file name and entity name
|
|
24579
24558
|
|
|
24580
24559
|
/**
|
|
24581
24560
|
* Tool name used by the USE USER LOCATION commitment.
|
|
@@ -24788,9 +24767,7 @@ class UseUserLocationCommitmentDefinition extends BaseCommitmentDefinition {
|
|
|
24788
24767
|
};
|
|
24789
24768
|
}
|
|
24790
24769
|
}
|
|
24791
|
-
|
|
24792
|
-
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
24793
|
-
*/
|
|
24770
|
+
// Note: [💞] Ignore a discrepancy between file name and entity name
|
|
24794
24771
|
|
|
24795
24772
|
/**
|
|
24796
24773
|
* `WRITING RULES` commitment definition.
|
|
@@ -24866,9 +24843,7 @@ class WritingRulesCommitmentDefinition extends BaseCommitmentDefinition {
|
|
|
24866
24843
|
return this.appendToSystemMessage(requirements, this.createSystemMessageSection('Writing rules', createWritingRulesSection(trimmedContent)), '\n\n');
|
|
24867
24844
|
}
|
|
24868
24845
|
}
|
|
24869
|
-
|
|
24870
|
-
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
24871
|
-
*/
|
|
24846
|
+
// Note: [💞] Ignore a discrepancy between file name and entity name
|
|
24872
24847
|
|
|
24873
24848
|
/**
|
|
24874
24849
|
* `WRITING SAMPLE` commitment definition.
|
|
@@ -24938,9 +24913,7 @@ class WritingSampleCommitmentDefinition extends BaseCommitmentDefinition {
|
|
|
24938
24913
|
return this.appendToSystemMessage(requirements, this.createSystemMessageSection('Writing sample', createWritingSampleSection(trimmedContent)), '\n\n');
|
|
24939
24914
|
}
|
|
24940
24915
|
}
|
|
24941
|
-
|
|
24942
|
-
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
24943
|
-
*/
|
|
24916
|
+
// Note: [💞] Ignore a discrepancy between file name and entity name
|
|
24944
24917
|
|
|
24945
24918
|
/**
|
|
24946
24919
|
* Placeholder commitment definition for commitments that are not yet implemented
|
|
@@ -25102,13 +25075,12 @@ const COMMITMENT_REGISTRY = [
|
|
|
25102
25075
|
new NotYetImplementedCommitmentDefinition('CONTEXT'),
|
|
25103
25076
|
// <- TODO: Prompt: Leverage aliases instead of duplicating commitment definitions
|
|
25104
25077
|
];
|
|
25105
|
-
|
|
25106
|
-
|
|
25107
|
-
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
25108
|
-
*/
|
|
25078
|
+
// TODO: [🧠] Maybe create through standardized $register
|
|
25079
|
+
// Note: [💞] Ignore a discrepancy between file name and entity name
|
|
25109
25080
|
|
|
25110
25081
|
/**
|
|
25111
25082
|
* Gets all available commitment definitions
|
|
25083
|
+
*
|
|
25112
25084
|
* @returns Array of all commitment definitions
|
|
25113
25085
|
*
|
|
25114
25086
|
* @public exported from `@promptbook/core`
|
|
@@ -25121,6 +25093,7 @@ function getAllCommitmentDefinitions() {
|
|
|
25121
25093
|
* Collects tool functions from all commitment definitions.
|
|
25122
25094
|
*
|
|
25123
25095
|
* @returns Map of tool function implementations.
|
|
25096
|
+
*
|
|
25124
25097
|
* @private internal helper for commitment tool registry
|
|
25125
25098
|
*/
|
|
25126
25099
|
function collectCommitmentToolFunctions() {
|
|
@@ -25142,6 +25115,7 @@ function collectCommitmentToolFunctions() {
|
|
|
25142
25115
|
*
|
|
25143
25116
|
* @param getFunctions - Provider of current tool functions.
|
|
25144
25117
|
* @returns Proxy exposing tool functions as properties.
|
|
25118
|
+
*
|
|
25145
25119
|
* @private internal helper for commitment tool registry
|
|
25146
25120
|
*/
|
|
25147
25121
|
function createToolFunctionsProxy(getFunctions) {
|
|
@@ -25179,10 +25153,11 @@ function createToolFunctionsProxy(getFunctions) {
|
|
|
25179
25153
|
},
|
|
25180
25154
|
});
|
|
25181
25155
|
}
|
|
25156
|
+
// Note: [💞] Ignore a discrepancy between file name and entity name
|
|
25157
|
+
|
|
25182
25158
|
/**
|
|
25183
|
-
*
|
|
25159
|
+
* Map of node tool functions.
|
|
25184
25160
|
*/
|
|
25185
|
-
|
|
25186
25161
|
const nodeToolFunctions = {
|
|
25187
25162
|
/**
|
|
25188
25163
|
* @@@
|
|
@@ -25214,6 +25189,9 @@ const nodeToolFunctions = {
|
|
|
25214
25189
|
spawn_agent: resolveSpawnAgentToolForNode(),
|
|
25215
25190
|
// TODO: !!!! Unhardcode, make proper server function register from definitions
|
|
25216
25191
|
};
|
|
25192
|
+
/**
|
|
25193
|
+
* Constant for node tool functions proxy.
|
|
25194
|
+
*/
|
|
25217
25195
|
const nodeToolFunctionsProxy = createToolFunctionsProxy(() => ({
|
|
25218
25196
|
...collectCommitmentToolFunctions(),
|
|
25219
25197
|
...nodeToolFunctions,
|
|
@@ -25237,10 +25215,8 @@ function getAllCommitmentsToolFunctionsForNode() {
|
|
|
25237
25215
|
}
|
|
25238
25216
|
return nodeToolFunctionsProxy;
|
|
25239
25217
|
}
|
|
25240
|
-
|
|
25241
|
-
|
|
25242
|
-
* TODO: [??] Unite `xxxForServer` and `xxxForNode` naming
|
|
25243
|
-
*/
|
|
25218
|
+
// Note: [??] Code in this file should never be never released in packages that could be imported into browser environment
|
|
25219
|
+
// TODO: [??] Unite `xxxForServer` and `xxxForNode` naming
|
|
25244
25220
|
|
|
25245
25221
|
/**
|
|
25246
25222
|
* Normalize options for `execCommand` and `execCommands`
|
|
@@ -25308,7 +25284,6 @@ function $execCommandNormalizeOptions(options) {
|
|
|
25308
25284
|
/**
|
|
25309
25285
|
* Run one command in a shell
|
|
25310
25286
|
*
|
|
25311
|
-
*
|
|
25312
25287
|
* Note: There are 2 similar functions in the codebase:
|
|
25313
25288
|
* - `$execCommand` which runs a single command
|
|
25314
25289
|
* - `$execCommands` which runs multiple commands
|
|
@@ -25407,7 +25382,7 @@ function $execCommand(options) {
|
|
|
25407
25382
|
}
|
|
25408
25383
|
});
|
|
25409
25384
|
}
|
|
25410
|
-
|
|
25385
|
+
// Note: [🟢] Code for Node command-execution helper [$execCommand](src/utils/execCommand/$execCommand.ts) should never be published into packages that could be imported into browser environment
|
|
25411
25386
|
|
|
25412
25387
|
/**
|
|
25413
25388
|
* Attempts to locate the specified application on a Linux system using the 'which' command.
|
|
@@ -25425,8 +25400,8 @@ async function locateAppOnLinux({ linuxWhich, }) {
|
|
|
25425
25400
|
return null;
|
|
25426
25401
|
}
|
|
25427
25402
|
}
|
|
25428
|
-
|
|
25429
|
-
|
|
25403
|
+
// Note: [🟢] Code for Node executable locator [locateAppOnLinux](src/executables/platforms/locateAppOnLinux.ts) should never be published into packages that could be imported into browser environment
|
|
25404
|
+
// TODO: [🧠][♿] Maybe export through `@promptbook/node`
|
|
25430
25405
|
|
|
25431
25406
|
/**
|
|
25432
25407
|
* Checks if the file is executable
|
|
@@ -25442,15 +25417,15 @@ async function isExecutable(path, fs) {
|
|
|
25442
25417
|
return false;
|
|
25443
25418
|
}
|
|
25444
25419
|
}
|
|
25445
|
-
|
|
25446
|
-
|
|
25447
|
-
* TODO: [🖇] What about symlinks?
|
|
25448
|
-
*/
|
|
25420
|
+
// Note: Not [~🟢~] because it is not directly dependent on `fs
|
|
25421
|
+
// TODO: [🖇] What about symlinks?
|
|
25449
25422
|
|
|
25450
25423
|
// Note: Module `userhome` has no types available, so it is imported using `require`
|
|
25451
25424
|
// @see https://stackoverflow.com/questions/37000981/how-to-import-node-module-in-typescript-without-type-definitions
|
|
25452
|
-
|
|
25453
|
-
|
|
25425
|
+
/**
|
|
25426
|
+
* Constant for userhome.
|
|
25427
|
+
*/
|
|
25428
|
+
const userhome = require('userhome'); // eslint-disable-line @typescript-eslint/no-var-requires
|
|
25454
25429
|
/**
|
|
25455
25430
|
* Attempts to locate the specified application on a macOS system by checking standard application paths and using mdfind.
|
|
25456
25431
|
* Returns the path to the executable if found, or null otherwise.
|
|
@@ -25479,8 +25454,8 @@ async function locateAppOnMacOs({ macOsName, }) {
|
|
|
25479
25454
|
return null;
|
|
25480
25455
|
}
|
|
25481
25456
|
}
|
|
25482
|
-
|
|
25483
|
-
|
|
25457
|
+
// Note: [🟢] Code for Node executable locator [locateAppOnMacOs](src/executables/platforms/locateAppOnMacOs.ts) should never be published into packages that could be imported into browser environment
|
|
25458
|
+
// TODO: [🧠][♿] Maybe export through `@promptbook/node`
|
|
25484
25459
|
|
|
25485
25460
|
/**
|
|
25486
25461
|
* Attempts to locate the specified application on a Windows system by searching common installation directories.
|
|
@@ -25509,8 +25484,8 @@ async function locateAppOnWindows({ appName, windowsSuffix, }) {
|
|
|
25509
25484
|
return null;
|
|
25510
25485
|
}
|
|
25511
25486
|
}
|
|
25512
|
-
|
|
25513
|
-
|
|
25487
|
+
// Note: [🟢] Code for Node executable locator [locateAppOnWindows](src/executables/platforms/locateAppOnWindows.ts) should never be published into packages that could be imported into browser environment
|
|
25488
|
+
// TODO: [🧠][♿] Maybe export through `@promptbook/node`
|
|
25514
25489
|
|
|
25515
25490
|
/**
|
|
25516
25491
|
* Locates an application on the system
|
|
@@ -25547,8 +25522,8 @@ function locateApp(options) {
|
|
|
25547
25522
|
}
|
|
25548
25523
|
}
|
|
25549
25524
|
}
|
|
25550
|
-
|
|
25551
|
-
|
|
25525
|
+
// Note: [🟢] Code for Node executable locator [locateApp](src/executables/locateApp.ts) should never be published into packages that could be imported into browser environment
|
|
25526
|
+
// TODO: [🧠][♿] Maybe export through `@promptbook/node`
|
|
25552
25527
|
|
|
25553
25528
|
/**
|
|
25554
25529
|
* Locates the LibreOffice executable on the current system by searching platform-specific paths.
|
|
@@ -25564,8 +25539,8 @@ function locateLibreoffice() {
|
|
|
25564
25539
|
macOsName: 'LibreOffice',
|
|
25565
25540
|
});
|
|
25566
25541
|
}
|
|
25567
|
-
|
|
25568
|
-
|
|
25542
|
+
// Note: [🟢] Code for Node executable locator [locateLibreoffice](src/executables/apps/locateLibreoffice.ts) should never be published into packages that could be imported into browser environment
|
|
25543
|
+
// TODO: [🧠][♿] Maybe export through `@promptbook/node` OR `@promptbook/legacy-documents`
|
|
25569
25544
|
|
|
25570
25545
|
/**
|
|
25571
25546
|
* Locates the Pandoc executable on the current system by searching platform-specific paths.
|
|
@@ -25581,8 +25556,8 @@ function locatePandoc() {
|
|
|
25581
25556
|
macOsName: 'Pandoc',
|
|
25582
25557
|
});
|
|
25583
25558
|
}
|
|
25584
|
-
|
|
25585
|
-
|
|
25559
|
+
// Note: [🟢] Code for Node executable locator [locatePandoc](src/executables/apps/locatePandoc.ts) should never be published into packages that could be imported into browser environment
|
|
25560
|
+
// TODO: [🧠][♿] Maybe export through `@promptbook/node` OR `@promptbook/documents`
|
|
25586
25561
|
|
|
25587
25562
|
/**
|
|
25588
25563
|
* Provides paths to required executables (i.e. as Pandoc and LibreOffice) for Node.js environments.
|
|
@@ -25599,35 +25574,33 @@ async function $provideExecutablesForNode(options) {
|
|
|
25599
25574
|
// <- TODO: [🧠] `null` vs `undefined`
|
|
25600
25575
|
};
|
|
25601
25576
|
}
|
|
25602
|
-
|
|
25603
|
-
|
|
25604
|
-
|
|
25605
|
-
* TODO: [🏓] Unite `xxxForServer` and `xxxForNode` naming
|
|
25606
|
-
*/
|
|
25577
|
+
// Note: [🟢] Code for Node executable locator [$provideExecutablesForNode](src/executables/$provideExecutablesForNode.ts) should never be published into packages that could be imported into browser environment
|
|
25578
|
+
// TODO: [🧠] Allow to override the executables without need to call `locatePandoc` / `locateLibreoffice` in case of provided
|
|
25579
|
+
// TODO: [🏓] Unite `xxxForServer` and `xxxForNode` naming
|
|
25607
25580
|
|
|
25608
25581
|
/**
|
|
25609
25582
|
* Register for LLM tools metadata.
|
|
25610
25583
|
*
|
|
25611
25584
|
* Note: `$` is used to indicate that this interacts with the global scope
|
|
25585
|
+
*
|
|
25612
25586
|
* @singleton Only one instance of each register is created per build, but there can be more instances across different builds or environments.
|
|
25587
|
+
*
|
|
25613
25588
|
* @public exported from `@promptbook/core`
|
|
25614
25589
|
*/
|
|
25615
25590
|
const $llmToolsMetadataRegister = new $Register('llm_tools_metadata');
|
|
25616
|
-
|
|
25617
|
-
* TODO: [®] DRY Register logic
|
|
25618
|
-
*/
|
|
25591
|
+
// TODO: [®] DRY Register logic
|
|
25619
25592
|
|
|
25620
25593
|
/**
|
|
25621
25594
|
* Register for LLM tools.
|
|
25622
25595
|
*
|
|
25623
25596
|
* Note: `$` is used to indicate that this interacts with the global scope
|
|
25597
|
+
*
|
|
25624
25598
|
* @singleton Only one instance of each register is created per build, but there can be more instances across different builds or environments.
|
|
25599
|
+
*
|
|
25625
25600
|
* @public exported from `@promptbook/core`
|
|
25626
25601
|
*/
|
|
25627
25602
|
const $llmToolsRegister = new $Register('llm_execution_tools_constructors');
|
|
25628
|
-
|
|
25629
|
-
* TODO: [®] DRY Register logic
|
|
25630
|
-
*/
|
|
25603
|
+
// TODO: [®] DRY Register logic
|
|
25631
25604
|
|
|
25632
25605
|
/**
|
|
25633
25606
|
* Path to the `.env` file which was used to configure LLM tools
|
|
@@ -25764,10 +25737,8 @@ function $registeredLlmToolsMessage() {
|
|
|
25764
25737
|
.join('\n'))}
|
|
25765
25738
|
`);
|
|
25766
25739
|
}
|
|
25767
|
-
|
|
25768
|
-
|
|
25769
|
-
* TODO: [🧠][⚛] Maybe pass env as argument
|
|
25770
|
-
*/
|
|
25740
|
+
// TODO: [®] DRY Register logic
|
|
25741
|
+
// TODO: [🧠][⚛] Maybe pass env as argument
|
|
25771
25742
|
|
|
25772
25743
|
/**
|
|
25773
25744
|
* Provides the path to the `.env` file
|
|
@@ -25809,7 +25780,7 @@ async function $provideEnvFilename() {
|
|
|
25809
25780
|
}
|
|
25810
25781
|
return null;
|
|
25811
25782
|
}
|
|
25812
|
-
|
|
25783
|
+
// Note: [🟢] Code for Node environment helper [$provideEnvFilename](src/llm-providers/_common/register/$provideEnvFilename.ts) should never be published into packages that could be imported into browser environment
|
|
25813
25784
|
|
|
25814
25785
|
/**
|
|
25815
25786
|
* Provides LLM tools configuration by reading environment variables.
|
|
@@ -25823,6 +25794,7 @@ async function $provideEnvFilename() {
|
|
|
25823
25794
|
*
|
|
25824
25795
|
* @see Environment variables documentation or .env file for required variables.
|
|
25825
25796
|
* @returns A promise that resolves to the LLM tools configuration, or null if configuration is incomplete or missing.
|
|
25797
|
+
*
|
|
25826
25798
|
* @public exported from `@promptbook/node`
|
|
25827
25799
|
*/
|
|
25828
25800
|
async function $provideLlmToolsConfigurationFromEnv() {
|
|
@@ -25839,7 +25811,7 @@ async function $provideLlmToolsConfigurationFromEnv() {
|
|
|
25839
25811
|
.filter((configuration) => configuration !== null);
|
|
25840
25812
|
return llmToolsConfiguration;
|
|
25841
25813
|
}
|
|
25842
|
-
|
|
25814
|
+
// Note: [🟢] Code for Node environment helper [$provideLlmToolsConfigurationFromEnv](src/llm-providers/_common/register/$provideLlmToolsConfigurationFromEnv.ts) should never be published into packages that could be imported into browser environment
|
|
25843
25815
|
|
|
25844
25816
|
/**
|
|
25845
25817
|
* Creates LLM execution tools from provided configuration objects
|
|
@@ -25852,6 +25824,7 @@ async function $provideLlmToolsConfigurationFromEnv() {
|
|
|
25852
25824
|
* @param configuration Array of LLM tool configurations to instantiate
|
|
25853
25825
|
* @param options Additional options for configuring the LLM tools
|
|
25854
25826
|
* @returns A unified interface combining all successfully instantiated LLM tools
|
|
25827
|
+
*
|
|
25855
25828
|
* @public exported from `@promptbook/core`
|
|
25856
25829
|
*/
|
|
25857
25830
|
function createLlmToolsFromConfiguration(configuration, options = {}) {
|
|
@@ -25921,6 +25894,7 @@ function createLlmToolsFromConfiguration(configuration, options = {}) {
|
|
|
25921
25894
|
*
|
|
25922
25895
|
* @param options Configuration options for the LLM tools
|
|
25923
25896
|
* @returns A unified interface containing all detected and configured LLM tools
|
|
25897
|
+
*
|
|
25924
25898
|
* @public exported from `@promptbook/node`
|
|
25925
25899
|
*/
|
|
25926
25900
|
async function $provideLlmToolsFromEnv(options = {}) {
|
|
@@ -25945,27 +25919,26 @@ async function $provideLlmToolsFromEnv(options = {}) {
|
|
|
25945
25919
|
}
|
|
25946
25920
|
return createLlmToolsFromConfiguration(configuration, options);
|
|
25947
25921
|
}
|
|
25948
|
-
|
|
25949
|
-
|
|
25950
|
-
|
|
25951
|
-
|
|
25952
|
-
|
|
25953
|
-
|
|
25954
|
-
|
|
25955
|
-
|
|
25956
|
-
|
|
25957
|
-
|
|
25958
|
-
|
|
25959
|
-
|
|
25960
|
-
|
|
25961
|
-
|
|
25962
|
-
* TODO: [®] DRY Register logic
|
|
25963
|
-
*/
|
|
25922
|
+
// Note: [🟢] Code for Node environment helper [$provideLlmToolsFromEnv](src/llm-providers/_common/register/$provideLlmToolsFromEnv.ts) should never be published into packages that could be imported into browser environment
|
|
25923
|
+
// TODO: The architecture for LLM tools configuration consists of three key functions:
|
|
25924
|
+
// 1. `$provideLlmToolsFromEnv` - High-level function that detects available providers from env vars and returns ready-to-use LLM tools
|
|
25925
|
+
// 2. `$provideLlmToolsConfigurationFromEnv` - Middle layer that extracts configuration objects from environment variables
|
|
25926
|
+
// 3. `createLlmToolsFromConfiguration` - Low-level function that instantiates LLM tools from explicit configuration
|
|
25927
|
+
// This layered approach allows flexibility in how tools are configured:
|
|
25928
|
+
// - Use $provideLlmToolsFromEnv for automatic detection and setup in Node.js environments
|
|
25929
|
+
// - Use $provideLlmToolsConfigurationFromEnv to extract config objects for modification before instantiation
|
|
25930
|
+
// - Use createLlmToolsFromConfiguration for explicit control over tool configurations
|
|
25931
|
+
// TODO: [🧠][🍛] Which name is better `$provideLlmToolsFromEnv` or `$provideLlmToolsFromEnvironment`?
|
|
25932
|
+
// TODO: [🧠] Is there some meaningfull way how to test this util
|
|
25933
|
+
// TODO: [🥃] Allow `ptbk make` without llm tools
|
|
25934
|
+
// TODO: This should be maybe not under `_common` but under `utils`
|
|
25935
|
+
// TODO: [®] DRY Register logic
|
|
25964
25936
|
|
|
25965
25937
|
/**
|
|
25966
25938
|
* Provides a collection of scrapers optimized for Node.js environment.
|
|
25967
25939
|
* 1) `provideScrapersForNode` use as default
|
|
25968
25940
|
* 2) `provideScrapersForBrowser` use in limited browser environment *
|
|
25941
|
+
*
|
|
25969
25942
|
* @public exported from `@promptbook/node`
|
|
25970
25943
|
*/
|
|
25971
25944
|
async function $provideScrapersForNode(tools, options) {
|
|
@@ -25985,8 +25958,8 @@ async function $provideScrapersForNode(tools, options) {
|
|
|
25985
25958
|
}
|
|
25986
25959
|
return scrapers;
|
|
25987
25960
|
}
|
|
25988
|
-
|
|
25989
|
-
|
|
25961
|
+
// Note: [🟢] Code for Node scraper registration helper [$provideScrapersForNode](src/scrapers/_common/register/$provideScrapersForNode.ts) should never be published into packages that could be imported into browser environment
|
|
25962
|
+
// TODO: [🏓] Unite `xxxForServer` and `xxxForNode` naming
|
|
25990
25963
|
|
|
25991
25964
|
/**
|
|
25992
25965
|
* Extracts code block from markdown.
|
|
@@ -25999,8 +25972,9 @@ async function $provideScrapersForNode(tools, options) {
|
|
|
25999
25972
|
* - `extractOneBlockFromMarkdown` extracts exactly one code block with language of the code block
|
|
26000
25973
|
* - `extractAllBlocksFromMarkdown` extracts all code blocks with language of the code block
|
|
26001
25974
|
*
|
|
26002
|
-
* @public exported from `@promptbook/markdown-utils`
|
|
26003
25975
|
* @throws {ParseError} if there is not exactly one code block in the markdown
|
|
25976
|
+
*
|
|
25977
|
+
* @public exported from `@promptbook/markdown-utils`
|
|
26004
25978
|
*/
|
|
26005
25979
|
function extractBlock(markdown) {
|
|
26006
25980
|
const { content } = extractOneBlockFromMarkdown(markdown);
|
|
@@ -26012,7 +25986,7 @@ function extractBlock(markdown) {
|
|
|
26012
25986
|
*
|
|
26013
25987
|
* Note: [🔂] This function is idempotent.
|
|
26014
25988
|
* Note: This is useful for post-processing of the result of the chat LLM model
|
|
26015
|
-
*
|
|
25989
|
+
* when the model wraps the result in the (markdown) code block.
|
|
26016
25990
|
*
|
|
26017
25991
|
* @public exported from `@promptbook/markdown-utils`
|
|
26018
25992
|
*/
|
|
@@ -26031,7 +26005,7 @@ function trimCodeBlock(value) {
|
|
|
26031
26005
|
* Function trimEndOfCodeBlock will remove ending code block from the string if it is present.
|
|
26032
26006
|
*
|
|
26033
26007
|
* Note: This is useful for post-processing of the result of the completion LLM model
|
|
26034
|
-
*
|
|
26008
|
+
* if you want to start code block in the prompt but you don't want to end it in the result.
|
|
26035
26009
|
*
|
|
26036
26010
|
* @public exported from `@promptbook/markdown-utils`
|
|
26037
26011
|
*/
|
|
@@ -26043,6 +26017,8 @@ function trimEndOfCodeBlock(value) {
|
|
|
26043
26017
|
}
|
|
26044
26018
|
|
|
26045
26019
|
/**
|
|
26020
|
+
* Collection of preserved.
|
|
26021
|
+
*
|
|
26046
26022
|
* @private internal for `preserve`
|
|
26047
26023
|
*/
|
|
26048
26024
|
const _preserved = [];
|
|
@@ -26052,21 +26028,20 @@ const _preserved = [];
|
|
|
26052
26028
|
*
|
|
26053
26029
|
* @param value any function to preserve
|
|
26054
26030
|
* @returns nothing
|
|
26031
|
+
*
|
|
26055
26032
|
* @private within the repository
|
|
26056
26033
|
*/
|
|
26057
26034
|
function $preserve(...value) {
|
|
26058
26035
|
_preserved.push(...value);
|
|
26059
26036
|
}
|
|
26060
|
-
|
|
26061
|
-
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
26062
|
-
*/
|
|
26037
|
+
// Note: [💞] Ignore a discrepancy between file name and entity name
|
|
26063
26038
|
|
|
26064
26039
|
// Note: [💎]
|
|
26065
26040
|
/**
|
|
26066
26041
|
* ScriptExecutionTools for JavaScript implemented via eval
|
|
26067
26042
|
*
|
|
26068
26043
|
* Warning: It is used for testing and mocking
|
|
26069
|
-
*
|
|
26044
|
+
* **NOT intended to use in the production** due to its unsafe nature, use `JavascriptExecutionTools` instead.
|
|
26070
26045
|
*
|
|
26071
26046
|
* @public exported from `@promptbook/javascript`
|
|
26072
26047
|
*/
|
|
@@ -26261,23 +26236,22 @@ class JavascriptEvalExecutionTools {
|
|
|
26261
26236
|
return result;
|
|
26262
26237
|
}
|
|
26263
26238
|
}
|
|
26264
|
-
|
|
26265
|
-
|
|
26266
|
-
* TODO: [🧠][💙] Distinct between options passed into ExecutionTools and to ExecutionTools.execute
|
|
26267
|
-
*/
|
|
26239
|
+
// TODO: Put predefined functions (like removeQuotes, spaceTrim, etc.) into annotation OR pass into constructor
|
|
26240
|
+
// TODO: [🧠][💙] Distinct between options passed into ExecutionTools and to ExecutionTools.execute
|
|
26268
26241
|
|
|
26269
26242
|
/**
|
|
26270
26243
|
* Placeholder for better implementation of JavascriptExecutionTools - some proper sandboxing
|
|
26271
26244
|
*
|
|
26272
26245
|
* @alias JavascriptExecutionTools
|
|
26246
|
+
*
|
|
26273
26247
|
* @public exported from `@promptbook/javascript`
|
|
26274
26248
|
*/
|
|
26275
26249
|
const JavascriptExecutionTools = JavascriptEvalExecutionTools;
|
|
26276
26250
|
|
|
26277
26251
|
/**
|
|
26278
26252
|
* Note: There is unfortunately no equivalent for this function in the browser environment
|
|
26279
|
-
*
|
|
26280
|
-
*
|
|
26253
|
+
* because it is not possible automatically detect configured LLM providers
|
|
26254
|
+
* you need to provide them manually BUT you can help by utilities like `$provideScrapersForBrowser`
|
|
26281
26255
|
*
|
|
26282
26256
|
* @public exported from `@promptbook/node`
|
|
26283
26257
|
*/
|
|
@@ -26302,8 +26276,8 @@ async function $provideExecutionToolsForNode(options) {
|
|
|
26302
26276
|
};
|
|
26303
26277
|
return tools;
|
|
26304
26278
|
}
|
|
26305
|
-
|
|
26306
|
-
|
|
26279
|
+
// Note: [🟢] Code for Node execution helper [$provideExecutionToolsForNode](src/execution/utils/$provideExecutionToolsForNode.ts) should never be published into packages that could be imported into browser environment
|
|
26280
|
+
// TODO: [🏓] Unite `xxxForServer` and `xxxForNode` naming
|
|
26307
26281
|
|
|
26308
26282
|
/**
|
|
26309
26283
|
* Checks if the directory exists
|
|
@@ -26324,12 +26298,10 @@ async function isDirectoryExisting(directoryPath, fs) {
|
|
|
26324
26298
|
.catch(() => false);
|
|
26325
26299
|
return isDirectory;
|
|
26326
26300
|
}
|
|
26327
|
-
|
|
26328
|
-
|
|
26329
|
-
|
|
26330
|
-
|
|
26331
|
-
* TODO: [🖇] What about symlinks?
|
|
26332
|
-
*/
|
|
26301
|
+
// Note: Not [~🟢~] because it is not directly dependent on `fs
|
|
26302
|
+
// TODO: [🐠] This can be a validator - with variants that return true/false and variants that throw errors with meaningless messages
|
|
26303
|
+
// TODO: [🧠][📂] "directory" vs "folder"
|
|
26304
|
+
// TODO: [🖇] What about symlinks?
|
|
26333
26305
|
|
|
26334
26306
|
/**
|
|
26335
26307
|
* Reads all files in the directory
|
|
@@ -26337,6 +26309,7 @@ async function isDirectoryExisting(directoryPath, fs) {
|
|
|
26337
26309
|
* @param path
|
|
26338
26310
|
* @param isRecursive
|
|
26339
26311
|
* @returns List of all files in the directory
|
|
26312
|
+
*
|
|
26340
26313
|
* @private internal function of `AgentCollectionInDirectory` and `createPipelineCollectionFromDirectory`
|
|
26341
26314
|
*/
|
|
26342
26315
|
async function listAllFiles(path, isRecursive, fs) {
|
|
@@ -26358,11 +26331,9 @@ async function listAllFiles(path, isRecursive, fs) {
|
|
|
26358
26331
|
}
|
|
26359
26332
|
return fileNames;
|
|
26360
26333
|
}
|
|
26361
|
-
|
|
26362
|
-
|
|
26363
|
-
|
|
26364
|
-
* TODO: [🖇] What about symlinks?
|
|
26365
|
-
*/
|
|
26334
|
+
// TODO: [😶] Unite folder listing
|
|
26335
|
+
// Note: Not [~🟢~] because it is not directly dependent on `fs
|
|
26336
|
+
// TODO: [🖇] What about symlinks?
|
|
26366
26337
|
|
|
26367
26338
|
/**
|
|
26368
26339
|
* Constructs `PipelineCollection` from async sources
|
|
@@ -26372,17 +26343,18 @@ async function listAllFiles(path, isRecursive, fs) {
|
|
|
26372
26343
|
* - Factory function that returns Promise of array of PipelineJson or PipelineString
|
|
26373
26344
|
*
|
|
26374
26345
|
* Note: This is useful as internal tool for other constructor functions like
|
|
26375
|
-
*
|
|
26376
|
-
*
|
|
26346
|
+
* `createPipelineCollectionFromUrl` or `createPipelineCollectionFromDirectory`
|
|
26347
|
+
* Consider using those functions instead of this one
|
|
26377
26348
|
*
|
|
26378
26349
|
* Note: The function does NOT return promise it returns the collection directly which waits for the sources to be resolved
|
|
26379
|
-
*
|
|
26350
|
+
* when error occurs in given promise or factory function, it is thrown during `listPipelines` or `getPipelineByUrl` call
|
|
26380
26351
|
*
|
|
26381
26352
|
* Note: Consider using `createPipelineCollectionFromDirectory` or `createPipelineCollectionFromUrl`
|
|
26382
26353
|
*
|
|
26383
26354
|
* @param promptbookSourcesPromiseOrFactory
|
|
26384
26355
|
* @returns PipelineCollection
|
|
26385
26356
|
* @deprecated Do not use, it will became internal tool for other constructor functions
|
|
26357
|
+
*
|
|
26386
26358
|
* @public exported from `@promptbook/core`
|
|
26387
26359
|
*/
|
|
26388
26360
|
function createPipelineCollectionFromPromise(promptbookSourcesPromiseOrFactory) {
|
|
@@ -26426,6 +26398,7 @@ function createPipelineCollectionFromPromise(promptbookSourcesPromiseOrFactory)
|
|
|
26426
26398
|
* @param tools - Execution tools to be used for pipeline preparation if needed - If not provided, `$provideExecutionToolsForNode` will be used
|
|
26427
26399
|
* @param options - Options for the collection creation
|
|
26428
26400
|
* @returns PipelineCollection
|
|
26401
|
+
*
|
|
26429
26402
|
* @public exported from `@promptbook/node`
|
|
26430
26403
|
*/
|
|
26431
26404
|
async function createPipelineCollectionFromDirectory(rootPath, tools, options) {
|
|
@@ -26609,10 +26582,8 @@ async function createPipelineCollectionFromDirectory(rootPath, tools, options) {
|
|
|
26609
26582
|
}
|
|
26610
26583
|
return collection;
|
|
26611
26584
|
}
|
|
26612
|
-
|
|
26613
|
-
|
|
26614
|
-
* TODO: Maybe move from `@promptbook/node` to `@promptbook/core` as we removes direct dependency on `fs`
|
|
26615
|
-
*/
|
|
26585
|
+
// TODO: [🖇] What about symlinks? Maybe option `isSymlinksFollowed`
|
|
26586
|
+
// TODO: Maybe move from `@promptbook/node` to `@promptbook/core` as we removes direct dependency on `fs`
|
|
26616
26587
|
|
|
26617
26588
|
/**
|
|
26618
26589
|
* Provides script execution tools
|
|
@@ -26626,8 +26597,8 @@ async function $provideScriptingForNode(options) {
|
|
|
26626
26597
|
// TODO: [🔱] Do here auto-installation
|
|
26627
26598
|
return [new JavascriptExecutionTools({ ...options, functions: getAllCommitmentsToolFunctionsForNode() })];
|
|
26628
26599
|
}
|
|
26629
|
-
|
|
26630
|
-
|
|
26600
|
+
// Note: [🟢] Code for Node scraper registration helper [$provideScriptingForNode](src/scrapers/_common/register/$provideScriptingForNode.ts) should never be published into packages that could be imported into browser environment
|
|
26601
|
+
// TODO: [🏓] Unite `xxxForServer` and `xxxForNode` naming
|
|
26631
26602
|
|
|
26632
26603
|
/**
|
|
26633
26604
|
* Stringify the PipelineJson with proper formatting
|
|
@@ -26655,12 +26626,10 @@ function stringifyPipelineJson(pipeline) {
|
|
|
26655
26626
|
pipelineJsonStringified += '\n';
|
|
26656
26627
|
return pipelineJsonStringified;
|
|
26657
26628
|
}
|
|
26658
|
-
|
|
26659
|
-
|
|
26660
|
-
|
|
26661
|
-
|
|
26662
|
-
* TODO: [🍙] Make some standard order of json properties
|
|
26663
|
-
*/
|
|
26629
|
+
// TODO: [🐝] Not Working properly @see https://promptbook.studio/examples/mixed-knowledge.book
|
|
26630
|
+
// TODO: [🧠][0] Maybe rename to `stringifyPipelineJson`, `stringifyIndexedJson`,...
|
|
26631
|
+
// TODO: [🧠] Maybe more elegant solution than replacing via regex
|
|
26632
|
+
// TODO: [🍙] Make some standard order of json properties
|
|
26664
26633
|
|
|
26665
26634
|
/**
|
|
26666
26635
|
* A storage implementation that caches data in files organized in a directory structure.
|
|
@@ -26750,8 +26719,8 @@ class FileCacheStorage {
|
|
|
26750
26719
|
// [0] When `setItem` and `removeItem` called, the state of the file system should be the same
|
|
26751
26720
|
}
|
|
26752
26721
|
}
|
|
26753
|
-
|
|
26754
|
-
|
|
26722
|
+
// Note: [🟢] Code for Node file-cache storage [FileCacheStorage](src/storage/file-cache-storage/FileCacheStorage.ts) should never be published into packages that could be imported into browser environment
|
|
26723
|
+
// TODO: [🌗] Maybe some checkers, not all valid JSONs are desired and valid values
|
|
26755
26724
|
|
|
26756
26725
|
/**
|
|
26757
26726
|
* Run multiple commands in a shell in sequence
|
|
@@ -26768,7 +26737,7 @@ async function $execCommands({ commands, cwd, crashOnError, }) {
|
|
|
26768
26737
|
await $execCommand({ command, cwd, crashOnError });
|
|
26769
26738
|
}
|
|
26770
26739
|
}
|
|
26771
|
-
|
|
26740
|
+
// Note: [🟢] Code for Node command-execution helper [$execCommands](src/utils/execCommand/$execCommands.ts) should never be published into packages that could be imported into browser environment
|
|
26772
26741
|
|
|
26773
26742
|
/**
|
|
26774
26743
|
* Keep-alive helpers used for streaming chat responses.
|
|
@@ -26780,9 +26749,7 @@ async function $execCommands({ commands, cwd, crashOnError, }) {
|
|
|
26780
26749
|
* @private internal streaming helper for Promptbook chat connections
|
|
26781
26750
|
*/
|
|
26782
26751
|
const CHAT_STREAM_KEEP_ALIVE_TOKEN = 'STREAM_KEEP_ALIVE';
|
|
26783
|
-
|
|
26784
|
-
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
26785
|
-
*/
|
|
26752
|
+
// Note: [💞] Ignore a discrepancy between file name and entity name
|
|
26786
26753
|
|
|
26787
26754
|
/**
|
|
26788
26755
|
* Type guard to check if a string is a valid agent source
|
|
@@ -26812,6 +26779,7 @@ function validateBook(source) {
|
|
|
26812
26779
|
* Default book
|
|
26813
26780
|
*
|
|
26814
26781
|
* @deprecated Use `$generateBookBoilerplate` instead
|
|
26782
|
+
*
|
|
26815
26783
|
* @public exported from `@promptbook/core`
|
|
26816
26784
|
*/
|
|
26817
26785
|
padBook(validateBook(spaceTrim$1(`
|
|
@@ -26830,6 +26798,7 @@ padBook(validateBook(spaceTrim$1(`
|
|
|
26830
26798
|
*
|
|
26831
26799
|
* @param {string} pipelineString the candidate for a pipeline string
|
|
26832
26800
|
* @returns {boolean} if the string is a valid pipeline string
|
|
26801
|
+
*
|
|
26833
26802
|
* @public exported from `@promptbook/core`
|
|
26834
26803
|
*/
|
|
26835
26804
|
function isValidPipelineString(pipelineString) {
|
|
@@ -26842,9 +26811,7 @@ function isValidPipelineString(pipelineString) {
|
|
|
26842
26811
|
return false;
|
|
26843
26812
|
}
|
|
26844
26813
|
}
|
|
26845
|
-
|
|
26846
|
-
* TODO: [🧠][🈴] Where is the best location for this file
|
|
26847
|
-
*/
|
|
26814
|
+
// TODO: [🧠][🈴] Where is the best location for this file
|
|
26848
26815
|
|
|
26849
26816
|
/**
|
|
26850
26817
|
* Tag function for notating a pipeline with a book\`...\ notation as template literal
|
|
@@ -26857,6 +26824,7 @@ function isValidPipelineString(pipelineString) {
|
|
|
26857
26824
|
* @param strings The static string parts of the template literal
|
|
26858
26825
|
* @param values The dynamic values embedded within the template literal used as data
|
|
26859
26826
|
* @returns the pipeline string
|
|
26827
|
+
*
|
|
26860
26828
|
* @public exported from `@promptbook/core`
|
|
26861
26829
|
*/
|
|
26862
26830
|
function book(strings, ...values) {
|
|
@@ -26883,10 +26851,8 @@ function book(strings, ...values) {
|
|
|
26883
26851
|
}
|
|
26884
26852
|
return padBook(bookString);
|
|
26885
26853
|
}
|
|
26886
|
-
|
|
26887
|
-
|
|
26888
|
-
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
26889
|
-
*/
|
|
26854
|
+
// TODO: [🧠][🈴] Where is the best location for this file
|
|
26855
|
+
// Note: [💞] Ignore a discrepancy between file name and entity name
|
|
26890
26856
|
|
|
26891
26857
|
/**
|
|
26892
26858
|
* Tool call name emitted while preparing a GPT assistant for an agent.
|
|
@@ -26931,9 +26897,7 @@ const CHAT_STREAM_WHITESPACE_DECODERS = [
|
|
|
26931
26897
|
{ token: CHAT_STREAM_WHITESPACE_TOKEN_TAB, value: '\t' },
|
|
26932
26898
|
{ token: CHAT_STREAM_WHITESPACE_TOKEN_SPACE, value: ' ' },
|
|
26933
26899
|
];
|
|
26934
|
-
|
|
26935
|
-
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
26936
|
-
*/
|
|
26900
|
+
// Note: [💞] Ignore a discrepancy between file name and entity name
|
|
26937
26901
|
|
|
26938
26902
|
/**
|
|
26939
26903
|
* Converts encoded whitespace markers back into real whitespace so the UI can render the message
|
|
@@ -26951,6 +26915,9 @@ function decodeChatStreamWhitespaceFromTransport(content) {
|
|
|
26951
26915
|
}, content);
|
|
26952
26916
|
}
|
|
26953
26917
|
|
|
26918
|
+
/**
|
|
26919
|
+
* Constant for raw tool call ID fields.
|
|
26920
|
+
*/
|
|
26954
26921
|
const RAW_TOOL_CALL_ID_FIELDS = ['callId', 'call_id', 'id'];
|
|
26955
26922
|
/**
|
|
26956
26923
|
* Builds a deterministic idempotency key for tool calls so the UI can track updates.
|
|
@@ -26981,6 +26948,9 @@ function resolveToolCallIdempotencyKey(toolCall) {
|
|
|
26981
26948
|
}
|
|
26982
26949
|
return `fallback:${toolCall.name}`;
|
|
26983
26950
|
}
|
|
26951
|
+
/**
|
|
26952
|
+
* Gets arguments key.
|
|
26953
|
+
*/
|
|
26984
26954
|
function getArgumentsKey(value) {
|
|
26985
26955
|
if (typeof value === 'string') {
|
|
26986
26956
|
return value;
|
|
@@ -27054,6 +27024,7 @@ function mergeToolCalls(existingToolCalls, incomingToolCalls) {
|
|
|
27054
27024
|
* @param existingToolCall - Previous snapshot.
|
|
27055
27025
|
* @param incomingToolCall - New snapshot.
|
|
27056
27026
|
* @returns One merged snapshot.
|
|
27027
|
+
*
|
|
27057
27028
|
* @private helper of `mergeToolCalls`
|
|
27058
27029
|
*/
|
|
27059
27030
|
function mergeToolCallSnapshot(existingToolCall, incomingToolCall) {
|
|
@@ -27076,6 +27047,7 @@ function mergeToolCallSnapshot(existingToolCall, incomingToolCall) {
|
|
|
27076
27047
|
* @param existingToolCall - Previous snapshot.
|
|
27077
27048
|
* @param incomingToolCall - New snapshot.
|
|
27078
27049
|
* @returns Resolved lifecycle state or `undefined` when neither snapshot provides enough data.
|
|
27050
|
+
*
|
|
27079
27051
|
* @private helper of `mergeToolCalls`
|
|
27080
27052
|
*/
|
|
27081
27053
|
function resolveMergedToolCallState(existingToolCall, incomingToolCall) {
|
|
@@ -27089,6 +27061,7 @@ function resolveMergedToolCallState(existingToolCall, incomingToolCall) {
|
|
|
27089
27061
|
*
|
|
27090
27062
|
* @param toolCall - Tool call snapshot to inspect.
|
|
27091
27063
|
* @returns Inferred lifecycle state or `undefined`.
|
|
27064
|
+
*
|
|
27092
27065
|
* @private helper of `mergeToolCalls`
|
|
27093
27066
|
*/
|
|
27094
27067
|
function inferToolCallState(toolCall) {
|
|
@@ -27112,6 +27085,7 @@ function inferToolCallState(toolCall) {
|
|
|
27112
27085
|
* @param existingValues - Previous list.
|
|
27113
27086
|
* @param incomingValues - Incoming list.
|
|
27114
27087
|
* @returns Deduplicated merged list or `undefined`.
|
|
27088
|
+
*
|
|
27115
27089
|
* @private helper of `mergeToolCalls`
|
|
27116
27090
|
*/
|
|
27117
27091
|
function mergeUnknownLists(existingValues, incomingValues) {
|
|
@@ -27138,6 +27112,7 @@ function mergeUnknownLists(existingValues, incomingValues) {
|
|
|
27138
27112
|
*
|
|
27139
27113
|
* @param value - Value to serialize.
|
|
27140
27114
|
* @returns String signature.
|
|
27115
|
+
*
|
|
27141
27116
|
* @private helper of `mergeToolCalls`
|
|
27142
27117
|
*/
|
|
27143
27118
|
function serializeValueForMerge(value) {
|
|
@@ -27155,6 +27130,7 @@ function serializeValueForMerge(value) {
|
|
|
27155
27130
|
*
|
|
27156
27131
|
* @param toolCalls - Mutable list to deduplicate in-place.
|
|
27157
27132
|
* @returns The same array after removing redundant preparation entries.
|
|
27133
|
+
*
|
|
27158
27134
|
* @private helper of `mergeToolCalls`
|
|
27159
27135
|
*/
|
|
27160
27136
|
function deduplicatePreparationToolCalls(toolCalls) {
|
|
@@ -27212,6 +27188,7 @@ function createDefaultAgentName(agentSource) {
|
|
|
27212
27188
|
*
|
|
27213
27189
|
* @param rawDomain - Raw domain value (for example `my-agent.com` or `https://my-agent.com/path`).
|
|
27214
27190
|
* @returns Normalized hostname or `null` when the value cannot be normalized.
|
|
27191
|
+
*
|
|
27215
27192
|
* @private utility for host/domain matching
|
|
27216
27193
|
*/
|
|
27217
27194
|
function normalizeDomainForMatching(rawDomain) {
|
|
@@ -27234,6 +27211,7 @@ function normalizeDomainForMatching(rawDomain) {
|
|
|
27234
27211
|
*
|
|
27235
27212
|
* @param value - Raw value to inspect.
|
|
27236
27213
|
* @returns True when the value starts with `http://` or `https://`.
|
|
27214
|
+
*
|
|
27237
27215
|
* @private utility for host/domain matching
|
|
27238
27216
|
*/
|
|
27239
27217
|
function hasHttpProtocol(value) {
|
|
@@ -27249,6 +27227,7 @@ function hasHttpProtocol(value) {
|
|
|
27249
27227
|
*
|
|
27250
27228
|
* @param agentSource - Raw agent source.
|
|
27251
27229
|
* @returns Parsed prelude with shared line metadata.
|
|
27230
|
+
*
|
|
27252
27231
|
* @private internal utility of book agent-source parsing
|
|
27253
27232
|
*/
|
|
27254
27233
|
function parseAgentSourcePrelude(agentSource) {
|
|
@@ -27424,6 +27403,7 @@ function parseAgentSourceWithCommitments(agentSource) {
|
|
|
27424
27403
|
*
|
|
27425
27404
|
* @param text - Text to extract parameters from
|
|
27426
27405
|
* @returns Array of parsed parameters with unified representation
|
|
27406
|
+
*
|
|
27427
27407
|
* @public exported from `@promptbook/core`
|
|
27428
27408
|
*/
|
|
27429
27409
|
function parseParameters(text) {
|
|
@@ -27852,9 +27832,7 @@ function normalizeMetaDomain(content) {
|
|
|
27852
27832
|
const trimmed = spaceTrim$1(content);
|
|
27853
27833
|
return normalizeDomainForMatching(trimmed) || trimmed.toLowerCase();
|
|
27854
27834
|
}
|
|
27855
|
-
|
|
27856
|
-
* TODO: [🕛] Unite `AgentBasicInformation`, `ChatParticipant`, `LlmExecutionTools` + `LlmToolsMetadata`
|
|
27857
|
-
*/
|
|
27835
|
+
// TODO: [🕛] Unite `AgentBasicInformation`, `ChatParticipant`, `LlmExecutionTools` + `LlmToolsMetadata`
|
|
27858
27836
|
|
|
27859
27837
|
/**
|
|
27860
27838
|
* Gets all tool titles provided by all commitments
|
|
@@ -27880,6 +27858,7 @@ function getAllCommitmentsToolTitles() {
|
|
|
27880
27858
|
* Restricts an Updatable to a (2) BehaviorSubject variant
|
|
27881
27859
|
*
|
|
27882
27860
|
* @see Updatable
|
|
27861
|
+
*
|
|
27883
27862
|
* @private internal utility <- TODO: [🧠] Maybe export from `@promptbook/types`
|
|
27884
27863
|
*/
|
|
27885
27864
|
function asUpdatableSubject(value) {
|
|
@@ -27904,9 +27883,7 @@ function asUpdatableSubject(value) {
|
|
|
27904
27883
|
return new BehaviorSubject(value);
|
|
27905
27884
|
}
|
|
27906
27885
|
}
|
|
27907
|
-
|
|
27908
|
-
* TODO: [🧠] Maybe `BehaviorSubject` is too heavy for this use case, maybe just tuple `[value,setValue]` is enough
|
|
27909
|
-
*/
|
|
27886
|
+
// TODO: [🧠] Maybe `BehaviorSubject` is too heavy for this use case, maybe just tuple `[value,setValue]` is enough
|
|
27910
27887
|
|
|
27911
27888
|
/**
|
|
27912
27889
|
* Creates an empty/basic agent model requirements object
|
|
@@ -27941,12 +27918,11 @@ function createBasicAgentModelRequirements(agentName) {
|
|
|
27941
27918
|
systemMessage: `You are ${agentName || 'AI Agent'}`,
|
|
27942
27919
|
};
|
|
27943
27920
|
}
|
|
27944
|
-
|
|
27945
|
-
* TODO: [🐤] Deduplicate `AgentModelRequirements` and `ModelRequirements` model requirements
|
|
27946
|
-
*/
|
|
27921
|
+
// TODO: [🐤] Deduplicate `AgentModelRequirements` and `ModelRequirements` model requirements
|
|
27947
27922
|
|
|
27948
27923
|
/**
|
|
27949
27924
|
* Gets a commitment definition by its type
|
|
27925
|
+
*
|
|
27950
27926
|
* @param type The commitment type to look up
|
|
27951
27927
|
* @returns The commitment definition or null if not found
|
|
27952
27928
|
*
|
|
@@ -28325,7 +28301,9 @@ async function createAgentModelRequirementsWithCommitments(agentSource, modelNam
|
|
|
28325
28301
|
};
|
|
28326
28302
|
}
|
|
28327
28303
|
/**
|
|
28328
|
-
*
|
|
28304
|
+
* Attempts to upload inline knowledge entries, falling back to legacy data URLs when the upload fails or is not configured.
|
|
28305
|
+
*
|
|
28306
|
+
* @private
|
|
28329
28307
|
*/
|
|
28330
28308
|
async function applyPendingInlineKnowledgeSources(requirements, uploader) {
|
|
28331
28309
|
var _a;
|
|
@@ -28346,6 +28324,9 @@ async function applyPendingInlineKnowledgeSources(requirements, uploader) {
|
|
|
28346
28324
|
_metadata: stripInlineKnowledgeMetadata(requirements._metadata),
|
|
28347
28325
|
};
|
|
28348
28326
|
}
|
|
28327
|
+
/**
|
|
28328
|
+
* Handles upload inline knowledge source with fallback.
|
|
28329
|
+
*/
|
|
28349
28330
|
async function uploadInlineKnowledgeSourceWithFallback(inlineSource, uploader) {
|
|
28350
28331
|
try {
|
|
28351
28332
|
return await uploader(inlineSource);
|
|
@@ -28358,6 +28339,9 @@ async function uploadInlineKnowledgeSourceWithFallback(inlineSource, uploader) {
|
|
|
28358
28339
|
return inlineKnowledgeSourceToDataUrl(inlineSource);
|
|
28359
28340
|
}
|
|
28360
28341
|
}
|
|
28342
|
+
/**
|
|
28343
|
+
* Extracts inline knowledge sources.
|
|
28344
|
+
*/
|
|
28361
28345
|
function extractInlineKnowledgeSources(metadata) {
|
|
28362
28346
|
if (!metadata) {
|
|
28363
28347
|
return [];
|
|
@@ -28365,6 +28349,9 @@ function extractInlineKnowledgeSources(metadata) {
|
|
|
28365
28349
|
const value = metadata.inlineKnowledgeSources;
|
|
28366
28350
|
return Array.isArray(value) ? value : [];
|
|
28367
28351
|
}
|
|
28352
|
+
/**
|
|
28353
|
+
* Strips inline knowledge metadata.
|
|
28354
|
+
*/
|
|
28368
28355
|
function stripInlineKnowledgeMetadata(metadata) {
|
|
28369
28356
|
if (!metadata || !Object.prototype.hasOwnProperty.call(metadata, 'inlineKnowledgeSources')) {
|
|
28370
28357
|
return metadata;
|
|
@@ -28415,6 +28402,7 @@ function isBinaryMimeType(mimeType) {
|
|
|
28415
28402
|
* @param availableModels - Models that could fulfill the agent.
|
|
28416
28403
|
* @param llmTools - Execution tools used when selecting a best model.
|
|
28417
28404
|
* @param options - Optional hooks such as the agent reference resolver.
|
|
28405
|
+
*
|
|
28418
28406
|
* @public exported from `@promptbook/core`
|
|
28419
28407
|
*/
|
|
28420
28408
|
async function createAgentModelRequirements(agentSource, modelName, availableModels, llmTools, options) {
|
|
@@ -28434,6 +28422,7 @@ async function createAgentModelRequirements(agentSource, modelName, availableMod
|
|
|
28434
28422
|
* @param agentSource The agent source to derive persona description from
|
|
28435
28423
|
* @param llmTools LLM tools for preparing persona
|
|
28436
28424
|
* @returns The name of the best selected model
|
|
28425
|
+
*
|
|
28437
28426
|
* @private function of `createAgentModelRequirements`
|
|
28438
28427
|
*/
|
|
28439
28428
|
async function selectBestModelUsingPersona(agentSource, llmTools) {
|
|
@@ -28569,6 +28558,7 @@ function normalizeChatAttachment(rawAttachment) {
|
|
|
28569
28558
|
*
|
|
28570
28559
|
* @param {unknown} rawAttachments - The raw attachments to normalize.
|
|
28571
28560
|
* @returns {Array<ChatAttachment>} The normalized attachments.
|
|
28561
|
+
*
|
|
28572
28562
|
* @public exported from `@promptbook/core`
|
|
28573
28563
|
*/
|
|
28574
28564
|
function normalizeChatAttachments(rawAttachments) {
|
|
@@ -28613,6 +28603,7 @@ function formatChatAttachmentLine(attachment) {
|
|
|
28613
28603
|
*
|
|
28614
28604
|
* @param {ReadonlyArray<ChatAttachment>} attachments - The attachments to format.
|
|
28615
28605
|
* @returns {string} The formatted context.
|
|
28606
|
+
*
|
|
28616
28607
|
* @public exported from `@promptbook/core`
|
|
28617
28608
|
*/
|
|
28618
28609
|
function formatChatAttachmentContext(attachments) {
|
|
@@ -28633,6 +28624,7 @@ function formatChatAttachmentContext(attachments) {
|
|
|
28633
28624
|
* @param {number} maxBytes - Maximum number of bytes to capture.
|
|
28634
28625
|
* @param {{ captureOverflowByte?: boolean }} [options] - Optional capture behavior.
|
|
28635
28626
|
* @returns {Promise<{ bytes: Uint8Array }>} Captured bytes, optionally including one overflow byte.
|
|
28627
|
+
*
|
|
28636
28628
|
* @private internal utility for bounded response reads
|
|
28637
28629
|
*/
|
|
28638
28630
|
async function readResponseBytes(response, maxBytes, options = {}) {
|
|
@@ -28729,6 +28721,7 @@ function createAttachmentContentFailure(attachment, reason, options = {}) {
|
|
|
28729
28721
|
* @param {number} maxInlineCharacters - Maximum number of characters to inline.
|
|
28730
28722
|
* @param {ResolveChatAttachmentOptions} options - Options for resolution.
|
|
28731
28723
|
* @returns {Promise<ResolvedChatAttachmentContent>} The resolved content.
|
|
28724
|
+
*
|
|
28732
28725
|
* @private function of resolveChatAttachmentContents
|
|
28733
28726
|
*/
|
|
28734
28727
|
async function resolveChatAttachmentContent(attachment, maxInlineCharacters, options = {}) {
|
|
@@ -28820,6 +28813,7 @@ const CHAT_ATTACHMENT_MAX_INLINE_CHARACTERS_TOTAL = 24000;
|
|
|
28820
28813
|
* @param {ReadonlyArray<ChatAttachment>} attachments - The attachments to resolve.
|
|
28821
28814
|
* @param {ResolveChatAttachmentOptions} options - Options for resolution.
|
|
28822
28815
|
* @returns {Promise<Array<ResolvedChatAttachmentContent>>} The resolved contents.
|
|
28816
|
+
*
|
|
28823
28817
|
* @public exported from `@promptbook/core`
|
|
28824
28818
|
*/
|
|
28825
28819
|
async function resolveChatAttachmentContents(attachments, options = {}) {
|
|
@@ -28885,6 +28879,7 @@ function formatResolvedChatAttachmentContent(contentResolution) {
|
|
|
28885
28879
|
*
|
|
28886
28880
|
* @param {ReadonlyArray<ResolvedChatAttachmentContent>} resolvedContents - The resolved contents to format.
|
|
28887
28881
|
* @returns {string} The formatted context.
|
|
28882
|
+
*
|
|
28888
28883
|
* @public exported from `@promptbook/core`
|
|
28889
28884
|
*/
|
|
28890
28885
|
function formatChatAttachmentContentContext(resolvedContents) {
|
|
@@ -28925,6 +28920,7 @@ function appendChatContextSections(messageContent, contextSections) {
|
|
|
28925
28920
|
* @param {ReadonlyArray<ChatAttachment>} attachments - The attachments to append.
|
|
28926
28921
|
* @param {ResolveChatAttachmentOptions} options - Options for resolution.
|
|
28927
28922
|
* @returns {Promise<string>} The updated message content.
|
|
28923
|
+
*
|
|
28928
28924
|
* @public exported from `@promptbook/core`
|
|
28929
28925
|
*/
|
|
28930
28926
|
async function appendChatAttachmentContextWithContent(messageContent, attachments, options = {}) {
|
|
@@ -28953,9 +28949,7 @@ async function appendChatAttachmentContextWithContent(messageContent, attachment
|
|
|
28953
28949
|
function humanizeAiTextEllipsis(aiText) {
|
|
28954
28950
|
return aiText.replace(/[…⋯]/g, '...').replace(/\.\s+\.\s+\./g, '...');
|
|
28955
28951
|
}
|
|
28956
|
-
|
|
28957
|
-
* Note: [🏂] This function is not tested by itself but together with other cleanup functions with `humanizeAiText`
|
|
28958
|
-
*/
|
|
28952
|
+
// Note: [🏂] This function is not tested by itself but together with other cleanup functions with `humanizeAiText`
|
|
28959
28953
|
|
|
28960
28954
|
/**
|
|
28961
28955
|
* Change dash-like characters to regular dashes `—` -> `-` and remove soft hyphens
|
|
@@ -28968,9 +28962,7 @@ function humanizeAiTextEllipsis(aiText) {
|
|
|
28968
28962
|
function humanizeAiTextEmdashed(aiText) {
|
|
28969
28963
|
return aiText.replace(/\u00AD/g, '').replace(/[‐‑‒–—―−⁃﹣-]/g, '-');
|
|
28970
28964
|
}
|
|
28971
|
-
|
|
28972
|
-
* Note: [🏂] This function is not tested by itself but together with other cleanup functions with `humanizeAiText`
|
|
28973
|
-
*/
|
|
28965
|
+
// Note: [🏂] This function is not tested by itself but together with other cleanup functions with `humanizeAiText`
|
|
28974
28966
|
|
|
28975
28967
|
/**
|
|
28976
28968
|
* Change smart quotes to regular quotes
|
|
@@ -28983,9 +28975,7 @@ function humanizeAiTextEmdashed(aiText) {
|
|
|
28983
28975
|
function humanizeAiTextQuotes(aiText) {
|
|
28984
28976
|
return aiText.replace(/[“”„‟«»❝❞〝〞〟"]/g, '"').replace(/[‚‘’‛‹›❛❜'ʼ]/g, "'");
|
|
28985
28977
|
}
|
|
28986
|
-
|
|
28987
|
-
* Note: [🏂] This function is not tested by itself but together with other cleanup functions with `humanizeAiText`
|
|
28988
|
-
*/
|
|
28978
|
+
// Note: [🏂] This function is not tested by itself but together with other cleanup functions with `humanizeAiText`
|
|
28989
28979
|
|
|
28990
28980
|
/**
|
|
28991
28981
|
* Remove bracketed source citation artifacts like `\u30105:1\u2020source\u3011`.
|
|
@@ -28998,9 +28988,7 @@ function humanizeAiTextQuotes(aiText) {
|
|
|
28998
28988
|
function humanizeAiTextSources(aiText) {
|
|
28999
28989
|
return aiText.replace(/[ \t]*\u3010\s*\d+(?:\s*:\s*\d+)?\s*\u2020source\s*\u3011/g, '');
|
|
29000
28990
|
}
|
|
29001
|
-
|
|
29002
|
-
* Note: [??] This function is not tested by itself but together with other cleanup functions with `humanizeAiText`
|
|
29003
|
-
*/
|
|
28991
|
+
// Note: [??] This function is not tested by itself but together with other cleanup functions with `humanizeAiText`
|
|
29004
28992
|
|
|
29005
28993
|
/**
|
|
29006
28994
|
* Change unprintable hard spaces to regular spaces and drop zero-width spaces
|
|
@@ -29013,9 +29001,7 @@ function humanizeAiTextSources(aiText) {
|
|
|
29013
29001
|
function humanizeAiTextWhitespace(aiText) {
|
|
29014
29002
|
return aiText.replace(/[\u00A0\u1680\u2000-\u200A\u202F\u205F\u3000]/g, ' ').replace(/[\u200B\uFEFF\u2060]/g, '');
|
|
29015
29003
|
}
|
|
29016
|
-
|
|
29017
|
-
* Note: [🏂] This function is not tested by itself but together with other cleanup functions with `humanizeAiText`
|
|
29018
|
-
*/
|
|
29004
|
+
// Note: [🏂] This function is not tested by itself but together with other cleanup functions with `humanizeAiText`
|
|
29019
29005
|
|
|
29020
29006
|
/**
|
|
29021
29007
|
* Function `humanizeAiText` will remove traces of AI text generation artifacts
|
|
@@ -29034,11 +29020,11 @@ function humanizeAiText(aiText) {
|
|
|
29034
29020
|
cleanedText = humanizeAiTextWhitespace(cleanedText);
|
|
29035
29021
|
return cleanedText;
|
|
29036
29022
|
}
|
|
29037
|
-
|
|
29038
|
-
* TODO: [🧠] Maybe this should be exported from `@promptbook/utils` not `@promptbook/markdown-utils`
|
|
29039
|
-
*/
|
|
29023
|
+
// TODO: [🧠] Maybe this should be exported from `@promptbook/utils` not `@promptbook/markdown-utils`
|
|
29040
29024
|
|
|
29041
29025
|
/**
|
|
29026
|
+
* Map of promptbook pseudotoken substitution.
|
|
29027
|
+
*
|
|
29042
29028
|
* @private
|
|
29043
29029
|
*/
|
|
29044
29030
|
const PROMPTBOOK_PSEUDOTOKEN_SUBSTITUTION = {
|
|
@@ -29086,9 +29072,7 @@ function promptbookifyAiText(text) {
|
|
|
29086
29072
|
}
|
|
29087
29073
|
return promptbookifiedTextTokens.join('');
|
|
29088
29074
|
}
|
|
29089
|
-
|
|
29090
|
-
* TODO: [🧠][✌️] Make some Promptbook-native token system
|
|
29091
|
-
*/
|
|
29075
|
+
// TODO: [🧠][✌️] Make some Promptbook-native token system
|
|
29092
29076
|
|
|
29093
29077
|
/**
|
|
29094
29078
|
* Make UncertainNumber
|
|
@@ -29144,6 +29128,7 @@ function pricing(value) {
|
|
|
29144
29128
|
*
|
|
29145
29129
|
* @see https://platform.openai.com/docs/models/
|
|
29146
29130
|
* @see https://openai.com/api/pricing/
|
|
29131
|
+
*
|
|
29147
29132
|
* @public exported from `@promptbook/openai`
|
|
29148
29133
|
*/
|
|
29149
29134
|
const OPENAI_MODELS = exportJson({
|
|
@@ -29820,6 +29805,7 @@ const OPENAI_MODELS = exportJson({
|
|
|
29820
29805
|
* @param rawResponse The raw response from OpenAI API
|
|
29821
29806
|
* @param duration The duration of the execution
|
|
29822
29807
|
* @throws {PipelineExecutionError} If the usage is not defined in the response from OpenAI
|
|
29808
|
+
*
|
|
29823
29809
|
* @private internal utility of `OpenAiExecutionTools`
|
|
29824
29810
|
*/
|
|
29825
29811
|
function computeOpenAiUsage(promptContent, // <- Note: Intentionally using [] to access type properties to bring jsdoc from Prompt/PromptResult to consumer
|
|
@@ -29862,15 +29848,14 @@ resultContent, rawResponse, duration = ZERO_VALUE) {
|
|
|
29862
29848
|
},
|
|
29863
29849
|
};
|
|
29864
29850
|
}
|
|
29865
|
-
|
|
29866
|
-
* TODO: [🤝] DRY Maybe some common abstraction between `computeOpenAiUsage` and `computeAnthropicClaudeUsage`
|
|
29867
|
-
*/
|
|
29851
|
+
// TODO: [🤝] DRY Maybe some common abstraction between `computeOpenAiUsage` and `computeAnthropicClaudeUsage`
|
|
29868
29852
|
|
|
29869
29853
|
/**
|
|
29870
29854
|
* Parses an OpenAI error message to identify which parameter is unsupported
|
|
29871
29855
|
*
|
|
29872
29856
|
* @param errorMessage The error message from OpenAI API
|
|
29873
29857
|
* @returns The parameter name that is unsupported, or null if not an unsupported parameter error
|
|
29858
|
+
*
|
|
29874
29859
|
* @private utility of LLM Tools
|
|
29875
29860
|
*/
|
|
29876
29861
|
function parseUnsupportedParameterError(errorMessage) {
|
|
@@ -29892,6 +29877,7 @@ function parseUnsupportedParameterError(errorMessage) {
|
|
|
29892
29877
|
* @param modelRequirements Original model requirements
|
|
29893
29878
|
* @param unsupportedParameter The parameter to remove
|
|
29894
29879
|
* @returns New model requirements without the unsupported parameter
|
|
29880
|
+
*
|
|
29895
29881
|
* @private utility of LLM Tools
|
|
29896
29882
|
*/
|
|
29897
29883
|
function removeUnsupportedModelRequirement(modelRequirements, unsupportedParameter) {
|
|
@@ -29911,8 +29897,10 @@ function removeUnsupportedModelRequirement(modelRequirements, unsupportedParamet
|
|
|
29911
29897
|
}
|
|
29912
29898
|
/**
|
|
29913
29899
|
* Checks if an error is an "Unsupported value" error from OpenAI
|
|
29900
|
+
*
|
|
29914
29901
|
* @param error The error to check
|
|
29915
29902
|
* @returns true if this is an unsupported parameter error
|
|
29903
|
+
*
|
|
29916
29904
|
* @private utility of LLM Tools
|
|
29917
29905
|
*/
|
|
29918
29906
|
function isUnsupportedParameterError(error) {
|
|
@@ -31018,13 +31006,11 @@ class OpenAiCompatibleExecutionTools {
|
|
|
31018
31006
|
return false;
|
|
31019
31007
|
}
|
|
31020
31008
|
}
|
|
31021
|
-
|
|
31022
|
-
|
|
31023
|
-
|
|
31024
|
-
|
|
31025
|
-
|
|
31026
|
-
* TODO: [🧠][🦢] Make reverse adapter from LlmExecutionTools to OpenAI-compatible:
|
|
31027
|
-
*/
|
|
31009
|
+
// TODO: [🛄] Some way how to re-wrap the errors from `OpenAiCompatibleExecutionTools`
|
|
31010
|
+
// TODO: [🛄] Maybe make custom `OpenAiCompatibleError`
|
|
31011
|
+
// TODO: [🧠][🈁] Maybe use `isDeterministic` from options
|
|
31012
|
+
// TODO: [🧠][🌰] Allow to pass `title` for tracking purposes
|
|
31013
|
+
// TODO: [🧠][🦢] Make reverse adapter from LlmExecutionTools to OpenAI-compatible:
|
|
31028
31014
|
|
|
31029
31015
|
/**
|
|
31030
31016
|
* Profile for OpenAI provider
|
|
@@ -31092,9 +31078,21 @@ class OpenAiExecutionTools extends OpenAiCompatibleExecutionTools {
|
|
|
31092
31078
|
}
|
|
31093
31079
|
}
|
|
31094
31080
|
|
|
31081
|
+
/**
|
|
31082
|
+
* Constant for default knowledge source download timeout ms.
|
|
31083
|
+
*/
|
|
31095
31084
|
const DEFAULT_KNOWLEDGE_SOURCE_DOWNLOAD_TIMEOUT_MS = 30000;
|
|
31085
|
+
/**
|
|
31086
|
+
* Constant for default knowledge source upload timeout ms.
|
|
31087
|
+
*/
|
|
31096
31088
|
const DEFAULT_KNOWLEDGE_SOURCE_UPLOAD_TIMEOUT_MS = 900000;
|
|
31089
|
+
/**
|
|
31090
|
+
* Constant for vector store progress log interval min ms.
|
|
31091
|
+
*/
|
|
31097
31092
|
const VECTOR_STORE_PROGRESS_LOG_INTERVAL_MIN_MS = 15000;
|
|
31093
|
+
/**
|
|
31094
|
+
* Constant for vector store stall log threshold ms.
|
|
31095
|
+
*/
|
|
31098
31096
|
const VECTOR_STORE_STALL_LOG_THRESHOLD_MS = 30000;
|
|
31099
31097
|
/**
|
|
31100
31098
|
* Base class for OpenAI execution tools that need hosted vector stores.
|
|
@@ -31861,6 +31859,9 @@ class OpenAiVectorStoreHandler extends OpenAiExecutionTools {
|
|
|
31861
31859
|
}
|
|
31862
31860
|
}
|
|
31863
31861
|
|
|
31862
|
+
/**
|
|
31863
|
+
* Constant for default agent kit model name.
|
|
31864
|
+
*/
|
|
31864
31865
|
const DEFAULT_AGENT_KIT_MODEL_NAME = 'gpt-5.4-nano';
|
|
31865
31866
|
/**
|
|
31866
31867
|
* Creates one structured log entry for streamed tool-call updates.
|
|
@@ -31904,6 +31905,9 @@ function resolveFinalToolCallState$1(options) {
|
|
|
31904
31905
|
}
|
|
31905
31906
|
return 'COMPLETE';
|
|
31906
31907
|
}
|
|
31908
|
+
/**
|
|
31909
|
+
* Constant for default JSON schema name.
|
|
31910
|
+
*/
|
|
31907
31911
|
const DEFAULT_JSON_SCHEMA_NAME = 'StructuredOutput';
|
|
31908
31912
|
/**
|
|
31909
31913
|
* File extensions considered image inputs when MIME type is missing or generic.
|
|
@@ -32059,6 +32063,7 @@ function buildJsonSchemaDefinition(jsonSchema) {
|
|
|
32059
32063
|
*
|
|
32060
32064
|
* @param responseFormat - The OpenAI `response_format` payload from the user request.
|
|
32061
32065
|
* @returns An Agent output type compatible with the requested schema or `undefined` when no impact is required.
|
|
32066
|
+
*
|
|
32062
32067
|
* @private utility of Open AI
|
|
32063
32068
|
*/
|
|
32064
32069
|
function mapResponseFormatToAgentOutputType(responseFormat) {
|
|
@@ -32817,6 +32822,7 @@ function resolveFinalToolCallState(options) {
|
|
|
32817
32822
|
* - `RemoteAgent` - which is an `Agent` that connects to a Promptbook Agents Server
|
|
32818
32823
|
*
|
|
32819
32824
|
* @deprecated Use `OpenAiAgentKitExecutionTools` instead.
|
|
32825
|
+
*
|
|
32820
32826
|
* @public exported from `@promptbook/openai`
|
|
32821
32827
|
*/
|
|
32822
32828
|
class OpenAiAssistantExecutionTools extends OpenAiVectorStoreHandler {
|
|
@@ -33508,14 +33514,12 @@ class OpenAiAssistantExecutionTools extends OpenAiVectorStoreHandler {
|
|
|
33508
33514
|
* @private const of `OpenAiAssistantExecutionTools`
|
|
33509
33515
|
*/
|
|
33510
33516
|
const DISCRIMINANT = 'OPEN_AI_ASSISTANT_V1';
|
|
33511
|
-
|
|
33512
|
-
|
|
33513
|
-
|
|
33514
|
-
|
|
33515
|
-
|
|
33516
|
-
|
|
33517
|
-
* TODO: [🧠][🌰] Allow to pass `title` for tracking purposes
|
|
33518
|
-
*/
|
|
33517
|
+
// TODO: !!!!! [✨🥚] Knowledge should work both with and without scrapers
|
|
33518
|
+
// TODO: [🙎] In `OpenAiAssistantExecutionTools` Allow to create abstract assistants with `isCreatingNewAssistantsAllowed`
|
|
33519
|
+
// TODO: [🧠][🧙♂️] Maybe there can be some wizard for those who want to use just OpenAI
|
|
33520
|
+
// TODO: Maybe make custom OpenAiError
|
|
33521
|
+
// TODO: [🧠][🈁] Maybe use `isDeterministic` from options
|
|
33522
|
+
// TODO: [🧠][🌰] Allow to pass `title` for tracking purposes
|
|
33519
33523
|
|
|
33520
33524
|
/**
|
|
33521
33525
|
* Emits a progress update to signal assistant preparation before long setup work.
|
|
@@ -33992,10 +33996,8 @@ AgentLlmExecutionTools.assistantCache = new Map();
|
|
|
33992
33996
|
* Cache of OpenAI vector stores to avoid creating duplicates
|
|
33993
33997
|
*/
|
|
33994
33998
|
AgentLlmExecutionTools.vectorStoreCache = new Map();
|
|
33995
|
-
|
|
33996
|
-
|
|
33997
|
-
* TODO: [🧠] Adding parameter substitution support (here or should be responsibility of the underlying LLM Tools)
|
|
33998
|
-
*/
|
|
33999
|
+
// TODO: [🍚] Implement Destroyable pattern to free resources
|
|
34000
|
+
// TODO: [🧠] Adding parameter substitution support (here or should be responsibility of the underlying LLM Tools)
|
|
33999
34001
|
|
|
34000
34002
|
/**
|
|
34001
34003
|
* Extracts the teacher-focused instructions from the latest `OPEN` commitment in the book.
|
|
@@ -34005,6 +34007,7 @@ AgentLlmExecutionTools.vectorStoreCache = new Map();
|
|
|
34005
34007
|
*
|
|
34006
34008
|
* @param agentSource - The raw agent book source
|
|
34007
34009
|
* @returns The trimmed instructions or `null` when no instructive `OPEN` commitment exists.
|
|
34010
|
+
*
|
|
34008
34011
|
* @private Internal helper shared between self-learning and related features.
|
|
34009
34012
|
*/
|
|
34010
34013
|
function extractOpenTeacherInstructions(agentSource) {
|
|
@@ -34212,6 +34215,7 @@ class SelfLearningManager {
|
|
|
34212
34215
|
*
|
|
34213
34216
|
* @param section Raw fragment from self-learning workflow.
|
|
34214
34217
|
* @returns Trimmed fragment, or empty string when nothing remains.
|
|
34218
|
+
*
|
|
34215
34219
|
* @private function of Agent
|
|
34216
34220
|
*/
|
|
34217
34221
|
function normalizeBookSection(section) {
|
|
@@ -34223,6 +34227,7 @@ function normalizeBookSection(section) {
|
|
|
34223
34227
|
* @param agentSource Current source.
|
|
34224
34228
|
* @param normalizedSection Candidate fragment expected to be normalized first.
|
|
34225
34229
|
* @returns True when appending would duplicate an existing fragment.
|
|
34230
|
+
*
|
|
34226
34231
|
* @private function of Agent
|
|
34227
34232
|
*/
|
|
34228
34233
|
function containsNormalizedBookSection(agentSource, normalizedSection) {
|
|
@@ -34237,6 +34242,7 @@ function containsNormalizedBookSection(agentSource, normalizedSection) {
|
|
|
34237
34242
|
*
|
|
34238
34243
|
* @param responseFormat Prompt response format requirements
|
|
34239
34244
|
* @returns True when JSON schema mode is active
|
|
34245
|
+
*
|
|
34240
34246
|
* @private function of Agent
|
|
34241
34247
|
*/
|
|
34242
34248
|
function isJsonSchemaResponseFormat(responseFormat) {
|
|
@@ -34248,6 +34254,7 @@ function isJsonSchemaResponseFormat(responseFormat) {
|
|
|
34248
34254
|
* @param content Original agent answer content
|
|
34249
34255
|
* @param isJsonMode Whether the interaction requested JSON schema output
|
|
34250
34256
|
* @returns Agent answer, wrapped in a formatted JSON code block when possible
|
|
34257
|
+
*
|
|
34251
34258
|
* @private function of Agent
|
|
34252
34259
|
*/
|
|
34253
34260
|
function formatAgentMessageForJsonMode(content, isJsonMode) {
|
|
@@ -34273,6 +34280,7 @@ function formatAgentMessageForJsonMode(content, isJsonMode) {
|
|
|
34273
34280
|
*
|
|
34274
34281
|
* @param content Text to parse as JSON
|
|
34275
34282
|
* @returns Parsed JSON value or null when parsing fails
|
|
34283
|
+
*
|
|
34276
34284
|
* @private function of Agent
|
|
34277
34285
|
*/
|
|
34278
34286
|
function tryParseJson(content) {
|
|
@@ -34288,6 +34296,7 @@ function tryParseJson(content) {
|
|
|
34288
34296
|
*
|
|
34289
34297
|
* @param options - Normalized sample parts.
|
|
34290
34298
|
* @returns Book-language sample section ready to append into agent source.
|
|
34299
|
+
*
|
|
34291
34300
|
* @private function of Agent
|
|
34292
34301
|
*/
|
|
34293
34302
|
function formatSelfLearningSample(options) {
|
|
@@ -34309,6 +34318,7 @@ function formatSelfLearningSample(options) {
|
|
|
34309
34318
|
*
|
|
34310
34319
|
* @param internalMessage Internal trace payload.
|
|
34311
34320
|
* @returns Book-language INTERNAL MESSAGE block.
|
|
34321
|
+
*
|
|
34312
34322
|
* @private function of Agent
|
|
34313
34323
|
*/
|
|
34314
34324
|
function formatInternalLearningMessage(internalMessage) {
|
|
@@ -34322,6 +34332,7 @@ function formatInternalLearningMessage(internalMessage) {
|
|
|
34322
34332
|
*
|
|
34323
34333
|
* @param result Final chat result used in self-learning.
|
|
34324
34334
|
* @returns Internal payloads that capture request/response/tool-call context.
|
|
34335
|
+
*
|
|
34325
34336
|
* @private function of Agent
|
|
34326
34337
|
*/
|
|
34327
34338
|
function buildInternalLearningMessages(result) {
|
|
@@ -34351,6 +34362,7 @@ function buildInternalLearningMessages(result) {
|
|
|
34351
34362
|
*
|
|
34352
34363
|
* @param toolCall Tool call produced during execution.
|
|
34353
34364
|
* @returns Sanitized and serializable tool-call payload.
|
|
34365
|
+
*
|
|
34354
34366
|
* @private function of Agent
|
|
34355
34367
|
*/
|
|
34356
34368
|
function sanitizeToolCallForLearning(toolCall) {
|
|
@@ -34370,6 +34382,7 @@ function sanitizeToolCallForLearning(toolCall) {
|
|
|
34370
34382
|
*
|
|
34371
34383
|
* @param payload Internal payload to serialize.
|
|
34372
34384
|
* @returns Pretty JSON string that can be embedded in BOOK.
|
|
34385
|
+
*
|
|
34373
34386
|
* @private function of Agent
|
|
34374
34387
|
*/
|
|
34375
34388
|
function stringifyInternalLearningPayload(payload) {
|
|
@@ -34419,6 +34432,7 @@ function createEmptySelfLearningCommitmentCounts() {
|
|
|
34419
34432
|
* Normalizes teacher commitments into trimmed, display-ready lines.
|
|
34420
34433
|
*
|
|
34421
34434
|
* @param commitments Raw teacher output
|
|
34435
|
+
*
|
|
34422
34436
|
* @private function of Agent
|
|
34423
34437
|
*/
|
|
34424
34438
|
function getTeacherCommitmentLines(commitments) {
|
|
@@ -34431,6 +34445,7 @@ function getTeacherCommitmentLines(commitments) {
|
|
|
34431
34445
|
* Summarizes teacher commitment lines into user-friendly counts for self-learning.
|
|
34432
34446
|
*
|
|
34433
34447
|
* @param lines Parsed teacher commitment lines
|
|
34448
|
+
*
|
|
34434
34449
|
* @private function of Agent
|
|
34435
34450
|
*/
|
|
34436
34451
|
function summarizeTeacherCommitmentLines(lines) {
|
|
@@ -34463,6 +34478,7 @@ function summarizeTeacherCommitmentLines(lines) {
|
|
|
34463
34478
|
* @param commitments Raw teacher commitments
|
|
34464
34479
|
* @param used Whether the teacher was invoked
|
|
34465
34480
|
* @returns Summary of learned commitments
|
|
34481
|
+
*
|
|
34466
34482
|
* @private function of Agent
|
|
34467
34483
|
*/
|
|
34468
34484
|
function buildTeacherSummary(commitments, used) {
|
|
@@ -34699,9 +34715,7 @@ class Agent extends AgentLlmExecutionTools {
|
|
|
34699
34715
|
return finalResult;
|
|
34700
34716
|
}
|
|
34701
34717
|
}
|
|
34702
|
-
|
|
34703
|
-
* TODO: [🧠][😰]Agent is not working with the parameters, should it be?
|
|
34704
|
-
*/
|
|
34718
|
+
// TODO: [🧠][😰]Agent is not working with the parameters, should it be?
|
|
34705
34719
|
|
|
34706
34720
|
/**
|
|
34707
34721
|
* Parses one failed remote agent response into a structured error.
|
|
@@ -35167,10 +35181,8 @@ class RemoteAgent extends Agent {
|
|
|
35167
35181
|
return agentResult;
|
|
35168
35182
|
}
|
|
35169
35183
|
}
|
|
35170
|
-
|
|
35171
|
-
|
|
35172
|
-
* TODO: !!! Agent on remote server
|
|
35173
|
-
*/
|
|
35184
|
+
// TODO: [🧠][😰]Agent is not working with the parameters, should it be?
|
|
35185
|
+
// TODO: !!! Agent on remote server
|
|
35174
35186
|
|
|
35175
35187
|
var RemoteAgent$1 = /*#__PURE__*/Object.freeze({
|
|
35176
35188
|
__proto__: null,
|