@promptbook/markdown-utils 0.113.0-7 → 0.113.0-9

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.
Files changed (221) hide show
  1. package/esm/index.es.js +459 -453
  2. package/esm/index.es.js.map +1 -1
  3. package/esm/src/_packages/types.index.d.ts +2 -2
  4. package/esm/src/avatars/renderAvatarVisualAsciiArt.d.ts +24 -1
  5. package/esm/src/avatars/visuals/octopus3dAvatarVisualShared.d.ts +1 -1
  6. package/esm/src/book-components/BookEditor/BookEditorMonacoUploadPanel.d.ts +1 -1
  7. package/esm/src/book-components/BookEditor/useBookEditorMonacoUploads/bookEditorMonacoUploadTypes.d.ts +120 -0
  8. package/esm/src/book-components/BookEditor/useBookEditorMonacoUploads/clearScheduledTimer.d.ts +6 -0
  9. package/esm/src/book-components/BookEditor/useBookEditorMonacoUploads/enqueueFilesForUpload.d.ts +26 -0
  10. package/esm/src/book-components/BookEditor/useBookEditorMonacoUploads/useBookEditorMonacoUploadEditorSync.d.ts +23 -0
  11. package/esm/src/book-components/BookEditor/useBookEditorMonacoUploads/useBookEditorMonacoUploadItemsState.d.ts +21 -0
  12. package/esm/src/book-components/BookEditor/useBookEditorMonacoUploads/useBookEditorMonacoUploadProgressQueue.d.ts +12 -0
  13. package/esm/src/book-components/BookEditor/useBookEditorMonacoUploads/useBookEditorMonacoUploadQueue.d.ts +27 -0
  14. package/esm/src/book-components/BookEditor/useBookEditorMonacoUploads/useCompletedUploadsAutoClear.d.ts +12 -0
  15. package/esm/src/book-components/BookEditor/useBookEditorMonacoUploads.d.ts +5 -58
  16. package/esm/src/book-components/Chat/Chat/ChatImageAttachmentModal.d.ts +25 -0
  17. package/esm/src/book-components/Chat/Chat/ChatInputArea.d.ts +3 -0
  18. package/esm/src/book-components/Chat/Chat/ChatMessageAttachments.d.ts +27 -0
  19. package/esm/src/book-components/Chat/Chat/ChatMessageItem.d.ts +1 -1
  20. package/esm/src/book-components/Chat/Chat/ChatMessageList.d.ts +1 -0
  21. package/esm/src/book-components/Chat/Chat/ChatProps.d.ts +8 -0
  22. package/esm/src/book-components/Chat/Chat/useChatInputAreaComposer.d.ts +12 -0
  23. package/esm/src/book-components/Chat/Chat/useChatInputAreaComposer.draftMessage.test.d.ts +2 -0
  24. package/esm/src/book-components/Chat/utils/isVisibleChatToolCall.d.ts +1 -1
  25. package/esm/src/book-components/Chat/utils/parseMessageButtons.d.ts +16 -2
  26. package/esm/src/cli/cli-commands/agents-server/buildAgentsServer/AGENTS_SERVER_BUILD_CACHE_FILENAME.d.ts +6 -0
  27. package/esm/src/cli/cli-commands/agents-server/buildAgentsServer/AGENTS_SERVER_BUILD_CACHE_VERSION.d.ts +6 -0
  28. package/esm/src/cli/cli-commands/agents-server/buildAgentsServer/AGENTS_SERVER_NEXT_BUILD_ID_FILENAME.d.ts +6 -0
  29. package/esm/src/cli/cli-commands/agents-server/buildAgentsServer/AgentsServerBuildCache.d.ts +10 -0
  30. package/esm/src/cli/cli-commands/agents-server/buildAgentsServer/AgentsServerBuildCacheOptions.d.ts +10 -0
  31. package/esm/src/cli/cli-commands/agents-server/buildAgentsServer/NODE_MODULES_DIRECTORY_NAME.d.ts +6 -0
  32. package/esm/src/cli/cli-commands/agents-server/buildAgentsServer/PreparedAgentsServerRuntime.d.ts +18 -0
  33. package/esm/src/cli/cli-commands/agents-server/buildAgentsServer/createAgentsServerBuildSourceFingerprint.d.ts +6 -0
  34. package/esm/src/cli/cli-commands/agents-server/buildAgentsServer/createAgentsServerRuntimeEnvironment.d.ts +28 -0
  35. package/esm/src/cli/cli-commands/agents-server/buildAgentsServer/ensureAgentsServerBuild.d.ts +19 -0
  36. package/esm/src/cli/cli-commands/agents-server/buildAgentsServer/getAgentsServerBuildInputRelativePaths.d.ts +11 -0
  37. package/esm/src/cli/cli-commands/agents-server/buildAgentsServer/isAgentsServerAppPath.d.ts +6 -0
  38. package/esm/src/cli/cli-commands/agents-server/buildAgentsServer/isAgentsServerAppPathMaterialized.d.ts +6 -0
  39. package/esm/src/cli/cli-commands/agents-server/buildAgentsServer/isAgentsServerBuildCacheCurrent.d.ts +7 -0
  40. package/esm/src/cli/cli-commands/agents-server/buildAgentsServer/isAgentsServerBuildInputTestFile.d.ts +6 -0
  41. package/esm/src/cli/cli-commands/agents-server/buildAgentsServer/isExcludedAgentsServerBuildInputDirectoryName.d.ts +6 -0
  42. package/esm/src/cli/cli-commands/agents-server/buildAgentsServer/isExcludedAgentsServerBuildInputPath.d.ts +6 -0
  43. package/esm/src/cli/cli-commands/agents-server/buildAgentsServer/isExcludedAgentsServerRuntimeSourcePath.d.ts +6 -0
  44. package/esm/src/cli/cli-commands/agents-server/buildAgentsServer/isFile.d.ts +6 -0
  45. package/esm/src/cli/cli-commands/agents-server/buildAgentsServer/isPathInsideNodeModules.d.ts +6 -0
  46. package/esm/src/cli/cli-commands/agents-server/buildAgentsServer/normalizeAgentsServerBuildInputPath.d.ts +6 -0
  47. package/esm/src/cli/cli-commands/agents-server/buildAgentsServer/prepareAgentsServerRuntime.d.ts +9 -0
  48. package/esm/src/cli/cli-commands/agents-server/buildAgentsServer/readAgentsServerBuildCache.d.ts +8 -0
  49. package/esm/src/cli/cli-commands/agents-server/buildAgentsServer/resolveAgentsServerAppPath.d.ts +6 -0
  50. package/esm/src/cli/cli-commands/agents-server/buildAgentsServer/resolveAgentsServerBuildAppPath.d.ts +9 -0
  51. package/esm/src/cli/cli-commands/agents-server/buildAgentsServer/resolveAgentsServerBuildOutputPath.d.ts +7 -0
  52. package/esm/src/cli/cli-commands/agents-server/buildAgentsServer/resolveNextCliPath.d.ts +6 -0
  53. package/esm/src/cli/cli-commands/agents-server/buildAgentsServer/resolveNodeModulesPath.d.ts +6 -0
  54. package/esm/src/cli/cli-commands/agents-server/buildAgentsServer/runNextBuild.d.ts +12 -0
  55. package/esm/src/cli/cli-commands/agents-server/buildAgentsServer/shouldCopyAgentsServerRuntimePath.d.ts +6 -0
  56. package/esm/src/cli/cli-commands/agents-server/buildAgentsServer/synchronizeMaterializedAgentsServerRuntime.d.ts +11 -0
  57. package/esm/src/cli/cli-commands/agents-server/buildAgentsServer/writeAgentsServerBuildCache.d.ts +7 -0
  58. package/esm/src/cli/cli-commands/agents-server/buildAgentsServer.d.ts +8 -109
  59. package/esm/src/cli/cli-commands/agents-server/ensureAgentsServerEnvFile.d.ts +1 -1
  60. package/esm/src/cli/cli-commands/agents-server/ensureAgentsServerGitignoreFile.d.ts +1 -1
  61. package/esm/src/cli/cli-commands/agents-server/startAgentsServer/AgentsServerChildEnvironment.d.ts +16 -0
  62. package/esm/src/cli/cli-commands/agents-server/startAgentsServer/AgentsServerLogStreams.d.ts +30 -0
  63. package/esm/src/cli/cli-commands/agents-server/startAgentsServer/AgentsServerRuntimePaths.d.ts +19 -0
  64. package/esm/src/cli/cli-commands/agents-server/startAgentsServer/AgentsServerSupervisorState.d.ts +37 -0
  65. package/esm/src/cli/cli-commands/agents-server/startAgentsServer/LocalAgentRunnerLimits.d.ts +9 -0
  66. package/esm/src/cli/cli-commands/agents-server/startAgentsServer/PreparedAgentsServerLaunch.d.ts +13 -0
  67. package/esm/src/cli/cli-commands/agents-server/startAgentsServer/StartAgentsServerOptions.d.ts +24 -0
  68. package/esm/src/cli/cli-commands/agents-server/startAgentsServer/createInternalRouteErrorMessage.d.ts +6 -0
  69. package/esm/src/cli/cli-commands/agents-server/startAgentsServer/createLocalAgentRunOptions.d.ts +9 -0
  70. package/esm/src/cli/cli-commands/agents-server/startAgentsServer/forwardChildOutput.d.ts +13 -0
  71. package/esm/src/cli/cli-commands/agents-server/startAgentsServer/loadAgentsServerProjectEnvironment.d.ts +6 -0
  72. package/esm/src/cli/cli-commands/agents-server/startAgentsServer/prepareAgentsServerLaunch.d.ts +18 -0
  73. package/esm/src/cli/cli-commands/agents-server/startAgentsServer/readInternalRouteErrorDetails.d.ts +6 -0
  74. package/esm/src/cli/cli-commands/agents-server/startAgentsServer/resolveAgentsServerChildHostname.d.ts +7 -0
  75. package/esm/src/cli/cli-commands/agents-server/startAgentsServer/startNextServer.d.ts +20 -0
  76. package/esm/src/cli/cli-commands/agents-server/startAgentsServer/startUserChatJobWorkerPump.d.ts +15 -0
  77. package/esm/src/cli/cli-commands/agents-server/startAgentsServer/stopChildProcess.d.ts +8 -0
  78. package/esm/src/cli/cli-commands/agents-server/startAgentsServer/waitForLocalAgentRunnerLimits.d.ts +16 -0
  79. package/esm/src/cli/cli-commands/agents-server/startAgentsServer.d.ts +3 -30
  80. package/esm/src/cli/cli-commands/common/promptRunnerCliOptions.d.ts +1 -1
  81. package/esm/src/collection/agent-collection/CreateAgentInput.d.ts +1 -1
  82. package/esm/src/collection/agent-collection/constructors/agent-collection-in-supabase/prepareAgentSourceForPersistence.d.ts +1 -1
  83. package/esm/src/commitments/META/META.d.ts +2 -2
  84. package/esm/src/commitments/META_AVATAR/META_AVATAR.d.ts +9 -4
  85. package/esm/src/commitments/index.d.ts +1 -1
  86. package/esm/src/conversion/validation/validatePipeline/createPipelineValidationContext.d.ts +16 -0
  87. package/esm/src/conversion/validation/validatePipeline/validatePipelineCollectionsStructure.d.ts +7 -0
  88. package/esm/src/conversion/validation/validatePipeline/validatePipelineDependencyResolution.d.ts +7 -0
  89. package/esm/src/conversion/validation/validatePipeline/validatePipelineMetadata.d.ts +7 -0
  90. package/esm/src/conversion/validation/validatePipeline/validatePipelineParameters.d.ts +7 -0
  91. package/esm/src/conversion/validation/validatePipeline/validatePipelineTasks.d.ts +7 -0
  92. package/esm/src/llm-providers/_common/register/$registeredLlmToolsMessage/RegisteredLlmToolsMessageContext.d.ts +46 -0
  93. package/esm/src/llm-providers/_common/register/$registeredLlmToolsMessage/USED_ENV_FILENAME.d.ts +11 -0
  94. package/esm/src/llm-providers/_common/register/$registeredLlmToolsMessage/createRegisteredLlmToolConfigurationStatusMessage.d.ts +7 -0
  95. package/esm/src/llm-providers/_common/register/$registeredLlmToolsMessage/createRegisteredLlmToolEntryKey.d.ts +7 -0
  96. package/esm/src/llm-providers/_common/register/$registeredLlmToolsMessage/createRegisteredLlmToolInstallationStatusMessage.d.ts +7 -0
  97. package/esm/src/llm-providers/_common/register/$registeredLlmToolsMessage/createRegisteredLlmToolStatus.d.ts +14 -0
  98. package/esm/src/llm-providers/_common/register/$registeredLlmToolsMessage/createRegisteredLlmToolsMessageContext.d.ts +7 -0
  99. package/esm/src/llm-providers/_common/register/$registeredLlmToolsMessage/getAvailableRegisteredLlmToolsEnvironmentVariables.d.ts +7 -0
  100. package/esm/src/llm-providers/_common/register/$registeredLlmToolsMessage/getRegisteredLlmToolRegisters.d.ts +7 -0
  101. package/esm/src/llm-providers/_common/register/$registeredLlmToolsMessage/hasRegisteredLlmToolEntry.d.ts +7 -0
  102. package/esm/src/llm-providers/_common/register/$registeredLlmToolsMessage/listRegisteredLlmToolEntries.d.ts +9 -0
  103. package/esm/src/llm-providers/_common/register/$registeredLlmToolsMessage/listRegisteredLlmToolStatuses.d.ts +7 -0
  104. package/esm/src/llm-providers/_common/register/$registeredLlmToolsMessage/renderAvailableRegisteredLlmTools.d.ts +7 -0
  105. package/esm/src/llm-providers/_common/register/$registeredLlmToolsMessage/renderNoRegisteredLlmToolsMessage.d.ts +7 -0
  106. package/esm/src/llm-providers/_common/register/$registeredLlmToolsMessage/renderRegisteredLlmToolsMessage.d.ts +8 -0
  107. package/esm/src/llm-providers/_common/register/$registeredLlmToolsMessage/renderRelevantRegisteredLlmToolsEnvironmentVariables.d.ts +7 -0
  108. package/esm/src/utils/agents/resolveAgentAvatarImageUrl.d.ts +2 -2
  109. package/esm/src/utils/color/Color.d.ts +1 -1
  110. package/esm/src/version.d.ts +1 -1
  111. package/package.json +1 -1
  112. package/umd/index.umd.js +459 -453
  113. package/umd/index.umd.js.map +1 -1
  114. package/umd/src/_packages/types.index.d.ts +2 -2
  115. package/umd/src/avatars/renderAvatarVisualAsciiArt.d.ts +24 -1
  116. package/umd/src/avatars/visuals/octopus3dAvatarVisualShared.d.ts +1 -1
  117. package/umd/src/book-components/BookEditor/BookEditorMonacoUploadPanel.d.ts +1 -1
  118. package/umd/src/book-components/BookEditor/useBookEditorMonacoUploads/bookEditorMonacoUploadTypes.d.ts +120 -0
  119. package/umd/src/book-components/BookEditor/useBookEditorMonacoUploads/clearScheduledTimer.d.ts +6 -0
  120. package/umd/src/book-components/BookEditor/useBookEditorMonacoUploads/enqueueFilesForUpload.d.ts +26 -0
  121. package/umd/src/book-components/BookEditor/useBookEditorMonacoUploads/useBookEditorMonacoUploadEditorSync.d.ts +23 -0
  122. package/umd/src/book-components/BookEditor/useBookEditorMonacoUploads/useBookEditorMonacoUploadItemsState.d.ts +21 -0
  123. package/umd/src/book-components/BookEditor/useBookEditorMonacoUploads/useBookEditorMonacoUploadProgressQueue.d.ts +12 -0
  124. package/umd/src/book-components/BookEditor/useBookEditorMonacoUploads/useBookEditorMonacoUploadQueue.d.ts +27 -0
  125. package/umd/src/book-components/BookEditor/useBookEditorMonacoUploads/useCompletedUploadsAutoClear.d.ts +12 -0
  126. package/umd/src/book-components/BookEditor/useBookEditorMonacoUploads.d.ts +5 -58
  127. package/umd/src/book-components/Chat/Chat/ChatImageAttachmentModal.d.ts +25 -0
  128. package/umd/src/book-components/Chat/Chat/ChatInputArea.d.ts +3 -0
  129. package/umd/src/book-components/Chat/Chat/ChatMessageAttachments.d.ts +27 -0
  130. package/umd/src/book-components/Chat/Chat/ChatMessageItem.d.ts +1 -1
  131. package/umd/src/book-components/Chat/Chat/ChatMessageList.d.ts +1 -0
  132. package/umd/src/book-components/Chat/Chat/ChatProps.d.ts +8 -0
  133. package/umd/src/book-components/Chat/Chat/useChatInputAreaComposer.d.ts +12 -0
  134. package/umd/src/book-components/Chat/Chat/useChatInputAreaComposer.draftMessage.test.d.ts +2 -0
  135. package/umd/src/book-components/Chat/utils/isVisibleChatToolCall.d.ts +1 -1
  136. package/umd/src/book-components/Chat/utils/parseMessageButtons.d.ts +16 -2
  137. package/umd/src/cli/cli-commands/agents-server/buildAgentsServer/AGENTS_SERVER_BUILD_CACHE_FILENAME.d.ts +6 -0
  138. package/umd/src/cli/cli-commands/agents-server/buildAgentsServer/AGENTS_SERVER_BUILD_CACHE_VERSION.d.ts +6 -0
  139. package/umd/src/cli/cli-commands/agents-server/buildAgentsServer/AGENTS_SERVER_NEXT_BUILD_ID_FILENAME.d.ts +6 -0
  140. package/umd/src/cli/cli-commands/agents-server/buildAgentsServer/AgentsServerBuildCache.d.ts +10 -0
  141. package/umd/src/cli/cli-commands/agents-server/buildAgentsServer/AgentsServerBuildCacheOptions.d.ts +10 -0
  142. package/umd/src/cli/cli-commands/agents-server/buildAgentsServer/NODE_MODULES_DIRECTORY_NAME.d.ts +6 -0
  143. package/umd/src/cli/cli-commands/agents-server/buildAgentsServer/PreparedAgentsServerRuntime.d.ts +18 -0
  144. package/umd/src/cli/cli-commands/agents-server/buildAgentsServer/createAgentsServerBuildSourceFingerprint.d.ts +6 -0
  145. package/umd/src/cli/cli-commands/agents-server/buildAgentsServer/createAgentsServerRuntimeEnvironment.d.ts +28 -0
  146. package/umd/src/cli/cli-commands/agents-server/buildAgentsServer/ensureAgentsServerBuild.d.ts +19 -0
  147. package/umd/src/cli/cli-commands/agents-server/buildAgentsServer/getAgentsServerBuildInputRelativePaths.d.ts +11 -0
  148. package/umd/src/cli/cli-commands/agents-server/buildAgentsServer/isAgentsServerAppPath.d.ts +6 -0
  149. package/umd/src/cli/cli-commands/agents-server/buildAgentsServer/isAgentsServerAppPathMaterialized.d.ts +6 -0
  150. package/umd/src/cli/cli-commands/agents-server/buildAgentsServer/isAgentsServerBuildCacheCurrent.d.ts +7 -0
  151. package/umd/src/cli/cli-commands/agents-server/buildAgentsServer/isAgentsServerBuildInputTestFile.d.ts +6 -0
  152. package/umd/src/cli/cli-commands/agents-server/buildAgentsServer/isExcludedAgentsServerBuildInputDirectoryName.d.ts +6 -0
  153. package/umd/src/cli/cli-commands/agents-server/buildAgentsServer/isExcludedAgentsServerBuildInputPath.d.ts +6 -0
  154. package/umd/src/cli/cli-commands/agents-server/buildAgentsServer/isExcludedAgentsServerRuntimeSourcePath.d.ts +6 -0
  155. package/umd/src/cli/cli-commands/agents-server/buildAgentsServer/isFile.d.ts +6 -0
  156. package/umd/src/cli/cli-commands/agents-server/buildAgentsServer/isPathInsideNodeModules.d.ts +6 -0
  157. package/umd/src/cli/cli-commands/agents-server/buildAgentsServer/normalizeAgentsServerBuildInputPath.d.ts +6 -0
  158. package/umd/src/cli/cli-commands/agents-server/buildAgentsServer/prepareAgentsServerRuntime.d.ts +9 -0
  159. package/umd/src/cli/cli-commands/agents-server/buildAgentsServer/readAgentsServerBuildCache.d.ts +8 -0
  160. package/umd/src/cli/cli-commands/agents-server/buildAgentsServer/resolveAgentsServerAppPath.d.ts +6 -0
  161. package/umd/src/cli/cli-commands/agents-server/buildAgentsServer/resolveAgentsServerBuildAppPath.d.ts +9 -0
  162. package/umd/src/cli/cli-commands/agents-server/buildAgentsServer/resolveAgentsServerBuildOutputPath.d.ts +7 -0
  163. package/umd/src/cli/cli-commands/agents-server/buildAgentsServer/resolveNextCliPath.d.ts +6 -0
  164. package/umd/src/cli/cli-commands/agents-server/buildAgentsServer/resolveNodeModulesPath.d.ts +6 -0
  165. package/umd/src/cli/cli-commands/agents-server/buildAgentsServer/runNextBuild.d.ts +12 -0
  166. package/umd/src/cli/cli-commands/agents-server/buildAgentsServer/shouldCopyAgentsServerRuntimePath.d.ts +6 -0
  167. package/umd/src/cli/cli-commands/agents-server/buildAgentsServer/synchronizeMaterializedAgentsServerRuntime.d.ts +11 -0
  168. package/umd/src/cli/cli-commands/agents-server/buildAgentsServer/writeAgentsServerBuildCache.d.ts +7 -0
  169. package/umd/src/cli/cli-commands/agents-server/buildAgentsServer.d.ts +8 -109
  170. package/umd/src/cli/cli-commands/agents-server/ensureAgentsServerEnvFile.d.ts +1 -1
  171. package/umd/src/cli/cli-commands/agents-server/ensureAgentsServerGitignoreFile.d.ts +1 -1
  172. package/umd/src/cli/cli-commands/agents-server/startAgentsServer/AgentsServerChildEnvironment.d.ts +16 -0
  173. package/umd/src/cli/cli-commands/agents-server/startAgentsServer/AgentsServerLogStreams.d.ts +30 -0
  174. package/umd/src/cli/cli-commands/agents-server/startAgentsServer/AgentsServerRuntimePaths.d.ts +19 -0
  175. package/umd/src/cli/cli-commands/agents-server/startAgentsServer/AgentsServerSupervisorState.d.ts +37 -0
  176. package/umd/src/cli/cli-commands/agents-server/startAgentsServer/LocalAgentRunnerLimits.d.ts +9 -0
  177. package/umd/src/cli/cli-commands/agents-server/startAgentsServer/PreparedAgentsServerLaunch.d.ts +13 -0
  178. package/umd/src/cli/cli-commands/agents-server/startAgentsServer/StartAgentsServerOptions.d.ts +24 -0
  179. package/umd/src/cli/cli-commands/agents-server/startAgentsServer/createInternalRouteErrorMessage.d.ts +6 -0
  180. package/umd/src/cli/cli-commands/agents-server/startAgentsServer/createLocalAgentRunOptions.d.ts +9 -0
  181. package/umd/src/cli/cli-commands/agents-server/startAgentsServer/forwardChildOutput.d.ts +13 -0
  182. package/umd/src/cli/cli-commands/agents-server/startAgentsServer/loadAgentsServerProjectEnvironment.d.ts +6 -0
  183. package/umd/src/cli/cli-commands/agents-server/startAgentsServer/prepareAgentsServerLaunch.d.ts +18 -0
  184. package/umd/src/cli/cli-commands/agents-server/startAgentsServer/readInternalRouteErrorDetails.d.ts +6 -0
  185. package/umd/src/cli/cli-commands/agents-server/startAgentsServer/resolveAgentsServerChildHostname.d.ts +7 -0
  186. package/umd/src/cli/cli-commands/agents-server/startAgentsServer/startNextServer.d.ts +20 -0
  187. package/umd/src/cli/cli-commands/agents-server/startAgentsServer/startUserChatJobWorkerPump.d.ts +15 -0
  188. package/umd/src/cli/cli-commands/agents-server/startAgentsServer/stopChildProcess.d.ts +8 -0
  189. package/umd/src/cli/cli-commands/agents-server/startAgentsServer/waitForLocalAgentRunnerLimits.d.ts +16 -0
  190. package/umd/src/cli/cli-commands/agents-server/startAgentsServer.d.ts +3 -30
  191. package/umd/src/cli/cli-commands/common/promptRunnerCliOptions.d.ts +1 -1
  192. package/umd/src/collection/agent-collection/CreateAgentInput.d.ts +1 -1
  193. package/umd/src/collection/agent-collection/constructors/agent-collection-in-supabase/prepareAgentSourceForPersistence.d.ts +1 -1
  194. package/umd/src/commitments/META/META.d.ts +2 -2
  195. package/umd/src/commitments/META_AVATAR/META_AVATAR.d.ts +9 -4
  196. package/umd/src/commitments/index.d.ts +1 -1
  197. package/umd/src/conversion/validation/validatePipeline/createPipelineValidationContext.d.ts +16 -0
  198. package/umd/src/conversion/validation/validatePipeline/validatePipelineCollectionsStructure.d.ts +7 -0
  199. package/umd/src/conversion/validation/validatePipeline/validatePipelineDependencyResolution.d.ts +7 -0
  200. package/umd/src/conversion/validation/validatePipeline/validatePipelineMetadata.d.ts +7 -0
  201. package/umd/src/conversion/validation/validatePipeline/validatePipelineParameters.d.ts +7 -0
  202. package/umd/src/conversion/validation/validatePipeline/validatePipelineTasks.d.ts +7 -0
  203. package/umd/src/llm-providers/_common/register/$registeredLlmToolsMessage/RegisteredLlmToolsMessageContext.d.ts +46 -0
  204. package/umd/src/llm-providers/_common/register/$registeredLlmToolsMessage/USED_ENV_FILENAME.d.ts +11 -0
  205. package/umd/src/llm-providers/_common/register/$registeredLlmToolsMessage/createRegisteredLlmToolConfigurationStatusMessage.d.ts +7 -0
  206. package/umd/src/llm-providers/_common/register/$registeredLlmToolsMessage/createRegisteredLlmToolEntryKey.d.ts +7 -0
  207. package/umd/src/llm-providers/_common/register/$registeredLlmToolsMessage/createRegisteredLlmToolInstallationStatusMessage.d.ts +7 -0
  208. package/umd/src/llm-providers/_common/register/$registeredLlmToolsMessage/createRegisteredLlmToolStatus.d.ts +14 -0
  209. package/umd/src/llm-providers/_common/register/$registeredLlmToolsMessage/createRegisteredLlmToolsMessageContext.d.ts +7 -0
  210. package/umd/src/llm-providers/_common/register/$registeredLlmToolsMessage/getAvailableRegisteredLlmToolsEnvironmentVariables.d.ts +7 -0
  211. package/umd/src/llm-providers/_common/register/$registeredLlmToolsMessage/getRegisteredLlmToolRegisters.d.ts +7 -0
  212. package/umd/src/llm-providers/_common/register/$registeredLlmToolsMessage/hasRegisteredLlmToolEntry.d.ts +7 -0
  213. package/umd/src/llm-providers/_common/register/$registeredLlmToolsMessage/listRegisteredLlmToolEntries.d.ts +9 -0
  214. package/umd/src/llm-providers/_common/register/$registeredLlmToolsMessage/listRegisteredLlmToolStatuses.d.ts +7 -0
  215. package/umd/src/llm-providers/_common/register/$registeredLlmToolsMessage/renderAvailableRegisteredLlmTools.d.ts +7 -0
  216. package/umd/src/llm-providers/_common/register/$registeredLlmToolsMessage/renderNoRegisteredLlmToolsMessage.d.ts +7 -0
  217. package/umd/src/llm-providers/_common/register/$registeredLlmToolsMessage/renderRegisteredLlmToolsMessage.d.ts +8 -0
  218. package/umd/src/llm-providers/_common/register/$registeredLlmToolsMessage/renderRelevantRegisteredLlmToolsEnvironmentVariables.d.ts +7 -0
  219. package/umd/src/utils/agents/resolveAgentAvatarImageUrl.d.ts +2 -2
  220. package/umd/src/utils/color/Color.d.ts +1 -1
  221. package/umd/src/version.d.ts +1 -1
