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