@promptbook/documents 0.113.0-8 → 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 +2 -2
  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
@@ -25,7 +25,7 @@ const BOOK_LANGUAGE_VERSION = '2.0.0';
25
25
  * @generated
26
26
  * @see https://github.com/webgptorg/promptbook
27
27
  */
28
- const PROMPTBOOK_ENGINE_VERSION = '0.113.0-8';
28
+ const PROMPTBOOK_ENGINE_VERSION = '0.113.0-9';
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
@@ -106,6 +106,127 @@ function take(initialValue) {
106
106
  });
107
107
  }
108
108
 
109
+ /**
110
+ * Validates that a channel value is a valid number within the range of 0 to 255.
111
+ * Throws an error if the value is not valid.
112
+ *
113
+ * @param channelName - The name of the channel being validated.
114
+ * @param value - The value of the channel to validate.
115
+ * @throws Will throw an error if the value is not a valid channel number.
116
+ *
117
+ * @private util of `@promptbook/color`
118
+ */
119
+ function checkChannelValue(channelName, value) {
120
+ if (typeof value !== 'number') {
121
+ throw new Error(`${channelName} channel value is not number but ${typeof value}`);
122
+ }
123
+ if (isNaN(value)) {
124
+ throw new Error(`${channelName} channel value is NaN`);
125
+ }
126
+ if (Math.round(value) !== value) {
127
+ throw new Error(`${channelName} channel is not whole number, it is ${value}`);
128
+ }
129
+ if (value < 0) {
130
+ throw new Error(`${channelName} channel is lower than 0, it is ${value}`);
131
+ }
132
+ if (value > 255) {
133
+ throw new Error(`${channelName} channel is greater than 255, it is ${value}`);
134
+ }
135
+ }
136
+
137
+ /**
138
+ * Shared immutable channel storage and serialization helpers for `Color`.
139
+ *
140
+ * @private base class of Color
141
+ */
142
+ class ColorValue {
143
+ constructor(red, green, blue, alpha = 255) {
144
+ this.red = red;
145
+ this.green = green;
146
+ this.blue = blue;
147
+ this.alpha = alpha;
148
+ checkChannelValue('Red', red);
149
+ checkChannelValue('Green', green);
150
+ checkChannelValue('Blue', blue);
151
+ checkChannelValue('Alpha', alpha);
152
+ }
153
+ /**
154
+ * Shortcut for `red` property
155
+ * Number from 0 to 255
156
+ * @alias red
157
+ */
158
+ get r() {
159
+ return this.red;
160
+ }
161
+ /**
162
+ * Shortcut for `green` property
163
+ * Number from 0 to 255
164
+ * @alias green
165
+ */
166
+ get g() {
167
+ return this.green;
168
+ }
169
+ /**
170
+ * Shortcut for `blue` property
171
+ * Number from 0 to 255
172
+ * @alias blue
173
+ */
174
+ get b() {
175
+ return this.blue;
176
+ }
177
+ /**
178
+ * Shortcut for `alpha` property
179
+ * Number from 0 (transparent) to 255 (opaque)
180
+ * @alias alpha
181
+ */
182
+ get a() {
183
+ return this.alpha;
184
+ }
185
+ /**
186
+ * Shortcut for `alpha` property
187
+ * Number from 0 (transparent) to 255 (opaque)
188
+ * @alias alpha
189
+ */
190
+ get opacity() {
191
+ return this.alpha;
192
+ }
193
+ /**
194
+ * Shortcut for 1-`alpha` property
195
+ */
196
+ get transparency() {
197
+ return 255 - this.alpha;
198
+ }
199
+ clone() {
200
+ return take(this.createColor(this.red, this.green, this.blue, this.alpha));
201
+ }
202
+ toString() {
203
+ return this.toHex();
204
+ }
205
+ toHex() {
206
+ if (this.alpha === 255) {
207
+ return `#${this.red.toString(16).padStart(2, '0')}${this.green.toString(16).padStart(2, '0')}${this.blue
208
+ .toString(16)
209
+ .padStart(2, '0')}`;
210
+ }
211
+ else {
212
+ return `#${this.red.toString(16).padStart(2, '0')}${this.green.toString(16).padStart(2, '0')}${this.blue
213
+ .toString(16)
214
+ .padStart(2, '0')}${this.alpha.toString(16).padStart(2, '0')}`;
215
+ }
216
+ }
217
+ toRgb() {
218
+ if (this.alpha === 255) {
219
+ return `rgb(${this.red}, ${this.green}, ${this.blue})`;
220
+ }
221
+ else {
222
+ return `rgba(${this.red}, ${this.green}, ${this.blue}, ${Math.round((this.alpha / 255) * 100)}%)`;
223
+ }
224
+ }
225
+ toHsl() {
226
+ throw new Error(`Getting HSL is not implemented`);
227
+ }
228
+ }
229
+
109
230
  /**
110
231
  * 🎨 List of all 140 color names which are supported by CSS
111
232
  *
@@ -265,127 +386,6 @@ const CSS_COLORS = {
265
386
  };
266
387
  // Note: [💞] Ignore a discrepancy between file name and entity name
267
388
 
268
- /**
269
- * Validates that a channel value is a valid number within the range of 0 to 255.
270
- * Throws an error if the value is not valid.
271
- *
272
- * @param channelName - The name of the channel being validated.
273
- * @param value - The value of the channel to validate.
274
- * @throws Will throw an error if the value is not a valid channel number.
275
- *
276
- * @private util of `@promptbook/color`
277
- */
278
- function checkChannelValue(channelName, value) {
279
- if (typeof value !== 'number') {
280
- throw new Error(`${channelName} channel value is not number but ${typeof value}`);
281
- }
282
- if (isNaN(value)) {
283
- throw new Error(`${channelName} channel value is NaN`);
284
- }
285
- if (Math.round(value) !== value) {
286
- throw new Error(`${channelName} channel is not whole number, it is ${value}`);
287
- }
288
- if (value < 0) {
289
- throw new Error(`${channelName} channel is lower than 0, it is ${value}`);
290
- }
291
- if (value > 255) {
292
- throw new Error(`${channelName} channel is greater than 255, it is ${value}`);
293
- }
294
- }
295
-
296
- /**
297
- * Shared immutable channel storage and serialization helpers for `Color`.
298
- *
299
- * @private base class of Color
300
- */
301
- class ColorValue {
302
- constructor(red, green, blue, alpha = 255) {
303
- this.red = red;
304
- this.green = green;
305
- this.blue = blue;
306
- this.alpha = alpha;
307
- checkChannelValue('Red', red);
308
- checkChannelValue('Green', green);
309
- checkChannelValue('Blue', blue);
310
- checkChannelValue('Alpha', alpha);
311
- }
312
- /**
313
- * Shortcut for `red` property
314
- * Number from 0 to 255
315
- * @alias red
316
- */
317
- get r() {
318
- return this.red;
319
- }
320
- /**
321
- * Shortcut for `green` property
322
- * Number from 0 to 255
323
- * @alias green
324
- */
325
- get g() {
326
- return this.green;
327
- }
328
- /**
329
- * Shortcut for `blue` property
330
- * Number from 0 to 255
331
- * @alias blue
332
- */
333
- get b() {
334
- return this.blue;
335
- }
336
- /**
337
- * Shortcut for `alpha` property
338
- * Number from 0 (transparent) to 255 (opaque)
339
- * @alias alpha
340
- */
341
- get a() {
342
- return this.alpha;
343
- }
344
- /**
345
- * Shortcut for `alpha` property
346
- * Number from 0 (transparent) to 255 (opaque)
347
- * @alias alpha
348
- */
349
- get opacity() {
350
- return this.alpha;
351
- }
352
- /**
353
- * Shortcut for 1-`alpha` property
354
- */
355
- get transparency() {
356
- return 255 - this.alpha;
357
- }
358
- clone() {
359
- return take(this.createColor(this.red, this.green, this.blue, this.alpha));
360
- }
361
- toString() {
362
- return this.toHex();
363
- }
364
- toHex() {
365
- if (this.alpha === 255) {
366
- return `#${this.red.toString(16).padStart(2, '0')}${this.green.toString(16).padStart(2, '0')}${this.blue
367
- .toString(16)
368
- .padStart(2, '0')}`;
369
- }
370
- else {
371
- return `#${this.red.toString(16).padStart(2, '0')}${this.green.toString(16).padStart(2, '0')}${this.blue
372
- .toString(16)
373
- .padStart(2, '0')}${this.alpha.toString(16).padStart(2, '0')}`;
374
- }
375
- }
376
- toRgb() {
377
- if (this.alpha === 255) {
378
- return `rgb(${this.red}, ${this.green}, ${this.blue})`;
379
- }
380
- else {
381
- return `rgba(${this.red}, ${this.green}, ${this.blue}, ${Math.round((this.alpha / 255) * 100)}%)`;
382
- }
383
- }
384
- toHsl() {
385
- throw new Error(`Getting HSL is not implemented`);
386
- }
387
- }
388
-
389
389
  /**
390
390
  * Checks if the given value is a valid hex color string
391
391
  *
@@ -2121,20 +2121,109 @@ function pipelineJsonToString(pipelineJson) {
2121
2121
  // TODO: [🧠] Should be in generated .book.md file GENERATOR_WARNING
2122
2122
 
2123
2123
  /**
2124
- * Orders JSON object by keys
2125
- *
2126
- * @returns The same type of object as the input re-ordered
2124
+ * This error indicates that the promptbook object has valid syntax (=can be parsed) but contains logical errors (like circular dependencies)
2127
2125
  *
2128
- * @public exported from `@promptbook/utils`
2126
+ * @public exported from `@promptbook/core`
2129
2127
  */