package/esm/index.es.js CHANGED
@@ -22,7 +22,7 @@ const BOOK_LANGUAGE_VERSION = '2.0.0';
22
22
  * @generated
23
23
  * @see https://github.com/webgptorg/promptbook
24
24
  */
25
- const PROMPTBOOK_ENGINE_VERSION = '0.113.0-7';
25
+ const PROMPTBOOK_ENGINE_VERSION = '0.113.0-9';
26
26
  /**
27
27
  * TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
28
28
  * Note: [💞] Ignore a discrepancy between file name and entity name
@@ -225,6 +225,127 @@ function take(initialValue) {
225
225
  });
226
226
  }
227
227
 
228
+ /**
229
+ * Validates that a channel value is a valid number within the range of 0 to 255.
230
+ * Throws an error if the value is not valid.
231
+ *
232
+ * @param channelName - The name of the channel being validated.
233
+ * @param value - The value of the channel to validate.
234
+ * @throws Will throw an error if the value is not a valid channel number.
235
+ *
236
+ * @private util of `@promptbook/color`
237
+ */
238
+ function checkChannelValue(channelName, value) {
239
+ if (typeof value !== 'number') {
240
+ throw new Error(`${channelName} channel value is not number but ${typeof value}`);
241
+ }
242
+ if (isNaN(value)) {
243
+ throw new Error(`${channelName} channel value is NaN`);
244
+ }
245
+ if (Math.round(value) !== value) {
246
+ throw new Error(`${channelName} channel is not whole number, it is ${value}`);
247
+ }
248
+ if (value < 0) {
249
+ throw new Error(`${channelName} channel is lower than 0, it is ${value}`);
250
+ }
251
+ if (value > 255) {
252
+ throw new Error(`${channelName} channel is greater than 255, it is ${value}`);
253
+ }
254
+ }
255
+
256
+ /**
257
+ * Shared immutable channel storage and serialization helpers for `Color`.
258
+ *
259
+ * @private base class of Color
260
+ */
261
+ class ColorValue {
262
+ constructor(red, green, blue, alpha = 255) {
263
+ this.red = red;
264
+ this.green = green;
265
+ this.blue = blue;
266
+ this.alpha = alpha;
267
+ checkChannelValue('Red', red);
268
+ checkChannelValue('Green', green);
269
+ checkChannelValue('Blue', blue);
270
+ checkChannelValue('Alpha', alpha);
271
+ }
272
+ /**
273
+ * Shortcut for `red` property
274
+ * Number from 0 to 255
275
+ * @alias red
276
+ */
277
+ get r() {
278
+ return this.red;
279
+ }
280
+ /**
281
+ * Shortcut for `green` property
282
+ * Number from 0 to 255
283
+ * @alias green
284
+ */
285
+ get g() {
286
+ return this.green;
287
+ }
288
+ /**
289
+ * Shortcut for `blue` property
290
+ * Number from 0 to 255
291
+ * @alias blue
292
+ */
293
+ get b() {
294
+ return this.blue;
295
+ }
296
+ /**
297
+ * Shortcut for `alpha` property
298
+ * Number from 0 (transparent) to 255 (opaque)
299
+ * @alias alpha
300
+ */
301
+ get a() {
302
+ return this.alpha;
303
+ }
304
+ /**
305
+ * Shortcut for `alpha` property
306
+ * Number from 0 (transparent) to 255 (opaque)
307
+ * @alias alpha
308
+ */
309
+ get opacity() {
310
+ return this.alpha;
311
+ }
312
+ /**
313
+ * Shortcut for 1-`alpha` property
314
+ */
315
+ get transparency() {
316
+ return 255 - this.alpha;
317
+ }
318
+ clone() {
319
+ return take(this.createColor(this.red, this.green, this.blue, this.alpha));
320
+ }
321
+ toString() {
322
+ return this.toHex();
323
+ }
324
+ toHex() {
325
+ if (this.alpha === 255) {
326
+ return `#${this.red.toString(16).padStart(2, '0')}${this.green.toString(16).padStart(2, '0')}${this.blue
327
+ .toString(16)
328
+ .padStart(2, '0')}`;
329
+ }
330
+ else {
331
+ return `#${this.red.toString(16).padStart(2, '0')}${this.green.toString(16).padStart(2, '0')}${this.blue
332
+ .toString(16)
333
+ .padStart(2, '0')}${this.alpha.toString(16).padStart(2, '0')}`;
334
+ }
335
+ }
336
+ toRgb() {
337
+ if (this.alpha === 255) {
338
+ return `rgb(${this.red}, ${this.green}, ${this.blue})`;
339
+ }
340
+ else {
341
+ return `rgba(${this.red}, ${this.green}, ${this.blue}, ${Math.round((this.alpha / 255) * 100)}%)`;
342
+ }
343
+ }
344
+ toHsl() {
345
+ throw new Error(`Getting HSL is not implemented`);
346
+ }
347
+ }
348
+
228
349
  /**
229
350
  * 🎨 List of all 140 color names which are supported by CSS
230
351
  *
@@ -384,127 +505,6 @@ const CSS_COLORS = {
384
505
  };
385
506
  // Note: [💞] Ignore a discrepancy between file name and entity name
386
507
 
387
- /**
388
- * Validates that a channel value is a valid number within the range of 0 to 255.
389
- * Throws an error if the value is not valid.
390
- *
391
- * @param channelName - The name of the channel being validated.
392
- * @param value - The value of the channel to validate.
393
- * @throws Will throw an error if the value is not a valid channel number.
394
- *
395
- * @private util of `@promptbook/color`
396
- */
397
- function checkChannelValue(channelName, value) {
398
- if (typeof value !== 'number') {
399
- throw new Error(`${channelName} channel value is not number but ${typeof value}`);
400
- }
401
- if (isNaN(value)) {
402
- throw new Error(`${channelName} channel value is NaN`);
403
- }
404
- if (Math.round(value) !== value) {
405
- throw new Error(`${channelName} channel is not whole number, it is ${value}`);
406
- }
407
- if (value < 0) {
408
- throw new Error(`${channelName} channel is lower than 0, it is ${value}`);
409
- }
410
- if (value > 255) {
411
- throw new Error(`${channelName} channel is greater than 255, it is ${value}`);
412
- }
413
- }
414
-
415
- /**
416
- * Shared immutable channel storage and serialization helpers for `Color`.
417
- *
418
- * @private base class of Color
419
- */
420
- class ColorValue {
421
- constructor(red, green, blue, alpha = 255) {
422
- this.red = red;
423
- this.green = green;
424
- this.blue = blue;
425
- this.alpha = alpha;
426
- checkChannelValue('Red', red);
427
- checkChannelValue('Green', green);
428
- checkChannelValue('Blue', blue);
429
- checkChannelValue('Alpha', alpha);
430
- }
431
- /**
432
- * Shortcut for `red` property
433
- * Number from 0 to 255
434
- * @alias red
435
- */
436
- get r() {
437
- return this.red;
438
- }
439
- /**
440
- * Shortcut for `green` property
441
- * Number from 0 to 255
442
- * @alias green
443
- */
444
- get g() {
445
- return this.green;
446
- }
447
- /**
448
- * Shortcut for `blue` property
449
- * Number from 0 to 255
450
- * @alias blue
451
- */
452
- get b() {
453
- return this.blue;
454
- }
455
- /**
456
- * Shortcut for `alpha` property
457
- * Number from 0 (transparent) to 255 (opaque)
458
- * @alias alpha
459
- */
460
- get a() {
461
- return this.alpha;
462
- }
463
- /**
464
- * Shortcut for `alpha` property
465
- * Number from 0 (transparent) to 255 (opaque)
466
- * @alias alpha
467
- */
468
- get opacity() {
469
- return this.alpha;
470
- }
471
- /**
472
- * Shortcut for 1-`alpha` property
473
- */
474
- get transparency() {
475
- return 255 - this.alpha;
476
- }
477
- clone() {
478
- return take(this.createColor(this.red, this.green, this.blue, this.alpha));
479
- }
480
- toString() {
481
- return this.toHex();
482
- }
483
- toHex() {
484
- if (this.alpha === 255) {
485
- return `#${this.red.toString(16).padStart(2, '0')}${this.green.toString(16).padStart(2, '0')}${this.blue
486
- .toString(16)
487
- .padStart(2, '0')}`;
488
- }
489
- else {
490
- return `#${this.red.toString(16).padStart(2, '0')}${this.green.toString(16).padStart(2, '0')}${this.blue
491
- .toString(16)
492
- .padStart(2, '0')}${this.alpha.toString(16).padStart(2, '0')}`;
493
- }
494
- }
495
- toRgb() {
496
- if (this.alpha === 255) {
497
- return `rgb(${this.red}, ${this.green}, ${this.blue})`;
498
- }
499
- else {
500
- return `rgba(${this.red}, ${this.green}, ${this.blue}, ${Math.round((this.alpha / 255) * 100)}%)`;
501
- }
502
- }
503
- toHsl() {
504
- throw new Error(`Getting HSL is not implemented`);
505
- }
506
- }
507
-
508
508
  /**
509
509
  * Checks if the given value is a valid hex color string
510
510
  *
@@ -2014,20 +2014,109 @@ function pipelineJsonToString(pipelineJson) {
2014
2014
  // TODO: [🧠] Should be in generated .book.md file GENERATOR_WARNING
2015
2015
 
2016
2016
  /**
2017
- * Orders JSON object by keys
2018
- *
2019
- * @returns The same type of object as the input re-ordered
2017
+ * This error indicates that the promptbook object has valid syntax (=can be parsed) but contains logical errors (like circular dependencies)
2020
2018
  *
2021
- * @public exported from `@promptbook/utils`
2019
+ * @public exported from `@promptbook/core`
2022
2020
  */
