@promptbook/markitdown 0.113.0-0 → 0.113.0-10
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 +1 -17
- package/esm/index.es.js +459 -453
- package/esm/index.es.js.map +1 -1
- package/esm/src/_packages/types.index.d.ts +2 -2
- package/esm/src/avatars/renderAvatarVisualAsciiArt.d.ts +98 -0
- package/esm/src/avatars/visuals/octopus3dAvatarVisualShared.d.ts +1 -1
- package/esm/src/book-components/BookEditor/BookEditorMonacoUploadPanel.d.ts +1 -1
- package/esm/src/book-components/BookEditor/useBookEditorMonacoUploads/bookEditorMonacoUploadTypes.d.ts +120 -0
- package/esm/src/book-components/BookEditor/useBookEditorMonacoUploads/clearScheduledTimer.d.ts +6 -0
- package/esm/src/book-components/BookEditor/useBookEditorMonacoUploads/enqueueFilesForUpload.d.ts +26 -0
- package/esm/src/book-components/BookEditor/useBookEditorMonacoUploads/useBookEditorMonacoUploadEditorSync.d.ts +23 -0
- package/esm/src/book-components/BookEditor/useBookEditorMonacoUploads/useBookEditorMonacoUploadItemsState.d.ts +21 -0
- package/esm/src/book-components/BookEditor/useBookEditorMonacoUploads/useBookEditorMonacoUploadProgressQueue.d.ts +12 -0
- package/esm/src/book-components/BookEditor/useBookEditorMonacoUploads/useBookEditorMonacoUploadQueue.d.ts +27 -0
- package/esm/src/book-components/BookEditor/useBookEditorMonacoUploads/useCompletedUploadsAutoClear.d.ts +12 -0
- package/esm/src/book-components/BookEditor/useBookEditorMonacoUploads.d.ts +5 -58
- package/esm/src/book-components/Chat/Chat/ChatImageAttachmentModal.d.ts +25 -0
- package/esm/src/book-components/Chat/Chat/ChatInputArea.d.ts +3 -0
- package/esm/src/book-components/Chat/Chat/ChatMessageAttachments.d.ts +27 -0
- package/esm/src/book-components/Chat/Chat/ChatMessageItem.d.ts +1 -1
- package/esm/src/book-components/Chat/Chat/ChatMessageList.d.ts +1 -0
- package/esm/src/book-components/Chat/Chat/ChatProps.d.ts +8 -0
- package/esm/src/book-components/Chat/Chat/CitationIframePreview.d.ts +2 -2
- package/esm/src/book-components/Chat/Chat/CitationIframePreview.test.d.ts +2 -0
- package/esm/src/book-components/Chat/Chat/insertDictationChunk.d.ts +1 -1
- package/esm/src/book-components/Chat/Chat/insertDictationChunk.test.d.ts +1 -0
- package/esm/src/book-components/Chat/Chat/learnDictationDictionary.test.d.ts +1 -0
- package/esm/src/book-components/Chat/Chat/refineFinalDictationChunk.test.d.ts +1 -0
- package/esm/src/book-components/Chat/Chat/useChatInputAreaComposer.d.ts +12 -0
- package/esm/src/book-components/Chat/Chat/useChatInputAreaComposer.draftMessage.test.d.ts +2 -0
- package/esm/src/book-components/Chat/utils/isVisibleChatToolCall.d.ts +1 -1
- package/esm/src/book-components/Chat/utils/parseMessageButtons.d.ts +16 -2
- package/esm/src/cli/cli-commands/agents-server/buildAgentsServer/AGENTS_SERVER_BUILD_CACHE_FILENAME.d.ts +6 -0
- package/esm/src/cli/cli-commands/agents-server/buildAgentsServer/AGENTS_SERVER_BUILD_CACHE_VERSION.d.ts +6 -0
- package/esm/src/cli/cli-commands/agents-server/buildAgentsServer/AGENTS_SERVER_NEXT_BUILD_ID_FILENAME.d.ts +6 -0
- package/esm/src/cli/cli-commands/agents-server/buildAgentsServer/AgentsServerBuildCache.d.ts +10 -0
- package/esm/src/cli/cli-commands/agents-server/buildAgentsServer/AgentsServerBuildCacheOptions.d.ts +10 -0
- package/esm/src/cli/cli-commands/agents-server/buildAgentsServer/NODE_MODULES_DIRECTORY_NAME.d.ts +6 -0
- package/esm/src/cli/cli-commands/agents-server/buildAgentsServer/PreparedAgentsServerRuntime.d.ts +18 -0
- package/esm/src/cli/cli-commands/agents-server/buildAgentsServer/createAgentsServerBuildSourceFingerprint.d.ts +6 -0
- package/esm/src/cli/cli-commands/agents-server/buildAgentsServer/createAgentsServerRuntimeEnvironment.d.ts +28 -0
- package/esm/src/cli/cli-commands/agents-server/buildAgentsServer/ensureAgentsServerBuild.d.ts +19 -0
- package/esm/src/cli/cli-commands/agents-server/buildAgentsServer/getAgentsServerBuildInputRelativePaths.d.ts +11 -0
- package/esm/src/cli/cli-commands/agents-server/buildAgentsServer/isAgentsServerAppPath.d.ts +6 -0
- package/esm/src/cli/cli-commands/agents-server/buildAgentsServer/isAgentsServerAppPathMaterialized.d.ts +6 -0
- package/esm/src/cli/cli-commands/agents-server/buildAgentsServer/isAgentsServerBuildCacheCurrent.d.ts +7 -0
- package/esm/src/cli/cli-commands/agents-server/buildAgentsServer/isAgentsServerBuildInputTestFile.d.ts +6 -0
- package/esm/src/cli/cli-commands/agents-server/buildAgentsServer/isExcludedAgentsServerBuildInputDirectoryName.d.ts +6 -0
- package/esm/src/cli/cli-commands/agents-server/buildAgentsServer/isExcludedAgentsServerBuildInputPath.d.ts +6 -0
- package/esm/src/cli/cli-commands/agents-server/buildAgentsServer/isExcludedAgentsServerRuntimeSourcePath.d.ts +6 -0
- package/esm/src/cli/cli-commands/agents-server/buildAgentsServer/isFile.d.ts +6 -0
- package/esm/src/cli/cli-commands/agents-server/buildAgentsServer/isPathInsideNodeModules.d.ts +6 -0
- package/esm/src/cli/cli-commands/agents-server/buildAgentsServer/normalizeAgentsServerBuildInputPath.d.ts +6 -0
- package/esm/src/cli/cli-commands/agents-server/buildAgentsServer/prepareAgentsServerRuntime.d.ts +9 -0
- package/esm/src/cli/cli-commands/agents-server/buildAgentsServer/readAgentsServerBuildCache.d.ts +8 -0
- package/esm/src/cli/cli-commands/agents-server/buildAgentsServer/resolveAgentsServerAppPath.d.ts +6 -0
- package/esm/src/cli/cli-commands/agents-server/buildAgentsServer/resolveAgentsServerBuildAppPath.d.ts +9 -0
- package/esm/src/cli/cli-commands/agents-server/buildAgentsServer/resolveAgentsServerBuildOutputPath.d.ts +7 -0
- package/esm/src/cli/cli-commands/agents-server/buildAgentsServer/resolveNextCliPath.d.ts +6 -0
- package/esm/src/cli/cli-commands/agents-server/buildAgentsServer/resolveNodeModulesPath.d.ts +6 -0
- package/esm/src/cli/cli-commands/agents-server/buildAgentsServer/runNextBuild.d.ts +12 -0
- package/esm/src/cli/cli-commands/agents-server/buildAgentsServer/shouldCopyAgentsServerRuntimePath.d.ts +6 -0
- package/esm/src/cli/cli-commands/agents-server/buildAgentsServer/synchronizeMaterializedAgentsServerRuntime.d.ts +11 -0
- package/esm/src/cli/cli-commands/agents-server/buildAgentsServer/writeAgentsServerBuildCache.d.ts +7 -0
- package/esm/src/cli/cli-commands/agents-server/buildAgentsServer.d.ts +8 -109
- package/esm/src/cli/cli-commands/agents-server/ensureAgentsServerEnvFile.d.ts +1 -1
- package/esm/src/cli/cli-commands/agents-server/ensureAgentsServerGitignoreFile.d.ts +1 -1
- package/esm/src/cli/cli-commands/agents-server/startAgentsServer/AgentsServerChildEnvironment.d.ts +16 -0
- package/esm/src/cli/cli-commands/agents-server/startAgentsServer/AgentsServerLogStreams.d.ts +30 -0
- package/esm/src/cli/cli-commands/agents-server/startAgentsServer/AgentsServerRuntimePaths.d.ts +19 -0
- package/esm/src/cli/cli-commands/agents-server/startAgentsServer/AgentsServerSupervisorState.d.ts +37 -0
- package/esm/src/cli/cli-commands/agents-server/startAgentsServer/LocalAgentRunnerLimits.d.ts +9 -0
- package/esm/src/cli/cli-commands/agents-server/startAgentsServer/PreparedAgentsServerLaunch.d.ts +13 -0
- package/esm/src/cli/cli-commands/agents-server/startAgentsServer/StartAgentsServerOptions.d.ts +24 -0
- package/esm/src/cli/cli-commands/agents-server/startAgentsServer/createInternalRouteErrorMessage.d.ts +6 -0
- package/esm/src/cli/cli-commands/agents-server/startAgentsServer/createLocalAgentRunOptions.d.ts +9 -0
- package/esm/src/cli/cli-commands/agents-server/startAgentsServer/forwardChildOutput.d.ts +13 -0
- package/esm/src/cli/cli-commands/agents-server/startAgentsServer/loadAgentsServerProjectEnvironment.d.ts +6 -0
- package/esm/src/cli/cli-commands/agents-server/startAgentsServer/prepareAgentsServerLaunch.d.ts +18 -0
- package/esm/src/cli/cli-commands/agents-server/startAgentsServer/readInternalRouteErrorDetails.d.ts +6 -0
- package/esm/src/cli/cli-commands/agents-server/startAgentsServer/resolveAgentsServerChildHostname.d.ts +7 -0
- package/esm/src/cli/cli-commands/agents-server/startAgentsServer/startNextServer.d.ts +20 -0
- package/esm/src/cli/cli-commands/agents-server/startAgentsServer/startUserChatJobWorkerPump.d.ts +15 -0
- package/esm/src/cli/cli-commands/agents-server/startAgentsServer/stopChildProcess.d.ts +8 -0
- package/esm/src/cli/cli-commands/agents-server/startAgentsServer/waitForLocalAgentRunnerLimits.d.ts +16 -0
- package/esm/src/cli/cli-commands/agents-server/startAgentsServer.d.ts +3 -30
- package/esm/src/cli/cli-commands/common/createPositiveIntegerOptionParser.d.ts +10 -0
- package/esm/src/cli/cli-commands/common/promptRunnerCliOptions.d.ts +1 -1
- package/esm/src/collection/agent-collection/CreateAgentInput.d.ts +1 -1
- package/esm/src/collection/agent-collection/constructors/agent-collection-in-supabase/prepareAgentSourceForPersistence.d.ts +1 -1
- package/esm/src/commitments/META/META.d.ts +2 -2
- package/esm/src/commitments/META_AVATAR/META_AVATAR.d.ts +9 -4
- package/esm/src/commitments/index.d.ts +1 -1
- package/esm/src/conversion/validation/validatePipeline/createPipelineValidationContext.d.ts +16 -0
- package/esm/src/conversion/validation/validatePipeline/validatePipelineCollectionsStructure.d.ts +7 -0
- package/esm/src/conversion/validation/validatePipeline/validatePipelineDependencyResolution.d.ts +7 -0
- package/esm/src/conversion/validation/validatePipeline/validatePipelineMetadata.d.ts +7 -0
- package/esm/src/conversion/validation/validatePipeline/validatePipelineParameters.d.ts +7 -0
- package/esm/src/conversion/validation/validatePipeline/validatePipelineTasks.d.ts +7 -0
- package/esm/src/llm-providers/_common/register/$registeredLlmToolsMessage/RegisteredLlmToolsMessageContext.d.ts +46 -0
- package/esm/src/llm-providers/_common/register/$registeredLlmToolsMessage/USED_ENV_FILENAME.d.ts +11 -0
- package/esm/src/llm-providers/_common/register/$registeredLlmToolsMessage/createRegisteredLlmToolConfigurationStatusMessage.d.ts +7 -0
- package/esm/src/llm-providers/_common/register/$registeredLlmToolsMessage/createRegisteredLlmToolEntryKey.d.ts +7 -0
- package/esm/src/llm-providers/_common/register/$registeredLlmToolsMessage/createRegisteredLlmToolInstallationStatusMessage.d.ts +7 -0
- package/esm/src/llm-providers/_common/register/$registeredLlmToolsMessage/createRegisteredLlmToolStatus.d.ts +14 -0
- package/esm/src/llm-providers/_common/register/$registeredLlmToolsMessage/createRegisteredLlmToolsMessageContext.d.ts +7 -0
- package/esm/src/llm-providers/_common/register/$registeredLlmToolsMessage/getAvailableRegisteredLlmToolsEnvironmentVariables.d.ts +7 -0
- package/esm/src/llm-providers/_common/register/$registeredLlmToolsMessage/getRegisteredLlmToolRegisters.d.ts +7 -0
- package/esm/src/llm-providers/_common/register/$registeredLlmToolsMessage/hasRegisteredLlmToolEntry.d.ts +7 -0
- package/esm/src/llm-providers/_common/register/$registeredLlmToolsMessage/listRegisteredLlmToolEntries.d.ts +9 -0
- package/esm/src/llm-providers/_common/register/$registeredLlmToolsMessage/listRegisteredLlmToolStatuses.d.ts +7 -0
- package/esm/src/llm-providers/_common/register/$registeredLlmToolsMessage/renderAvailableRegisteredLlmTools.d.ts +7 -0
- package/esm/src/llm-providers/_common/register/$registeredLlmToolsMessage/renderNoRegisteredLlmToolsMessage.d.ts +7 -0
- package/esm/src/llm-providers/_common/register/$registeredLlmToolsMessage/renderRegisteredLlmToolsMessage.d.ts +8 -0
- package/esm/src/llm-providers/_common/register/$registeredLlmToolsMessage/renderRelevantRegisteredLlmToolsEnvironmentVariables.d.ts +7 -0
- package/esm/src/utils/agent-message-runtime/agentMessageRuntimePaths.d.ts +24 -0
- package/esm/src/utils/agents/resolveAgentAvatarImageUrl.d.ts +2 -2
- package/esm/src/utils/ascii-art/$detectTerminalAnsiColorDepth.d.ts +15 -0
- package/esm/src/utils/ascii-art/convertImageDataToAsciiArt.d.ts +80 -0
- package/esm/src/utils/color/Color.d.ts +1 -1
- package/esm/src/version.d.ts +1 -1
- package/package.json +2 -2
- package/umd/index.umd.js +459 -453
- package/umd/index.umd.js.map +1 -1
- package/umd/src/_packages/types.index.d.ts +2 -2
- package/umd/src/avatars/renderAvatarVisualAsciiArt.d.ts +98 -0
- package/umd/src/avatars/visuals/octopus3dAvatarVisualShared.d.ts +1 -1
- package/umd/src/book-components/BookEditor/BookEditorMonacoUploadPanel.d.ts +1 -1
- package/umd/src/book-components/BookEditor/useBookEditorMonacoUploads/bookEditorMonacoUploadTypes.d.ts +120 -0
- package/umd/src/book-components/BookEditor/useBookEditorMonacoUploads/clearScheduledTimer.d.ts +6 -0
- package/umd/src/book-components/BookEditor/useBookEditorMonacoUploads/enqueueFilesForUpload.d.ts +26 -0
- package/umd/src/book-components/BookEditor/useBookEditorMonacoUploads/useBookEditorMonacoUploadEditorSync.d.ts +23 -0
- package/umd/src/book-components/BookEditor/useBookEditorMonacoUploads/useBookEditorMonacoUploadItemsState.d.ts +21 -0
- package/umd/src/book-components/BookEditor/useBookEditorMonacoUploads/useBookEditorMonacoUploadProgressQueue.d.ts +12 -0
- package/umd/src/book-components/BookEditor/useBookEditorMonacoUploads/useBookEditorMonacoUploadQueue.d.ts +27 -0
- package/umd/src/book-components/BookEditor/useBookEditorMonacoUploads/useCompletedUploadsAutoClear.d.ts +12 -0
- package/umd/src/book-components/BookEditor/useBookEditorMonacoUploads.d.ts +5 -58
- package/umd/src/book-components/Chat/Chat/ChatImageAttachmentModal.d.ts +25 -0
- package/umd/src/book-components/Chat/Chat/ChatInputArea.d.ts +3 -0
- package/umd/src/book-components/Chat/Chat/ChatMessageAttachments.d.ts +27 -0
- package/umd/src/book-components/Chat/Chat/ChatMessageItem.d.ts +1 -1
- package/umd/src/book-components/Chat/Chat/ChatMessageList.d.ts +1 -0
- package/umd/src/book-components/Chat/Chat/ChatProps.d.ts +8 -0
- package/umd/src/book-components/Chat/Chat/CitationIframePreview.d.ts +2 -2
- package/umd/src/book-components/Chat/Chat/CitationIframePreview.test.d.ts +2 -0
- package/umd/src/book-components/Chat/Chat/insertDictationChunk.d.ts +1 -1
- package/umd/src/book-components/Chat/Chat/insertDictationChunk.test.d.ts +1 -0
- package/umd/src/book-components/Chat/Chat/learnDictationDictionary.test.d.ts +1 -0
- package/umd/src/book-components/Chat/Chat/refineFinalDictationChunk.test.d.ts +1 -0
- package/umd/src/book-components/Chat/Chat/useChatInputAreaComposer.d.ts +12 -0
- package/umd/src/book-components/Chat/Chat/useChatInputAreaComposer.draftMessage.test.d.ts +2 -0
- package/umd/src/book-components/Chat/utils/isVisibleChatToolCall.d.ts +1 -1
- package/umd/src/book-components/Chat/utils/parseMessageButtons.d.ts +16 -2
- package/umd/src/cli/cli-commands/agents-server/buildAgentsServer/AGENTS_SERVER_BUILD_CACHE_FILENAME.d.ts +6 -0
- package/umd/src/cli/cli-commands/agents-server/buildAgentsServer/AGENTS_SERVER_BUILD_CACHE_VERSION.d.ts +6 -0
- package/umd/src/cli/cli-commands/agents-server/buildAgentsServer/AGENTS_SERVER_NEXT_BUILD_ID_FILENAME.d.ts +6 -0
- package/umd/src/cli/cli-commands/agents-server/buildAgentsServer/AgentsServerBuildCache.d.ts +10 -0
- package/umd/src/cli/cli-commands/agents-server/buildAgentsServer/AgentsServerBuildCacheOptions.d.ts +10 -0
- package/umd/src/cli/cli-commands/agents-server/buildAgentsServer/NODE_MODULES_DIRECTORY_NAME.d.ts +6 -0
- package/umd/src/cli/cli-commands/agents-server/buildAgentsServer/PreparedAgentsServerRuntime.d.ts +18 -0
- package/umd/src/cli/cli-commands/agents-server/buildAgentsServer/createAgentsServerBuildSourceFingerprint.d.ts +6 -0
- package/umd/src/cli/cli-commands/agents-server/buildAgentsServer/createAgentsServerRuntimeEnvironment.d.ts +28 -0
- package/umd/src/cli/cli-commands/agents-server/buildAgentsServer/ensureAgentsServerBuild.d.ts +19 -0
- package/umd/src/cli/cli-commands/agents-server/buildAgentsServer/getAgentsServerBuildInputRelativePaths.d.ts +11 -0
- package/umd/src/cli/cli-commands/agents-server/buildAgentsServer/isAgentsServerAppPath.d.ts +6 -0
- package/umd/src/cli/cli-commands/agents-server/buildAgentsServer/isAgentsServerAppPathMaterialized.d.ts +6 -0
- package/umd/src/cli/cli-commands/agents-server/buildAgentsServer/isAgentsServerBuildCacheCurrent.d.ts +7 -0
- package/umd/src/cli/cli-commands/agents-server/buildAgentsServer/isAgentsServerBuildInputTestFile.d.ts +6 -0
- package/umd/src/cli/cli-commands/agents-server/buildAgentsServer/isExcludedAgentsServerBuildInputDirectoryName.d.ts +6 -0
- package/umd/src/cli/cli-commands/agents-server/buildAgentsServer/isExcludedAgentsServerBuildInputPath.d.ts +6 -0
- package/umd/src/cli/cli-commands/agents-server/buildAgentsServer/isExcludedAgentsServerRuntimeSourcePath.d.ts +6 -0
- package/umd/src/cli/cli-commands/agents-server/buildAgentsServer/isFile.d.ts +6 -0
- package/umd/src/cli/cli-commands/agents-server/buildAgentsServer/isPathInsideNodeModules.d.ts +6 -0
- package/umd/src/cli/cli-commands/agents-server/buildAgentsServer/normalizeAgentsServerBuildInputPath.d.ts +6 -0
- package/umd/src/cli/cli-commands/agents-server/buildAgentsServer/prepareAgentsServerRuntime.d.ts +9 -0
- package/umd/src/cli/cli-commands/agents-server/buildAgentsServer/readAgentsServerBuildCache.d.ts +8 -0
- package/umd/src/cli/cli-commands/agents-server/buildAgentsServer/resolveAgentsServerAppPath.d.ts +6 -0
- package/umd/src/cli/cli-commands/agents-server/buildAgentsServer/resolveAgentsServerBuildAppPath.d.ts +9 -0
- package/umd/src/cli/cli-commands/agents-server/buildAgentsServer/resolveAgentsServerBuildOutputPath.d.ts +7 -0
- package/umd/src/cli/cli-commands/agents-server/buildAgentsServer/resolveNextCliPath.d.ts +6 -0
- package/umd/src/cli/cli-commands/agents-server/buildAgentsServer/resolveNodeModulesPath.d.ts +6 -0
- package/umd/src/cli/cli-commands/agents-server/buildAgentsServer/runNextBuild.d.ts +12 -0
- package/umd/src/cli/cli-commands/agents-server/buildAgentsServer/shouldCopyAgentsServerRuntimePath.d.ts +6 -0
- package/umd/src/cli/cli-commands/agents-server/buildAgentsServer/synchronizeMaterializedAgentsServerRuntime.d.ts +11 -0
- package/umd/src/cli/cli-commands/agents-server/buildAgentsServer/writeAgentsServerBuildCache.d.ts +7 -0
- package/umd/src/cli/cli-commands/agents-server/buildAgentsServer.d.ts +8 -109
- package/umd/src/cli/cli-commands/agents-server/ensureAgentsServerEnvFile.d.ts +1 -1
- package/umd/src/cli/cli-commands/agents-server/ensureAgentsServerGitignoreFile.d.ts +1 -1
- package/umd/src/cli/cli-commands/agents-server/startAgentsServer/AgentsServerChildEnvironment.d.ts +16 -0
- package/umd/src/cli/cli-commands/agents-server/startAgentsServer/AgentsServerLogStreams.d.ts +30 -0
- package/umd/src/cli/cli-commands/agents-server/startAgentsServer/AgentsServerRuntimePaths.d.ts +19 -0
- package/umd/src/cli/cli-commands/agents-server/startAgentsServer/AgentsServerSupervisorState.d.ts +37 -0
- package/umd/src/cli/cli-commands/agents-server/startAgentsServer/LocalAgentRunnerLimits.d.ts +9 -0
- package/umd/src/cli/cli-commands/agents-server/startAgentsServer/PreparedAgentsServerLaunch.d.ts +13 -0
- package/umd/src/cli/cli-commands/agents-server/startAgentsServer/StartAgentsServerOptions.d.ts +24 -0
- package/umd/src/cli/cli-commands/agents-server/startAgentsServer/createInternalRouteErrorMessage.d.ts +6 -0
- package/umd/src/cli/cli-commands/agents-server/startAgentsServer/createLocalAgentRunOptions.d.ts +9 -0
- package/umd/src/cli/cli-commands/agents-server/startAgentsServer/forwardChildOutput.d.ts +13 -0
- package/umd/src/cli/cli-commands/agents-server/startAgentsServer/loadAgentsServerProjectEnvironment.d.ts +6 -0
- package/umd/src/cli/cli-commands/agents-server/startAgentsServer/prepareAgentsServerLaunch.d.ts +18 -0
- package/umd/src/cli/cli-commands/agents-server/startAgentsServer/readInternalRouteErrorDetails.d.ts +6 -0
- package/umd/src/cli/cli-commands/agents-server/startAgentsServer/resolveAgentsServerChildHostname.d.ts +7 -0
- package/umd/src/cli/cli-commands/agents-server/startAgentsServer/startNextServer.d.ts +20 -0
- package/umd/src/cli/cli-commands/agents-server/startAgentsServer/startUserChatJobWorkerPump.d.ts +15 -0
- package/umd/src/cli/cli-commands/agents-server/startAgentsServer/stopChildProcess.d.ts +8 -0
- package/umd/src/cli/cli-commands/agents-server/startAgentsServer/waitForLocalAgentRunnerLimits.d.ts +16 -0
- package/umd/src/cli/cli-commands/agents-server/startAgentsServer.d.ts +3 -30
- package/umd/src/cli/cli-commands/common/createPositiveIntegerOptionParser.d.ts +10 -0
- package/umd/src/cli/cli-commands/common/promptRunnerCliOptions.d.ts +1 -1
- package/umd/src/collection/agent-collection/CreateAgentInput.d.ts +1 -1
- package/umd/src/collection/agent-collection/constructors/agent-collection-in-supabase/prepareAgentSourceForPersistence.d.ts +1 -1
- package/umd/src/commitments/META/META.d.ts +2 -2
- package/umd/src/commitments/META_AVATAR/META_AVATAR.d.ts +9 -4
- package/umd/src/commitments/index.d.ts +1 -1
- package/umd/src/conversion/validation/validatePipeline/createPipelineValidationContext.d.ts +16 -0
- package/umd/src/conversion/validation/validatePipeline/validatePipelineCollectionsStructure.d.ts +7 -0
- package/umd/src/conversion/validation/validatePipeline/validatePipelineDependencyResolution.d.ts +7 -0
- package/umd/src/conversion/validation/validatePipeline/validatePipelineMetadata.d.ts +7 -0
- package/umd/src/conversion/validation/validatePipeline/validatePipelineParameters.d.ts +7 -0
- package/umd/src/conversion/validation/validatePipeline/validatePipelineTasks.d.ts +7 -0
- package/umd/src/llm-providers/_common/register/$registeredLlmToolsMessage/RegisteredLlmToolsMessageContext.d.ts +46 -0
- package/umd/src/llm-providers/_common/register/$registeredLlmToolsMessage/USED_ENV_FILENAME.d.ts +11 -0
- package/umd/src/llm-providers/_common/register/$registeredLlmToolsMessage/createRegisteredLlmToolConfigurationStatusMessage.d.ts +7 -0
- package/umd/src/llm-providers/_common/register/$registeredLlmToolsMessage/createRegisteredLlmToolEntryKey.d.ts +7 -0
- package/umd/src/llm-providers/_common/register/$registeredLlmToolsMessage/createRegisteredLlmToolInstallationStatusMessage.d.ts +7 -0
- package/umd/src/llm-providers/_common/register/$registeredLlmToolsMessage/createRegisteredLlmToolStatus.d.ts +14 -0
- package/umd/src/llm-providers/_common/register/$registeredLlmToolsMessage/createRegisteredLlmToolsMessageContext.d.ts +7 -0
- package/umd/src/llm-providers/_common/register/$registeredLlmToolsMessage/getAvailableRegisteredLlmToolsEnvironmentVariables.d.ts +7 -0
- package/umd/src/llm-providers/_common/register/$registeredLlmToolsMessage/getRegisteredLlmToolRegisters.d.ts +7 -0
- package/umd/src/llm-providers/_common/register/$registeredLlmToolsMessage/hasRegisteredLlmToolEntry.d.ts +7 -0
- package/umd/src/llm-providers/_common/register/$registeredLlmToolsMessage/listRegisteredLlmToolEntries.d.ts +9 -0
- package/umd/src/llm-providers/_common/register/$registeredLlmToolsMessage/listRegisteredLlmToolStatuses.d.ts +7 -0
- package/umd/src/llm-providers/_common/register/$registeredLlmToolsMessage/renderAvailableRegisteredLlmTools.d.ts +7 -0
- package/umd/src/llm-providers/_common/register/$registeredLlmToolsMessage/renderNoRegisteredLlmToolsMessage.d.ts +7 -0
- package/umd/src/llm-providers/_common/register/$registeredLlmToolsMessage/renderRegisteredLlmToolsMessage.d.ts +8 -0
- package/umd/src/llm-providers/_common/register/$registeredLlmToolsMessage/renderRelevantRegisteredLlmToolsEnvironmentVariables.d.ts +7 -0
- package/umd/src/utils/agent-message-runtime/agentMessageRuntimePaths.d.ts +24 -0
- package/umd/src/utils/agents/resolveAgentAvatarImageUrl.d.ts +2 -2
- package/umd/src/utils/ascii-art/$detectTerminalAnsiColorDepth.d.ts +15 -0
- package/umd/src/utils/ascii-art/convertImageDataToAsciiArt.d.ts +80 -0
- package/umd/src/utils/color/Color.d.ts +1 -1
- package/umd/src/version.d.ts +1 -1
package/esm/index.es.js
CHANGED
|
@@ -23,7 +23,7 @@ const BOOK_LANGUAGE_VERSION = '2.0.0';
|
|
|
23
23
|
* @generated
|
|
24
24
|
* @see https://github.com/webgptorg/promptbook
|
|
25
25
|
*/
|
|
26
|
-
const PROMPTBOOK_ENGINE_VERSION = '0.113.0-
|
|
26
|
+
const PROMPTBOOK_ENGINE_VERSION = '0.113.0-10';
|
|
27
27
|
/**
|
|
28
28
|
* TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
|
|
29
29
|
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
@@ -104,6 +104,127 @@ function take(initialValue) {
|
|
|
104
104
|
});
|
|
105
105
|
}
|
|
106
106
|
|
|
107
|
+
/**
|
|
108
|
+
* Validates that a channel value is a valid number within the range of 0 to 255.
|
|
109
|
+
* Throws an error if the value is not valid.
|
|
110
|
+
*
|
|
111
|
+
* @param channelName - The name of the channel being validated.
|
|
112
|
+
* @param value - The value of the channel to validate.
|
|
113
|
+
* @throws Will throw an error if the value is not a valid channel number.
|
|
114
|
+
*
|
|
115
|
+
* @private util of `@promptbook/color`
|
|
116
|
+
*/
|
|
117
|
+
function checkChannelValue(channelName, value) {
|
|
118
|
+
if (typeof value !== 'number') {
|
|
119
|
+
throw new Error(`${channelName} channel value is not number but ${typeof value}`);
|
|
120
|
+
}
|
|
121
|
+
if (isNaN(value)) {
|
|
122
|
+
throw new Error(`${channelName} channel value is NaN`);
|
|
123
|
+
}
|
|
124
|
+
if (Math.round(value) !== value) {
|
|
125
|
+
throw new Error(`${channelName} channel is not whole number, it is ${value}`);
|
|
126
|
+
}
|
|
127
|
+
if (value < 0) {
|
|
128
|
+
throw new Error(`${channelName} channel is lower than 0, it is ${value}`);
|
|
129
|
+
}
|
|
130
|
+
if (value > 255) {
|
|
131
|
+
throw new Error(`${channelName} channel is greater than 255, it is ${value}`);
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
/**
|
|
136
|
+
* Shared immutable channel storage and serialization helpers for `Color`.
|
|
137
|
+
*
|
|
138
|
+
* @private base class of Color
|
|
139
|
+
*/
|
|
140
|
+
class ColorValue {
|
|
141
|
+
constructor(red, green, blue, alpha = 255) {
|
|
142
|
+
this.red = red;
|
|
143
|
+
this.green = green;
|
|
144
|
+
this.blue = blue;
|
|
145
|
+
this.alpha = alpha;
|
|
146
|
+
checkChannelValue('Red', red);
|
|
147
|
+
checkChannelValue('Green', green);
|
|
148
|
+
checkChannelValue('Blue', blue);
|
|
149
|
+
checkChannelValue('Alpha', alpha);
|
|
150
|
+
}
|
|
151
|
+
/**
|
|
152
|
+
* Shortcut for `red` property
|
|
153
|
+
* Number from 0 to 255
|
|
154
|
+
* @alias red
|
|
155
|
+
*/
|
|
156
|
+
get r() {
|
|
157
|
+
return this.red;
|
|
158
|
+
}
|
|
159
|
+
/**
|
|
160
|
+
* Shortcut for `green` property
|
|
161
|
+
* Number from 0 to 255
|
|
162
|
+
* @alias green
|
|
163
|
+
*/
|
|
164
|
+
get g() {
|
|
165
|
+
return this.green;
|
|
166
|
+
}
|
|
167
|
+
/**
|
|
168
|
+
* Shortcut for `blue` property
|
|
169
|
+
* Number from 0 to 255
|
|
170
|
+
* @alias blue
|
|
171
|
+
*/
|
|
172
|
+
get b() {
|
|
173
|
+
return this.blue;
|
|
174
|
+
}
|
|
175
|
+
/**
|
|
176
|
+
* Shortcut for `alpha` property
|
|
177
|
+
* Number from 0 (transparent) to 255 (opaque)
|
|
178
|
+
* @alias alpha
|
|
179
|
+
*/
|
|
180
|
+
get a() {
|
|
181
|
+
return this.alpha;
|
|
182
|
+
}
|
|
183
|
+
/**
|
|
184
|
+
* Shortcut for `alpha` property
|
|
185
|
+
* Number from 0 (transparent) to 255 (opaque)
|
|
186
|
+
* @alias alpha
|
|
187
|
+
*/
|
|
188
|
+
get opacity() {
|
|
189
|
+
return this.alpha;
|
|
190
|
+
}
|
|
191
|
+
/**
|
|
192
|
+
* Shortcut for 1-`alpha` property
|
|
193
|
+
*/
|
|
194
|
+
get transparency() {
|
|
195
|
+
return 255 - this.alpha;
|
|
196
|
+
}
|
|
197
|
+
clone() {
|
|
198
|
+
return take(this.createColor(this.red, this.green, this.blue, this.alpha));
|
|
199
|
+
}
|
|
200
|
+
toString() {
|
|
201
|
+
return this.toHex();
|
|
202
|
+
}
|
|
203
|
+
toHex() {
|
|
204
|
+
if (this.alpha === 255) {
|
|
205
|
+
return `#${this.red.toString(16).padStart(2, '0')}${this.green.toString(16).padStart(2, '0')}${this.blue
|
|
206
|
+
.toString(16)
|
|
207
|
+
.padStart(2, '0')}`;
|
|
208
|
+
}
|
|
209
|
+
else {
|
|
210
|
+
return `#${this.red.toString(16).padStart(2, '0')}${this.green.toString(16).padStart(2, '0')}${this.blue
|
|
211
|
+
.toString(16)
|
|
212
|
+
.padStart(2, '0')}${this.alpha.toString(16).padStart(2, '0')}`;
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
toRgb() {
|
|
216
|
+
if (this.alpha === 255) {
|
|
217
|
+
return `rgb(${this.red}, ${this.green}, ${this.blue})`;
|
|
218
|
+
}
|
|
219
|
+
else {
|
|
220
|
+
return `rgba(${this.red}, ${this.green}, ${this.blue}, ${Math.round((this.alpha / 255) * 100)}%)`;
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
toHsl() {
|
|
224
|
+
throw new Error(`Getting HSL is not implemented`);
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
|
|
107
228
|
/**
|
|
108
229
|
* 🎨 List of all 140 color names which are supported by CSS
|
|
109
230
|
*
|
|
@@ -263,127 +384,6 @@ const CSS_COLORS = {
|
|
|
263
384
|
};
|
|
264
385
|
// Note: [💞] Ignore a discrepancy between file name and entity name
|
|
265
386
|
|
|
266
|
-
/**
|
|
267
|
-
* Validates that a channel value is a valid number within the range of 0 to 255.
|
|
268
|
-
* Throws an error if the value is not valid.
|
|
269
|
-
*
|
|
270
|
-
* @param channelName - The name of the channel being validated.
|
|
271
|
-
* @param value - The value of the channel to validate.
|
|
272
|
-
* @throws Will throw an error if the value is not a valid channel number.
|
|
273
|
-
*
|
|
274
|
-
* @private util of `@promptbook/color`
|
|
275
|
-
*/
|
|
276
|
-
function checkChannelValue(channelName, value) {
|
|
277
|
-
if (typeof value !== 'number') {
|
|
278
|
-
throw new Error(`${channelName} channel value is not number but ${typeof value}`);
|
|
279
|
-
}
|
|
280
|
-
if (isNaN(value)) {
|
|
281
|
-
throw new Error(`${channelName} channel value is NaN`);
|
|
282
|
-
}
|
|
283
|
-
if (Math.round(value) !== value) {
|
|
284
|
-
throw new Error(`${channelName} channel is not whole number, it is ${value}`);
|
|
285
|
-
}
|
|
286
|
-
if (value < 0) {
|
|
287
|
-
throw new Error(`${channelName} channel is lower than 0, it is ${value}`);
|
|
288
|
-
}
|
|
289
|
-
if (value > 255) {
|
|
290
|
-
throw new Error(`${channelName} channel is greater than 255, it is ${value}`);
|
|
291
|
-
}
|
|
292
|
-
}
|
|
293
|
-
|
|
294
|
-
/**
|
|
295
|
-
* Shared immutable channel storage and serialization helpers for `Color`.
|
|
296
|
-
*
|
|
297
|
-
* @private base class of Color
|
|
298
|
-
*/
|
|
299
|
-
class ColorValue {
|
|
300
|
-
constructor(red, green, blue, alpha = 255) {
|
|
301
|
-
this.red = red;
|
|
302
|
-
this.green = green;
|
|
303
|
-
this.blue = blue;
|
|
304
|
-
this.alpha = alpha;
|
|
305
|
-
checkChannelValue('Red', red);
|
|
306
|
-
checkChannelValue('Green', green);
|
|
307
|
-
checkChannelValue('Blue', blue);
|
|
308
|
-
checkChannelValue('Alpha', alpha);
|
|
309
|
-
}
|
|
310
|
-
/**
|
|
311
|
-
* Shortcut for `red` property
|
|
312
|
-
* Number from 0 to 255
|
|
313
|
-
* @alias red
|
|
314
|
-
*/
|
|
315
|
-
get r() {
|
|
316
|
-
return this.red;
|
|
317
|
-
}
|
|
318
|
-
/**
|
|
319
|
-
* Shortcut for `green` property
|
|
320
|
-
* Number from 0 to 255
|
|
321
|
-
* @alias green
|
|
322
|
-
*/
|
|
323
|
-
get g() {
|
|
324
|
-
return this.green;
|
|
325
|
-
}
|
|
326
|
-
/**
|
|
327
|
-
* Shortcut for `blue` property
|
|
328
|
-
* Number from 0 to 255
|
|
329
|
-
* @alias blue
|
|
330
|
-
*/
|
|
331
|
-
get b() {
|
|
332
|
-
return this.blue;
|
|
333
|
-
}
|
|
334
|
-
/**
|
|
335
|
-
* Shortcut for `alpha` property
|
|
336
|
-
* Number from 0 (transparent) to 255 (opaque)
|
|
337
|
-
* @alias alpha
|
|
338
|
-
*/
|
|
339
|
-
get a() {
|
|
340
|
-
return this.alpha;
|
|
341
|
-
}
|
|
342
|
-
/**
|
|
343
|
-
* Shortcut for `alpha` property
|
|
344
|
-
* Number from 0 (transparent) to 255 (opaque)
|
|
345
|
-
* @alias alpha
|
|
346
|
-
*/
|
|
347
|
-
get opacity() {
|
|
348
|
-
return this.alpha;
|
|
349
|
-
}
|
|
350
|
-
/**
|
|
351
|
-
* Shortcut for 1-`alpha` property
|
|
352
|
-
*/
|
|
353
|
-
get transparency() {
|
|
354
|
-
return 255 - this.alpha;
|
|
355
|
-
}
|
|
356
|
-
clone() {
|
|
357
|
-
return take(this.createColor(this.red, this.green, this.blue, this.alpha));
|
|
358
|
-
}
|
|
359
|
-
toString() {
|
|
360
|
-
return this.toHex();
|
|
361
|
-
}
|
|
362
|
-
toHex() {
|
|
363
|
-
if (this.alpha === 255) {
|
|
364
|
-
return `#${this.red.toString(16).padStart(2, '0')}${this.green.toString(16).padStart(2, '0')}${this.blue
|
|
365
|
-
.toString(16)
|
|
366
|
-
.padStart(2, '0')}`;
|
|
367
|
-
}
|
|
368
|
-
else {
|
|
369
|
-
return `#${this.red.toString(16).padStart(2, '0')}${this.green.toString(16).padStart(2, '0')}${this.blue
|
|
370
|
-
.toString(16)
|
|
371
|
-
.padStart(2, '0')}${this.alpha.toString(16).padStart(2, '0')}`;
|
|
372
|
-
}
|
|
373
|
-
}
|
|
374
|
-
toRgb() {
|
|
375
|
-
if (this.alpha === 255) {
|
|
376
|
-
return `rgb(${this.red}, ${this.green}, ${this.blue})`;
|
|
377
|
-
}
|
|
378
|
-
else {
|
|
379
|
-
return `rgba(${this.red}, ${this.green}, ${this.blue}, ${Math.round((this.alpha / 255) * 100)}%)`;
|
|
380
|
-
}
|
|
381
|
-
}
|
|
382
|
-
toHsl() {
|
|
383
|
-
throw new Error(`Getting HSL is not implemented`);
|
|
384
|
-
}
|
|
385
|
-
}
|
|
386
|
-
|
|
387
387
|
/**
|
|
388
388
|
* Checks if the given value is a valid hex color string
|
|
389
389
|
*
|
|
@@ -2366,20 +2366,109 @@ function pipelineJsonToString(pipelineJson) {
|
|
|
2366
2366
|
// TODO: [🧠] Should be in generated .book.md file GENERATOR_WARNING
|
|
2367
2367
|
|
|
2368
2368
|
/**
|
|
2369
|
-
*
|
|
2370
|
-
*
|
|
2371
|
-
* @returns The same type of object as the input re-ordered
|
|
2369
|
+
* This error indicates that the promptbook object has valid syntax (=can be parsed) but contains logical errors (like circular dependencies)
|
|
2372
2370
|
*
|
|
2373
|
-
* @public exported from `@promptbook/
|
|
2371
|
+
* @public exported from `@promptbook/core`
|
|
2374
2372
|
*/
|
|
2375
|
-
|
|
2376
|
-
|
|
2377
|
-
|
|
2378
|
-
|
|
2379
|
-
|
|
2380
|
-
}
|
|
2381
|
-
|
|
2382
|
-
|
|
2373
|
+
class PipelineLogicError extends Error {
|
|
2374
|
+
constructor(message) {
|
|
2375
|
+
super(message);
|
|
2376
|
+
this.name = 'PipelineLogicError';
|
|
2377
|
+
Object.setPrototypeOf(this, PipelineLogicError.prototype);
|
|
2378
|
+
}
|
|
2379
|
+
}
|
|
2380
|
+
|
|
2381
|
+
/**
|
|
2382
|
+
* Creates the shared validation context for one pipeline.
|
|
2383
|
+
*
|
|
2384
|
+
* @private function of `validatePipeline`
|
|
2385
|
+
*/
|
|
2386
|
+
function createPipelineValidationContext(pipeline) {
|
|
2387
|
+
return {
|
|
2388
|
+
pipeline,
|
|
2389
|
+
pipelineIdentification: getPipelineIdentification(pipeline),
|
|
2390
|
+
};
|
|
2391
|
+
}
|
|
2392
|
+
/**
|
|
2393
|
+
* Builds a short file/url identification block for validation errors.
|
|
2394
|
+
*
|
|
2395
|
+
* @private internal utility of `validatePipeline`
|
|
2396
|
+
*/
|
|
2397
|
+
function getPipelineIdentification(pipeline) {
|
|
2398
|
+
// Note: This is a 😐 implementation of [🚞]
|
|
2399
|
+
const pipelineIdentificationParts = [];
|
|
2400
|
+
if (pipeline.sourceFile !== undefined) {
|
|
2401
|
+
pipelineIdentificationParts.push(`File: ${pipeline.sourceFile}`);
|
|
2402
|
+
}
|
|
2403
|
+
if (pipeline.pipelineUrl !== undefined) {
|
|
2404
|
+
pipelineIdentificationParts.push(`Url: ${pipeline.pipelineUrl}`);
|
|
2405
|
+
}
|
|
2406
|
+
return pipelineIdentificationParts.join('\n');
|
|
2407
|
+
}
|
|
2408
|
+
|
|
2409
|
+
/**
|
|
2410
|
+
* Validates that the expected top-level collections have array structure.
|
|
2411
|
+
*
|
|
2412
|
+
* @private function of `validatePipeline`
|
|
2413
|
+
*/
|
|
2414
|
+
function validatePipelineCollectionsStructure({ pipeline, pipelineIdentification, }) {
|
|
2415
|
+
validatePipelineParametersCollection(pipeline, pipelineIdentification);
|
|
2416
|
+
validatePipelineTasksCollection(pipeline, pipelineIdentification);
|
|
2417
|
+
}
|
|
2418
|
+
/**
|
|
2419
|
+
* Validates that `pipeline.parameters` is an array.
|
|
2420
|
+
*
|
|
2421
|
+
* @private internal utility of `validatePipelineCollectionsStructure`
|
|
2422
|
+
*/
|
|
2423
|
+
function validatePipelineParametersCollection(pipeline, pipelineIdentification) {
|
|
2424
|
+
// TODO: [🧠] Maybe do here some proper JSON-schema / ZOD checking
|
|
2425
|
+
if (Array.isArray(pipeline.parameters)) {
|
|
2426
|
+
return;
|
|
2427
|
+
}
|
|
2428
|
+
// TODO: [🧠] what is the correct error tp throw - maybe PromptbookSchemaError
|
|
2429
|
+
throw new ParseError(spaceTrim$1((block) => `
|
|
2430
|
+
Pipeline is valid JSON but with wrong structure
|
|
2431
|
+
|
|
2432
|
+
\`PipelineJson.parameters\` expected to be an array, but got ${typeof pipeline.parameters}
|
|
2433
|
+
|
|
2434
|
+
${block(pipelineIdentification)}
|
|
2435
|
+
`));
|
|
2436
|
+
}
|
|
2437
|
+
/**
|
|
2438
|
+
* Validates that `pipeline.tasks` is an array.
|
|
2439
|
+
*
|
|
2440
|
+
* @private internal utility of `validatePipelineCollectionsStructure`
|
|
2441
|
+
*/
|
|
2442
|
+
function validatePipelineTasksCollection(pipeline, pipelineIdentification) {
|
|
2443
|
+
// TODO: [🧠] Maybe do here some proper JSON-schema / ZOD checking
|
|
2444
|
+
if (Array.isArray(pipeline.tasks)) {
|
|
2445
|
+
return;
|
|
2446
|
+
}
|
|
2447
|
+
// TODO: [🧠] what is the correct error tp throw - maybe PromptbookSchemaError
|
|
2448
|
+
throw new ParseError(spaceTrim$1((block) => `
|
|
2449
|
+
Pipeline is valid JSON but with wrong structure
|
|
2450
|
+
|
|
2451
|
+
\`PipelineJson.tasks\` expected to be an array, but got ${typeof pipeline.tasks}
|
|
2452
|
+
|
|
2453
|
+
${block(pipelineIdentification)}
|
|
2454
|
+
`));
|
|
2455
|
+
}
|
|
2456
|
+
|
|
2457
|
+
/**
|
|
2458
|
+
* Orders JSON object by keys
|
|
2459
|
+
*
|
|
2460
|
+
* @returns The same type of object as the input re-ordered
|
|
2461
|
+
*
|
|
2462
|
+
* @public exported from `@promptbook/utils`
|
|
2463
|
+
*/
|
|
2464
|
+
function orderJson(options) {
|
|
2465
|
+
const { value, order } = options;
|
|
2466
|
+
const orderedValue = {
|
|
2467
|
+
...(order === undefined ? {} : Object.fromEntries(order.map((key) => [key, undefined]))),
|
|
2468
|
+
...value,
|
|
2469
|
+
};
|
|
2470
|
+
return orderedValue;
|
|
2471
|
+
}
|
|
2383
2472
|
|
|
2384
2473
|
/**
|
|
2385
2474
|
* Freezes the given object and all its nested objects recursively
|
|
@@ -2728,16 +2817,137 @@ const RESERVED_PARAMETER_NAMES = exportJson({
|
|
|
2728
2817
|
// Note: [💞] Ignore a discrepancy between file name and entity name
|
|
2729
2818
|
|
|
2730
2819
|
/**
|
|
2731
|
-
*
|
|
2820
|
+
* Validates that task dependencies can be resolved without cycles or missing definitions.
|
|
2732
2821
|
*
|
|
2733
|
-
* @
|
|
2822
|
+
* @private function of `validatePipeline`
|
|
2734
2823
|
*/
|
|
2735
|
-
|
|
2736
|
-
|
|
2737
|
-
|
|
2738
|
-
|
|
2739
|
-
|
|
2824
|
+
function validatePipelineDependencyResolution({ pipeline, pipelineIdentification, }) {
|
|
2825
|
+
let dependencyResolutionState = createInitialDependencyResolutionState(pipeline);
|
|
2826
|
+
let loopLimit = LOOP_LIMIT;
|
|
2827
|
+
while (hasUnresolvedTasks(dependencyResolutionState)) {
|
|
2828
|
+
if (loopLimit-- < 0) {
|
|
2829
|
+
throw createDependencyResolutionLoopLimitError(pipelineIdentification);
|
|
2830
|
+
}
|
|
2831
|
+
dependencyResolutionState = resolveNextDependencyResolutionState(dependencyResolutionState, pipelineIdentification);
|
|
2832
|
+
}
|
|
2833
|
+
}
|
|
2834
|
+
/**
|
|
2835
|
+
* Collects the parameter names that are already resolvable before dependency traversal starts.
|
|
2836
|
+
*
|
|
2837
|
+
* @private internal utility of `validatePipelineDependencyResolution`
|
|
2838
|
+
*/
|
|
2839
|
+
function createInitialDependencyResolutionState(pipeline) {
|
|
2840
|
+
return {
|
|
2841
|
+
resolvedParameterNames: createInitiallyResolvedParameterNames(pipeline),
|
|
2842
|
+
unresolvedTasks: [...pipeline.tasks],
|
|
2843
|
+
};
|
|
2844
|
+
}
|
|
2845
|
+
/**
|
|
2846
|
+
* Checks whether dependency resolution still has tasks left to process.
|
|
2847
|
+
*
|
|
2848
|
+
* @private internal utility of `validatePipelineDependencyResolution`
|
|
2849
|
+
*/
|
|
2850
|
+
function hasUnresolvedTasks({ unresolvedTasks }) {
|
|
2851
|
+
return unresolvedTasks.length > 0;
|
|
2852
|
+
}
|
|
2853
|
+
/**
|
|
2854
|
+
* Resolves the next batch of currently satisfiable tasks.
|
|
2855
|
+
*
|
|
2856
|
+
* @private internal utility of `validatePipelineDependencyResolution`
|
|
2857
|
+
*/
|
|
2858
|
+
function resolveNextDependencyResolutionState(dependencyResolutionState, pipelineIdentification) {
|
|
2859
|
+
const currentlyResolvedTasks = getCurrentlyResolvedTasks(dependencyResolutionState.unresolvedTasks, dependencyResolutionState.resolvedParameterNames);
|
|
2860
|
+
if (currentlyResolvedTasks.length === 0) {
|
|
2861
|
+
throw createUnresolvedTasksError(dependencyResolutionState.unresolvedTasks, dependencyResolutionState.resolvedParameterNames, pipelineIdentification);
|
|
2862
|
+
}
|
|
2863
|
+
return {
|
|
2864
|
+
resolvedParameterNames: appendResolvedTaskParameterNames(dependencyResolutionState.resolvedParameterNames, currentlyResolvedTasks),
|
|
2865
|
+
unresolvedTasks: dependencyResolutionState.unresolvedTasks.filter((task) => !currentlyResolvedTasks.includes(task)),
|
|
2866
|
+
};
|
|
2867
|
+
}
|
|
2868
|
+
/**
|
|
2869
|
+
* Collects the parameter names that are already resolvable before dependency traversal starts.
|
|
2870
|
+
*
|
|
2871
|
+
* @private internal utility of `validatePipelineDependencyResolution`
|
|
2872
|
+
*/
|
|
2873
|
+
function createInitiallyResolvedParameterNames(pipeline) {
|
|
2874
|
+
let resolvedParameterNames = pipeline.parameters
|
|
2875
|
+
.filter(({ isInput }) => isInput)
|
|
2876
|
+
.map(({ name }) => name);
|
|
2877
|
+
for (const reservedParameterName of RESERVED_PARAMETER_NAMES) {
|
|
2878
|
+
resolvedParameterNames = [...resolvedParameterNames, reservedParameterName];
|
|
2740
2879
|
}
|
|
2880
|
+
return resolvedParameterNames;
|
|
2881
|
+
}
|
|
2882
|
+
/**
|
|
2883
|
+
* Adds newly resolved task outputs to the resolved parameter list.
|
|
2884
|
+
*
|
|
2885
|
+
* @private internal utility of `validatePipelineDependencyResolution`
|
|
2886
|
+
*/
|
|
2887
|
+
function appendResolvedTaskParameterNames(resolvedParameterNames, currentlyResolvedTasks) {
|
|
2888
|
+
return [
|
|
2889
|
+
...resolvedParameterNames,
|
|
2890
|
+
...currentlyResolvedTasks.map(({ resultingParameterName }) => resultingParameterName),
|
|
2891
|
+
];
|
|
2892
|
+
}
|
|
2893
|
+
/**
|
|
2894
|
+
* Selects tasks whose dependencies are already resolved.
|
|
2895
|
+
*
|
|
2896
|
+
* @private internal utility of `validatePipelineDependencyResolution`
|
|
2897
|
+
*/
|
|
2898
|
+
function getCurrentlyResolvedTasks(unresolvedTasks, resolvedParameterNames) {
|
|
2899
|
+
return unresolvedTasks.filter((task) => task.dependentParameterNames.every((name) => resolvedParameterNames.includes(name)));
|
|
2900
|
+
}
|
|
2901
|
+
/**
|
|
2902
|
+
* Creates the unexpected loop-limit error for dependency resolution.
|
|
2903
|
+
*
|
|
2904
|
+
* @private internal utility of `validatePipelineDependencyResolution`
|
|
2905
|
+
*/
|
|
2906
|
+
function createDependencyResolutionLoopLimitError(pipelineIdentification) {
|
|
2907
|
+
// Note: Really UnexpectedError not LimitReachedError - this should not happen and be caught below
|
|
2908
|
+
return new UnexpectedError(spaceTrim$1((block) => `
|
|
2909
|
+
Loop limit reached during detection of circular dependencies in \`validatePipeline\`
|
|
2910
|
+
|
|
2911
|
+
${block(pipelineIdentification)}
|
|
2912
|
+
`));
|
|
2913
|
+
}
|
|
2914
|
+
/**
|
|
2915
|
+
* Creates the detailed error for unresolved or circular task dependencies.
|
|
2916
|
+
*
|
|
2917
|
+
* @private internal utility of `validatePipelineDependencyResolution`
|
|
2918
|
+
*/
|
|
2919
|
+
function createUnresolvedTasksError(unresolvedTasks, resolvedParameterNames, pipelineIdentification) {
|
|
2920
|
+
return new PipelineLogicError(
|
|
2921
|
+
// TODO: [🐎] DRY
|
|
2922
|
+
spaceTrim$1((block) => `
|
|
2923
|
+
|
|
2924
|
+
Can not resolve some parameters:
|
|
2925
|
+
Either you are using a parameter that is not defined, or there are some circular dependencies.
|
|
2926
|
+
|
|
2927
|
+
${block(pipelineIdentification)}
|
|
2928
|
+
|
|
2929
|
+
**Can not resolve:**
|
|
2930
|
+
${block(unresolvedTasks
|
|
2931
|
+
.map(({ resultingParameterName, dependentParameterNames }) => `- Parameter \`{${resultingParameterName}}\` which depends on ${dependentParameterNames
|
|
2932
|
+
.map((dependentParameterName) => `\`{${dependentParameterName}}\``)
|
|
2933
|
+
.join(' and ')}`)
|
|
2934
|
+
.join('\n'))}
|
|
2935
|
+
|
|
2936
|
+
**Resolved:**
|
|
2937
|
+
${block(resolvedParameterNames
|
|
2938
|
+
.filter((name) => !RESERVED_PARAMETER_NAMES.includes(name))
|
|
2939
|
+
.map((name) => `- Parameter \`{${name}}\``)
|
|
2940
|
+
.join('\n'))}
|
|
2941
|
+
|
|
2942
|
+
|
|
2943
|
+
**Reserved (which are available):**
|
|
2944
|
+
${block(resolvedParameterNames
|
|
2945
|
+
.filter((name) => RESERVED_PARAMETER_NAMES.includes(name))
|
|
2946
|
+
.map((name) => `- Parameter \`{${name}}\``)
|
|
2947
|
+
.join('\n'))}
|
|
2948
|
+
|
|
2949
|
+
|
|
2950
|
+
`));
|
|
2741
2951
|
}
|
|
2742
2952
|
|
|
2743
2953
|
/**
|
|
@@ -2815,171 +3025,22 @@ function isValidPipelineUrl(url) {
|
|
|
2815
3025
|
// TODO: [🐠] Maybe more info why the URL is invalid
|
|
2816
3026
|
|
|
2817
3027
|
/**
|
|
2818
|
-
* Validates
|
|
2819
|
-
*
|
|
2820
|
-
* It checks:
|
|
2821
|
-
* - if it has correct parameters dependency
|
|
2822
|
-
*
|
|
2823
|
-
* It does NOT check:
|
|
2824
|
-
* - if it is valid json
|
|
2825
|
-
* - if it is meaningful
|
|
2826
|
-
*
|
|
2827
|
-
* Note: [🔂] This function is idempotent.
|
|
3028
|
+
* Validates pipeline-level metadata fields.
|
|
2828
3029
|
*
|
|
2829
|
-
* @
|
|
2830
|
-
|
|
2831
|
-
|
|
3030
|
+
* @private function of `validatePipeline`
|
|
3031
|
+
*/
|
|
3032
|
+
function validatePipelineMetadata({ pipeline, pipelineIdentification }) {
|
|
3033
|
+
validatePipelineUrl(pipeline, pipelineIdentification);
|
|
3034
|
+
validatePipelineBookVersion(pipeline, pipelineIdentification);
|
|
3035
|
+
}
|
|
3036
|
+
/**
|
|
3037
|
+
* Validates the pipeline URL, when present.
|
|
2832
3038
|
*
|
|
2833
|
-
* @
|
|
3039
|
+
* @private internal utility of `validatePipelineMetadata`
|
|
2834
3040
|
*/
|
|
2835
|
-
function
|
|
2836
|
-
if (
|
|
2837
|
-
|
|
2838
|
-
}
|
|
2839
|
-
else {
|
|
2840
|
-
try {
|
|
2841
|
-
validatePipeline_InnerFunction(pipeline);
|
|
2842
|
-
}
|
|
2843
|
-
catch (error) {
|
|
2844
|
-
if (!(error instanceof PipelineLogicError)) {
|
|
2845
|
-
throw error;
|
|
2846
|
-
}
|
|
2847
|
-
console.error(spaceTrim$1((block) => `
|
|
2848
|
-
Pipeline is not valid but logic errors are temporarily disabled via \`IS_PIPELINE_LOGIC_VALIDATED\`
|
|
2849
|
-
|
|
2850
|
-
${block(error.message)}
|
|
2851
|
-
`));
|
|
2852
|
-
}
|
|
2853
|
-
}
|
|
2854
|
-
return pipeline;
|
|
2855
|
-
}
|
|
2856
|
-
/**
|
|
2857
|
-
* Validates pipeline inner function.
|
|
2858
|
-
*
|
|
2859
|
-
* @private internal function for `validatePipeline`
|
|
2860
|
-
*/
|
|
2861
|
-
function validatePipeline_InnerFunction(pipeline) {
|
|
2862
|
-
// TODO: [🧠] Maybe test if promptbook is a promise and make specific error case for that
|
|
2863
|
-
const context = createPipelineValidationContext(pipeline);
|
|
2864
|
-
validatePipelineMetadata(context);
|
|
2865
|
-
validatePipelineCollectionsStructure(context);
|
|
2866
|
-
validatePipelineParameters(context);
|
|
2867
|
-
validatePipelineTasks(context);
|
|
2868
|
-
validatePipelineDependencyResolution(context);
|
|
2869
|
-
// Note: Check that formfactor is corresponding to the pipeline interface
|
|
2870
|
-
// TODO: !!6 Implement this
|
|
2871
|
-
// pipeline.formfactorName
|
|
2872
|
-
}
|
|
2873
|
-
/**
|
|
2874
|
-
* Creates the shared validation context for one pipeline.
|
|
2875
|
-
*
|
|
2876
|
-
* @private internal utility of `validatePipeline`
|
|
2877
|
-
*/
|
|
2878
|
-
function createPipelineValidationContext(pipeline) {
|
|
2879
|
-
return {
|
|
2880
|
-
pipeline,
|
|
2881
|
-
pipelineIdentification: getPipelineIdentification(pipeline),
|
|
2882
|
-
};
|
|
2883
|
-
}
|
|
2884
|
-
/**
|
|
2885
|
-
* Builds a short file/url identification block for validation errors.
|
|
2886
|
-
*
|
|
2887
|
-
* @private internal utility of `validatePipeline`
|
|
2888
|
-
*/
|
|
2889
|
-
function getPipelineIdentification(pipeline) {
|
|
2890
|
-
// Note: This is a 😐 implementation of [🚞]
|
|
2891
|
-
const pipelineIdentificationParts = [];
|
|
2892
|
-
if (pipeline.sourceFile !== undefined) {
|
|
2893
|
-
pipelineIdentificationParts.push(`File: ${pipeline.sourceFile}`);
|
|
2894
|
-
}
|
|
2895
|
-
if (pipeline.pipelineUrl !== undefined) {
|
|
2896
|
-
pipelineIdentificationParts.push(`Url: ${pipeline.pipelineUrl}`);
|
|
2897
|
-
}
|
|
2898
|
-
return pipelineIdentificationParts.join('\n');
|
|
2899
|
-
}
|
|
2900
|
-
/**
|
|
2901
|
-
* Validates pipeline-level metadata fields.
|
|
2902
|
-
*
|
|
2903
|
-
* @private internal step of `validatePipeline`
|
|
2904
|
-
*/
|
|
2905
|
-
function validatePipelineMetadata({ pipeline, pipelineIdentification }) {
|
|
2906
|
-
validatePipelineUrl(pipeline, pipelineIdentification);
|
|
2907
|
-
validatePipelineBookVersion(pipeline, pipelineIdentification);
|
|
2908
|
-
}
|
|
2909
|
-
/**
|
|
2910
|
-
* Validates that the expected top-level collections have array structure.
|
|
2911
|
-
*
|
|
2912
|
-
* @private internal step of `validatePipeline`
|
|
2913
|
-
*/
|
|
2914
|
-
function validatePipelineCollectionsStructure({ pipeline, pipelineIdentification }) {
|
|
2915
|
-
validatePipelineParametersCollection(pipeline, pipelineIdentification);
|
|
2916
|
-
validatePipelineTasksCollection(pipeline, pipelineIdentification);
|
|
2917
|
-
}
|
|
2918
|
-
/**
|
|
2919
|
-
* Validates all pipeline parameter declarations.
|
|
2920
|
-
*
|
|
2921
|
-
* @private internal step of `validatePipeline`
|
|
2922
|
-
*/
|
|
2923
|
-
function validatePipelineParameters({ pipeline, pipelineIdentification }) {
|
|
2924
|
-
for (const parameter of pipeline.parameters) {
|
|
2925
|
-
validatePipelineParameter(parameter, pipeline, pipelineIdentification);
|
|
2926
|
-
}
|
|
2927
|
-
}
|
|
2928
|
-
/**
|
|
2929
|
-
* Validates all pipeline tasks and their per-task invariants.
|
|
2930
|
-
*
|
|
2931
|
-
* @private internal step of `validatePipeline`
|
|
2932
|
-
*/
|
|
2933
|
-
function validatePipelineTasks({ pipeline, pipelineIdentification }) {
|
|
2934
|
-
// Note: All input parameters are defined - so that they can be used as result of some task
|
|
2935
|
-
const definedParameters = createInitiallyDefinedParameters(pipeline);
|
|
2936
|
-
for (const task of pipeline.tasks) {
|
|
2937
|
-
validatePipelineTask(task, definedParameters, pipelineIdentification);
|
|
2938
|
-
}
|
|
2939
|
-
}
|
|
2940
|
-
/**
|
|
2941
|
-
* Validates that task dependencies can be resolved without cycles or missing definitions.
|
|
2942
|
-
*
|
|
2943
|
-
* @private internal step of `validatePipeline`
|
|
2944
|
-
*/
|
|
2945
|
-
function validatePipelineDependencyResolution({ pipeline, pipelineIdentification }) {
|
|
2946
|
-
let dependencyResolutionState = createInitialDependencyResolutionState(pipeline);
|
|
2947
|
-
let loopLimit = LOOP_LIMIT;
|
|
2948
|
-
while (hasUnresolvedTasks(dependencyResolutionState)) {
|
|
2949
|
-
if (loopLimit-- < 0) {
|
|
2950
|
-
throw createDependencyResolutionLoopLimitError(pipelineIdentification);
|
|
2951
|
-
}
|
|
2952
|
-
dependencyResolutionState = resolveNextDependencyResolutionState(dependencyResolutionState, pipelineIdentification);
|
|
2953
|
-
}
|
|
2954
|
-
}
|
|
2955
|
-
/**
|
|
2956
|
-
* Validates one pipeline parameter declaration.
|
|
2957
|
-
*
|
|
2958
|
-
* @private internal step of `validatePipeline`
|
|
2959
|
-
*/
|
|
2960
|
-
function validatePipelineParameter(parameter, pipeline, pipelineIdentification) {
|
|
2961
|
-
validateParameterDirection(parameter, pipelineIdentification);
|
|
2962
|
-
validateParameterUsage(parameter, pipeline, pipelineIdentification);
|
|
2963
|
-
validateParameterDefinition(parameter, pipeline, pipelineIdentification);
|
|
2964
|
-
}
|
|
2965
|
-
/**
|
|
2966
|
-
* Validates one pipeline task and its invariants.
|
|
2967
|
-
*
|
|
2968
|
-
* @private internal step of `validatePipeline`
|
|
2969
|
-
*/
|
|
2970
|
-
function validatePipelineTask(task, definedParameters, pipelineIdentification) {
|
|
2971
|
-
validateTaskResultingParameter(task, definedParameters, pipelineIdentification);
|
|
2972
|
-
validateTaskJokers(task, pipelineIdentification);
|
|
2973
|
-
validateTaskExpectations(task, pipelineIdentification);
|
|
2974
|
-
}
|
|
2975
|
-
/**
|
|
2976
|
-
* Validates the pipeline URL, when present.
|
|
2977
|
-
*
|
|
2978
|
-
* @private internal utility of `validatePipeline`
|
|
2979
|
-
*/
|
|
2980
|
-
function validatePipelineUrl(pipeline, pipelineIdentification) {
|
|
2981
|
-
if (pipeline.pipelineUrl === undefined || isValidPipelineUrl(pipeline.pipelineUrl)) {
|
|
2982
|
-
return;
|
|
3041
|
+
function validatePipelineUrl(pipeline, pipelineIdentification) {
|
|
3042
|
+
if (pipeline.pipelineUrl === undefined || isValidPipelineUrl(pipeline.pipelineUrl)) {
|
|
3043
|
+
return;
|
|
2983
3044
|
}
|
|
2984
3045
|
// <- Note: [🚲]
|
|
2985
3046
|
throw new PipelineLogicError(spaceTrim$1((block) => `
|
|
@@ -2991,7 +3052,7 @@ function validatePipelineUrl(pipeline, pipelineIdentification) {
|
|
|
2991
3052
|
/**
|
|
2992
3053
|
* Validates the Promptbook version, when present.
|
|
2993
3054
|
*
|
|
2994
|
-
* @private internal utility of `
|
|
3055
|
+
* @private internal utility of `validatePipelineMetadata`
|
|
2995
3056
|
*/
|
|
2996
3057
|
function validatePipelineBookVersion(pipeline, pipelineIdentification) {
|
|
2997
3058
|
if (pipeline.bookVersion === undefined || isValidPromptbookVersion(pipeline.bookVersion)) {
|
|
@@ -3004,48 +3065,31 @@ function validatePipelineBookVersion(pipeline, pipelineIdentification) {
|
|
|
3004
3065
|
${block(pipelineIdentification)}
|
|
3005
3066
|
`));
|
|
3006
3067
|
}
|
|
3068
|
+
|
|
3007
3069
|
/**
|
|
3008
|
-
* Validates
|
|
3070
|
+
* Validates all pipeline parameter declarations.
|
|
3009
3071
|
*
|
|
3010
|
-
* @private
|
|
3072
|
+
* @private function of `validatePipeline`
|
|
3011
3073
|
*/
|
|
3012
|
-
function
|
|
3013
|
-
|
|
3014
|
-
|
|
3015
|
-
return;
|
|
3074
|
+
function validatePipelineParameters({ pipeline, pipelineIdentification }) {
|
|
3075
|
+
for (const parameter of pipeline.parameters) {
|
|
3076
|
+
validatePipelineParameter(parameter, pipeline, pipelineIdentification);
|
|
3016
3077
|
}
|
|
3017
|
-
// TODO: [🧠] what is the correct error tp throw - maybe PromptbookSchemaError
|
|
3018
|
-
throw new ParseError(spaceTrim$1((block) => `
|
|
3019
|
-
Pipeline is valid JSON but with wrong structure
|
|
3020
|
-
|
|
3021
|
-
\`PipelineJson.parameters\` expected to be an array, but got ${typeof pipeline.parameters}
|
|
3022
|
-
|
|
3023
|
-
${block(pipelineIdentification)}
|
|
3024
|
-
`));
|
|
3025
3078
|
}
|
|
3026
3079
|
/**
|
|
3027
|
-
* Validates
|
|
3080
|
+
* Validates one pipeline parameter declaration.
|
|
3028
3081
|
*
|
|
3029
|
-
* @private internal utility of `
|
|
3082
|
+
* @private internal utility of `validatePipelineParameters`
|
|
3030
3083
|
*/
|
|
3031
|
-
function
|
|
3032
|
-
|
|
3033
|
-
|
|
3034
|
-
|
|
3035
|
-
}
|
|
3036
|
-
// TODO: [🧠] what is the correct error tp throw - maybe PromptbookSchemaError
|
|
3037
|
-
throw new ParseError(spaceTrim$1((block) => `
|
|
3038
|
-
Pipeline is valid JSON but with wrong structure
|
|
3039
|
-
|
|
3040
|
-
\`PipelineJson.tasks\` expected to be an array, but got ${typeof pipeline.tasks}
|
|
3041
|
-
|
|
3042
|
-
${block(pipelineIdentification)}
|
|
3043
|
-
`));
|
|
3084
|
+
function validatePipelineParameter(parameter, pipeline, pipelineIdentification) {
|
|
3085
|
+
validateParameterDirection(parameter, pipelineIdentification);
|
|
3086
|
+
validateParameterUsage(parameter, pipeline, pipelineIdentification);
|
|
3087
|
+
validateParameterDefinition(parameter, pipeline, pipelineIdentification);
|
|
3044
3088
|
}
|
|
3045
3089
|
/**
|
|
3046
3090
|
* Validates that one parameter does not declare incompatible directions.
|
|
3047
3091
|
*
|
|
3048
|
-
* @private internal utility of `
|
|
3092
|
+
* @private internal utility of `validatePipelineParameters`
|
|
3049
3093
|
*/
|
|
3050
3094
|
function validateParameterDirection(parameter, pipelineIdentification) {
|
|
3051
3095
|
if (!parameter.isInput || !parameter.isOutput) {
|
|
@@ -3062,7 +3106,7 @@ function validateParameterDirection(parameter, pipelineIdentification) {
|
|
|
3062
3106
|
/**
|
|
3063
3107
|
* Validates that one intermediate parameter is actually consumed by at least one task.
|
|
3064
3108
|
*
|
|
3065
|
-
* @private internal utility of `
|
|
3109
|
+
* @private internal utility of `validatePipelineParameters`
|
|
3066
3110
|
*/
|
|
3067
3111
|
function validateParameterUsage(parameter, pipeline, pipelineIdentification) {
|
|
3068
3112
|
if (parameter.isInput || parameter.isOutput || isParameterUsedByAnyTask(parameter, pipeline.tasks)) {
|
|
@@ -3081,7 +3125,7 @@ function validateParameterUsage(parameter, pipeline, pipelineIdentification) {
|
|
|
3081
3125
|
/**
|
|
3082
3126
|
* Validates that one non-input parameter is produced by at least one task.
|
|
3083
3127
|
*
|
|
3084
|
-
* @private internal utility of `
|
|
3128
|
+
* @private internal utility of `validatePipelineParameters`
|
|
3085
3129
|
*/
|
|
3086
3130
|
function validateParameterDefinition(parameter, pipeline, pipelineIdentification) {
|
|
3087
3131
|
if (parameter.isInput || isParameterDefinedByAnyTask(parameter, pipeline.tasks)) {
|
|
@@ -3100,7 +3144,7 @@ function validateParameterDefinition(parameter, pipeline, pipelineIdentification
|
|
|
3100
3144
|
/**
|
|
3101
3145
|
* Checks whether one parameter is consumed by at least one task dependency list.
|
|
3102
3146
|
*
|
|
3103
|
-
* @private internal utility of `
|
|
3147
|
+
* @private internal utility of `validatePipelineParameters`
|
|
3104
3148
|
*/
|
|
3105
3149
|
function isParameterUsedByAnyTask(parameter, tasks) {
|
|
3106
3150
|
return tasks.some((task) => task.dependentParameterNames.includes(parameter.name));
|
|
@@ -3108,23 +3152,46 @@ function isParameterUsedByAnyTask(parameter, tasks) {
|
|
|
3108
3152
|
/**
|
|
3109
3153
|
* Checks whether one parameter is produced by at least one task.
|
|
3110
3154
|
*
|
|
3111
|
-
* @private internal utility of `
|
|
3155
|
+
* @private internal utility of `validatePipelineParameters`
|
|
3112
3156
|
*/
|
|
3113
3157
|
function isParameterDefinedByAnyTask(parameter, tasks) {
|
|
3114
3158
|
return tasks.some((task) => task.resultingParameterName === parameter.name);
|
|
3115
3159
|
}
|
|
3160
|
+
|
|
3161
|
+
/**
|
|
3162
|
+
* Validates all pipeline tasks and their per-task invariants.
|
|
3163
|
+
*
|
|
3164
|
+
* @private function of `validatePipeline`
|
|
3165
|
+
*/
|
|
3166
|
+
function validatePipelineTasks({ pipeline, pipelineIdentification }) {
|
|
3167
|
+
// Note: All input parameters are defined - so that they can be used as result of some task
|
|
3168
|
+
const definedParameters = createInitiallyDefinedParameters(pipeline);
|
|
3169
|
+
for (const task of pipeline.tasks) {
|
|
3170
|
+
validatePipelineTask(task, definedParameters, pipelineIdentification);
|
|
3171
|
+
}
|
|
3172
|
+
}
|
|
3116
3173
|
/**
|
|
3117
3174
|
* Collects the parameter names that are already defined before task validation starts.
|
|
3118
3175
|
*
|
|
3119
|
-
* @private internal utility of `
|
|
3176
|
+
* @private internal utility of `validatePipelineTasks`
|
|
3120
3177
|
*/
|
|
3121
3178
|
function createInitiallyDefinedParameters(pipeline) {
|
|
3122
3179
|
return new Set(pipeline.parameters.filter(({ isInput }) => isInput).map(({ name }) => name));
|
|
3123
3180
|
}
|
|
3181
|
+
/**
|
|
3182
|
+
* Validates one pipeline task and its invariants.
|
|
3183
|
+
*
|
|
3184
|
+
* @private internal utility of `validatePipelineTasks`
|
|
3185
|
+
*/
|
|
3186
|
+
function validatePipelineTask(task, definedParameters, pipelineIdentification) {
|
|
3187
|
+
validateTaskResultingParameter(task, definedParameters, pipelineIdentification);
|
|
3188
|
+
validateTaskJokers(task, pipelineIdentification);
|
|
3189
|
+
validateTaskExpectations(task, pipelineIdentification);
|
|
3190
|
+
}
|
|
3124
3191
|
/**
|
|
3125
3192
|
* Validates one task result parameter declaration and marks it as defined.
|
|
3126
3193
|
*
|
|
3127
|
-
* @private internal utility of `
|
|
3194
|
+
* @private internal utility of `validatePipelineTasks`
|
|
3128
3195
|
*/
|
|
3129
3196
|
function validateTaskResultingParameter(task, definedParameters, pipelineIdentification) {
|
|
3130
3197
|
if (definedParameters.has(task.resultingParameterName)) {
|
|
@@ -3146,7 +3213,7 @@ function validateTaskResultingParameter(task, definedParameters, pipelineIdentif
|
|
|
3146
3213
|
/**
|
|
3147
3214
|
* Validates joker parameters for one task.
|
|
3148
3215
|
*
|
|
3149
|
-
* @private internal utility of `
|
|
3216
|
+
* @private internal utility of `validatePipelineTasks`
|
|
3150
3217
|
*/
|
|
3151
3218
|
function validateTaskJokers(task, pipelineIdentification) {
|
|
3152
3219
|
if (!hasTaskJokers(task)) {
|
|
@@ -3158,7 +3225,7 @@ function validateTaskJokers(task, pipelineIdentification) {
|
|
|
3158
3225
|
/**
|
|
3159
3226
|
* Checks whether one task declares any joker parameters.
|
|
3160
3227
|
*
|
|
3161
|
-
* @private internal utility of `
|
|
3228
|
+
* @private internal utility of `validatePipelineTasks`
|
|
3162
3229
|
*/
|
|
3163
3230
|
function hasTaskJokers(task) {
|
|
3164
3231
|
return !!task.jokerParameterNames && task.jokerParameterNames.length > 0;
|
|
@@ -3166,7 +3233,7 @@ function hasTaskJokers(task) {
|
|
|
3166
3233
|
/**
|
|
3167
3234
|
* Validates that a task has the required supporting features when using jokers.
|
|
3168
3235
|
*
|
|
3169
|
-
* @private internal utility of `
|
|
3236
|
+
* @private internal utility of `validatePipelineTasks`
|
|
3170
3237
|
*/
|
|
3171
3238
|
function validateTaskSupportsJokers(task, pipelineIdentification) {
|
|
3172
3239
|
if (task.format || task.expectations /* <- TODO: Require at least 1 -> min <- expectation to use jokers */) {
|
|
@@ -3181,7 +3248,7 @@ function validateTaskSupportsJokers(task, pipelineIdentification) {
|
|
|
3181
3248
|
/**
|
|
3182
3249
|
* Validates that every joker parameter is also listed among task dependencies.
|
|
3183
3250
|
*
|
|
3184
|
-
* @private internal utility of `
|
|
3251
|
+
* @private internal utility of `validatePipelineTasks`
|
|
3185
3252
|
*/
|
|
3186
3253
|
function validateTaskJokerDependencies(task, pipelineIdentification) {
|
|
3187
3254
|
for (const joker of task.jokerParameterNames) {
|
|
@@ -3198,7 +3265,7 @@ function validateTaskJokerDependencies(task, pipelineIdentification) {
|
|
|
3198
3265
|
/**
|
|
3199
3266
|
* Validates all expectation bounds configured on one task.
|
|
3200
3267
|
*
|
|
3201
|
-
* @private internal utility of `
|
|
3268
|
+
* @private internal utility of `validatePipelineTasks`
|
|
3202
3269
|
*/
|
|
3203
3270
|
function validateTaskExpectations(task, pipelineIdentification) {
|
|
3204
3271
|
if (!task.expectations) {
|
|
@@ -3213,7 +3280,7 @@ function validateTaskExpectations(task, pipelineIdentification) {
|
|
|
3213
3280
|
/**
|
|
3214
3281
|
* Validates the minimum and maximum expectation ordering for one unit.
|
|
3215
3282
|
*
|
|
3216
|
-
* @private internal utility of `
|
|
3283
|
+
* @private internal utility of `validatePipelineTasks`
|
|
3217
3284
|
*/
|
|
3218
3285
|
function validateTaskExpectationRange(unit, min, max, pipelineIdentification) {
|
|
3219
3286
|
if (min === undefined || max === undefined || min <= max) {
|
|
@@ -3228,7 +3295,7 @@ function validateTaskExpectationRange(unit, min, max, pipelineIdentification) {
|
|
|
3228
3295
|
/**
|
|
3229
3296
|
* Validates the minimum expectation bound for one unit.
|
|
3230
3297
|
*
|
|
3231
|
-
* @private internal utility of `
|
|
3298
|
+
* @private internal utility of `validatePipelineTasks`
|
|
3232
3299
|
*/
|
|
3233
3300
|
function validateTaskExpectationMin(unit, min, pipelineIdentification) {
|
|
3234
3301
|
if (min === undefined || min >= 0) {
|
|
@@ -3243,7 +3310,7 @@ function validateTaskExpectationMin(unit, min, pipelineIdentification) {
|
|
|
3243
3310
|
/**
|
|
3244
3311
|
* Validates the maximum expectation bound for one unit.
|
|
3245
3312
|
*
|
|
3246
|
-
* @private internal utility of `
|
|
3313
|
+
* @private internal utility of `validatePipelineTasks`
|
|
3247
3314
|
*/
|
|
3248
3315
|
function validateTaskExpectationMax(unit, max, pipelineIdentification) {
|
|
3249
3316
|
if (max === undefined || max > 0) {
|
|
@@ -3255,123 +3322,62 @@ function validateTaskExpectationMax(unit, max, pipelineIdentification) {
|
|
|
3255
3322
|
${block(pipelineIdentification)}
|
|
3256
3323
|
`));
|
|
3257
3324
|
}
|
|
3325
|
+
|
|
3258
3326
|
/**
|
|
3259
|
-
*
|
|
3260
|
-
*
|
|
3261
|
-
* @private internal utility of `validatePipeline`
|
|
3262
|
-
*/
|
|
3263
|
-
function createInitialDependencyResolutionState(pipeline) {
|
|
3264
|
-
return {
|
|
3265
|
-
resolvedParameterNames: createInitiallyResolvedParameterNames(pipeline),
|
|
3266
|
-
unresolvedTasks: [...pipeline.tasks],
|
|
3267
|
-
};
|
|
3268
|
-
}
|
|
3269
|
-
/**
|
|
3270
|
-
* Checks whether dependency resolution still has tasks left to process.
|
|
3271
|
-
*
|
|
3272
|
-
* @private internal utility of `validatePipeline`
|
|
3273
|
-
*/
|
|
3274
|
-
function hasUnresolvedTasks({ unresolvedTasks }) {
|
|
3275
|
-
return unresolvedTasks.length > 0;
|
|
3276
|
-
}
|
|
3277
|
-
/**
|
|
3278
|
-
* Resolves the next batch of currently satisfiable tasks.
|
|
3327
|
+
* Validates PipelineJson if it is logically valid
|
|
3279
3328
|
*
|
|
3280
|
-
*
|
|
3281
|
-
|
|
3282
|
-
function resolveNextDependencyResolutionState(dependencyResolutionState, pipelineIdentification) {
|
|
3283
|
-
const currentlyResolvedTasks = getCurrentlyResolvedTasks(dependencyResolutionState.unresolvedTasks, dependencyResolutionState.resolvedParameterNames);
|
|
3284
|
-
if (currentlyResolvedTasks.length === 0) {
|
|
3285
|
-
throw createUnresolvedTasksError(dependencyResolutionState.unresolvedTasks, dependencyResolutionState.resolvedParameterNames, pipelineIdentification);
|
|
3286
|
-
}
|
|
3287
|
-
return {
|
|
3288
|
-
resolvedParameterNames: appendResolvedTaskParameterNames(dependencyResolutionState.resolvedParameterNames, currentlyResolvedTasks),
|
|
3289
|
-
unresolvedTasks: dependencyResolutionState.unresolvedTasks.filter((task) => !currentlyResolvedTasks.includes(task)),
|
|
3290
|
-
};
|
|
3291
|
-
}
|
|
3292
|
-
/**
|
|
3293
|
-
* Collects the parameter names that are already resolvable before dependency traversal starts.
|
|
3329
|
+
* It checks:
|
|
3330
|
+
* - if it has correct parameters dependency
|
|
3294
3331
|
*
|
|
3295
|
-
*
|
|
3296
|
-
|
|
3297
|
-
|
|
3298
|
-
let resolvedParameterNames = pipeline.parameters
|
|
3299
|
-
.filter(({ isInput }) => isInput)
|
|
3300
|
-
.map(({ name }) => name);
|
|
3301
|
-
for (const reservedParameterName of RESERVED_PARAMETER_NAMES) {
|
|
3302
|
-
resolvedParameterNames = [...resolvedParameterNames, reservedParameterName];
|
|
3303
|
-
}
|
|
3304
|
-
return resolvedParameterNames;
|
|
3305
|
-
}
|
|
3306
|
-
/**
|
|
3307
|
-
* Adds newly resolved task outputs to the resolved parameter list.
|
|
3332
|
+
* It does NOT check:
|
|
3333
|
+
* - if it is valid json
|
|
3334
|
+
* - if it is meaningful
|
|
3308
3335
|
*
|
|
3309
|
-
*
|
|
3310
|
-
*/
|
|
3311
|
-
function appendResolvedTaskParameterNames(resolvedParameterNames, currentlyResolvedTasks) {
|
|
3312
|
-
return [
|
|
3313
|
-
...resolvedParameterNames,
|
|
3314
|
-
...currentlyResolvedTasks.map(({ resultingParameterName }) => resultingParameterName),
|
|
3315
|
-
];
|
|
3316
|
-
}
|
|
3317
|
-
/**
|
|
3318
|
-
* Selects tasks whose dependencies are already resolved.
|
|
3336
|
+
* Note: [🔂] This function is idempotent.
|
|
3319
3337
|
*
|
|
3320
|
-
* @
|
|
3321
|
-
|
|
3322
|
-
|
|
3323
|
-
return unresolvedTasks.filter((task) => task.dependentParameterNames.every((name) => resolvedParameterNames.includes(name)));
|
|
3324
|
-
}
|
|
3325
|
-
/**
|
|
3326
|
-
* Creates the unexpected loop-limit error for dependency resolution.
|
|
3338
|
+
* @param pipeline valid or invalid PipelineJson
|
|
3339
|
+
* @returns the same pipeline if it is logically valid
|
|
3340
|
+
* @throws {PipelineLogicError} on logical error in the pipeline
|
|
3327
3341
|
*
|
|
3328
|
-
* @
|
|
3342
|
+
* @public exported from `@promptbook/core`
|
|
3329
3343
|
*/
|
|
3330
|
-
function
|
|
3331
|
-
|
|
3332
|
-
|
|
3333
|
-
|
|
3344
|
+
function validatePipeline(pipeline) {
|
|
3345
|
+
if (IS_PIPELINE_LOGIC_VALIDATED) {
|
|
3346
|
+
validatePipeline_InnerFunction(pipeline);
|
|
3347
|
+
}
|
|
3348
|
+
else {
|
|
3349
|
+
try {
|
|
3350
|
+
validatePipeline_InnerFunction(pipeline);
|
|
3351
|
+
}
|
|
3352
|
+
catch (error) {
|
|
3353
|
+
if (!(error instanceof PipelineLogicError)) {
|
|
3354
|
+
throw error;
|
|
3355
|
+
}
|
|
3356
|
+
console.error(spaceTrim$1((block) => `
|
|
3357
|
+
Pipeline is not valid but logic errors are temporarily disabled via \`IS_PIPELINE_LOGIC_VALIDATED\`
|
|
3334
3358
|
|
|
3335
|
-
|
|
3336
|
-
|
|
3359
|
+
${block(error.message)}
|
|
3360
|
+
`));
|
|
3361
|
+
}
|
|
3362
|
+
}
|
|
3363
|
+
return pipeline;
|
|
3337
3364
|
}
|
|
3338
3365
|
/**
|
|
3339
|
-
*
|
|
3366
|
+
* Validates pipeline inner function.
|
|
3340
3367
|
*
|
|
3341
|
-
* @private internal
|
|
3368
|
+
* @private internal function for `validatePipeline`
|
|
3342
3369
|
*/
|
|
3343
|
-
function
|
|
3344
|
-
|
|
3345
|
-
|
|
3346
|
-
|
|
3347
|
-
|
|
3348
|
-
|
|
3349
|
-
|
|
3350
|
-
|
|
3351
|
-
|
|
3352
|
-
|
|
3353
|
-
|
|
3354
|
-
${block(unresolvedTasks
|
|
3355
|
-
.map(({ resultingParameterName, dependentParameterNames }) => `- Parameter \`{${resultingParameterName}}\` which depends on ${dependentParameterNames
|
|
3356
|
-
.map((dependentParameterName) => `\`{${dependentParameterName}}\``)
|
|
3357
|
-
.join(' and ')}`)
|
|
3358
|
-
.join('\n'))}
|
|
3359
|
-
|
|
3360
|
-
**Resolved:**
|
|
3361
|
-
${block(resolvedParameterNames
|
|
3362
|
-
.filter((name) => !RESERVED_PARAMETER_NAMES.includes(name))
|
|
3363
|
-
.map((name) => `- Parameter \`{${name}}\``)
|
|
3364
|
-
.join('\n'))}
|
|
3365
|
-
|
|
3366
|
-
|
|
3367
|
-
**Reserved (which are available):**
|
|
3368
|
-
${block(resolvedParameterNames
|
|
3369
|
-
.filter((name) => RESERVED_PARAMETER_NAMES.includes(name))
|
|
3370
|
-
.map((name) => `- Parameter \`{${name}}\``)
|
|
3371
|
-
.join('\n'))}
|
|
3372
|
-
|
|
3373
|
-
|
|
3374
|
-
`));
|
|
3370
|
+
function validatePipeline_InnerFunction(pipeline) {
|
|
3371
|
+
// TODO: [🧠] Maybe test if promptbook is a promise and make specific error case for that
|
|
3372
|
+
const context = createPipelineValidationContext(pipeline);
|
|
3373
|
+
validatePipelineMetadata(context);
|
|
3374
|
+
validatePipelineCollectionsStructure(context);
|
|
3375
|
+
validatePipelineParameters(context);
|
|
3376
|
+
validatePipelineTasks(context);
|
|
3377
|
+
validatePipelineDependencyResolution(context);
|
|
3378
|
+
// Note: Check that formfactor is corresponding to the pipeline interface
|
|
3379
|
+
// TODO: !!6 Implement this
|
|
3380
|
+
// pipeline.formfactorName
|
|
3375
3381
|
}
|
|
3376
3382
|
/**
|
|
3377
3383
|
* TODO: [🧞♀️] Do not allow joker + foreach
|