2130
- function orderJson(options) {
2131
- const { value, order } = options;
2132
- const orderedValue = {
2133
- ...(order === undefined ? {} : Object.fromEntries(order.map((key) => [key, undefined]))),
2134
- ...value,
2135
- };
2136
- return orderedValue;
2137
- }
2128
+ class PipelineLogicError extends Error {
2129
+ constructor(message) {
2130
+ super(message);
2131
+ this.name = 'PipelineLogicError';
2132
+ Object.setPrototypeOf(this, PipelineLogicError.prototype);
2133
+ }
2134
+ }
2135
+
2136
+ /**
2137
+ * Creates the shared validation context for one pipeline.
2138
+ *
2139
+ * @private function of `validatePipeline`
2140
+ */
2141
+ function createPipelineValidationContext(pipeline) {
2142
+ return {
2143
+ pipeline,
2144
+ pipelineIdentification: getPipelineIdentification(pipeline),
2145
+ };
2146
+ }
2147
+ /**
2148
+ * Builds a short file/url identification block for validation errors.
2149
+ *
2150
+ * @private internal utility of `validatePipeline`
2151
+ */
2152
+ function getPipelineIdentification(pipeline) {
2153
+ // Note: This is a 😐 implementation of [🚞]
2154
+ const pipelineIdentificationParts = [];
2155
+ if (pipeline.sourceFile !== undefined) {
2156
+ pipelineIdentificationParts.push(`File: ${pipeline.sourceFile}`);
2157
+ }
2158
+ if (pipeline.pipelineUrl !== undefined) {
2159
+ pipelineIdentificationParts.push(`Url: ${pipeline.pipelineUrl}`);
2160
+ }
2161
+ return pipelineIdentificationParts.join('\n');
2162
+ }
2163
+
2164
+ /**
2165
+ * Validates that the expected top-level collections have array structure.
2166
+ *
2167
+ * @private function of `validatePipeline`
2168
+ */
2169
+ function validatePipelineCollectionsStructure({ pipeline, pipelineIdentification, }) {
2170
+ validatePipelineParametersCollection(pipeline, pipelineIdentification);
2171
+ validatePipelineTasksCollection(pipeline, pipelineIdentification);
2172
+ }
2173
+ /**
2174
+ * Validates that `pipeline.parameters` is an array.
2175
+ *
2176
+ * @private internal utility of `validatePipelineCollectionsStructure`
2177
+ */
2178
+ function validatePipelineParametersCollection(pipeline, pipelineIdentification) {
2179
+ // TODO: [🧠] Maybe do here some proper JSON-schema / ZOD checking
2180
+ if (Array.isArray(pipeline.parameters)) {
2181
+ return;
2182
+ }
2183
+ // TODO: [🧠] what is the correct error tp throw - maybe PromptbookSchemaError
2184
+ throw new ParseError(spaceTrim$1((block) => `
2185
+ Pipeline is valid JSON but with wrong structure
2186
+
2187
+ \`PipelineJson.parameters\` expected to be an array, but got ${typeof pipeline.parameters}
2188
+
2189
+ ${block(pipelineIdentification)}
2190
+ `));
2191
+ }
2192
+ /**
2193
+ * Validates that `pipeline.tasks` is an array.
2194
+ *
2195
+ * @private internal utility of `validatePipelineCollectionsStructure`
2196
+ */
2197
+ function validatePipelineTasksCollection(pipeline, pipelineIdentification) {
2198
+ // TODO: [🧠] Maybe do here some proper JSON-schema / ZOD checking
2199
+ if (Array.isArray(pipeline.tasks)) {
2200
+ return;
2201
+ }
2202
+ // TODO: [🧠] what is the correct error tp throw - maybe PromptbookSchemaError
2203
+ throw new ParseError(spaceTrim$1((block) => `
2204
+ Pipeline is valid JSON but with wrong structure
2205
+
2206
+ \`PipelineJson.tasks\` expected to be an array, but got ${typeof pipeline.tasks}
2207
+
2208
+ ${block(pipelineIdentification)}
2209
+ `));
2210
+ }
2211
+
2212
+ /**
2213
+ * Orders JSON object by keys
2214
+ *
2215
+ * @returns The same type of object as the input re-ordered
2216
+ *
2217
+ * @public exported from `@promptbook/utils`
2218
+ */
2219
+ function orderJson(options) {
2220
+ const { value, order } = options;
2221
+ const orderedValue = {
2222
+ ...(order === undefined ? {} : Object.fromEntries(order.map((key) => [key, undefined]))),
2223
+ ...value,
2224
+ };
2225
+ return orderedValue;
2226
+ }
2138
2227
 