2023
- function orderJson(options) {
2024
- const { value, order } = options;
2025
- const orderedValue = {
2026
- ...(order === undefined ? {} : Object.fromEntries(order.map((key) => [key, undefined]))),
2027
- ...value,
2028
- };
2029
- return orderedValue;
2030
- }
2021
+ class PipelineLogicError extends Error {
2022
+ constructor(message) {
2023
+ super(message);
2024
+ this.name = 'PipelineLogicError';
2025
+ Object.setPrototypeOf(this, PipelineLogicError.prototype);
2026
+ }
2027
+ }
2028
+
2029
+ /**
2030
+ * Creates the shared validation context for one pipeline.
2031
+ *
2032
+ * @private function of `validatePipeline`
2033
+ */
2034
+ function createPipelineValidationContext(pipeline) {
2035
+ return {
2036
+ pipeline,
2037
+ pipelineIdentification: getPipelineIdentification(pipeline),
2038
+ };
2039
+ }
2040
+ /**
2041
+ * Builds a short file/url identification block for validation errors.
2042
+ *
2043
+ * @private internal utility of `validatePipeline`
2044
+ */
2045
+ function getPipelineIdentification(pipeline) {
2046
+ // Note: This is a 😐 implementation of [🚞]
2047
+ const pipelineIdentificationParts = [];
2048
+ if (pipeline.sourceFile !== undefined) {
2049
+ pipelineIdentificationParts.push(`File: ${pipeline.sourceFile}`);
2050
+ }
2051
+ if (pipeline.pipelineUrl !== undefined) {
2052
+ pipelineIdentificationParts.push(`Url: ${pipeline.pipelineUrl}`);
2053
+ }
2054
+ return pipelineIdentificationParts.join('\n');
2055
+ }
2056
+
2057
+ /**
2058
+ * Validates that the expected top-level collections have array structure.
2059
+ *
2060
+ * @private function of `validatePipeline`
2061
+ */
2062
+ function validatePipelineCollectionsStructure({ pipeline, pipelineIdentification, }) {
2063
+ validatePipelineParametersCollection(pipeline, pipelineIdentification);
2064
+ validatePipelineTasksCollection(pipeline, pipelineIdentification);
2065
+ }
2066
+ /**
2067
+ * Validates that `pipeline.parameters` is an array.
2068
+ *
2069
+ * @private internal utility of `validatePipelineCollectionsStructure`
2070
+ */
2071
+ function validatePipelineParametersCollection(pipeline, pipelineIdentification) {
2072
+ // TODO: [🧠] Maybe do here some proper JSON-schema / ZOD checking
2073
+ if (Array.isArray(pipeline.parameters)) {
2074
+ return;
2075
+ }
2076
+ // TODO: [🧠] what is the correct error tp throw - maybe PromptbookSchemaError
2077
+ throw new ParseError(spaceTrim$1((block) => `
2078
+ Pipeline is valid JSON but with wrong structure
2079
+
2080
+ \`PipelineJson.parameters\` expected to be an array, but got ${typeof pipeline.parameters}
2081
+
2082
+ ${block(pipelineIdentification)}
2083
+ `));
2084
+ }
2085
+ /**
2086
+ * Validates that `pipeline.tasks` is an array.
2087
+ *
2088
+ * @private internal utility of `validatePipelineCollectionsStructure`
2089
+ */
2090
+ function validatePipelineTasksCollection(pipeline, pipelineIdentification) {
2091
+ // TODO: [🧠] Maybe do here some proper JSON-schema / ZOD checking
2092
+ if (Array.isArray(pipeline.tasks)) {
2093
+ return;
2094
+ }
2095
+ // TODO: [🧠] what is the correct error tp throw - maybe PromptbookSchemaError
2096
+ throw new ParseError(spaceTrim$1((block) => `
2097
+ Pipeline is valid JSON but with wrong structure
2098
+
2099
+ \`PipelineJson.tasks\` expected to be an array, but got ${typeof pipeline.tasks}
2100
+
2101
+ ${block(pipelineIdentification)}
2102
+ `));
2103
+ }
2104
+
2105
+ /**
2106
+ * Orders JSON object by keys
2107
+ *
2108
+ * @returns The same type of object as the input re-ordered
2109
+ *
2110
+ * @public exported from `@promptbook/utils`
2111
+ */
2112
+ function orderJson(options) {
2113
+ const { value, order } = options;
2114
+ const orderedValue = {
2115
+ ...(order === undefined ? {} : Object.fromEntries(order.map((key) => [key, undefined]))),
2116
+ ...value,
2117
+ };
2118
+ return orderedValue;
2119
+ }
2031
2120
 
