@promptbook/pdf 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
|
|
@@ -118,6 +118,127 @@ function take(initialValue) {
|
|
|
118
118
|
});
|
|
119
119
|
}
|
|
120
120
|
|
|
121
|
+
/**
|
|
122
|
+
* Validates that a channel value is a valid number within the range of 0 to 255.
|
|
123
|
+
* Throws an error if the value is not valid.
|
|
124
|
+
*
|
|
125
|
+
* @param channelName - The name of the channel being validated.
|
|
126
|
+
* @param value - The value of the channel to validate.
|
|
127
|
+
* @throws Will throw an error if the value is not a valid channel number.
|
|
128
|
+
*
|
|
129
|
+
* @private util of `@promptbook/color`
|
|
130
|
+
*/
|
|
131
|
+
function checkChannelValue(channelName, value) {
|
|
132
|
+
if (typeof value !== 'number') {
|
|
133
|
+
throw new Error(`${channelName} channel value is not number but ${typeof value}`);
|
|
134
|
+
}
|
|
135
|
+
if (isNaN(value)) {
|
|
136
|
+
throw new Error(`${channelName} channel value is NaN`);
|
|
137
|
+
}
|
|
138
|
+
if (Math.round(value) !== value) {
|
|
139
|
+
throw new Error(`${channelName} channel is not whole number, it is ${value}`);
|
|
140
|
+
}
|
|
141
|
+
if (value < 0) {
|
|
142
|
+
throw new Error(`${channelName} channel is lower than 0, it is ${value}`);
|
|
143
|
+
}
|
|
144
|
+
if (value > 255) {
|
|
145
|
+
throw new Error(`${channelName} channel is greater than 255, it is ${value}`);
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
/**
|
|
150
|
+
* Shared immutable channel storage and serialization helpers for `Color`.
|
|
151
|
+
*
|
|
152
|
+
* @private base class of Color
|
|
153
|
+
*/
|
|
154
|
+
class ColorValue {
|
|
155
|
+
constructor(red, green, blue, alpha = 255) {
|
|
156
|
+
this.red = red;
|
|
157
|
+
this.green = green;
|
|
158
|
+
this.blue = blue;
|
|
159
|
+
this.alpha = alpha;
|
|
160
|
+
checkChannelValue('Red', red);
|
|
161
|
+
checkChannelValue('Green', green);
|
|
162
|
+
checkChannelValue('Blue', blue);
|
|
163
|
+
checkChannelValue('Alpha', alpha);
|
|
164
|
+
}
|
|
165
|
+
/**
|
|
166
|
+
* Shortcut for `red` property
|
|
167
|
+
* Number from 0 to 255
|
|
168
|
+
* @alias red
|
|
169
|
+
*/
|
|
170
|
+
get r() {
|
|
171
|
+
return this.red;
|
|
172
|
+
}
|
|
173
|
+
/**
|
|
174
|
+
* Shortcut for `green` property
|
|
175
|
+
* Number from 0 to 255
|
|
176
|
+
* @alias green
|
|
177
|
+
*/
|
|
178
|
+
get g() {
|
|
179
|
+
return this.green;
|
|
180
|
+
}
|
|
181
|
+
/**
|
|
182
|
+
* Shortcut for `blue` property
|
|
183
|
+
* Number from 0 to 255
|
|
184
|
+
* @alias blue
|
|
185
|
+
*/
|
|
186
|
+
get b() {
|
|
187
|
+
return this.blue;
|
|
188
|
+
}
|
|
189
|
+
/**
|
|
190
|
+
* Shortcut for `alpha` property
|
|
191
|
+
* Number from 0 (transparent) to 255 (opaque)
|
|
192
|
+
* @alias alpha
|
|
193
|
+
*/
|
|
194
|
+
get a() {
|
|
195
|
+
return this.alpha;
|
|
196
|
+
}
|
|
197
|
+
/**
|
|
198
|
+
* Shortcut for `alpha` property
|
|
199
|
+
* Number from 0 (transparent) to 255 (opaque)
|
|
200
|
+
* @alias alpha
|
|
201
|
+
*/
|
|
202
|
+
get opacity() {
|
|
203
|
+
return this.alpha;
|
|
204
|
+
}
|
|
205
|
+
/**
|
|
206
|
+
* Shortcut for 1-`alpha` property
|
|
207
|
+
*/
|
|
208
|
+
get transparency() {
|
|
209
|
+
return 255 - this.alpha;
|
|
210
|
+
}
|
|
211
|
+
clone() {
|
|
212
|
+
return take(this.createColor(this.red, this.green, this.blue, this.alpha));
|
|
213
|
+
}
|
|
214
|
+
toString() {
|
|
215
|
+
return this.toHex();
|
|
216
|
+
}
|
|
217
|
+
toHex() {
|
|
218
|
+
if (this.alpha === 255) {
|
|
219
|
+
return `#${this.red.toString(16).padStart(2, '0')}${this.green.toString(16).padStart(2, '0')}${this.blue
|
|
220
|
+
.toString(16)
|
|
221
|
+
.padStart(2, '0')}`;
|
|
222
|
+
}
|
|
223
|
+
else {
|
|
224
|
+
return `#${this.red.toString(16).padStart(2, '0')}${this.green.toString(16).padStart(2, '0')}${this.blue
|
|
225
|
+
.toString(16)
|
|
226
|
+
.padStart(2, '0')}${this.alpha.toString(16).padStart(2, '0')}`;
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
toRgb() {
|
|
230
|
+
if (this.alpha === 255) {
|
|
231
|
+
return `rgb(${this.red}, ${this.green}, ${this.blue})`;
|
|
232
|
+
}
|
|
233
|
+
else {
|
|
234
|
+
return `rgba(${this.red}, ${this.green}, ${this.blue}, ${Math.round((this.alpha / 255) * 100)}%)`;
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
toHsl() {
|
|
238
|
+
throw new Error(`Getting HSL is not implemented`);
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
|
|
121
242
|
/**
|
|
122
243
|
* 🎨 List of all 140 color names which are supported by CSS
|
|
123
244
|
*
|
|
@@ -277,127 +398,6 @@ const CSS_COLORS = {
|
|
|
277
398
|
};
|
|
278
399
|
// Note: [💞] Ignore a discrepancy between file name and entity name
|
|
279
400
|
|
|
280
|
-
/**
|
|
281
|
-
* Validates that a channel value is a valid number within the range of 0 to 255.
|
|
282
|
-
* Throws an error if the value is not valid.
|
|
283
|
-
*
|
|
284
|
-
* @param channelName - The name of the channel being validated.
|
|
285
|
-
* @param value - The value of the channel to validate.
|
|
286
|
-
* @throws Will throw an error if the value is not a valid channel number.
|
|
287
|
-
*
|
|
288
|
-
* @private util of `@promptbook/color`
|
|
289
|
-
*/
|
|
290
|
-
function checkChannelValue(channelName, value) {
|
|
291
|
-
if (typeof value !== 'number') {
|
|
292
|
-
throw new Error(`${channelName} channel value is not number but ${typeof value}`);
|
|
293
|
-
}
|
|
294
|
-
if (isNaN(value)) {
|
|
295
|
-
throw new Error(`${channelName} channel value is NaN`);
|
|
296
|
-
}
|
|
297
|
-
if (Math.round(value) !== value) {
|
|
298
|
-
throw new Error(`${channelName} channel is not whole number, it is ${value}`);
|
|
299
|
-
}
|
|
300
|
-
if (value < 0) {
|
|
301
|
-
throw new Error(`${channelName} channel is lower than 0, it is ${value}`);
|
|
302
|
-
}
|
|
303
|
-
if (value > 255) {
|
|
304
|
-
throw new Error(`${channelName} channel is greater than 255, it is ${value}`);
|
|
305
|
-
}
|
|
306
|
-
}
|
|
307
|
-
|
|
308
|
-
/**
|
|
309
|
-
* Shared immutable channel storage and serialization helpers for `Color`.
|
|
310
|
-
*
|
|
311
|
-
* @private base class of Color
|
|
312
|
-
*/
|
|
313
|
-
class ColorValue {
|
|
314
|
-
constructor(red, green, blue, alpha = 255) {
|
|
315
|
-
this.red = red;
|
|
316
|
-
this.green = green;
|
|
317
|
-
this.blue = blue;
|
|
318
|
-
this.alpha = alpha;
|
|
319
|
-
checkChannelValue('Red', red);
|
|
320
|
-
checkChannelValue('Green', green);
|
|
321
|
-
checkChannelValue('Blue', blue);
|
|
322
|
-
checkChannelValue('Alpha', alpha);
|
|
323
|
-
}
|
|
324
|
-
/**
|
|
325
|
-
* Shortcut for `red` property
|
|
326
|
-
* Number from 0 to 255
|
|
327
|
-
* @alias red
|
|
328
|
-
*/
|
|
329
|
-
get r() {
|
|
330
|
-
return this.red;
|
|
331
|
-
}
|
|
332
|
-
/**
|
|
333
|
-
* Shortcut for `green` property
|
|
334
|
-
* Number from 0 to 255
|
|
335
|
-
* @alias green
|
|
336
|
-
*/
|
|
337
|
-
get g() {
|
|
338
|
-
return this.green;
|
|
339
|
-
}
|
|
340
|
-
/**
|
|
341
|
-
* Shortcut for `blue` property
|
|
342
|
-
* Number from 0 to 255
|
|
343
|
-
* @alias blue
|
|
344
|
-
*/
|
|
345
|
-
get b() {
|
|
346
|
-
return this.blue;
|
|
347
|
-
}
|
|
348
|
-
/**
|
|
349
|
-
* Shortcut for `alpha` property
|
|
350
|
-
* Number from 0 (transparent) to 255 (opaque)
|
|
351
|
-
* @alias alpha
|
|
352
|
-
*/
|
|
353
|
-
get a() {
|
|
354
|
-
return this.alpha;
|
|
355
|
-
}
|
|
356
|
-
/**
|
|
357
|
-
* Shortcut for `alpha` property
|
|
358
|
-
* Number from 0 (transparent) to 255 (opaque)
|
|
359
|
-
* @alias alpha
|
|
360
|
-
*/
|
|
361
|
-
get opacity() {
|
|
362
|
-
return this.alpha;
|
|
363
|
-
}
|
|
364
|
-
/**
|
|
365
|
-
* Shortcut for 1-`alpha` property
|
|
366
|
-
*/
|
|
367
|
-
get transparency() {
|
|
368
|
-
return 255 - this.alpha;
|
|
369
|
-
}
|
|
370
|
-
clone() {
|
|
371
|
-
return take(this.createColor(this.red, this.green, this.blue, this.alpha));
|
|
372
|
-
}
|
|
373
|
-
toString() {
|
|
374
|
-
return this.toHex();
|
|
375
|
-
}
|
|
376
|
-
toHex() {
|
|
377
|
-
if (this.alpha === 255) {
|
|
378
|
-
return `#${this.red.toString(16).padStart(2, '0')}${this.green.toString(16).padStart(2, '0')}${this.blue
|
|
379
|
-
.toString(16)
|
|
380
|
-
.padStart(2, '0')}`;
|
|
381
|
-
}
|
|
382
|
-
else {
|
|
383
|
-
return `#${this.red.toString(16).padStart(2, '0')}${this.green.toString(16).padStart(2, '0')}${this.blue
|
|
384
|
-
.toString(16)
|
|
385
|
-
.padStart(2, '0')}${this.alpha.toString(16).padStart(2, '0')}`;
|
|
386
|
-
}
|
|
387
|
-
}
|
|
388
|
-
toRgb() {
|
|
389
|
-
if (this.alpha === 255) {
|
|
390
|
-
return `rgb(${this.red}, ${this.green}, ${this.blue})`;
|
|
391
|
-
}
|
|
392
|
-
else {
|
|
393
|
-
return `rgba(${this.red}, ${this.green}, ${this.blue}, ${Math.round((this.alpha / 255) * 100)}%)`;
|
|
394
|
-
}
|
|
395
|
-
}
|
|
396
|
-
toHsl() {
|
|
397
|
-
throw new Error(`Getting HSL is not implemented`);
|
|
398
|
-
}
|
|
399
|
-
}
|
|
400
|
-
|
|
401
401
|
/**
|
|
402
402
|
* Checks if the given value is a valid hex color string
|
|
403
403
|
*
|
|
@@ -2380,20 +2380,109 @@ function pipelineJsonToString(pipelineJson) {
|
|
|
2380
2380
|
// TODO: [🧠] Should be in generated .book.md file GENERATOR_WARNING
|
|
2381
2381
|
|
|
2382
2382
|
/**
|
|
2383
|
-
*
|
|
2384
|
-
*
|
|
2385
|
-
* @returns The same type of object as the input re-ordered
|
|
2383
|
+
* This error indicates that the promptbook object has valid syntax (=can be parsed) but contains logical errors (like circular dependencies)
|
|
2386
2384
|
*
|
|
2387
|
-
* @public exported from `@promptbook/
|
|
2385
|
+
* @public exported from `@promptbook/core`
|
|
2388
2386
|
*/
|
|
2389
|
-
|
|
2390
|
-
|
|
2391
|
-
|
|
2392
|
-
|
|
2393
|
-
|
|
2394
|
-
}
|
|
2395
|
-
|
|
2396
|
-
|
|
2387
|
+
class PipelineLogicError extends Error {
|
|
2388
|
+
constructor(message) {
|
|
2389
|
+
super(message);
|
|
2390
|
+
this.name = 'PipelineLogicError';
|
|
2391
|
+
Object.setPrototypeOf(this, PipelineLogicError.prototype);
|
|
2392
|
+
}
|
|
2393
|
+
}
|
|
2394
|
+
|
|
2395
|
+
/**
|
|
2396
|
+
* Creates the shared validation context for one pipeline.
|
|
2397
|
+
*
|
|
2398
|
+
* @private function of `validatePipeline`
|
|
2399
|
+
*/
|
|
2400
|
+
function createPipelineValidationContext(pipeline) {
|
|
2401
|
+
return {
|
|
2402
|
+
pipeline,
|
|
2403
|
+
pipelineIdentification: getPipelineIdentification(pipeline),
|
|
2404
|
+
};
|
|
2405
|
+
}
|
|
2406
|
+
/**
|
|
2407
|
+
* Builds a short file/url identification block for validation errors.
|
|
2408
|
+
*
|
|
2409
|
+
* @private internal utility of `validatePipeline`
|
|
2410
|
+
*/
|
|
2411
|
+
function getPipelineIdentification(pipeline) {
|
|
2412
|
+
// Note: This is a 😐 implementation of [🚞]
|
|
2413
|
+
const pipelineIdentificationParts = [];
|
|
2414
|
+
if (pipeline.sourceFile !== undefined) {
|
|
2415
|
+
pipelineIdentificationParts.push(`File: ${pipeline.sourceFile}`);
|
|
2416
|
+
}
|
|
2417
|
+
if (pipeline.pipelineUrl !== undefined) {
|
|
2418
|
+
pipelineIdentificationParts.push(`Url: ${pipeline.pipelineUrl}`);
|
|
2419
|
+
}
|
|
2420
|
+
return pipelineIdentificationParts.join('\n');
|
|
2421
|
+
}
|
|
2422
|
+
|
|
2423
|
+
/**
|
|
2424
|
+
* Validates that the expected top-level collections have array structure.
|
|
2425
|
+
*
|
|
2426
|
+
* @private function of `validatePipeline`
|
|
2427
|
+
*/
|
|
2428
|
+
function validatePipelineCollectionsStructure({ pipeline, pipelineIdentification, }) {
|
|
2429
|
+
validatePipelineParametersCollection(pipeline, pipelineIdentification);
|
|
2430
|
+
validatePipelineTasksCollection(pipeline, pipelineIdentification);
|
|
2431
|
+
}
|
|
2432
|
+
/**
|
|
2433
|
+
* Validates that `pipeline.parameters` is an array.
|
|
2434
|
+
*
|
|
2435
|
+
* @private internal utility of `validatePipelineCollectionsStructure`
|
|
2436
|
+
*/
|
|
2437
|
+
function validatePipelineParametersCollection(pipeline, pipelineIdentification) {
|
|
2438
|
+
// TODO: [🧠] Maybe do here some proper JSON-schema / ZOD checking
|
|
2439
|
+
if (Array.isArray(pipeline.parameters)) {
|
|
2440
|
+
return;
|
|
2441
|
+
}
|
|
2442
|
+
// TODO: [🧠] what is the correct error tp throw - maybe PromptbookSchemaError
|
|
2443
|
+
throw new ParseError(spaceTrim$1((block) => `
|
|
2444
|
+
Pipeline is valid JSON but with wrong structure
|
|
2445
|
+
|
|
2446
|
+
\`PipelineJson.parameters\` expected to be an array, but got ${typeof pipeline.parameters}
|
|
2447
|
+
|
|
2448
|
+
${block(pipelineIdentification)}
|
|
2449
|
+
`));
|
|
2450
|
+
}
|
|
2451
|
+
/**
|
|
2452
|
+
* Validates that `pipeline.tasks` is an array.
|
|
2453
|
+
*
|
|
2454
|
+
* @private internal utility of `validatePipelineCollectionsStructure`
|
|
2455
|
+
*/
|
|
2456
|
+
function validatePipelineTasksCollection(pipeline, pipelineIdentification) {
|
|
2457
|
+
// TODO: [🧠] Maybe do here some proper JSON-schema / ZOD checking
|
|
2458
|
+
if (Array.isArray(pipeline.tasks)) {
|
|
2459
|
+
return;
|
|
2460
|
+
}
|
|
2461
|
+
// TODO: [🧠] what is the correct error tp throw - maybe PromptbookSchemaError
|
|
2462
|
+
throw new ParseError(spaceTrim$1((block) => `
|
|
2463
|
+
Pipeline is valid JSON but with wrong structure
|
|
2464
|
+
|
|
2465
|
+
\`PipelineJson.tasks\` expected to be an array, but got ${typeof pipeline.tasks}
|
|
2466
|
+
|
|
2467
|
+
${block(pipelineIdentification)}
|
|
2468
|
+
`));
|
|
2469
|
+
}
|
|
2470
|
+
|
|
2471
|
+
/**
|
|
2472
|
+
* Orders JSON object by keys
|
|
2473
|
+
*
|
|
2474
|
+
* @returns The same type of object as the input re-ordered
|
|
2475
|
+
*
|
|
2476
|
+
* @public exported from `@promptbook/utils`
|
|
2477
|
+
*/
|
|
2478
|
+
function orderJson(options) {
|
|
2479
|
+
const { value, order } = options;
|
|
2480
|
+
const orderedValue = {
|
|
2481
|
+
...(order === undefined ? {} : Object.fromEntries(order.map((key) => [key, undefined]))),
|
|
2482
|
+
...value,
|
|
2483
|
+
};
|
|
2484
|
+
return orderedValue;
|
|
2485
|
+
}
|
|
2397
2486
|
|
|
2398
2487
|
/**
|
|
2399
2488
|
* Freezes the given object and all its nested objects recursively
|
|
@@ -2742,16 +2831,137 @@ const RESERVED_PARAMETER_NAMES = exportJson({
|
|
|
2742
2831
|
// Note: [💞] Ignore a discrepancy between file name and entity name
|
|
2743
2832
|
|
|
2744
2833
|
/**
|
|
2745
|
-
*
|
|
2834
|
+
* Validates that task dependencies can be resolved without cycles or missing definitions.
|
|
2746
2835
|
*
|
|
2747
|
-
* @
|
|
2836
|
+
* @private function of `validatePipeline`
|
|
2748
2837
|
*/
|
|
2749
|
-
|
|
2750
|
-
|
|
2751
|
-
|
|
2752
|
-
|
|
2753
|
-
|
|
2838
|
+
function validatePipelineDependencyResolution({ pipeline, pipelineIdentification, }) {
|
|
2839
|
+
let dependencyResolutionState = createInitialDependencyResolutionState(pipeline);
|
|
2840
|
+
let loopLimit = LOOP_LIMIT;
|
|
2841
|
+
while (hasUnresolvedTasks(dependencyResolutionState)) {
|
|
2842
|
+
if (loopLimit-- < 0) {
|
|
2843
|
+
throw createDependencyResolutionLoopLimitError(pipelineIdentification);
|
|
2844
|
+
}
|
|
2845
|
+
dependencyResolutionState = resolveNextDependencyResolutionState(dependencyResolutionState, pipelineIdentification);
|
|
2846
|
+
}
|
|
2847
|
+
}
|
|
2848
|
+
/**
|
|
2849
|
+
* Collects the parameter names that are already resolvable before dependency traversal starts.
|
|
2850
|
+
*
|
|
2851
|
+
* @private internal utility of `validatePipelineDependencyResolution`
|
|
2852
|
+
*/
|
|
2853
|
+
function createInitialDependencyResolutionState(pipeline) {
|
|
2854
|
+
return {
|
|
2855
|
+
resolvedParameterNames: createInitiallyResolvedParameterNames(pipeline),
|
|
2856
|
+
unresolvedTasks: [...pipeline.tasks],
|
|
2857
|
+
};
|
|
2858
|
+
}
|
|
2859
|
+
/**
|
|
2860
|
+
* Checks whether dependency resolution still has tasks left to process.
|
|
2861
|
+
*
|
|
2862
|
+
* @private internal utility of `validatePipelineDependencyResolution`
|
|
2863
|
+
*/
|
|
2864
|
+
function hasUnresolvedTasks({ unresolvedTasks }) {
|
|
2865
|
+
return unresolvedTasks.length > 0;
|
|
2866
|
+
}
|
|
2867
|
+
/**
|
|
2868
|
+
* Resolves the next batch of currently satisfiable tasks.
|
|
2869
|
+
*
|
|
2870
|
+
* @private internal utility of `validatePipelineDependencyResolution`
|
|
2871
|
+
*/
|
|
2872
|
+
function resolveNextDependencyResolutionState(dependencyResolutionState, pipelineIdentification) {
|
|
2873
|
+
const currentlyResolvedTasks = getCurrentlyResolvedTasks(dependencyResolutionState.unresolvedTasks, dependencyResolutionState.resolvedParameterNames);
|
|
2874
|
+
if (currentlyResolvedTasks.length === 0) {
|
|
2875
|
+
throw createUnresolvedTasksError(dependencyResolutionState.unresolvedTasks, dependencyResolutionState.resolvedParameterNames, pipelineIdentification);
|
|
2876
|
+
}
|
|
2877
|
+
return {
|
|
2878
|
+
resolvedParameterNames: appendResolvedTaskParameterNames(dependencyResolutionState.resolvedParameterNames, currentlyResolvedTasks),
|
|
2879
|
+
unresolvedTasks: dependencyResolutionState.unresolvedTasks.filter((task) => !currentlyResolvedTasks.includes(task)),
|
|
2880
|
+
};
|
|
2881
|
+
}
|
|
2882
|
+
/**
|
|
2883
|
+
* Collects the parameter names that are already resolvable before dependency traversal starts.
|
|
2884
|
+
*
|
|
2885
|
+
* @private internal utility of `validatePipelineDependencyResolution`
|
|
2886
|
+
*/
|
|
2887
|
+
function createInitiallyResolvedParameterNames(pipeline) {
|
|
2888
|
+
let resolvedParameterNames = pipeline.parameters
|
|
2889
|
+
.filter(({ isInput }) => isInput)
|
|
2890
|
+
.map(({ name }) => name);
|
|
2891
|
+
for (const reservedParameterName of RESERVED_PARAMETER_NAMES) {
|
|
2892
|
+
resolvedParameterNames = [...resolvedParameterNames, reservedParameterName];
|
|
2754
2893
|
}
|
|
2894
|
+
return resolvedParameterNames;
|
|
2895
|
+
}
|
|
2896
|
+
/**
|
|
2897
|
+
* Adds newly resolved task outputs to the resolved parameter list.
|
|
2898
|
+
*
|
|
2899
|
+
* @private internal utility of `validatePipelineDependencyResolution`
|
|
2900
|
+
*/
|
|
2901
|
+
function appendResolvedTaskParameterNames(resolvedParameterNames, currentlyResolvedTasks) {
|
|
2902
|
+
return [
|
|
2903
|
+
...resolvedParameterNames,
|
|
2904
|
+
...currentlyResolvedTasks.map(({ resultingParameterName }) => resultingParameterName),
|
|
2905
|
+
];
|
|
2906
|
+
}
|
|
2907
|
+
/**
|
|
2908
|
+
* Selects tasks whose dependencies are already resolved.
|
|
2909
|
+
*
|
|
2910
|
+
* @private internal utility of `validatePipelineDependencyResolution`
|
|
2911
|
+
*/
|
|
2912
|
+
function getCurrentlyResolvedTasks(unresolvedTasks, resolvedParameterNames) {
|
|
2913
|
+
return unresolvedTasks.filter((task) => task.dependentParameterNames.every((name) => resolvedParameterNames.includes(name)));
|
|
2914
|
+
}
|
|
2915
|
+
/**
|
|
2916
|
+
* Creates the unexpected loop-limit error for dependency resolution.
|
|
2917
|
+
*
|
|
2918
|
+
* @private internal utility of `validatePipelineDependencyResolution`
|
|
2919
|
+
*/
|
|
2920
|
+
function createDependencyResolutionLoopLimitError(pipelineIdentification) {
|
|
2921
|
+
// Note: Really UnexpectedError not LimitReachedError - this should not happen and be caught below
|
|
2922
|
+
return new UnexpectedError(spaceTrim$1((block) => `
|
|
2923
|
+
Loop limit reached during detection of circular dependencies in \`validatePipeline\`
|
|
2924
|
+
|
|
2925
|
+
${block(pipelineIdentification)}
|
|
2926
|
+
`));
|
|
2927
|
+
}
|
|
2928
|
+
/**
|
|
2929
|
+
* Creates the detailed error for unresolved or circular task dependencies.
|
|
2930
|
+
*
|
|
2931
|
+
* @private internal utility of `validatePipelineDependencyResolution`
|
|
2932
|
+
*/
|
|
2933
|
+
function createUnresolvedTasksError(unresolvedTasks, resolvedParameterNames, pipelineIdentification) {
|
|
2934
|
+
return new PipelineLogicError(
|
|
2935
|
+
// TODO: [🐎] DRY
|
|
2936
|
+
spaceTrim$1((block) => `
|
|
2937
|
+
|
|
2938
|
+
Can not resolve some parameters:
|
|
2939
|
+
Either you are using a parameter that is not defined, or there are some circular dependencies.
|
|
2940
|
+
|
|
2941
|
+
${block(pipelineIdentification)}
|
|
2942
|
+
|
|
2943
|
+
**Can not resolve:**
|
|
2944
|
+
${block(unresolvedTasks
|
|
2945
|
+
.map(({ resultingParameterName, dependentParameterNames }) => `- Parameter \`{${resultingParameterName}}\` which depends on ${dependentParameterNames
|
|
2946
|
+
.map((dependentParameterName) => `\`{${dependentParameterName}}\``)
|
|
2947
|
+
.join(' and ')}`)
|
|
2948
|
+
.join('\n'))}
|
|
2949
|
+
|
|
2950
|
+
**Resolved:**
|
|
2951
|
+
${block(resolvedParameterNames
|
|
2952
|
+
.filter((name) => !RESERVED_PARAMETER_NAMES.includes(name))
|
|
2953
|
+
.map((name) => `- Parameter \`{${name}}\``)
|
|
2954
|
+
.join('\n'))}
|
|
2955
|
+
|
|
2956
|
+
|
|
2957
|
+
**Reserved (which are available):**
|
|
2958
|
+
${block(resolvedParameterNames
|
|
2959
|
+
.filter((name) => RESERVED_PARAMETER_NAMES.includes(name))
|
|
2960
|
+
.map((name) => `- Parameter \`{${name}}\``)
|
|
2961
|
+
.join('\n'))}
|
|
2962
|
+
|
|
2963
|
+
|
|
2964
|
+
`));
|
|
2755
2965
|
}
|
|
2756
2966
|
|
|
2757
2967
|
/**
|
|
@@ -2829,171 +3039,22 @@ function isValidPipelineUrl(url) {
|
|
|
2829
3039
|
// TODO: [🐠] Maybe more info why the URL is invalid
|
|
2830
3040
|
|
|
2831
3041
|
/**
|
|
2832
|
-
* Validates
|
|
2833
|
-
*
|
|
2834
|
-
* It checks:
|
|
2835
|
-
* - if it has correct parameters dependency
|
|
2836
|
-
*
|
|
2837
|
-
* It does NOT check:
|
|
2838
|
-
* - if it is valid json
|
|
2839
|
-
* - if it is meaningful
|
|
2840
|
-
*
|
|
2841
|
-
* Note: [🔂] This function is idempotent.
|
|
3042
|
+
* Validates pipeline-level metadata fields.
|
|
2842
3043
|
*
|
|
2843
|
-
* @
|
|
2844
|
-
|
|
2845
|
-
|
|
3044
|
+
* @private function of `validatePipeline`
|
|
3045
|
+
*/
|
|
3046
|
+
function validatePipelineMetadata({ pipeline, pipelineIdentification }) {
|
|
3047
|
+
validatePipelineUrl(pipeline, pipelineIdentification);
|
|
3048
|
+
validatePipelineBookVersion(pipeline, pipelineIdentification);
|
|
3049
|
+
}
|
|
3050
|
+
/**
|
|
3051
|
+
* Validates the pipeline URL, when present.
|
|
2846
3052
|
*
|
|
2847
|
-
* @
|
|
3053
|
+
* @private internal utility of `validatePipelineMetadata`
|
|
2848
3054
|
*/
|
|
2849
|
-
function
|
|
2850
|
-
if (
|
|
2851
|
-
|
|
2852
|
-
}
|
|
2853
|
-
else {
|
|
2854
|
-
try {
|
|
2855
|
-
validatePipeline_InnerFunction(pipeline);
|
|
2856
|
-
}
|
|
2857
|
-
catch (error) {
|
|
2858
|
-
if (!(error instanceof PipelineLogicError)) {
|
|
2859
|
-
throw error;
|
|
2860
|
-
}
|
|
2861
|
-
console.error(spaceTrim$1((block) => `
|
|
2862
|
-
Pipeline is not valid but logic errors are temporarily disabled via \`IS_PIPELINE_LOGIC_VALIDATED\`
|
|
2863
|
-
|
|
2864
|
-
${block(error.message)}
|
|
2865
|
-
`));
|
|
2866
|
-
}
|
|
2867
|
-
}
|
|
2868
|
-
return pipeline;
|
|
2869
|
-
}
|
|
2870
|
-
/**
|
|
2871
|
-
* Validates pipeline inner function.
|
|
2872
|
-
*
|
|
2873
|
-
* @private internal function for `validatePipeline`
|
|
2874
|
-
*/
|
|
2875
|
-
function validatePipeline_InnerFunction(pipeline) {
|
|
2876
|
-
// TODO: [🧠] Maybe test if promptbook is a promise and make specific error case for that
|
|
2877
|
-
const context = createPipelineValidationContext(pipeline);
|
|
2878
|
-
validatePipelineMetadata(context);
|
|
2879
|
-
validatePipelineCollectionsStructure(context);
|
|
2880
|
-
validatePipelineParameters(context);
|
|
2881
|
-
validatePipelineTasks(context);
|
|
2882
|
-
validatePipelineDependencyResolution(context);
|
|
2883
|
-
// Note: Check that formfactor is corresponding to the pipeline interface
|
|
2884
|
-
// TODO: !!6 Implement this
|
|
2885
|
-
// pipeline.formfactorName
|
|
2886
|
-
}
|
|
2887
|
-
/**
|
|
2888
|
-
* Creates the shared validation context for one pipeline.
|
|
2889
|
-
*
|
|
2890
|
-
* @private internal utility of `validatePipeline`
|
|
2891
|
-
*/
|
|
2892
|
-
function createPipelineValidationContext(pipeline) {
|
|
2893
|
-
return {
|
|
2894
|
-
pipeline,
|
|
2895
|
-
pipelineIdentification: getPipelineIdentification(pipeline),
|
|
2896
|
-
};
|
|
2897
|
-
}
|
|
2898
|
-
/**
|
|
2899
|
-
* Builds a short file/url identification block for validation errors.
|
|
2900
|
-
*
|
|
2901
|
-
* @private internal utility of `validatePipeline`
|
|
2902
|
-
*/
|
|
2903
|
-
function getPipelineIdentification(pipeline) {
|
|
2904
|
-
// Note: This is a 😐 implementation of [🚞]
|
|
2905
|
-
const pipelineIdentificationParts = [];
|
|
2906
|
-
if (pipeline.sourceFile !== undefined) {
|
|
2907
|
-
pipelineIdentificationParts.push(`File: ${pipeline.sourceFile}`);
|
|
2908
|
-
}
|
|
2909
|
-
if (pipeline.pipelineUrl !== undefined) {
|
|
2910
|
-
pipelineIdentificationParts.push(`Url: ${pipeline.pipelineUrl}`);
|
|
2911
|
-
}
|
|
2912
|
-
return pipelineIdentificationParts.join('\n');
|
|
2913
|
-
}
|
|
2914
|
-
/**
|
|
2915
|
-
* Validates pipeline-level metadata fields.
|
|
2916
|
-
*
|
|
2917
|
-
* @private internal step of `validatePipeline`
|
|
2918
|
-
*/
|
|
2919
|
-
function validatePipelineMetadata({ pipeline, pipelineIdentification }) {
|
|
2920
|
-
validatePipelineUrl(pipeline, pipelineIdentification);
|
|
2921
|
-
validatePipelineBookVersion(pipeline, pipelineIdentification);
|
|
2922
|
-
}
|
|
2923
|
-
/**
|
|
2924
|
-
* Validates that the expected top-level collections have array structure.
|
|
2925
|
-
*
|
|
2926
|
-
* @private internal step of `validatePipeline`
|
|
2927
|
-
*/
|
|
2928
|
-
function validatePipelineCollectionsStructure({ pipeline, pipelineIdentification }) {
|
|
2929
|
-
validatePipelineParametersCollection(pipeline, pipelineIdentification);
|
|
2930
|
-
validatePipelineTasksCollection(pipeline, pipelineIdentification);
|
|
2931
|
-
}
|
|
2932
|
-
/**
|
|
2933
|
-
* Validates all pipeline parameter declarations.
|
|
2934
|
-
*
|
|
2935
|
-
* @private internal step of `validatePipeline`
|
|
2936
|
-
*/
|
|
2937
|
-
function validatePipelineParameters({ pipeline, pipelineIdentification }) {
|
|
2938
|
-
for (const parameter of pipeline.parameters) {
|
|
2939
|
-
validatePipelineParameter(parameter, pipeline, pipelineIdentification);
|
|
2940
|
-
}
|
|
2941
|
-
}
|
|
2942
|
-
/**
|
|
2943
|
-
* Validates all pipeline tasks and their per-task invariants.
|
|
2944
|
-
*
|
|
2945
|
-
* @private internal step of `validatePipeline`
|
|
2946
|
-
*/
|
|
2947
|
-
function validatePipelineTasks({ pipeline, pipelineIdentification }) {
|
|
2948
|
-
// Note: All input parameters are defined - so that they can be used as result of some task
|
|
2949
|
-
const definedParameters = createInitiallyDefinedParameters(pipeline);
|
|
2950
|
-
for (const task of pipeline.tasks) {
|
|
2951
|
-
validatePipelineTask(task, definedParameters, pipelineIdentification);
|
|
2952
|
-
}
|
|
2953
|
-
}
|
|
2954
|
-
/**
|
|
2955
|
-
* Validates that task dependencies can be resolved without cycles or missing definitions.
|
|
2956
|
-
*
|
|
2957
|
-
* @private internal step of `validatePipeline`
|
|
2958
|
-
*/
|
|
2959
|
-
function validatePipelineDependencyResolution({ pipeline, pipelineIdentification }) {
|
|
2960
|
-
let dependencyResolutionState = createInitialDependencyResolutionState(pipeline);
|
|
2961
|
-
let loopLimit = LOOP_LIMIT;
|
|
2962
|
-
while (hasUnresolvedTasks(dependencyResolutionState)) {
|
|
2963
|
-
if (loopLimit-- < 0) {
|
|
2964
|
-
throw createDependencyResolutionLoopLimitError(pipelineIdentification);
|
|
2965
|
-
}
|
|
2966
|
-
dependencyResolutionState = resolveNextDependencyResolutionState(dependencyResolutionState, pipelineIdentification);
|
|
2967
|
-
}
|
|
2968
|
-
}
|
|
2969
|
-
/**
|
|
2970
|
-
* Validates one pipeline parameter declaration.
|
|
2971
|
-
*
|
|
2972
|
-
* @private internal step of `validatePipeline`
|
|
2973
|
-
*/
|
|
2974
|
-
function validatePipelineParameter(parameter, pipeline, pipelineIdentification) {
|
|
2975
|
-
validateParameterDirection(parameter, pipelineIdentification);
|
|
2976
|
-
validateParameterUsage(parameter, pipeline, pipelineIdentification);
|
|
2977
|
-
validateParameterDefinition(parameter, pipeline, pipelineIdentification);
|
|
2978
|
-
}
|
|
2979
|
-
/**
|
|
2980
|
-
* Validates one pipeline task and its invariants.
|
|
2981
|
-
*
|
|
2982
|
-
* @private internal step of `validatePipeline`
|
|
2983
|
-
*/
|
|
2984
|
-
function validatePipelineTask(task, definedParameters, pipelineIdentification) {
|
|
2985
|
-
validateTaskResultingParameter(task, definedParameters, pipelineIdentification);
|
|
2986
|
-
validateTaskJokers(task, pipelineIdentification);
|
|
2987
|
-
validateTaskExpectations(task, pipelineIdentification);
|
|
2988
|
-
}
|
|
2989
|
-
/**
|
|
2990
|
-
* Validates the pipeline URL, when present.
|
|
2991
|
-
*
|
|
2992
|
-
* @private internal utility of `validatePipeline`
|
|
2993
|
-
*/
|
|
2994
|
-
function validatePipelineUrl(pipeline, pipelineIdentification) {
|
|
2995
|
-
if (pipeline.pipelineUrl === undefined || isValidPipelineUrl(pipeline.pipelineUrl)) {
|
|
2996
|
-
return;
|
|
3055
|
+
function validatePipelineUrl(pipeline, pipelineIdentification) {
|
|
3056
|
+
if (pipeline.pipelineUrl === undefined || isValidPipelineUrl(pipeline.pipelineUrl)) {
|
|
3057
|
+
return;
|
|
2997
3058
|
}
|
|
2998
3059
|
// <- Note: [🚲]
|
|
2999
3060
|
throw new PipelineLogicError(spaceTrim$1((block) => `
|
|
@@ -3005,7 +3066,7 @@ function validatePipelineUrl(pipeline, pipelineIdentification) {
|
|
|
3005
3066
|
/**
|
|
3006
3067
|
* Validates the Promptbook version, when present.
|
|
3007
3068
|
*
|
|
3008
|
-
* @private internal utility of `
|
|
3069
|
+
* @private internal utility of `validatePipelineMetadata`
|
|
3009
3070
|
*/
|
|
3010
3071
|
function validatePipelineBookVersion(pipeline, pipelineIdentification) {
|
|
3011
3072
|
if (pipeline.bookVersion === undefined || isValidPromptbookVersion(pipeline.bookVersion)) {
|
|
@@ -3018,48 +3079,31 @@ function validatePipelineBookVersion(pipeline, pipelineIdentification) {
|
|
|
3018
3079
|
${block(pipelineIdentification)}
|
|
3019
3080
|
`));
|
|
3020
3081
|
}
|
|
3082
|
+
|
|
3021
3083
|
/**
|
|
3022
|
-
* Validates
|
|
3084
|
+
* Validates all pipeline parameter declarations.
|
|
3023
3085
|
*
|
|
3024
|
-
* @private
|
|
3086
|
+
* @private function of `validatePipeline`
|
|
3025
3087
|
*/
|
|
3026
|
-
function
|
|
3027
|
-
|
|
3028
|
-
|
|
3029
|
-
return;
|
|
3088
|
+
function validatePipelineParameters({ pipeline, pipelineIdentification }) {
|
|
3089
|
+
for (const parameter of pipeline.parameters) {
|
|
3090
|
+
validatePipelineParameter(parameter, pipeline, pipelineIdentification);
|
|
3030
3091
|
}
|
|
3031
|
-
// TODO: [🧠] what is the correct error tp throw - maybe PromptbookSchemaError
|
|
3032
|
-
throw new ParseError(spaceTrim$1((block) => `
|
|
3033
|
-
Pipeline is valid JSON but with wrong structure
|
|
3034
|
-
|
|
3035
|
-
\`PipelineJson.parameters\` expected to be an array, but got ${typeof pipeline.parameters}
|
|
3036
|
-
|
|
3037
|
-
${block(pipelineIdentification)}
|
|
3038
|
-
`));
|
|
3039
3092
|
}
|
|
3040
3093
|
/**
|
|
3041
|
-
* Validates
|
|
3094
|
+
* Validates one pipeline parameter declaration.
|
|
3042
3095
|
*
|
|
3043
|
-
* @private internal utility of `
|
|
3096
|
+
* @private internal utility of `validatePipelineParameters`
|
|
3044
3097
|
*/
|
|
3045
|
-
function
|
|
3046
|
-
|
|
3047
|
-
|
|
3048
|
-
|
|
3049
|
-
}
|
|
3050
|
-
// TODO: [🧠] what is the correct error tp throw - maybe PromptbookSchemaError
|
|
3051
|
-
throw new ParseError(spaceTrim$1((block) => `
|
|
3052
|
-
Pipeline is valid JSON but with wrong structure
|
|
3053
|
-
|
|
3054
|
-
\`PipelineJson.tasks\` expected to be an array, but got ${typeof pipeline.tasks}
|
|
3055
|
-
|
|
3056
|
-
${block(pipelineIdentification)}
|
|
3057
|
-
`));
|
|
3098
|
+
function validatePipelineParameter(parameter, pipeline, pipelineIdentification) {
|
|
3099
|
+
validateParameterDirection(parameter, pipelineIdentification);
|
|
3100
|
+
validateParameterUsage(parameter, pipeline, pipelineIdentification);
|
|
3101
|
+
validateParameterDefinition(parameter, pipeline, pipelineIdentification);
|
|
3058
3102
|
}
|
|
3059
3103
|
/**
|
|
3060
3104
|
* Validates that one parameter does not declare incompatible directions.
|
|
3061
3105
|
*
|
|
3062
|
-
* @private internal utility of `
|
|
3106
|
+
* @private internal utility of `validatePipelineParameters`
|
|
3063
3107
|
*/
|
|
3064
3108
|
function validateParameterDirection(parameter, pipelineIdentification) {
|
|
3065
3109
|
if (!parameter.isInput || !parameter.isOutput) {
|
|
@@ -3076,7 +3120,7 @@ function validateParameterDirection(parameter, pipelineIdentification) {
|
|
|
3076
3120
|
/**
|
|
3077
3121
|
* Validates that one intermediate parameter is actually consumed by at least one task.
|
|
3078
3122
|
*
|
|
3079
|
-
* @private internal utility of `
|
|
3123
|
+
* @private internal utility of `validatePipelineParameters`
|
|
3080
3124
|
*/
|
|
3081
3125
|
function validateParameterUsage(parameter, pipeline, pipelineIdentification) {
|
|
3082
3126
|
if (parameter.isInput || parameter.isOutput || isParameterUsedByAnyTask(parameter, pipeline.tasks)) {
|
|
@@ -3095,7 +3139,7 @@ function validateParameterUsage(parameter, pipeline, pipelineIdentification) {
|
|
|
3095
3139
|
/**
|
|
3096
3140
|
* Validates that one non-input parameter is produced by at least one task.
|
|
3097
3141
|
*
|
|
3098
|
-
* @private internal utility of `
|
|
3142
|
+
* @private internal utility of `validatePipelineParameters`
|
|
3099
3143
|
*/
|
|
3100
3144
|
function validateParameterDefinition(parameter, pipeline, pipelineIdentification) {
|
|
3101
3145
|
if (parameter.isInput || isParameterDefinedByAnyTask(parameter, pipeline.tasks)) {
|
|
@@ -3114,7 +3158,7 @@ function validateParameterDefinition(parameter, pipeline, pipelineIdentification
|
|
|
3114
3158
|
/**
|
|
3115
3159
|
* Checks whether one parameter is consumed by at least one task dependency list.
|
|
3116
3160
|
*
|
|
3117
|
-
* @private internal utility of `
|
|
3161
|
+
* @private internal utility of `validatePipelineParameters`
|
|
3118
3162
|
*/
|
|
3119
3163
|
function isParameterUsedByAnyTask(parameter, tasks) {
|
|
3120
3164
|
return tasks.some((task) => task.dependentParameterNames.includes(parameter.name));
|
|
@@ -3122,23 +3166,46 @@ function isParameterUsedByAnyTask(parameter, tasks) {
|
|
|
3122
3166
|
/**
|
|
3123
3167
|
* Checks whether one parameter is produced by at least one task.
|
|
3124
3168
|
*
|
|
3125
|
-
* @private internal utility of `
|
|
3169
|
+
* @private internal utility of `validatePipelineParameters`
|
|
3126
3170
|
*/
|
|
3127
3171
|
function isParameterDefinedByAnyTask(parameter, tasks) {
|
|
3128
3172
|
return tasks.some((task) => task.resultingParameterName === parameter.name);
|
|
3129
3173
|
}
|
|
3174
|
+
|
|
3175
|
+
/**
|
|
3176
|
+
* Validates all pipeline tasks and their per-task invariants.
|
|
3177
|
+
*
|
|
3178
|
+
* @private function of `validatePipeline`
|
|
3179
|
+
*/
|
|
3180
|
+
function validatePipelineTasks({ pipeline, pipelineIdentification }) {
|
|
3181
|
+
// Note: All input parameters are defined - so that they can be used as result of some task
|
|
3182
|
+
const definedParameters = createInitiallyDefinedParameters(pipeline);
|
|
3183
|
+
for (const task of pipeline.tasks) {
|
|
3184
|
+
validatePipelineTask(task, definedParameters, pipelineIdentification);
|
|
3185
|
+
}
|
|
3186
|
+
}
|
|
3130
3187
|
/**
|
|
3131
3188
|
* Collects the parameter names that are already defined before task validation starts.
|
|
3132
3189
|
*
|
|
3133
|
-
* @private internal utility of `
|
|
3190
|
+
* @private internal utility of `validatePipelineTasks`
|
|
3134
3191
|
*/
|
|
3135
3192
|
function createInitiallyDefinedParameters(pipeline) {
|
|
3136
3193
|
return new Set(pipeline.parameters.filter(({ isInput }) => isInput).map(({ name }) => name));
|
|
3137
3194
|
}
|
|
3195
|
+
/**
|
|
3196
|
+
* Validates one pipeline task and its invariants.
|
|
3197
|
+
*
|
|
3198
|
+
* @private internal utility of `validatePipelineTasks`
|
|
3199
|
+
*/
|
|
3200
|
+
function validatePipelineTask(task, definedParameters, pipelineIdentification) {
|
|
3201
|
+
validateTaskResultingParameter(task, definedParameters, pipelineIdentification);
|
|
3202
|
+
validateTaskJokers(task, pipelineIdentification);
|
|
3203
|
+
validateTaskExpectations(task, pipelineIdentification);
|
|
3204
|
+
}
|
|
3138
3205
|
/**
|
|
3139
3206
|
* Validates one task result parameter declaration and marks it as defined.
|
|
3140
3207
|
*
|
|
3141
|
-
* @private internal utility of `
|
|
3208
|
+
* @private internal utility of `validatePipelineTasks`
|
|
3142
3209
|
*/
|
|
3143
3210
|
function validateTaskResultingParameter(task, definedParameters, pipelineIdentification) {
|
|
3144
3211
|
if (definedParameters.has(task.resultingParameterName)) {
|
|
@@ -3160,7 +3227,7 @@ function validateTaskResultingParameter(task, definedParameters, pipelineIdentif
|
|
|
3160
3227
|
/**
|
|
3161
3228
|
* Validates joker parameters for one task.
|
|
3162
3229
|
*
|
|
3163
|
-
* @private internal utility of `
|
|
3230
|
+
* @private internal utility of `validatePipelineTasks`
|
|
3164
3231
|
*/
|
|
3165
3232
|
function validateTaskJokers(task, pipelineIdentification) {
|
|
3166
3233
|
if (!hasTaskJokers(task)) {
|
|
@@ -3172,7 +3239,7 @@ function validateTaskJokers(task, pipelineIdentification) {
|
|
|
3172
3239
|
/**
|
|
3173
3240
|
* Checks whether one task declares any joker parameters.
|
|
3174
3241
|
*
|
|
3175
|
-
* @private internal utility of `
|
|
3242
|
+
* @private internal utility of `validatePipelineTasks`
|
|
3176
3243
|
*/
|
|
3177
3244
|
function hasTaskJokers(task) {
|
|
3178
3245
|
return !!task.jokerParameterNames && task.jokerParameterNames.length > 0;
|
|
@@ -3180,7 +3247,7 @@ function hasTaskJokers(task) {
|
|
|
3180
3247
|
/**
|
|
3181
3248
|
* Validates that a task has the required supporting features when using jokers.
|
|
3182
3249
|
*
|
|
3183
|
-
* @private internal utility of `
|
|
3250
|
+
* @private internal utility of `validatePipelineTasks`
|
|
3184
3251
|
*/
|
|
3185
3252
|
function validateTaskSupportsJokers(task, pipelineIdentification) {
|
|
3186
3253
|
if (task.format || task.expectations /* <- TODO: Require at least 1 -> min <- expectation to use jokers */) {
|
|
@@ -3195,7 +3262,7 @@ function validateTaskSupportsJokers(task, pipelineIdentification) {
|
|
|
3195
3262
|
/**
|
|
3196
3263
|
* Validates that every joker parameter is also listed among task dependencies.
|
|
3197
3264
|
*
|
|
3198
|
-
* @private internal utility of `
|
|
3265
|
+
* @private internal utility of `validatePipelineTasks`
|
|
3199
3266
|
*/
|
|
3200
3267
|
function validateTaskJokerDependencies(task, pipelineIdentification) {
|
|
3201
3268
|
for (const joker of task.jokerParameterNames) {
|
|
@@ -3212,7 +3279,7 @@ function validateTaskJokerDependencies(task, pipelineIdentification) {
|
|
|
3212
3279
|
/**
|
|
3213
3280
|
* Validates all expectation bounds configured on one task.
|
|
3214
3281
|
*
|
|
3215
|
-
* @private internal utility of `
|
|
3282
|
+
* @private internal utility of `validatePipelineTasks`
|
|
3216
3283
|
*/
|
|
3217
3284
|
function validateTaskExpectations(task, pipelineIdentification) {
|
|
3218
3285
|
if (!task.expectations) {
|
|
@@ -3227,7 +3294,7 @@ function validateTaskExpectations(task, pipelineIdentification) {
|
|
|
3227
3294
|
/**
|
|
3228
3295
|
* Validates the minimum and maximum expectation ordering for one unit.
|
|
3229
3296
|
*
|
|
3230
|
-
* @private internal utility of `
|
|
3297
|
+
* @private internal utility of `validatePipelineTasks`
|
|
3231
3298
|
*/
|
|
3232
3299
|
function validateTaskExpectationRange(unit, min, max, pipelineIdentification) {
|
|
3233
3300
|
if (min === undefined || max === undefined || min <= max) {
|
|
@@ -3242,7 +3309,7 @@ function validateTaskExpectationRange(unit, min, max, pipelineIdentification) {
|
|
|
3242
3309
|
/**
|
|
3243
3310
|
* Validates the minimum expectation bound for one unit.
|
|
3244
3311
|
*
|
|
3245
|
-
* @private internal utility of `
|
|
3312
|
+
* @private internal utility of `validatePipelineTasks`
|
|
3246
3313
|
*/
|
|
3247
3314
|
function validateTaskExpectationMin(unit, min, pipelineIdentification) {
|
|
3248
3315
|
if (min === undefined || min >= 0) {
|
|
@@ -3257,7 +3324,7 @@ function validateTaskExpectationMin(unit, min, pipelineIdentification) {
|
|
|
3257
3324
|
/**
|
|
3258
3325
|
* Validates the maximum expectation bound for one unit.
|
|
3259
3326
|
*
|
|
3260
|
-
* @private internal utility of `
|
|
3327
|
+
* @private internal utility of `validatePipelineTasks`
|
|
3261
3328
|
*/
|
|
3262
3329
|
function validateTaskExpectationMax(unit, max, pipelineIdentification) {
|
|
3263
3330
|
if (max === undefined || max > 0) {
|
|
@@ -3269,123 +3336,62 @@ function validateTaskExpectationMax(unit, max, pipelineIdentification) {
|
|
|
3269
3336
|
${block(pipelineIdentification)}
|
|
3270
3337
|
`));
|
|
3271
3338
|
}
|
|
3339
|
+
|
|
3272
3340
|
/**
|
|
3273
|
-
*
|
|
3274
|
-
*
|
|
3275
|
-
* @private internal utility of `validatePipeline`
|
|
3276
|
-
*/
|
|
3277
|
-
function createInitialDependencyResolutionState(pipeline) {
|
|
3278
|
-
return {
|
|
3279
|
-
resolvedParameterNames: createInitiallyResolvedParameterNames(pipeline),
|
|
3280
|
-
unresolvedTasks: [...pipeline.tasks],
|
|
3281
|
-
};
|
|
3282
|
-
}
|
|
3283
|
-
/**
|
|
3284
|
-
* Checks whether dependency resolution still has tasks left to process.
|
|
3285
|
-
*
|
|
3286
|
-
* @private internal utility of `validatePipeline`
|
|
3287
|
-
*/
|
|
3288
|
-
function hasUnresolvedTasks({ unresolvedTasks }) {
|
|
3289
|
-
return unresolvedTasks.length > 0;
|
|
3290
|
-
}
|
|
3291
|
-
/**
|
|
3292
|
-
* Resolves the next batch of currently satisfiable tasks.
|
|
3341
|
+
* Validates PipelineJson if it is logically valid
|
|
3293
3342
|
*
|
|
3294
|
-
*
|
|
3295
|
-
|
|
3296
|
-
function resolveNextDependencyResolutionState(dependencyResolutionState, pipelineIdentification) {
|
|
3297
|
-
const currentlyResolvedTasks = getCurrentlyResolvedTasks(dependencyResolutionState.unresolvedTasks, dependencyResolutionState.resolvedParameterNames);
|
|
3298
|
-
if (currentlyResolvedTasks.length === 0) {
|
|
3299
|
-
throw createUnresolvedTasksError(dependencyResolutionState.unresolvedTasks, dependencyResolutionState.resolvedParameterNames, pipelineIdentification);
|
|
3300
|
-
}
|
|
3301
|
-
return {
|
|
3302
|
-
resolvedParameterNames: appendResolvedTaskParameterNames(dependencyResolutionState.resolvedParameterNames, currentlyResolvedTasks),
|
|
3303
|
-
unresolvedTasks: dependencyResolutionState.unresolvedTasks.filter((task) => !currentlyResolvedTasks.includes(task)),
|
|
3304
|
-
};
|
|
3305
|
-
}
|
|
3306
|
-
/**
|
|
3307
|
-
* Collects the parameter names that are already resolvable before dependency traversal starts.
|
|
3343
|
+
* It checks:
|
|
3344
|
+
* - if it has correct parameters dependency
|
|
3308
3345
|
*
|
|
3309
|
-
*
|
|
3310
|
-
|
|
3311
|
-
|
|
3312
|
-
let resolvedParameterNames = pipeline.parameters
|
|
3313
|
-
.filter(({ isInput }) => isInput)
|
|
3314
|
-
.map(({ name }) => name);
|
|
3315
|
-
for (const reservedParameterName of RESERVED_PARAMETER_NAMES) {
|
|
3316
|
-
resolvedParameterNames = [...resolvedParameterNames, reservedParameterName];
|
|
3317
|
-
}
|
|
3318
|
-
return resolvedParameterNames;
|
|
3319
|
-
}
|
|
3320
|
-
/**
|
|
3321
|
-
* Adds newly resolved task outputs to the resolved parameter list.
|
|
3346
|
+
* It does NOT check:
|
|
3347
|
+
* - if it is valid json
|
|
3348
|
+
* - if it is meaningful
|
|
3322
3349
|
*
|
|
3323
|
-
*
|
|
3324
|
-
*/
|
|
3325
|
-
function appendResolvedTaskParameterNames(resolvedParameterNames, currentlyResolvedTasks) {
|
|
3326
|
-
return [
|
|
3327
|
-
...resolvedParameterNames,
|
|
3328
|
-
...currentlyResolvedTasks.map(({ resultingParameterName }) => resultingParameterName),
|
|
3329
|
-
];
|
|
3330
|
-
}
|
|
3331
|
-
/**
|
|
3332
|
-
* Selects tasks whose dependencies are already resolved.
|
|
3350
|
+
* Note: [🔂] This function is idempotent.
|
|
3333
3351
|
*
|
|
3334
|
-
* @
|
|
3335
|
-
|
|
3336
|
-
|
|
3337
|
-
return unresolvedTasks.filter((task) => task.dependentParameterNames.every((name) => resolvedParameterNames.includes(name)));
|
|
3338
|
-
}
|
|
3339
|
-
/**
|
|
3340
|
-
* Creates the unexpected loop-limit error for dependency resolution.
|
|
3352
|
+
* @param pipeline valid or invalid PipelineJson
|
|
3353
|
+
* @returns the same pipeline if it is logically valid
|
|
3354
|
+
* @throws {PipelineLogicError} on logical error in the pipeline
|
|
3341
3355
|
*
|
|
3342
|
-
* @
|
|
3356
|
+
* @public exported from `@promptbook/core`
|
|
3343
3357
|
*/
|
|
3344
|
-
function
|
|
3345
|
-
|
|
3346
|
-
|
|
3347
|
-
|
|
3358
|
+
function validatePipeline(pipeline) {
|
|
3359
|
+
if (IS_PIPELINE_LOGIC_VALIDATED) {
|
|
3360
|
+
validatePipeline_InnerFunction(pipeline);
|
|
3361
|
+
}
|
|
3362
|
+
else {
|
|
3363
|
+
try {
|
|
3364
|
+
validatePipeline_InnerFunction(pipeline);
|
|
3365
|
+
}
|
|
3366
|
+
catch (error) {
|
|
3367
|
+
if (!(error instanceof PipelineLogicError)) {
|
|
3368
|
+
throw error;
|
|
3369
|
+
}
|
|
3370
|
+
console.error(spaceTrim$1((block) => `
|
|
3371
|
+
Pipeline is not valid but logic errors are temporarily disabled via \`IS_PIPELINE_LOGIC_VALIDATED\`
|
|
3348
3372
|
|
|
3349
|
-
|
|
3350
|
-
|
|
3373
|
+
${block(error.message)}
|
|
3374
|
+
`));
|
|
3375
|
+
}
|
|
3376
|
+
}
|
|
3377
|
+
return pipeline;
|
|
3351
3378
|
}
|
|
3352
3379
|
/**
|
|
3353
|
-
*
|
|
3380
|
+
* Validates pipeline inner function.
|
|
3354
3381
|
*
|
|
3355
|
-
* @private internal
|
|
3382
|
+
* @private internal function for `validatePipeline`
|
|
3356
3383
|
*/
|
|
3357
|
-
function
|
|
3358
|
-
|
|
3359
|
-
|
|
3360
|
-
|
|
3361
|
-
|
|
3362
|
-
|
|
3363
|
-
|
|
3364
|
-
|
|
3365
|
-
|
|
3366
|
-
|
|
3367
|
-
|
|
3368
|
-
${block(unresolvedTasks
|
|
3369
|
-
.map(({ resultingParameterName, dependentParameterNames }) => `- Parameter \`{${resultingParameterName}}\` which depends on ${dependentParameterNames
|
|
3370
|
-
.map((dependentParameterName) => `\`{${dependentParameterName}}\``)
|
|
3371
|
-
.join(' and ')}`)
|
|
3372
|
-
.join('\n'))}
|
|
3373
|
-
|
|
3374
|
-
**Resolved:**
|
|
3375
|
-
${block(resolvedParameterNames
|
|
3376
|
-
.filter((name) => !RESERVED_PARAMETER_NAMES.includes(name))
|
|
3377
|
-
.map((name) => `- Parameter \`{${name}}\``)
|
|
3378
|
-
.join('\n'))}
|
|
3379
|
-
|
|
3380
|
-
|
|
3381
|
-
**Reserved (which are available):**
|
|
3382
|
-
${block(resolvedParameterNames
|
|
3383
|
-
.filter((name) => RESERVED_PARAMETER_NAMES.includes(name))
|
|
3384
|
-
.map((name) => `- Parameter \`{${name}}\``)
|
|
3385
|
-
.join('\n'))}
|
|
3386
|
-
|
|
3387
|
-
|
|
3388
|
-
`));
|
|
3384
|
+
function validatePipeline_InnerFunction(pipeline) {
|
|
3385
|
+
// TODO: [🧠] Maybe test if promptbook is a promise and make specific error case for that
|
|
3386
|
+
const context = createPipelineValidationContext(pipeline);
|
|
3387
|
+
validatePipelineMetadata(context);
|
|
3388
|
+
validatePipelineCollectionsStructure(context);
|
|
3389
|
+
validatePipelineParameters(context);
|
|
3390
|
+
validatePipelineTasks(context);
|
|
3391
|
+
validatePipelineDependencyResolution(context);
|
|
3392
|
+
// Note: Check that formfactor is corresponding to the pipeline interface
|
|
3393
|
+
// TODO: !!6 Implement this
|
|
3394
|
+
// pipeline.formfactorName
|
|
3389
3395
|
}
|
|
3390
3396
|
/**
|
|
3391
3397
|
* TODO: [🧞♀️] Do not allow joker + foreach
|