2139
2228
  /**
2140
2229
  * Freezes the given object and all its nested objects recursively
@@ -2483,16 +2572,137 @@ const RESERVED_PARAMETER_NAMES = exportJson({
2483
2572
  // Note: [💞] Ignore a discrepancy between file name and entity name
2484
2573
 
2485
2574
  /**
2486
- * This error indicates that the promptbook object has valid syntax (=can be parsed) but contains logical errors (like circular dependencies)
2575
+ * Validates that task dependencies can be resolved without cycles or missing definitions.
2487
2576
  *
2488
- * @public exported from `@promptbook/core`
2577
+ * @private function of `validatePipeline`
2489
2578
  */
2490
- class PipelineLogicError extends Error {
2491
- constructor(message) {
2492
- super(message);
2493
- this.name = 'PipelineLogicError';
2494
- Object.setPrototypeOf(this, PipelineLogicError.prototype);
2579
+ function validatePipelineDependencyResolution({ pipeline, pipelineIdentification, }) {
2580
+ let dependencyResolutionState = createInitialDependencyResolutionState(pipeline);
2581
+ let loopLimit = LOOP_LIMIT;
2582
+ while (hasUnresolvedTasks(dependencyResolutionState)) {
2583
+ if (loopLimit-- < 0) {
2584
+ throw createDependencyResolutionLoopLimitError(pipelineIdentification);
2585
+ }
2586
+ dependencyResolutionState = resolveNextDependencyResolutionState(dependencyResolutionState, pipelineIdentification);
2587
+ }
2588
+ }
2589
+ /**
2590
+ * Collects the parameter names that are already resolvable before dependency traversal starts.
2591
+ *
2592
+ * @private internal utility of `validatePipelineDependencyResolution`
2593
+ */
2594
+ function createInitialDependencyResolutionState(pipeline) {
2595
+ return {
2596
+ resolvedParameterNames: createInitiallyResolvedParameterNames(pipeline),
2597
+ unresolvedTasks: [...pipeline.tasks],
2598
+ };
2599
+ }
2600
+ /**
2601
+ * Checks whether dependency resolution still has tasks left to process.
2602
+ *
2603
+ * @private internal utility of `validatePipelineDependencyResolution`
2604
+ */
2605
+ function hasUnresolvedTasks({ unresolvedTasks }) {
2606
+ return unresolvedTasks.length > 0;
2607
+ }
2608
+ /**
2609
+ * Resolves the next batch of currently satisfiable tasks.
2610
+ *
2611
+ * @private internal utility of `validatePipelineDependencyResolution`
2612
+ */
2613
+ function resolveNextDependencyResolutionState(dependencyResolutionState, pipelineIdentification) {
2614
+ const currentlyResolvedTasks = getCurrentlyResolvedTasks(dependencyResolutionState.unresolvedTasks, dependencyResolutionState.resolvedParameterNames);
2615
+ if (currentlyResolvedTasks.length === 0) {
2616
+ throw createUnresolvedTasksError(dependencyResolutionState.unresolvedTasks, dependencyResolutionState.resolvedParameterNames, pipelineIdentification);
2617
+ }
2618
+ return {
2619
+ resolvedParameterNames: appendResolvedTaskParameterNames(dependencyResolutionState.resolvedParameterNames, currentlyResolvedTasks),
2620
+ unresolvedTasks: dependencyResolutionState.unresolvedTasks.filter((task) => !currentlyResolvedTasks.includes(task)),
2621
+ };
2622
+ }
2623
+ /**
2624
+ * Collects the parameter names that are already resolvable before dependency traversal starts.
2625
+ *
2626
+ * @private internal utility of `validatePipelineDependencyResolution`
2627
+ */
2628
+ function createInitiallyResolvedParameterNames(pipeline) {
2629
+ let resolvedParameterNames = pipeline.parameters
2630
+ .filter(({ isInput }) => isInput)
2631
+ .map(({ name }) => name);
2632
+ for (const reservedParameterName of RESERVED_PARAMETER_NAMES) {
2633
+ resolvedParameterNames = [...resolvedParameterNames, reservedParameterName];
2495
2634
  }
2635
+ return resolvedParameterNames;
2636
+ }
2637
+ /**
2638
+ * Adds newly resolved task outputs to the resolved parameter list.
2639
+ *
2640
+ * @private internal utility of `validatePipelineDependencyResolution`
2641
+ */
2642
+ function appendResolvedTaskParameterNames(resolvedParameterNames, currentlyResolvedTasks) {
2643
+ return [
2644
+ ...resolvedParameterNames,
2645
+ ...currentlyResolvedTasks.map(({ resultingParameterName }) => resultingParameterName),
2646
+ ];
2647
+ }
2648
+ /**
2649
+ * Selects tasks whose dependencies are already resolved.
2650
+ *
2651
+ * @private internal utility of `validatePipelineDependencyResolution`
2652
+ */
2653
+ function getCurrentlyResolvedTasks(unresolvedTasks, resolvedParameterNames) {
2654
+ return unresolvedTasks.filter((task) => task.dependentParameterNames.every((name) => resolvedParameterNames.includes(name)));
2655
+ }
2656
+ /**
2657
+ * Creates the unexpected loop-limit error for dependency resolution.
2658
+ *
2659
+ * @private internal utility of `validatePipelineDependencyResolution`
2660
+ */
2661
+ function createDependencyResolutionLoopLimitError(pipelineIdentification) {
2662
+ // Note: Really UnexpectedError not LimitReachedError - this should not happen and be caught below
2663
+ return new UnexpectedError(spaceTrim$1((block) => `
2664
+ Loop limit reached during detection of circular dependencies in \`validatePipeline\`
2665
+
2666
+ ${block(pipelineIdentification)}
2667
+ `));
2668
+ }
2669
+ /**
2670
+ * Creates the detailed error for unresolved or circular task dependencies.
2671
+ *
2672
+ * @private internal utility of `validatePipelineDependencyResolution`
2673
+ */
2674
+ function createUnresolvedTasksError(unresolvedTasks, resolvedParameterNames, pipelineIdentification) {
2675
+ return new PipelineLogicError(
2676
+ // TODO: [🐎] DRY
2677
+ spaceTrim$1((block) => `
2678
+
2679
+ Can not resolve some parameters:
2680
+ Either you are using a parameter that is not defined, or there are some circular dependencies.
2681
+
2682
+ ${block(pipelineIdentification)}
2683
+
2684
+ **Can not resolve:**
2685
+ ${block(unresolvedTasks
2686
+ .map(({ resultingParameterName, dependentParameterNames }) => `- Parameter \`{${resultingParameterName}}\` which depends on ${dependentParameterNames
2687
+ .map((dependentParameterName) => `\`{${dependentParameterName}}\``)
2688
+ .join(' and ')}`)
2689
+ .join('\n'))}
2690
+
2691
+ **Resolved:**
2692
+ ${block(resolvedParameterNames
2693
+ .filter((name) => !RESERVED_PARAMETER_NAMES.includes(name))
2694
+ .map((name) => `- Parameter \`{${name}}\``)
2695
+ .join('\n'))}
2696
+
2697
+
2698
+ **Reserved (which are available):**
2699
+ ${block(resolvedParameterNames
2700
+ .filter((name) => RESERVED_PARAMETER_NAMES.includes(name))
2701
+ .map((name) => `- Parameter \`{${name}}\``)
2702
+ .join('\n'))}
2703
+
2704
+
2705
+ `));
2496
2706
  }
2497
2707
 
2498
2708
  /**
@@ -2570,171 +2780,22 @@ function isValidPipelineUrl(url) {
2570
2780
  // TODO: [🐠] Maybe more info why the URL is invalid
2571
2781
 
2572
2782
  /**
2573
- * Validates PipelineJson if it is logically valid
2574
- *
2575
- * It checks:
2576
- * - if it has correct parameters dependency
2577
- *
2578
- * It does NOT check:
2579
- * - if it is valid json
2580
- * - if it is meaningful
2581
- *
2582
- * Note: [🔂] This function is idempotent.
2783
+ * Validates pipeline-level metadata fields.
2583
2784
  *
2584
- * @param pipeline valid or invalid PipelineJson
2585
- * @returns the same pipeline if it is logically valid
2586
- * @throws {PipelineLogicError} on logical error in the pipeline
2785
+ * @private function of `validatePipeline`
2786
+ */
2787
+ function validatePipelineMetadata({ pipeline, pipelineIdentification }) {
2788
+ validatePipelineUrl(pipeline, pipelineIdentification);
2789
+ validatePipelineBookVersion(pipeline, pipelineIdentification);
2790
+ }
2791
+ /**
2792
+ * Validates the pipeline URL, when present.
2587
2793
  *
2588
- * @public exported from `@promptbook/core`
2794
+ * @private internal utility of `validatePipelineMetadata`
2589
2795
  */
2590
- function validatePipeline(pipeline) {
2591
- if (IS_PIPELINE_LOGIC_VALIDATED) {
2592
- validatePipeline_InnerFunction(pipeline);
2593
- }
2594
- else {
2595
- try {
2596
- validatePipeline_InnerFunction(pipeline);
2597
- }
2598
- catch (error) {
2599
- if (!(error instanceof PipelineLogicError)) {
2600
- throw error;
2601
- }
2602
- console.error(spaceTrim$1((block) => `
2603
- Pipeline is not valid but logic errors are temporarily disabled via \`IS_PIPELINE_LOGIC_VALIDATED\`
2604
-
2605
- ${block(error.message)}
2606
- `));
2607
- }
2608
- }
2609
- return pipeline;
2610
- }
2611
- /**
2612
- * Validates pipeline inner function.
2613
- *
2614
- * @private internal function for `validatePipeline`
2615
- */
2616
- function validatePipeline_InnerFunction(pipeline) {
2617
- // TODO: [🧠] Maybe test if promptbook is a promise and make specific error case for that
2618
- const context = createPipelineValidationContext(pipeline);
2619
- validatePipelineMetadata(context);
2620
- validatePipelineCollectionsStructure(context);
2621
- validatePipelineParameters(context);
2622
- validatePipelineTasks(context);
2623
- validatePipelineDependencyResolution(context);
2624
- // Note: Check that formfactor is corresponding to the pipeline interface
2625
- // TODO: !!6 Implement this
2626
- // pipeline.formfactorName
2627
- }
2628
- /**
2629
- * Creates the shared validation context for one pipeline.
2630
- *
2631
- * @private internal utility of `validatePipeline`
2632
- */
2633
- function createPipelineValidationContext(pipeline) {
2634
- return {
2635
- pipeline,
2636
- pipelineIdentification: getPipelineIdentification(pipeline),
2637
- };
2638
- }
2639
- /**
2640
- * Builds a short file/url identification block for validation errors.
2641
- *
2642
- * @private internal utility of `validatePipeline`
2643
- */
2644
- function getPipelineIdentification(pipeline) {
2645
- // Note: This is a 😐 implementation of [🚞]
2646
- const pipelineIdentificationParts = [];
2647
- if (pipeline.sourceFile !== undefined) {
2648
- pipelineIdentificationParts.push(`File: ${pipeline.sourceFile}`);
2649
- }
2650
- if (pipeline.pipelineUrl !== undefined) {
2651
- pipelineIdentificationParts.push(`Url: ${pipeline.pipelineUrl}`);
2652
- }
2653
- return pipelineIdentificationParts.join('\n');
2654
- }
2655
- /**
2656
- * Validates pipeline-level metadata fields.
2657
- *
2658
- * @private internal step of `validatePipeline`
2659
- */
2660
- function validatePipelineMetadata({ pipeline, pipelineIdentification }) {
2661
- validatePipelineUrl(pipeline, pipelineIdentification);
2662
- validatePipelineBookVersion(pipeline, pipelineIdentification);
2663
- }
2664
- /**
2665
- * Validates that the expected top-level collections have array structure.
2666
- *
2667
- * @private internal step of `validatePipeline`
2668
- */
2669
- function validatePipelineCollectionsStructure({ pipeline, pipelineIdentification }) {
2670
- validatePipelineParametersCollection(pipeline, pipelineIdentification);
2671
- validatePipelineTasksCollection(pipeline, pipelineIdentification);
2672
- }
2673
- /**
2674
- * Validates all pipeline parameter declarations.
2675
- *
2676
- * @private internal step of `validatePipeline`
2677
- */
2678
- function validatePipelineParameters({ pipeline, pipelineIdentification }) {
2679
- for (const parameter of pipeline.parameters) {
2680
- validatePipelineParameter(parameter, pipeline, pipelineIdentification);
2681
- }
2682
- }
2683
- /**
2684
- * Validates all pipeline tasks and their per-task invariants.
2685
- *
2686
- * @private internal step of `validatePipeline`
2687
- */
2688
- function validatePipelineTasks({ pipeline, pipelineIdentification }) {
2689
- // Note: All input parameters are defined - so that they can be used as result of some task
2690
- const definedParameters = createInitiallyDefinedParameters(pipeline);
2691
- for (const task of pipeline.tasks) {
2692
- validatePipelineTask(task, definedParameters, pipelineIdentification);
2693
- }
2694
- }
2695
- /**
2696
- * Validates that task dependencies can be resolved without cycles or missing definitions.
2697
- *
2698
- * @private internal step of `validatePipeline`
2699
- */
2700
- function validatePipelineDependencyResolution({ pipeline, pipelineIdentification }) {
2701
- let dependencyResolutionState = createInitialDependencyResolutionState(pipeline);
2702
- let loopLimit = LOOP_LIMIT;
2703
- while (hasUnresolvedTasks(dependencyResolutionState)) {
2704
- if (loopLimit-- < 0) {
2705
- throw createDependencyResolutionLoopLimitError(pipelineIdentification);
2706
- }
2707
- dependencyResolutionState = resolveNextDependencyResolutionState(dependencyResolutionState, pipelineIdentification);
2708
- }
2709
- }
2710
- /**
2711
- * Validates one pipeline parameter declaration.
2712
- *
2713
- * @private internal step of `validatePipeline`
2714
- */
2715
- function validatePipelineParameter(parameter, pipeline, pipelineIdentification) {
2716
- validateParameterDirection(parameter, pipelineIdentification);
2717
- validateParameterUsage(parameter, pipeline, pipelineIdentification);
2718
- validateParameterDefinition(parameter, pipeline, pipelineIdentification);
2719
- }
2720
- /**
2721
- * Validates one pipeline task and its invariants.
2722
- *
2723
- * @private internal step of `validatePipeline`
2724
- */
2725
- function validatePipelineTask(task, definedParameters, pipelineIdentification) {
2726
- validateTaskResultingParameter(task, definedParameters, pipelineIdentification);
2727
- validateTaskJokers(task, pipelineIdentification);
2728
- validateTaskExpectations(task, pipelineIdentification);
2729
- }
2730
- /**
2731
- * Validates the pipeline URL, when present.
2732
- *
2733
- * @private internal utility of `validatePipeline`
2734
- */
2735
- function validatePipelineUrl(pipeline, pipelineIdentification) {
2736
- if (pipeline.pipelineUrl === undefined || isValidPipelineUrl(pipeline.pipelineUrl)) {
2737
- return;
2796
+ function validatePipelineUrl(pipeline, pipelineIdentification) {
2797
+ if (pipeline.pipelineUrl === undefined || isValidPipelineUrl(pipeline.pipelineUrl)) {
2798
+ return;
2738
2799
  }
2739
2800
  // <- Note: [🚲]
2740
2801
  throw new PipelineLogicError(spaceTrim$1((block) => `
@@ -2746,7 +2807,7 @@ function validatePipelineUrl(pipeline, pipelineIdentification) {
2746
2807
  /**
2747
2808
  * Validates the Promptbook version, when present.
2748
2809
  *
2749
- * @private internal utility of `validatePipeline`
2810
+ * @private internal utility of `validatePipelineMetadata`
2750
2811
  */
2751
2812
  function validatePipelineBookVersion(pipeline, pipelineIdentification) {
2752
2813
  if (pipeline.bookVersion === undefined || isValidPromptbookVersion(pipeline.bookVersion)) {
@@ -2759,48 +2820,31 @@ function validatePipelineBookVersion(pipeline, pipelineIdentification) {
2759
2820
  ${block(pipelineIdentification)}
2760
2821
  `));
2761
2822
  }
2823
+
2762
2824
  /**
2763
- * Validates that `pipeline.parameters` is an array.
2825
+ * Validates all pipeline parameter declarations.
2764
2826
  *
2765
- * @private internal utility of `validatePipeline`
2827
+ * @private function of `validatePipeline`
2766
2828
  */
2767
- function validatePipelineParametersCollection(pipeline, pipelineIdentification) {
2768
- // TODO: [🧠] Maybe do here some proper JSON-schema / ZOD checking
2769
- if (Array.isArray(pipeline.parameters)) {
2770
- return;
2829
+ function validatePipelineParameters({ pipeline, pipelineIdentification }) {
2830
+ for (const parameter of pipeline.parameters) {
2831
+ validatePipelineParameter(parameter, pipeline, pipelineIdentification);
2771
2832
  }
2772
- // TODO: [🧠] what is the correct error tp throw - maybe PromptbookSchemaError
2773
- throw new ParseError(spaceTrim$1((block) => `
2774
- Pipeline is valid JSON but with wrong structure
2775
-
2776
- \`PipelineJson.parameters\` expected to be an array, but got ${typeof pipeline.parameters}
2777
-
2778
- ${block(pipelineIdentification)}
2779
- `));
2780
2833
  }
2781
2834
  /**
2782
- * Validates that `pipeline.tasks` is an array.
2835
+ * Validates one pipeline parameter declaration.
2783
2836
  *
2784
- * @private internal utility of `validatePipeline`
2837
+ * @private internal utility of `validatePipelineParameters`
2785
2838
  */
2786
- function validatePipelineTasksCollection(pipeline, pipelineIdentification) {
2787
- // TODO: [🧠] Maybe do here some proper JSON-schema / ZOD checking
2788
- if (Array.isArray(pipeline.tasks)) {
2789
- return;
2790
- }
2791
- // TODO: [🧠] what is the correct error tp throw - maybe PromptbookSchemaError
2792
- throw new ParseError(spaceTrim$1((block) => `
2793
- Pipeline is valid JSON but with wrong structure
2794
-
2795
- \`PipelineJson.tasks\` expected to be an array, but got ${typeof pipeline.tasks}
2796
-
2797
- ${block(pipelineIdentification)}
2798
- `));
2839
+ function validatePipelineParameter(parameter, pipeline, pipelineIdentification) {
2840
+ validateParameterDirection(parameter, pipelineIdentification);
2841
+ validateParameterUsage(parameter, pipeline, pipelineIdentification);
2842
+ validateParameterDefinition(parameter, pipeline, pipelineIdentification);
2799
2843
  }
2800
2844
  /**
2801
2845
  * Validates that one parameter does not declare incompatible directions.
2802
2846
  *
2803
- * @private internal utility of `validatePipeline`
2847
+ * @private internal utility of `validatePipelineParameters`
2804
2848
  */
2805
2849
  function validateParameterDirection(parameter, pipelineIdentification) {
2806
2850
  if (!parameter.isInput || !parameter.isOutput) {
@@ -2817,7 +2861,7 @@ function validateParameterDirection(parameter, pipelineIdentification) {
2817
2861
  /**
2818
2862
  * Validates that one intermediate parameter is actually consumed by at least one task.
2819
2863
  *
2820
- * @private internal utility of `validatePipeline`
2864
+ * @private internal utility of `validatePipelineParameters`
2821
2865
  */
2822
2866
  function validateParameterUsage(parameter, pipeline, pipelineIdentification) {
2823
2867
  if (parameter.isInput || parameter.isOutput || isParameterUsedByAnyTask(parameter, pipeline.tasks)) {
@@ -2836,7 +2880,7 @@ function validateParameterUsage(parameter, pipeline, pipelineIdentification) {
2836
2880
  /**
2837
2881
  * Validates that one non-input parameter is produced by at least one task.
2838
2882
  *
2839
- * @private internal utility of `validatePipeline`
2883
+ * @private internal utility of `validatePipelineParameters`
2840
2884
  */
2841
2885
  function validateParameterDefinition(parameter, pipeline, pipelineIdentification) {
2842
2886
  if (parameter.isInput || isParameterDefinedByAnyTask(parameter, pipeline.tasks)) {
@@ -2855,7 +2899,7 @@ function validateParameterDefinition(parameter, pipeline, pipelineIdentification
2855
2899
  /**
2856
2900
  * Checks whether one parameter is consumed by at least one task dependency list.
2857
2901
  *
2858
- * @private internal utility of `validatePipeline`
2902
+ * @private internal utility of `validatePipelineParameters`
2859
2903
  */
2860
2904
  function isParameterUsedByAnyTask(parameter, tasks) {
2861
2905
  return tasks.some((task) => task.dependentParameterNames.includes(parameter.name));
@@ -2863,23 +2907,46 @@ function isParameterUsedByAnyTask(parameter, tasks) {
2863
2907
  /**
2864
2908
  * Checks whether one parameter is produced by at least one task.
2865
2909
  *
2866
- * @private internal utility of `validatePipeline`
2910
+ * @private internal utility of `validatePipelineParameters`
2867
2911
  */
2868
2912
  function isParameterDefinedByAnyTask(parameter, tasks) {
2869
2913
  return tasks.some((task) => task.resultingParameterName === parameter.name);
2870
2914
  }
2915
+
2916
+ /**
2917
+ * Validates all pipeline tasks and their per-task invariants.
2918
+ *
2919
+ * @private function of `validatePipeline`
2920
+ */
2921
+ function validatePipelineTasks({ pipeline, pipelineIdentification }) {
2922
+ // Note: All input parameters are defined - so that they can be used as result of some task
2923
+ const definedParameters = createInitiallyDefinedParameters(pipeline);
2924
+ for (const task of pipeline.tasks) {
2925
+ validatePipelineTask(task, definedParameters, pipelineIdentification);
2926
+ }
2927
+ }
2871
2928
  /**
2872
2929
  * Collects the parameter names that are already defined before task validation starts.
2873
2930
  *
2874
- * @private internal utility of `validatePipeline`
2931
+ * @private internal utility of `validatePipelineTasks`
2875
2932
  */
2876
2933
  function createInitiallyDefinedParameters(pipeline) {
2877
2934
  return new Set(pipeline.parameters.filter(({ isInput }) => isInput).map(({ name }) => name));
2878
2935
  }
2936
+ /**
2937
+ * Validates one pipeline task and its invariants.
2938
+ *
2939
+ * @private internal utility of `validatePipelineTasks`
2940
+ */
2941
+ function validatePipelineTask(task, definedParameters, pipelineIdentification) {
2942
+ validateTaskResultingParameter(task, definedParameters, pipelineIdentification);
2943
+ validateTaskJokers(task, pipelineIdentification);
2944
+ validateTaskExpectations(task, pipelineIdentification);
2945
+ }
2879
2946
  /**
2880
2947
  * Validates one task result parameter declaration and marks it as defined.
2881
2948
  *
2882
- * @private internal utility of `validatePipeline`
2949
+ * @private internal utility of `validatePipelineTasks`
2883
2950
  */
2884
2951
  function validateTaskResultingParameter(task, definedParameters, pipelineIdentification) {
2885
2952
  if (definedParameters.has(task.resultingParameterName)) {
@@ -2901,7 +2968,7 @@ function validateTaskResultingParameter(task, definedParameters, pipelineIdentif
2901
2968
  /**
2902
2969
  * Validates joker parameters for one task.
2903
2970
  *
2904
- * @private internal utility of `validatePipeline`
2971
+ * @private internal utility of `validatePipelineTasks`
2905
2972
  */
2906
2973
  function validateTaskJokers(task, pipelineIdentification) {
2907
2974
  if (!hasTaskJokers(task)) {
@@ -2913,7 +2980,7 @@ function validateTaskJokers(task, pipelineIdentification) {
2913
2980
  /**
2914
2981
  * Checks whether one task declares any joker parameters.
2915
2982
  *
2916
- * @private internal utility of `validatePipeline`
2983
+ * @private internal utility of `validatePipelineTasks`
2917
2984
  */
2918
2985
  function hasTaskJokers(task) {
2919
2986
  return !!task.jokerParameterNames && task.jokerParameterNames.length > 0;
@@ -2921,7 +2988,7 @@ function hasTaskJokers(task) {
2921
2988
  /**
2922
2989
  * Validates that a task has the required supporting features when using jokers.
2923
2990
  *
2924
- * @private internal utility of `validatePipeline`
2991
+ * @private internal utility of `validatePipelineTasks`
2925
2992
  */
2926
2993
  function validateTaskSupportsJokers(task, pipelineIdentification) {
2927
2994
  if (task.format || task.expectations /* <- TODO: Require at least 1 -> min <- expectation to use jokers */) {
@@ -2936,7 +3003,7 @@ function validateTaskSupportsJokers(task, pipelineIdentification) {
2936
3003
  /**
2937
3004
  * Validates that every joker parameter is also listed among task dependencies.
2938
3005
  *
2939
- * @private internal utility of `validatePipeline`
3006
+ * @private internal utility of `validatePipelineTasks`
2940
3007
  */
2941
3008
  function validateTaskJokerDependencies(task, pipelineIdentification) {
2942
3009
  for (const joker of task.jokerParameterNames) {
@@ -2953,7 +3020,7 @@ function validateTaskJokerDependencies(task, pipelineIdentification) {
2953
3020
  /**
2954
3021
  * Validates all expectation bounds configured on one task.
2955
3022
  *
2956
- * @private internal utility of `validatePipeline`
3023
+ * @private internal utility of `validatePipelineTasks`
2957
3024
  */
2958
3025
  function validateTaskExpectations(task, pipelineIdentification) {
2959
3026
  if (!task.expectations) {
@@ -2968,7 +3035,7 @@ function validateTaskExpectations(task, pipelineIdentification) {
2968
3035
  /**
2969
3036
  * Validates the minimum and maximum expectation ordering for one unit.
2970
3037
  *
2971
- * @private internal utility of `validatePipeline`
3038
+ * @private internal utility of `validatePipelineTasks`
2972
3039
  */
2973
3040
  function validateTaskExpectationRange(unit, min, max, pipelineIdentification) {
2974
3041
  if (min === undefined || max === undefined || min <= max) {
@@ -2983,7 +3050,7 @@ function validateTaskExpectationRange(unit, min, max, pipelineIdentification) {
2983
3050
  /**
2984
3051
  * Validates the minimum expectation bound for one unit.
2985
3052
  *
2986
- * @private internal utility of `validatePipeline`
3053
+ * @private internal utility of `validatePipelineTasks`
2987
3054
  */
2988
3055
  function validateTaskExpectationMin(unit, min, pipelineIdentification) {
2989
3056
  if (min === undefined || min >= 0) {
@@ -2998,7 +3065,7 @@ function validateTaskExpectationMin(unit, min, pipelineIdentification) {
2998
3065
  /**
2999
3066
  * Validates the maximum expectation bound for one unit.
3000
3067
  *
3001
- * @private internal utility of `validatePipeline`
3068
+ * @private internal utility of `validatePipelineTasks`
3002
3069
  */
3003
3070
  function validateTaskExpectationMax(unit, max, pipelineIdentification) {
3004
3071
  if (max === undefined || max > 0) {
@@ -3010,123 +3077,62 @@ function validateTaskExpectationMax(unit, max, pipelineIdentification) {
3010
3077
  ${block(pipelineIdentification)}
3011
3078
  `));
3012
3079
  }
3080
+
3013
3081
  /**
3014
- * Collects the parameter names that are already resolvable before dependency traversal starts.
3015
- *
3016
- * @private internal utility of `validatePipeline`
3017
- */
3018
- function createInitialDependencyResolutionState(pipeline) {
3019
- return {
3020
- resolvedParameterNames: createInitiallyResolvedParameterNames(pipeline),
3021
- unresolvedTasks: [...pipeline.tasks],
3022
- };
3023
- }
3024
- /**
3025
- * Checks whether dependency resolution still has tasks left to process.
3026
- *
3027
- * @private internal utility of `validatePipeline`
3028
- */
3029
- function hasUnresolvedTasks({ unresolvedTasks }) {
3030
- return unresolvedTasks.length > 0;
3031
- }
3032
- /**
3033
- * Resolves the next batch of currently satisfiable tasks.
3082
+ * Validates PipelineJson if it is logically valid
3034
3083
  *
3035
- * @private internal utility of `validatePipeline`
3036
- */
3037
- function resolveNextDependencyResolutionState(dependencyResolutionState, pipelineIdentification) {
3038
- const currentlyResolvedTasks = getCurrentlyResolvedTasks(dependencyResolutionState.unresolvedTasks, dependencyResolutionState.resolvedParameterNames);
3039
- if (currentlyResolvedTasks.length === 0) {
3040
- throw createUnresolvedTasksError(dependencyResolutionState.unresolvedTasks, dependencyResolutionState.resolvedParameterNames, pipelineIdentification);
3041
- }
3042
- return {
3043
- resolvedParameterNames: appendResolvedTaskParameterNames(dependencyResolutionState.resolvedParameterNames, currentlyResolvedTasks),
3044
- unresolvedTasks: dependencyResolutionState.unresolvedTasks.filter((task) => !currentlyResolvedTasks.includes(task)),
3045
- };
3046
- }
3047
- /**
3048
- * Collects the parameter names that are already resolvable before dependency traversal starts.
3084
+ * It checks:
3085
+ * - if it has correct parameters dependency
3049
3086
  *
3050
- * @private internal utility of `validatePipeline`
3051
- */
3052
- function createInitiallyResolvedParameterNames(pipeline) {
3053
- let resolvedParameterNames = pipeline.parameters
3054
- .filter(({ isInput }) => isInput)
3055
- .map(({ name }) => name);
3056
- for (const reservedParameterName of RESERVED_PARAMETER_NAMES) {
3057
- resolvedParameterNames = [...resolvedParameterNames, reservedParameterName];
3058
- }
3059
- return resolvedParameterNames;
3060
- }
3061
- /**
3062
- * Adds newly resolved task outputs to the resolved parameter list.
3087
+ * It does NOT check:
3088
+ * - if it is valid json
3089
+ * - if it is meaningful
3063
3090
  *
3064
- * @private internal utility of `validatePipeline`
3065
- */
3066
- function appendResolvedTaskParameterNames(resolvedParameterNames, currentlyResolvedTasks) {
3067
- return [
3068
- ...resolvedParameterNames,
3069
- ...currentlyResolvedTasks.map(({ resultingParameterName }) => resultingParameterName),
3070
- ];
3071
- }
3072
- /**
3073
- * Selects tasks whose dependencies are already resolved.
3091
+ * Note: [🔂] This function is idempotent.
3074
3092
  *
3075
- * @private internal utility of `validatePipeline`
3076
- */
3077
- function getCurrentlyResolvedTasks(unresolvedTasks, resolvedParameterNames) {
3078
- return unresolvedTasks.filter((task) => task.dependentParameterNames.every((name) => resolvedParameterNames.includes(name)));
3079
- }
3080
- /**
3081
- * Creates the unexpected loop-limit error for dependency resolution.
3093
+ * @param pipeline valid or invalid PipelineJson
3094
+ * @returns the same pipeline if it is logically valid
3095
+ * @throws {PipelineLogicError} on logical error in the pipeline
3082
3096
  *
3083
- * @private internal utility of `validatePipeline`
3097
+ * @public exported from `@promptbook/core`
3084
3098
  */
3085
- function createDependencyResolutionLoopLimitError(pipelineIdentification) {
3086
- // Note: Really UnexpectedError not LimitReachedError - this should not happen and be caught below
3087
- return new UnexpectedError(spaceTrim$1((block) => `
3088
- Loop limit reached during detection of circular dependencies in \`validatePipeline\`
3099
+ function validatePipeline(pipeline) {
3100
+ if (IS_PIPELINE_LOGIC_VALIDATED) {
3101
+ validatePipeline_InnerFunction(pipeline);
3102
+ }
3103
+ else {
3104
+ try {
3105
+ validatePipeline_InnerFunction(pipeline);
3106
+ }
3107
+ catch (error) {
3108
+ if (!(error instanceof PipelineLogicError)) {
3109
+ throw error;
3110
+ }
3111
+ console.error(spaceTrim$1((block) => `
3112
+ Pipeline is not valid but logic errors are temporarily disabled via \`IS_PIPELINE_LOGIC_VALIDATED\`
3089
3113
 
3090
- ${block(pipelineIdentification)}
3091
- `));
3114
+ ${block(error.message)}
3115
+ `));
3116
+ }
3117
+ }
3118
+ return pipeline;
3092
3119
  }
3093
3120
  /**
3094
- * Creates the detailed error for unresolved or circular task dependencies.
3121
+ * Validates pipeline inner function.
3095
3122
  *
3096
- * @private internal utility of `validatePipeline`
3123
+ * @private internal function for `validatePipeline`
3097
3124
  */
3098
- function createUnresolvedTasksError(unresolvedTasks, resolvedParameterNames, pipelineIdentification) {
3099
- return new PipelineLogicError(
3100
- // TODO: [🐎] DRY
3101
- spaceTrim$1((block) => `
3102
-
3103
- Can not resolve some parameters:
3104
- Either you are using a parameter that is not defined, or there are some circular dependencies.
3105
-
3106
- ${block(pipelineIdentification)}
3107
-
3108
- **Can not resolve:**
3109
- ${block(unresolvedTasks
3110
- .map(({ resultingParameterName, dependentParameterNames }) => `- Parameter \`{${resultingParameterName}}\` which depends on ${dependentParameterNames
3111
- .map((dependentParameterName) => `\`{${dependentParameterName}}\``)
3112
- .join(' and ')}`)
3113
- .join('\n'))}
3114
-
3115
- **Resolved:**
3116
- ${block(resolvedParameterNames
3117
- .filter((name) => !RESERVED_PARAMETER_NAMES.includes(name))
3118
- .map((name) => `- Parameter \`{${name}}\``)
3119
- .join('\n'))}
3120
-
3121
-
3122
- **Reserved (which are available):**
3123
- ${block(resolvedParameterNames
3124
- .filter((name) => RESERVED_PARAMETER_NAMES.includes(name))
3125
- .map((name) => `- Parameter \`{${name}}\``)
3126
- .join('\n'))}
3127
-
3128
-
3129
- `));
3125
+ function validatePipeline_InnerFunction(pipeline) {
3126
+ // TODO: [🧠] Maybe test if promptbook is a promise and make specific error case for that
3127
+ const context = createPipelineValidationContext(pipeline);
3128
+ validatePipelineMetadata(context);
3129
+ validatePipelineCollectionsStructure(context);
3130
+ validatePipelineParameters(context);
3131
+ validatePipelineTasks(context);
3132
+ validatePipelineDependencyResolution(context);
3133
+ // Note: Check that formfactor is corresponding to the pipeline interface
3134
+ // TODO: !!6 Implement this
3135
+ // pipeline.formfactorName
3130
3136
  }
3131
3137
  /**
3132
3138
  * TODO: [🧞‍♀️] Do not allow joker + foreach