2032
2121
  /**
2033
2122
  * Freezes the given object and all its nested objects recursively
@@ -2376,16 +2465,137 @@ const RESERVED_PARAMETER_NAMES = exportJson({
2376
2465
  // Note: [💞] Ignore a discrepancy between file name and entity name
2377
2466
 
2378
2467
  /**
2379
- * This error indicates that the promptbook object has valid syntax (=can be parsed) but contains logical errors (like circular dependencies)
2468
+ * Validates that task dependencies can be resolved without cycles or missing definitions.
2380
2469
  *
2381
- * @public exported from `@promptbook/core`
2470
+ * @private function of `validatePipeline`
2382
2471
  */
2383
- class PipelineLogicError extends Error {
2384
- constructor(message) {
2385
- super(message);
2386
- this.name = 'PipelineLogicError';
2387
- Object.setPrototypeOf(this, PipelineLogicError.prototype);
2472
+ function validatePipelineDependencyResolution({ pipeline, pipelineIdentification, }) {
2473
+ let dependencyResolutionState = createInitialDependencyResolutionState(pipeline);
2474
+ let loopLimit = LOOP_LIMIT;
2475
+ while (hasUnresolvedTasks(dependencyResolutionState)) {
2476
+ if (loopLimit-- < 0) {
2477
+ throw createDependencyResolutionLoopLimitError(pipelineIdentification);
2478
+ }
2479
+ dependencyResolutionState = resolveNextDependencyResolutionState(dependencyResolutionState, pipelineIdentification);
2480
+ }
2481
+ }
2482
+ /**
2483
+ * Collects the parameter names that are already resolvable before dependency traversal starts.
2484
+ *
2485
+ * @private internal utility of `validatePipelineDependencyResolution`
2486
+ */
2487
+ function createInitialDependencyResolutionState(pipeline) {
2488
+ return {
2489
+ resolvedParameterNames: createInitiallyResolvedParameterNames(pipeline),
2490
+ unresolvedTasks: [...pipeline.tasks],
2491
+ };
2492
+ }
2493
+ /**
2494
+ * Checks whether dependency resolution still has tasks left to process.
2495
+ *
2496
+ * @private internal utility of `validatePipelineDependencyResolution`
2497
+ */
2498
+ function hasUnresolvedTasks({ unresolvedTasks }) {
2499
+ return unresolvedTasks.length > 0;
2500
+ }
2501
+ /**
2502
+ * Resolves the next batch of currently satisfiable tasks.
2503
+ *
2504
+ * @private internal utility of `validatePipelineDependencyResolution`
2505
+ */
2506
+ function resolveNextDependencyResolutionState(dependencyResolutionState, pipelineIdentification) {
2507
+ const currentlyResolvedTasks = getCurrentlyResolvedTasks(dependencyResolutionState.unresolvedTasks, dependencyResolutionState.resolvedParameterNames);
2508
+ if (currentlyResolvedTasks.length === 0) {
2509
+ throw createUnresolvedTasksError(dependencyResolutionState.unresolvedTasks, dependencyResolutionState.resolvedParameterNames, pipelineIdentification);
2510
+ }
2511
+ return {
2512
+ resolvedParameterNames: appendResolvedTaskParameterNames(dependencyResolutionState.resolvedParameterNames, currentlyResolvedTasks),
2513
+ unresolvedTasks: dependencyResolutionState.unresolvedTasks.filter((task) => !currentlyResolvedTasks.includes(task)),
2514
+ };
2515
+ }
2516
+ /**
2517
+ * Collects the parameter names that are already resolvable before dependency traversal starts.
2518
+ *
2519
+ * @private internal utility of `validatePipelineDependencyResolution`
2520
+ */
2521
+ function createInitiallyResolvedParameterNames(pipeline) {
2522
+ let resolvedParameterNames = pipeline.parameters
2523
+ .filter(({ isInput }) => isInput)
2524
+ .map(({ name }) => name);
2525
+ for (const reservedParameterName of RESERVED_PARAMETER_NAMES) {
2526
+ resolvedParameterNames = [...resolvedParameterNames, reservedParameterName];
2388
2527
  }
2528
+ return resolvedParameterNames;
2529
+ }
2530
+ /**
2531
+ * Adds newly resolved task outputs to the resolved parameter list.
2532
+ *
2533
+ * @private internal utility of `validatePipelineDependencyResolution`
2534
+ */
2535
+ function appendResolvedTaskParameterNames(resolvedParameterNames, currentlyResolvedTasks) {
2536
+ return [
2537
+ ...resolvedParameterNames,
2538
+ ...currentlyResolvedTasks.map(({ resultingParameterName }) => resultingParameterName),
2539
+ ];
2540
+ }
2541
+ /**
2542
+ * Selects tasks whose dependencies are already resolved.
2543
+ *
2544
+ * @private internal utility of `validatePipelineDependencyResolution`
2545
+ */
2546
+ function getCurrentlyResolvedTasks(unresolvedTasks, resolvedParameterNames) {
2547
+ return unresolvedTasks.filter((task) => task.dependentParameterNames.every((name) => resolvedParameterNames.includes(name)));
2548
+ }
2549
+ /**
2550
+ * Creates the unexpected loop-limit error for dependency resolution.
2551
+ *
2552
+ * @private internal utility of `validatePipelineDependencyResolution`
2553
+ */
2554
+ function createDependencyResolutionLoopLimitError(pipelineIdentification) {
2555
+ // Note: Really UnexpectedError not LimitReachedError - this should not happen and be caught below
2556
+ return new UnexpectedError(spaceTrim$1((block) => `
2557
+ Loop limit reached during detection of circular dependencies in \`validatePipeline\`
2558
+
2559
+ ${block(pipelineIdentification)}
2560
+ `));
2561
+ }
2562
+ /**
2563
+ * Creates the detailed error for unresolved or circular task dependencies.
2564
+ *
2565
+ * @private internal utility of `validatePipelineDependencyResolution`
2566
+ */
2567
+ function createUnresolvedTasksError(unresolvedTasks, resolvedParameterNames, pipelineIdentification) {
2568
+ return new PipelineLogicError(
2569
+ // TODO: [🐎] DRY
2570
+ spaceTrim$1((block) => `
2571
+
2572
+ Can not resolve some parameters:
2573
+ Either you are using a parameter that is not defined, or there are some circular dependencies.
2574
+
2575
+ ${block(pipelineIdentification)}
2576
+
2577
+ **Can not resolve:**
2578
+ ${block(unresolvedTasks
2579
+ .map(({ resultingParameterName, dependentParameterNames }) => `- Parameter \`{${resultingParameterName}}\` which depends on ${dependentParameterNames
2580
+ .map((dependentParameterName) => `\`{${dependentParameterName}}\``)
2581
+ .join(' and ')}`)
2582
+ .join('\n'))}
2583
+
2584
+ **Resolved:**
2585
+ ${block(resolvedParameterNames
2586
+ .filter((name) => !RESERVED_PARAMETER_NAMES.includes(name))
2587
+ .map((name) => `- Parameter \`{${name}}\``)
2588
+ .join('\n'))}
2589
+
2590
+
2591
+ **Reserved (which are available):**
2592
+ ${block(resolvedParameterNames
2593
+ .filter((name) => RESERVED_PARAMETER_NAMES.includes(name))
2594
+ .map((name) => `- Parameter \`{${name}}\``)
2595
+ .join('\n'))}
2596
+
2597
+
2598
+ `));
2389
2599
  }
2390
2600
 
2391
2601
  /**
@@ -2463,171 +2673,22 @@ function isValidPipelineUrl(url) {
2463
2673
  // TODO: [🐠] Maybe more info why the URL is invalid
2464
2674
 
2465
2675
  /**
2466
- * Validates PipelineJson if it is logically valid
2467
- *
2468
- * It checks:
2469
- * - if it has correct parameters dependency
2470
- *
2471
- * It does NOT check:
2472
- * - if it is valid json
2473
- * - if it is meaningful
2474
- *
2475
- * Note: [🔂] This function is idempotent.
2676
+ * Validates pipeline-level metadata fields.
2476
2677
  *
2477
- * @param pipeline valid or invalid PipelineJson
2478
- * @returns the same pipeline if it is logically valid
2479
- * @throws {PipelineLogicError} on logical error in the pipeline
2678
+ * @private function of `validatePipeline`
2679
+ */
2680
+ function validatePipelineMetadata({ pipeline, pipelineIdentification }) {
2681
+ validatePipelineUrl(pipeline, pipelineIdentification);
2682
+ validatePipelineBookVersion(pipeline, pipelineIdentification);
2683
+ }
2684
+ /**
2685
+ * Validates the pipeline URL, when present.
2480
2686
  *
2481
- * @public exported from `@promptbook/core`
2687
+ * @private internal utility of `validatePipelineMetadata`
2482
2688
  */
2483
- function validatePipeline(pipeline) {
2484
- if (IS_PIPELINE_LOGIC_VALIDATED) {
2485
- validatePipeline_InnerFunction(pipeline);
2486
- }
2487
- else {
2488
- try {
2489
- validatePipeline_InnerFunction(pipeline);
2490
- }
2491
- catch (error) {
2492
- if (!(error instanceof PipelineLogicError)) {
2493
- throw error;
2494
- }
2495
- console.error(spaceTrim$1((block) => `
2496
- Pipeline is not valid but logic errors are temporarily disabled via \`IS_PIPELINE_LOGIC_VALIDATED\`
2497
-
2498
- ${block(error.message)}
2499
- `));
2500
- }
2501
- }
2502
- return pipeline;
2503
- }
2504
- /**
2505
- * Validates pipeline inner function.
2506
- *
2507
- * @private internal function for `validatePipeline`
2508
- */
2509
- function validatePipeline_InnerFunction(pipeline) {
2510
- // TODO: [🧠] Maybe test if promptbook is a promise and make specific error case for that
2511
- const context = createPipelineValidationContext(pipeline);
2512
- validatePipelineMetadata(context);
2513
- validatePipelineCollectionsStructure(context);
2514
- validatePipelineParameters(context);
2515
- validatePipelineTasks(context);
2516
- validatePipelineDependencyResolution(context);
2517
- // Note: Check that formfactor is corresponding to the pipeline interface
2518
- // TODO: !!6 Implement this
2519
- // pipeline.formfactorName
2520
- }
2521
- /**
2522
- * Creates the shared validation context for one pipeline.
2523
- *
2524
- * @private internal utility of `validatePipeline`
2525
- */
2526
- function createPipelineValidationContext(pipeline) {
2527
- return {
2528
- pipeline,
2529
- pipelineIdentification: getPipelineIdentification(pipeline),
2530
- };
2531
- }
2532
- /**
2533
- * Builds a short file/url identification block for validation errors.
2534
- *
2535
- * @private internal utility of `validatePipeline`
2536
- */
2537
- function getPipelineIdentification(pipeline) {
2538
- // Note: This is a 😐 implementation of [🚞]
2539
- const pipelineIdentificationParts = [];
2540
- if (pipeline.sourceFile !== undefined) {
2541
- pipelineIdentificationParts.push(`File: ${pipeline.sourceFile}`);
2542
- }
2543
- if (pipeline.pipelineUrl !== undefined) {
2544
- pipelineIdentificationParts.push(`Url: ${pipeline.pipelineUrl}`);
2545
- }
2546
- return pipelineIdentificationParts.join('\n');
2547
- }
2548
- /**
2549
- * Validates pipeline-level metadata fields.
2550
- *
2551
- * @private internal step of `validatePipeline`
2552
- */
2553
- function validatePipelineMetadata({ pipeline, pipelineIdentification }) {
2554
- validatePipelineUrl(pipeline, pipelineIdentification);
2555
- validatePipelineBookVersion(pipeline, pipelineIdentification);
2556
- }
2557
- /**
2558
- * Validates that the expected top-level collections have array structure.
2559
- *
2560
- * @private internal step of `validatePipeline`
2561
- */
2562
- function validatePipelineCollectionsStructure({ pipeline, pipelineIdentification }) {
2563
- validatePipelineParametersCollection(pipeline, pipelineIdentification);
2564
- validatePipelineTasksCollection(pipeline, pipelineIdentification);
2565
- }
2566
- /**
2567
- * Validates all pipeline parameter declarations.
2568
- *
2569
- * @private internal step of `validatePipeline`
2570
- */
2571
- function validatePipelineParameters({ pipeline, pipelineIdentification }) {
2572
- for (const parameter of pipeline.parameters) {
2573
- validatePipelineParameter(parameter, pipeline, pipelineIdentification);
2574
- }
2575
- }
2576
- /**
2577
- * Validates all pipeline tasks and their per-task invariants.
2578
- *
2579
- * @private internal step of `validatePipeline`
2580
- */
2581
- function validatePipelineTasks({ pipeline, pipelineIdentification }) {
2582
- // Note: All input parameters are defined - so that they can be used as result of some task
2583
- const definedParameters = createInitiallyDefinedParameters(pipeline);
2584
- for (const task of pipeline.tasks) {
2585
- validatePipelineTask(task, definedParameters, pipelineIdentification);
2586
- }
2587
- }
2588
- /**
2589
- * Validates that task dependencies can be resolved without cycles or missing definitions.
2590
- *
2591
- * @private internal step of `validatePipeline`
2592
- */
2593
- function validatePipelineDependencyResolution({ pipeline, pipelineIdentification }) {
2594
- let dependencyResolutionState = createInitialDependencyResolutionState(pipeline);
2595
- let loopLimit = LOOP_LIMIT;
2596
- while (hasUnresolvedTasks(dependencyResolutionState)) {
2597
- if (loopLimit-- < 0) {
2598
- throw createDependencyResolutionLoopLimitError(pipelineIdentification);
2599
- }
2600
- dependencyResolutionState = resolveNextDependencyResolutionState(dependencyResolutionState, pipelineIdentification);
2601
- }
2602
- }
2603
- /**
2604
- * Validates one pipeline parameter declaration.
2605
- *
2606
- * @private internal step of `validatePipeline`
2607
- */
2608
- function validatePipelineParameter(parameter, pipeline, pipelineIdentification) {
2609
- validateParameterDirection(parameter, pipelineIdentification);
2610
- validateParameterUsage(parameter, pipeline, pipelineIdentification);
2611
- validateParameterDefinition(parameter, pipeline, pipelineIdentification);
2612
- }
2613
- /**
2614
- * Validates one pipeline task and its invariants.
2615
- *
2616
- * @private internal step of `validatePipeline`
2617
- */
2618
- function validatePipelineTask(task, definedParameters, pipelineIdentification) {
2619
- validateTaskResultingParameter(task, definedParameters, pipelineIdentification);
2620
- validateTaskJokers(task, pipelineIdentification);
2621
- validateTaskExpectations(task, pipelineIdentification);
2622
- }
2623
- /**
2624
- * Validates the pipeline URL, when present.
2625
- *
2626
- * @private internal utility of `validatePipeline`
2627
- */
2628
- function validatePipelineUrl(pipeline, pipelineIdentification) {
2629
- if (pipeline.pipelineUrl === undefined || isValidPipelineUrl(pipeline.pipelineUrl)) {
2630
- return;
2689
+ function validatePipelineUrl(pipeline, pipelineIdentification) {
2690
+ if (pipeline.pipelineUrl === undefined || isValidPipelineUrl(pipeline.pipelineUrl)) {
2691
+ return;
2631
2692
  }
2632
2693
  // <- Note: [🚲]
2633
2694
  throw new PipelineLogicError(spaceTrim$1((block) => `
@@ -2639,7 +2700,7 @@ function validatePipelineUrl(pipeline, pipelineIdentification) {
2639
2700
  /**
2640
2701
  * Validates the Promptbook version, when present.
2641
2702
  *
2642
- * @private internal utility of `validatePipeline`
2703
+ * @private internal utility of `validatePipelineMetadata`
2643
2704
  */
2644
2705
  function validatePipelineBookVersion(pipeline, pipelineIdentification) {
2645
2706
  if (pipeline.bookVersion === undefined || isValidPromptbookVersion(pipeline.bookVersion)) {
@@ -2652,48 +2713,31 @@ function validatePipelineBookVersion(pipeline, pipelineIdentification) {
2652
2713
  ${block(pipelineIdentification)}
2653
2714
  `));
2654
2715
  }
2716
+
2655
2717
  /**
2656
- * Validates that `pipeline.parameters` is an array.
2718
+ * Validates all pipeline parameter declarations.
2657
2719
  *
2658
- * @private internal utility of `validatePipeline`
2720
+ * @private function of `validatePipeline`
2659
2721
  */
2660
- function validatePipelineParametersCollection(pipeline, pipelineIdentification) {
2661
- // TODO: [🧠] Maybe do here some proper JSON-schema / ZOD checking
2662
- if (Array.isArray(pipeline.parameters)) {
2663
- return;
2722
+ function validatePipelineParameters({ pipeline, pipelineIdentification }) {
2723
+ for (const parameter of pipeline.parameters) {
2724
+ validatePipelineParameter(parameter, pipeline, pipelineIdentification);
2664
2725
  }
2665
- // TODO: [🧠] what is the correct error tp throw - maybe PromptbookSchemaError
2666
- throw new ParseError(spaceTrim$1((block) => `
2667
- Pipeline is valid JSON but with wrong structure
2668
-
2669
- \`PipelineJson.parameters\` expected to be an array, but got ${typeof pipeline.parameters}
2670
-
2671
- ${block(pipelineIdentification)}
2672
- `));
2673
2726
  }
2674
2727
  /**
2675
- * Validates that `pipeline.tasks` is an array.
2728
+ * Validates one pipeline parameter declaration.
2676
2729
  *
2677
- * @private internal utility of `validatePipeline`
2730
+ * @private internal utility of `validatePipelineParameters`
2678
2731
  */
2679
- function validatePipelineTasksCollection(pipeline, pipelineIdentification) {
2680
- // TODO: [🧠] Maybe do here some proper JSON-schema / ZOD checking
2681
- if (Array.isArray(pipeline.tasks)) {
2682
- return;
2683
- }
2684
- // TODO: [🧠] what is the correct error tp throw - maybe PromptbookSchemaError
2685
- throw new ParseError(spaceTrim$1((block) => `
2686
- Pipeline is valid JSON but with wrong structure
2687
-
2688
- \`PipelineJson.tasks\` expected to be an array, but got ${typeof pipeline.tasks}
2689
-
2690
- ${block(pipelineIdentification)}
2691
- `));
2732
+ function validatePipelineParameter(parameter, pipeline, pipelineIdentification) {
2733
+ validateParameterDirection(parameter, pipelineIdentification);
2734
+ validateParameterUsage(parameter, pipeline, pipelineIdentification);
2735
+ validateParameterDefinition(parameter, pipeline, pipelineIdentification);
2692
2736
  }
2693
2737
  /**
2694
2738
  * Validates that one parameter does not declare incompatible directions.
2695
2739
  *
2696
- * @private internal utility of `validatePipeline`
2740
+ * @private internal utility of `validatePipelineParameters`
2697
2741
  */
2698
2742
  function validateParameterDirection(parameter, pipelineIdentification) {
2699
2743
  if (!parameter.isInput || !parameter.isOutput) {
@@ -2710,7 +2754,7 @@ function validateParameterDirection(parameter, pipelineIdentification) {
2710
2754
  /**
2711
2755
  * Validates that one intermediate parameter is actually consumed by at least one task.
2712
2756
  *
2713
- * @private internal utility of `validatePipeline`
2757
+ * @private internal utility of `validatePipelineParameters`
2714
2758
  */
2715
2759
  function validateParameterUsage(parameter, pipeline, pipelineIdentification) {
2716
2760
  if (parameter.isInput || parameter.isOutput || isParameterUsedByAnyTask(parameter, pipeline.tasks)) {
@@ -2729,7 +2773,7 @@ function validateParameterUsage(parameter, pipeline, pipelineIdentification) {
2729
2773
  /**
2730
2774
  * Validates that one non-input parameter is produced by at least one task.
2731
2775
  *
2732
- * @private internal utility of `validatePipeline`
2776
+ * @private internal utility of `validatePipelineParameters`
2733
2777
  */
2734
2778
  function validateParameterDefinition(parameter, pipeline, pipelineIdentification) {
2735
2779
  if (parameter.isInput || isParameterDefinedByAnyTask(parameter, pipeline.tasks)) {
@@ -2748,7 +2792,7 @@ function validateParameterDefinition(parameter, pipeline, pipelineIdentification
2748
2792
  /**
2749
2793
  * Checks whether one parameter is consumed by at least one task dependency list.
2750
2794
  *
2751
- * @private internal utility of `validatePipeline`
2795
+ * @private internal utility of `validatePipelineParameters`
2752
2796
  */
2753
2797
  function isParameterUsedByAnyTask(parameter, tasks) {
2754
2798
  return tasks.some((task) => task.dependentParameterNames.includes(parameter.name));
@@ -2756,23 +2800,46 @@ function isParameterUsedByAnyTask(parameter, tasks) {
2756
2800
  /**
2757
2801
  * Checks whether one parameter is produced by at least one task.
2758
2802
  *
2759
- * @private internal utility of `validatePipeline`
2803
+ * @private internal utility of `validatePipelineParameters`
2760
2804
  */
2761
2805
  function isParameterDefinedByAnyTask(parameter, tasks) {
2762
2806
  return tasks.some((task) => task.resultingParameterName === parameter.name);
2763
2807
  }
2808
+
2809
+ /**
2810
+ * Validates all pipeline tasks and their per-task invariants.
2811
+ *
2812
+ * @private function of `validatePipeline`
2813
+ */
2814
+ function validatePipelineTasks({ pipeline, pipelineIdentification }) {
2815
+ // Note: All input parameters are defined - so that they can be used as result of some task
2816
+ const definedParameters = createInitiallyDefinedParameters(pipeline);
2817
+ for (const task of pipeline.tasks) {
2818
+ validatePipelineTask(task, definedParameters, pipelineIdentification);
2819
+ }
2820
+ }
2764
2821
  /**
2765
2822
  * Collects the parameter names that are already defined before task validation starts.
2766
2823
  *
2767
- * @private internal utility of `validatePipeline`
2824
+ * @private internal utility of `validatePipelineTasks`
2768
2825
  */
2769
2826
  function createInitiallyDefinedParameters(pipeline) {
2770
2827
  return new Set(pipeline.parameters.filter(({ isInput }) => isInput).map(({ name }) => name));
2771
2828
  }
2829
+ /**
2830
+ * Validates one pipeline task and its invariants.
2831
+ *
2832
+ * @private internal utility of `validatePipelineTasks`
2833
+ */
2834
+ function validatePipelineTask(task, definedParameters, pipelineIdentification) {
2835
+ validateTaskResultingParameter(task, definedParameters, pipelineIdentification);
2836
+ validateTaskJokers(task, pipelineIdentification);
2837
+ validateTaskExpectations(task, pipelineIdentification);
2838
+ }
2772
2839
  /**
2773
2840
  * Validates one task result parameter declaration and marks it as defined.
2774
2841
  *
2775
- * @private internal utility of `validatePipeline`
2842
+ * @private internal utility of `validatePipelineTasks`
2776
2843
  */
2777
2844
  function validateTaskResultingParameter(task, definedParameters, pipelineIdentification) {
2778
2845
  if (definedParameters.has(task.resultingParameterName)) {
@@ -2794,7 +2861,7 @@ function validateTaskResultingParameter(task, definedParameters, pipelineIdentif
2794
2861
  /**
2795
2862
  * Validates joker parameters for one task.
2796
2863
  *
2797
- * @private internal utility of `validatePipeline`
2864
+ * @private internal utility of `validatePipelineTasks`
2798
2865
  */
2799
2866
  function validateTaskJokers(task, pipelineIdentification) {
2800
2867
  if (!hasTaskJokers(task)) {
@@ -2806,7 +2873,7 @@ function validateTaskJokers(task, pipelineIdentification) {
2806
2873
  /**
2807
2874
  * Checks whether one task declares any joker parameters.
2808
2875
  *
2809
- * @private internal utility of `validatePipeline`
2876
+ * @private internal utility of `validatePipelineTasks`
2810
2877
  */
2811
2878
  function hasTaskJokers(task) {
2812
2879
  return !!task.jokerParameterNames && task.jokerParameterNames.length > 0;
@@ -2814,7 +2881,7 @@ function hasTaskJokers(task) {
2814
2881
  /**
2815
2882
  * Validates that a task has the required supporting features when using jokers.
2816
2883
  *
2817
- * @private internal utility of `validatePipeline`
2884
+ * @private internal utility of `validatePipelineTasks`
2818
2885
  */
2819
2886
  function validateTaskSupportsJokers(task, pipelineIdentification) {
2820
2887
  if (task.format || task.expectations /* <- TODO: Require at least 1 -> min <- expectation to use jokers */) {
@@ -2829,7 +2896,7 @@ function validateTaskSupportsJokers(task, pipelineIdentification) {
2829
2896
  /**
2830
2897
  * Validates that every joker parameter is also listed among task dependencies.
2831
2898
  *
2832
- * @private internal utility of `validatePipeline`
2899
+ * @private internal utility of `validatePipelineTasks`
2833
2900
  */
2834
2901
  function validateTaskJokerDependencies(task, pipelineIdentification) {
2835
2902
  for (const joker of task.jokerParameterNames) {
@@ -2846,7 +2913,7 @@ function validateTaskJokerDependencies(task, pipelineIdentification) {
2846
2913
  /**
2847
2914
  * Validates all expectation bounds configured on one task.
2848
2915
  *
2849
- * @private internal utility of `validatePipeline`
2916
+ * @private internal utility of `validatePipelineTasks`
2850
2917
  */
2851
2918
  function validateTaskExpectations(task, pipelineIdentification) {
2852
2919
  if (!task.expectations) {
@@ -2861,7 +2928,7 @@ function validateTaskExpectations(task, pipelineIdentification) {
2861
2928
  /**
2862
2929
  * Validates the minimum and maximum expectation ordering for one unit.
2863
2930
  *
2864
- * @private internal utility of `validatePipeline`
2931
+ * @private internal utility of `validatePipelineTasks`
2865
2932
  */
2866
2933
  function validateTaskExpectationRange(unit, min, max, pipelineIdentification) {
2867
2934
  if (min === undefined || max === undefined || min <= max) {
@@ -2876,7 +2943,7 @@ function validateTaskExpectationRange(unit, min, max, pipelineIdentification) {
2876
2943
  /**
2877
2944
  * Validates the minimum expectation bound for one unit.
2878
2945
  *
2879
- * @private internal utility of `validatePipeline`
2946
+ * @private internal utility of `validatePipelineTasks`
2880
2947
  */
2881
2948
  function validateTaskExpectationMin(unit, min, pipelineIdentification) {
2882
2949
  if (min === undefined || min >= 0) {
@@ -2891,7 +2958,7 @@ function validateTaskExpectationMin(unit, min, pipelineIdentification) {
2891
2958
  /**
2892
2959
  * Validates the maximum expectation bound for one unit.
2893
2960
  *
2894
- * @private internal utility of `validatePipeline`
2961
+ * @private internal utility of `validatePipelineTasks`
2895
2962
  */
2896
2963
  function validateTaskExpectationMax(unit, max, pipelineIdentification) {
2897
2964
  if (max === undefined || max > 0) {
@@ -2903,123 +2970,62 @@ function validateTaskExpectationMax(unit, max, pipelineIdentification) {
2903
2970
  ${block(pipelineIdentification)}
2904
2971
  `));
2905
2972
  }
2973
+
2906
2974
  /**
2907
- * Collects the parameter names that are already resolvable before dependency traversal starts.
2908
- *
2909
- * @private internal utility of `validatePipeline`
2910
- */
2911
- function createInitialDependencyResolutionState(pipeline) {
2912
- return {
2913
- resolvedParameterNames: createInitiallyResolvedParameterNames(pipeline),
2914
- unresolvedTasks: [...pipeline.tasks],
2915
- };
2916
- }
2917
- /**
2918
- * Checks whether dependency resolution still has tasks left to process.
2919
- *
2920
- * @private internal utility of `validatePipeline`
2921
- */
2922
- function hasUnresolvedTasks({ unresolvedTasks }) {
2923
- return unresolvedTasks.length > 0;
2924
- }
2925
- /**
2926
- * Resolves the next batch of currently satisfiable tasks.
2975
+ * Validates PipelineJson if it is logically valid
2927
2976
  *
2928
- * @private internal utility of `validatePipeline`
2929
- */
2930
- function resolveNextDependencyResolutionState(dependencyResolutionState, pipelineIdentification) {
2931
- const currentlyResolvedTasks = getCurrentlyResolvedTasks(dependencyResolutionState.unresolvedTasks, dependencyResolutionState.resolvedParameterNames);
2932
- if (currentlyResolvedTasks.length === 0) {
2933
- throw createUnresolvedTasksError(dependencyResolutionState.unresolvedTasks, dependencyResolutionState.resolvedParameterNames, pipelineIdentification);
2934
- }
2935
- return {
2936
- resolvedParameterNames: appendResolvedTaskParameterNames(dependencyResolutionState.resolvedParameterNames, currentlyResolvedTasks),
2937
- unresolvedTasks: dependencyResolutionState.unresolvedTasks.filter((task) => !currentlyResolvedTasks.includes(task)),
2938
- };
2939
- }
2940
- /**
2941
- * Collects the parameter names that are already resolvable before dependency traversal starts.
2977
+ * It checks:
2978
+ * - if it has correct parameters dependency
2942
2979
  *
2943
- * @private internal utility of `validatePipeline`
2944
- */
2945
- function createInitiallyResolvedParameterNames(pipeline) {
2946
- let resolvedParameterNames = pipeline.parameters
2947
- .filter(({ isInput }) => isInput)
2948
- .map(({ name }) => name);
2949
- for (const reservedParameterName of RESERVED_PARAMETER_NAMES) {
2950
- resolvedParameterNames = [...resolvedParameterNames, reservedParameterName];
2951
- }
2952
- return resolvedParameterNames;
2953
- }
2954
- /**
2955
- * Adds newly resolved task outputs to the resolved parameter list.
2980
+ * It does NOT check:
2981
+ * - if it is valid json
2982
+ * - if it is meaningful
2956
2983
  *
2957
- * @private internal utility of `validatePipeline`
2958
- */
2959
- function appendResolvedTaskParameterNames(resolvedParameterNames, currentlyResolvedTasks) {
2960
- return [
2961
- ...resolvedParameterNames,
2962
- ...currentlyResolvedTasks.map(({ resultingParameterName }) => resultingParameterName),
2963
- ];
2964
- }
2965
- /**
2966
- * Selects tasks whose dependencies are already resolved.
2984
+ * Note: [🔂] This function is idempotent.
2967
2985
  *
2968
- * @private internal utility of `validatePipeline`
2969
- */
2970
- function getCurrentlyResolvedTasks(unresolvedTasks, resolvedParameterNames) {
2971
- return unresolvedTasks.filter((task) => task.dependentParameterNames.every((name) => resolvedParameterNames.includes(name)));
2972
- }
2973
- /**
2974
- * Creates the unexpected loop-limit error for dependency resolution.
2986
+ * @param pipeline valid or invalid PipelineJson
2987
+ * @returns the same pipeline if it is logically valid
2988
+ * @throws {PipelineLogicError} on logical error in the pipeline
2975
2989
  *
2976
- * @private internal utility of `validatePipeline`
2990
+ * @public exported from `@promptbook/core`
2977
2991
  */
2978
- function createDependencyResolutionLoopLimitError(pipelineIdentification) {
2979
- // Note: Really UnexpectedError not LimitReachedError - this should not happen and be caught below
2980
- return new UnexpectedError(spaceTrim$1((block) => `
2981
- Loop limit reached during detection of circular dependencies in \`validatePipeline\`
2992
+ function validatePipeline(pipeline) {
2993
+ if (IS_PIPELINE_LOGIC_VALIDATED) {
2994
+ validatePipeline_InnerFunction(pipeline);
2995
+ }
2996
+ else {
2997
+ try {
2998
+ validatePipeline_InnerFunction(pipeline);
2999
+ }
3000
+ catch (error) {
3001
+ if (!(error instanceof PipelineLogicError)) {
3002
+ throw error;
3003
+ }
3004
+ console.error(spaceTrim$1((block) => `
3005
+ Pipeline is not valid but logic errors are temporarily disabled via \`IS_PIPELINE_LOGIC_VALIDATED\`
2982
3006
 
2983
- ${block(pipelineIdentification)}
2984
- `));
3007
+ ${block(error.message)}
3008
+ `));
3009
+ }
3010
+ }
3011
+ return pipeline;
2985
3012
  }
2986
3013
  /**
2987
- * Creates the detailed error for unresolved or circular task dependencies.
3014
+ * Validates pipeline inner function.
2988
3015
  *
2989
- * @private internal utility of `validatePipeline`
3016
+ * @private internal function for `validatePipeline`
2990
3017
  */
2991
- function createUnresolvedTasksError(unresolvedTasks, resolvedParameterNames, pipelineIdentification) {
2992
- return new PipelineLogicError(
2993
- // TODO: [🐎] DRY
2994
- spaceTrim$1((block) => `
2995
-
2996
- Can not resolve some parameters:
2997
- Either you are using a parameter that is not defined, or there are some circular dependencies.
2998
-
2999
- ${block(pipelineIdentification)}
3000
-
3001
- **Can not resolve:**
3002
- ${block(unresolvedTasks
3003
- .map(({ resultingParameterName, dependentParameterNames }) => `- Parameter \`{${resultingParameterName}}\` which depends on ${dependentParameterNames
3004
- .map((dependentParameterName) => `\`{${dependentParameterName}}\``)
3005
- .join(' and ')}`)
3006
- .join('\n'))}
3007
-
3008
- **Resolved:**
3009
- ${block(resolvedParameterNames
3010
- .filter((name) => !RESERVED_PARAMETER_NAMES.includes(name))
3011
- .map((name) => `- Parameter \`{${name}}\``)
3012
- .join('\n'))}
3013
-
3014
-
3015
- **Reserved (which are available):**
3016
- ${block(resolvedParameterNames
3017
- .filter((name) => RESERVED_PARAMETER_NAMES.includes(name))
3018
- .map((name) => `- Parameter \`{${name}}\``)
3019
- .join('\n'))}
3020
-
3021
-
3022
- `));
3018
+ function validatePipeline_InnerFunction(pipeline) {
3019
+ // TODO: [🧠] Maybe test if promptbook is a promise and make specific error case for that
3020
+ const context = createPipelineValidationContext(pipeline);
3021
+ validatePipelineMetadata(context);
3022
+ validatePipelineCollectionsStructure(context);
3023
+ validatePipelineParameters(context);
3024
+ validatePipelineTasks(context);
3025
+ validatePipelineDependencyResolution(context);
3026
+ // Note: Check that formfactor is corresponding to the pipeline interface
3027
+ // TODO: !!6 Implement this
3028
+ // pipeline.formfactorName
3023
3029
  }
3024
3030
  /**
3025
3031
  * TODO: [🧞‍♀️] Do not allow joker + foreach