@promptbook/node 0.103.0-9 → 0.103.0

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 (273) hide show
  1. package/README.md +92 -66
  2. package/esm/index.es.js +373 -232
  3. package/esm/index.es.js.map +1 -1
  4. package/esm/typings/books/index.d.ts +0 -81
  5. package/esm/typings/servers.d.ts +9 -7
  6. package/esm/typings/src/_packages/browser.index.d.ts +6 -0
  7. package/esm/typings/src/_packages/cli.index.d.ts +4 -0
  8. package/esm/typings/src/_packages/components.index.d.ts +22 -8
  9. package/esm/typings/src/_packages/core.index.d.ts +58 -18
  10. package/esm/typings/src/_packages/node.index.d.ts +2 -2
  11. package/esm/typings/src/_packages/remote-server.index.d.ts +2 -0
  12. package/esm/typings/src/_packages/types.index.d.ts +70 -8
  13. package/esm/typings/src/_packages/utils.index.d.ts +6 -0
  14. package/esm/typings/src/_packages/wizard.index.d.ts +4 -0
  15. package/esm/typings/src/book-2.0/agent-source/AgentBasicInformation.d.ts +20 -5
  16. package/esm/typings/src/book-2.0/agent-source/AgentModelRequirements.d.ts +17 -1
  17. package/esm/typings/src/book-2.0/agent-source/AgentSourceParseResult.d.ts +3 -2
  18. package/esm/typings/src/book-2.0/agent-source/computeAgentHash.d.ts +8 -0
  19. package/esm/typings/src/book-2.0/agent-source/createCommitmentRegex.d.ts +3 -3
  20. package/esm/typings/src/book-2.0/agent-source/createDefaultAgentName.d.ts +8 -0
  21. package/esm/typings/src/book-2.0/agent-source/normalizeAgentName.d.ts +9 -0
  22. package/esm/typings/src/book-2.0/agent-source/padBook.d.ts +18 -0
  23. package/esm/typings/src/book-2.0/agent-source/parseAgentSourceWithCommitments.d.ts +1 -1
  24. package/esm/typings/src/book-2.0/agent-source/string_book.d.ts +3 -0
  25. package/esm/typings/src/book-components/AvatarProfile/AvatarProfile/AvatarProfile.d.ts +6 -1
  26. package/esm/typings/src/book-components/BookEditor/BookEditor.d.ts +85 -14
  27. package/esm/typings/src/book-components/BookEditor/BookEditorActionbar.d.ts +18 -0
  28. package/esm/typings/src/book-components/BookEditor/BookEditorMonaco.d.ts +5 -0
  29. package/esm/typings/src/book-components/Chat/AgentChat/AgentChat.d.ts +17 -0
  30. package/esm/typings/src/book-components/Chat/AgentChat/AgentChatProps.d.ts +13 -0
  31. package/esm/typings/src/book-components/Chat/Chat/ChatProps.d.ts +16 -0
  32. package/esm/typings/src/book-components/Chat/LlmChat/LlmChatProps.d.ts +5 -0
  33. package/esm/typings/src/book-components/Chat/MarkdownContent/MarkdownContent.d.ts +15 -0
  34. package/esm/typings/src/book-components/Chat/MockedChat/MockedChat.d.ts +5 -0
  35. package/esm/typings/src/book-components/Chat/save/_common/ChatSaveFormatDefinition.d.ts +1 -1
  36. package/esm/typings/src/book-components/Chat/save/html/htmlSaveFormatDefinition.d.ts +1 -0
  37. package/esm/typings/src/book-components/Chat/save/pdf/pdfSaveFormatDefinition.d.ts +4 -0
  38. package/esm/typings/src/book-components/Chat/types/ChatParticipant.d.ts +1 -1
  39. package/esm/typings/src/book-components/PromptbookAgent/PromptbookAgentIntegration.d.ts +52 -0
  40. package/esm/typings/src/book-components/PromptbookAgent/PromptbookAgentSeamlessIntegration.d.ts +14 -0
  41. package/esm/typings/src/book-components/Qr/BrandedQrCode.d.ts +18 -0
  42. package/esm/typings/src/book-components/Qr/GenericQrCode.d.ts +10 -0
  43. package/esm/typings/src/book-components/Qr/PromptbookQrCode.d.ts +18 -0
  44. package/esm/typings/src/book-components/Qr/useQrCode.d.ts +15 -0
  45. package/esm/typings/src/book-components/_common/Dropdown/Dropdown.d.ts +15 -0
  46. package/esm/typings/src/book-components/_common/HamburgerMenu/HamburgerMenu.d.ts +12 -0
  47. package/esm/typings/src/book-components/_common/Modal/Modal.d.ts +2 -2
  48. package/esm/typings/src/book-components/_common/Tooltip/Tooltip.d.ts +47 -0
  49. package/esm/typings/src/book-components/icons/AboutIcon.d.ts +9 -0
  50. package/esm/typings/src/book-components/icons/CameraIcon.d.ts +11 -0
  51. package/esm/typings/src/book-components/icons/CloseIcon.d.ts +4 -8
  52. package/esm/typings/src/book-components/icons/DownloadIcon.d.ts +9 -0
  53. package/esm/typings/src/book-components/icons/ExitFullscreenIcon.d.ts +7 -0
  54. package/esm/typings/src/book-components/icons/FullscreenIcon.d.ts +7 -0
  55. package/esm/typings/src/book-components/icons/MenuIcon.d.ts +12 -0
  56. package/esm/typings/src/book-components/icons/MicIcon.d.ts +8 -0
  57. package/esm/typings/src/book-components/icons/SendIcon.d.ts +3 -0
  58. package/esm/typings/src/cli/cli-commands/_boilerplate.d.ts +2 -1
  59. package/esm/typings/src/cli/cli-commands/about.d.ts +3 -1
  60. package/esm/typings/src/cli/cli-commands/hello.d.ts +2 -1
  61. package/esm/typings/src/cli/cli-commands/list-models.d.ts +2 -1
  62. package/esm/typings/src/cli/cli-commands/list-scrapers.d.ts +2 -1
  63. package/esm/typings/src/cli/cli-commands/login.d.ts +2 -1
  64. package/esm/typings/src/cli/cli-commands/make.d.ts +2 -1
  65. package/esm/typings/src/cli/cli-commands/prettify.d.ts +2 -1
  66. package/esm/typings/src/cli/cli-commands/run.d.ts +2 -1
  67. package/esm/typings/src/cli/cli-commands/{start-server.d.ts → start-agents-server.d.ts} +3 -2
  68. package/esm/typings/src/cli/cli-commands/start-pipelines-server.d.ts +15 -0
  69. package/esm/typings/src/cli/cli-commands/test-command.d.ts +2 -1
  70. package/esm/typings/src/cli/common/$addGlobalOptionsToCommand.d.ts +2 -1
  71. package/esm/typings/src/collection/agent-collection/AgentCollection.d.ts +12 -0
  72. package/esm/typings/src/collection/agent-collection/constructors/agent-collection-in-supabase/AgentCollectionInSupabase.d.ts +75 -0
  73. package/esm/typings/src/collection/agent-collection/constructors/agent-collection-in-supabase/AgentCollectionInSupabaseOptions.d.ts +10 -0
  74. package/esm/typings/src/collection/agent-collection/constructors/agent-collection-in-supabase/AgentsDatabaseSchema.d.ts +154 -0
  75. package/esm/typings/src/collection/{PipelineCollection.d.ts → pipeline-collection/PipelineCollection.d.ts} +7 -3
  76. package/esm/typings/src/collection/{SimplePipelineCollection.d.ts → pipeline-collection/SimplePipelineCollection.d.ts} +5 -5
  77. package/esm/typings/src/collection/{constructors/createCollectionFromDirectory.d.ts → pipeline-collection/constructors/createPipelineCollectionFromDirectory.d.ts} +8 -11
  78. package/esm/typings/src/collection/pipeline-collection/constructors/createPipelineCollectionFromJson.d.ts +13 -0
  79. package/esm/typings/src/collection/{constructors/createCollectionFromPromise.d.ts → pipeline-collection/constructors/createPipelineCollectionFromPromise.d.ts} +6 -5
  80. package/esm/typings/src/collection/pipeline-collection/constructors/createPipelineCollectionFromPromise.test.d.ts +1 -0
  81. package/esm/typings/src/collection/{constructors/createCollectionFromUrl.d.ts → pipeline-collection/constructors/createPipelineCollectionFromUrl.d.ts} +3 -3
  82. package/esm/typings/src/collection/{constructors/createSubcollection.d.ts → pipeline-collection/constructors/createPipelineSubcollection.d.ts} +3 -3
  83. package/esm/typings/src/collection/pipeline-collection/pipelineCollectionToJson.d.ts +13 -0
  84. package/esm/typings/src/commands/_common/types/CommandParser.d.ts +4 -5
  85. package/esm/typings/src/{book-2.0/commitments → commitments}/ACTION/ACTION.d.ts +5 -1
  86. package/esm/typings/src/commitments/CLOSED/CLOSED.d.ts +39 -0
  87. package/esm/typings/src/commitments/CLOSED/CLOSED.test.d.ts +4 -0
  88. package/esm/typings/src/commitments/COMPONENT/COMPONENT.d.ts +28 -0
  89. package/esm/typings/src/{book-2.0/commitments → commitments}/DELETE/DELETE.d.ts +5 -1
  90. package/esm/typings/src/{book-2.0/commitments → commitments}/FORMAT/FORMAT.d.ts +5 -1
  91. package/esm/typings/src/commitments/FROM/FROM.d.ts +34 -0
  92. package/esm/typings/src/{book-2.0/commitments → commitments}/GOAL/GOAL.d.ts +5 -1
  93. package/esm/typings/src/{book-2.0/commitments → commitments}/KNOWLEDGE/KNOWLEDGE.d.ts +5 -5
  94. package/esm/typings/src/commitments/LANGUAGE/LANGUAGE.d.ts +35 -0
  95. package/esm/typings/src/{book-2.0/commitments → commitments}/MEMORY/MEMORY.d.ts +5 -1
  96. package/esm/typings/src/commitments/MESSAGE/AgentMessageCommitmentDefinition.d.ts +32 -0
  97. package/esm/typings/src/commitments/MESSAGE/InitialMessageCommitmentDefinition.d.ts +32 -0
  98. package/esm/typings/src/{book-2.0/commitments → commitments}/MESSAGE/MESSAGE.d.ts +5 -1
  99. package/esm/typings/src/commitments/MESSAGE/UserMessageCommitmentDefinition.d.ts +32 -0
  100. package/esm/typings/src/{book-2.0/commitments → commitments}/META/META.d.ts +5 -1
  101. package/esm/typings/src/commitments/META_COLOR/META_COLOR.d.ts +48 -0
  102. package/esm/typings/src/commitments/META_FONT/META_FONT.d.ts +42 -0
  103. package/esm/typings/src/{book-2.0/commitments → commitments}/META_IMAGE/META_IMAGE.d.ts +5 -1
  104. package/esm/typings/src/{book-2.0/commitments → commitments}/META_LINK/META_LINK.d.ts +5 -1
  105. package/esm/typings/src/{book-2.0/commitments → commitments}/MODEL/MODEL.d.ts +5 -1
  106. package/esm/typings/src/{book-2.0/commitments → commitments}/NOTE/NOTE.d.ts +5 -1
  107. package/esm/typings/src/commitments/OPEN/OPEN.d.ts +35 -0
  108. package/esm/typings/src/{book-2.0/commitments → commitments}/PERSONA/PERSONA.d.ts +5 -1
  109. package/esm/typings/src/{book-2.0/commitments → commitments}/RULE/RULE.d.ts +5 -1
  110. package/esm/typings/src/{book-2.0/commitments → commitments}/SAMPLE/SAMPLE.d.ts +5 -1
  111. package/esm/typings/src/{book-2.0/commitments → commitments}/SCENARIO/SCENARIO.d.ts +5 -1
  112. package/esm/typings/src/{book-2.0/commitments → commitments}/STYLE/STYLE.d.ts +5 -1
  113. package/esm/typings/src/commitments/USE/USE.d.ts +53 -0
  114. package/esm/typings/src/commitments/USE_BROWSER/USE_BROWSER.d.ts +42 -0
  115. package/esm/typings/src/commitments/USE_BROWSER/USE_BROWSER.test.d.ts +1 -0
  116. package/esm/typings/src/commitments/USE_MCP/USE_MCP.d.ts +37 -0
  117. package/esm/typings/src/commitments/USE_SEARCH_ENGINE/USE_SEARCH_ENGINE.d.ts +38 -0
  118. package/esm/typings/src/{book-2.0/commitments → commitments}/_base/BaseCommitmentDefinition.d.ts +14 -2
  119. package/esm/typings/src/{book-2.0/commitments → commitments}/_base/CommitmentDefinition.d.ts +6 -1
  120. package/esm/typings/src/{book-2.0/commitments → commitments}/_base/NotYetImplementedCommitmentDefinition.d.ts +5 -1
  121. package/esm/typings/src/{book-2.0/commitments → commitments}/_base/createEmptyAgentModelRequirements.d.ts +1 -1
  122. package/esm/typings/src/commitments/index.d.ts +93 -0
  123. package/esm/typings/src/config.d.ts +24 -3
  124. package/esm/typings/src/conversion/validation/validatePipeline.d.ts +2 -0
  125. package/esm/typings/src/errors/0-index.d.ts +6 -0
  126. package/esm/typings/src/errors/DatabaseError.d.ts +12 -0
  127. package/esm/typings/src/errors/NotAllowed.d.ts +9 -0
  128. package/esm/typings/src/errors/WrappedError.d.ts +2 -2
  129. package/esm/typings/src/execution/AvailableModel.d.ts +1 -0
  130. package/esm/typings/src/execution/Executables.d.ts +3 -0
  131. package/esm/typings/src/execution/ExecutionTask.d.ts +12 -3
  132. package/esm/typings/src/execution/ExecutionTools.d.ts +5 -0
  133. package/esm/typings/src/execution/FilesystemTools.d.ts +1 -1
  134. package/esm/typings/src/execution/LlmExecutionTools.d.ts +26 -2
  135. package/esm/typings/src/execution/PromptResult.d.ts +7 -1
  136. package/esm/typings/src/execution/createPipelineExecutor/10-executePipeline.d.ts +5 -0
  137. package/esm/typings/src/execution/createPipelineExecutor/20-executeTask.d.ts +5 -0
  138. package/esm/typings/src/execution/createPipelineExecutor/30-executeFormatSubvalues.d.ts +5 -0
  139. package/esm/typings/src/execution/createPipelineExecutor/40-executeAttempts.d.ts +5 -0
  140. package/esm/typings/src/execution/utils/usage-constants.d.ts +4 -124
  141. package/esm/typings/src/execution/utils/validatePromptResult.d.ts +2 -0
  142. package/esm/typings/src/high-level-abstractions/_common/HighLevelAbstraction.d.ts +2 -1
  143. package/esm/typings/src/llm-providers/_common/register/$provideLlmToolsForWizardOrCli.d.ts +2 -2
  144. package/esm/typings/src/llm-providers/_common/register/$registeredLlmToolsMessage.d.ts +2 -1
  145. package/esm/typings/src/llm-providers/_common/register/LlmToolsMetadata.d.ts +1 -1
  146. package/esm/typings/src/llm-providers/_common/utils/assertUniqueModels.d.ts +12 -0
  147. package/esm/typings/src/llm-providers/_multiple/getSingleLlmExecutionTools.d.ts +1 -0
  148. package/esm/typings/src/llm-providers/_multiple/joinLlmExecutionTools.d.ts +1 -0
  149. package/esm/typings/src/llm-providers/agent/Agent.d.ts +72 -0
  150. package/esm/typings/src/llm-providers/agent/AgentLlmExecutionTools.d.ts +26 -4
  151. package/esm/typings/src/llm-providers/agent/AgentOptions.d.ts +19 -0
  152. package/esm/typings/src/llm-providers/agent/CreateAgentLlmExecutionToolsOptions.d.ts +17 -0
  153. package/esm/typings/src/llm-providers/agent/RemoteAgent.d.ts +50 -0
  154. package/esm/typings/src/llm-providers/agent/RemoteAgentOptions.d.ts +11 -0
  155. package/esm/typings/src/llm-providers/agent/createAgentLlmExecutionTools.d.ts +1 -19
  156. package/esm/typings/src/llm-providers/anthropic-claude/anthropic-claude-models.d.ts +1 -1
  157. package/esm/typings/src/llm-providers/google/google-models.d.ts +1 -1
  158. package/esm/typings/src/llm-providers/ollama/OllamaExecutionTools.d.ts +4 -0
  159. package/esm/typings/src/llm-providers/openai/OpenAiAssistantExecutionTools.d.ts +60 -2
  160. package/esm/typings/src/llm-providers/openai/OpenAiAssistantExecutionToolsOptions.d.ts +7 -1
  161. package/esm/typings/src/llm-providers/openai/OpenAiCompatibleExecutionTools.d.ts +13 -1
  162. package/esm/typings/src/llm-providers/openai/OpenAiExecutionTools.d.ts +4 -0
  163. package/esm/typings/src/llm-providers/openai/createOpenAiCompatibleExecutionTools.d.ts +6 -6
  164. package/esm/typings/src/llm-providers/openai/openai-models.d.ts +1 -1
  165. package/esm/typings/src/llm-providers/openai/openai-models.test.d.ts +4 -0
  166. package/esm/typings/src/other/templates/getTemplatesPipelineCollection.d.ts +1 -1
  167. package/esm/typings/src/pipeline/validatePipelineString.d.ts +2 -0
  168. package/esm/typings/src/playground/permanent/_boilerplate.d.ts +5 -0
  169. package/esm/typings/src/playground/permanent/agent-with-browser-playground.d.ts +5 -0
  170. package/esm/typings/src/prepare/PrepareAndScrapeOptions.d.ts +1 -0
  171. package/esm/typings/src/remote-server/startAgentServer.d.ts +26 -0
  172. package/esm/typings/src/remote-server/startRemoteServer.d.ts +4 -1
  173. package/esm/typings/src/remote-server/types/RemoteServerOptions.d.ts +3 -8
  174. package/esm/typings/src/scrapers/_boilerplate/createBoilerplateScraper.d.ts +1 -12
  175. package/esm/typings/src/scrapers/_boilerplate/register-metadata.d.ts +1 -9
  176. package/esm/typings/src/scrapers/document/createDocumentScraper.d.ts +1 -12
  177. package/esm/typings/src/scrapers/document/register-metadata.d.ts +1 -9
  178. package/esm/typings/src/scrapers/document-legacy/createLegacyDocumentScraper.d.ts +1 -12
  179. package/esm/typings/src/scrapers/document-legacy/register-metadata.d.ts +1 -9
  180. package/esm/typings/src/scrapers/markdown/createMarkdownScraper.d.ts +1 -12
  181. package/esm/typings/src/scrapers/markdown/register-metadata.d.ts +1 -9
  182. package/esm/typings/src/scrapers/markitdown/createMarkitdownScraper.d.ts +1 -12
  183. package/esm/typings/src/scrapers/markitdown/register-metadata.d.ts +1 -9
  184. package/esm/typings/src/scrapers/pdf/createPdfScraper.d.ts +1 -12
  185. package/esm/typings/src/scrapers/pdf/register-metadata.d.ts +1 -9
  186. package/esm/typings/src/scrapers/website/createWebsiteScraper.d.ts +1 -12
  187. package/esm/typings/src/scrapers/website/register-metadata.d.ts +1 -9
  188. package/esm/typings/src/storage/_common/PromptbookStorage.d.ts +1 -0
  189. package/esm/typings/src/storage/env-storage/$EnvStorage.d.ts +2 -1
  190. package/esm/typings/src/transpilers/_common/BookTranspiler.d.ts +33 -0
  191. package/esm/typings/src/transpilers/_common/BookTranspilerOptions.d.ts +18 -0
  192. package/esm/typings/src/transpilers/_common/register/$bookTranspilersRegister.d.ts +15 -0
  193. package/esm/typings/src/transpilers/formatted-book-in-markdown/FormattedBookInMarkdownTranspiler.d.ts +16 -0
  194. package/esm/typings/src/transpilers/formatted-book-in-markdown/register.d.ts +15 -0
  195. package/esm/typings/src/transpilers/openai-sdk/OpenAiSdkTranspiler.d.ts +16 -0
  196. package/esm/typings/src/transpilers/openai-sdk/OpenAiSdkTranspiler.test.d.ts +1 -0
  197. package/esm/typings/src/transpilers/openai-sdk/playground/playground.d.ts +5 -0
  198. package/esm/typings/src/transpilers/openai-sdk/register.d.ts +15 -0
  199. package/esm/typings/src/types/LlmCall.d.ts +20 -0
  200. package/esm/typings/src/types/ModelRequirements.d.ts +13 -1
  201. package/esm/typings/src/types/ModelVariant.d.ts +1 -1
  202. package/esm/typings/src/types/Prompt.d.ts +13 -1
  203. package/esm/typings/src/types/Updatable.d.ts +19 -0
  204. package/esm/typings/src/types/typeAliases.d.ts +38 -2
  205. package/esm/typings/src/utils/color/$randomColor.d.ts +1 -0
  206. package/esm/typings/src/utils/color/Color.d.ts +16 -1
  207. package/esm/typings/src/utils/color/Color.test.d.ts +1 -0
  208. package/esm/typings/src/utils/color/css-colors.d.ts +1 -0
  209. package/esm/typings/src/utils/color/internal-utils/checkChannelValue.d.ts +0 -3
  210. package/esm/typings/src/utils/color/operators/darken.d.ts +1 -1
  211. package/esm/typings/src/utils/color/operators/grayscale.d.ts +1 -1
  212. package/esm/typings/src/utils/color/operators/lighten.d.ts +1 -1
  213. package/esm/typings/src/utils/color/operators/mixWithColor.d.ts +1 -1
  214. package/esm/typings/src/utils/color/operators/saturate.d.ts +1 -1
  215. package/esm/typings/src/utils/environment/$detectRuntimeEnvironment.d.ts +16 -0
  216. package/esm/typings/src/utils/environment/$getGlobalScope.d.ts +2 -2
  217. package/esm/typings/src/utils/execCommand/$execCommand.d.ts +2 -1
  218. package/esm/typings/src/utils/execCommand/$execCommands.d.ts +2 -1
  219. package/esm/typings/src/utils/files/$induceBookDownload.d.ts +13 -0
  220. package/esm/typings/src/utils/files/$induceFileDownload.d.ts +13 -0
  221. package/esm/typings/src/utils/files/ObjectUrl.d.ts +46 -0
  222. package/esm/typings/src/utils/files/listAllFiles.d.ts +2 -3
  223. package/esm/typings/src/utils/misc/aboutPromptbookInformation.d.ts +27 -0
  224. package/esm/typings/src/utils/misc/computeHash.d.ts +11 -0
  225. package/esm/typings/src/utils/misc/computeHash.test.d.ts +1 -0
  226. package/esm/typings/src/utils/misc/injectCssModuleIntoShadowRoot.d.ts +1 -0
  227. package/esm/typings/src/utils/misc/xAboutPromptbookInformation.d.ts +13 -0
  228. package/esm/typings/src/utils/normalization/normalize-to-kebab-case.d.ts +2 -0
  229. package/esm/typings/src/utils/normalization/normalizeMessageText.d.ts +9 -0
  230. package/esm/typings/src/utils/normalization/normalizeMessageText.test.d.ts +1 -0
  231. package/esm/typings/src/utils/normalization/normalizeTo_PascalCase.d.ts +3 -0
  232. package/esm/typings/src/utils/normalization/normalizeTo_camelCase.d.ts +2 -0
  233. package/esm/typings/src/utils/normalization/titleToName.d.ts +2 -0
  234. package/esm/typings/src/utils/organization/$sideEffect.d.ts +2 -2
  235. package/esm/typings/src/utils/organization/$side_effect.d.ts +7 -0
  236. package/esm/typings/src/utils/organization/TODO_USE.d.ts +2 -2
  237. package/esm/typings/src/utils/organization/keepUnused.d.ts +2 -2
  238. package/esm/typings/src/utils/organization/preserve.d.ts +3 -3
  239. package/esm/typings/src/utils/organization/really_any.d.ts +7 -0
  240. package/esm/typings/src/utils/random/$generateBookBoilerplate.d.ts +31 -0
  241. package/esm/typings/src/utils/random/$randomAgentPersona.d.ts +9 -0
  242. package/esm/typings/src/utils/random/$randomFullnameWithColor.d.ts +13 -0
  243. package/esm/typings/src/utils/random/$randomItem.d.ts +9 -0
  244. package/esm/typings/src/utils/random/$randomSeed.d.ts +3 -0
  245. package/esm/typings/src/utils/random/$randomToken.d.ts +2 -0
  246. package/esm/typings/src/utils/random/CzechNamePool.d.ts +7 -0
  247. package/esm/typings/src/utils/random/EnglishNamePool.d.ts +7 -0
  248. package/esm/typings/src/utils/random/NamePool.d.ts +17 -0
  249. package/esm/typings/src/utils/random/getNamePool.d.ts +10 -0
  250. package/esm/typings/src/utils/serialization/$deepFreeze.d.ts +2 -1
  251. package/esm/typings/src/utils/serialization/asSerializable.d.ts +2 -2
  252. package/esm/typings/src/utils/serialization/serializeToPromptbookJavascript.d.ts +2 -2
  253. package/esm/typings/src/utils/validators/parameterName/validateParameterName.d.ts +2 -0
  254. package/esm/typings/src/version.d.ts +1 -1
  255. package/esm/typings/src/wizard/$getCompiledBook.d.ts +1 -2
  256. package/package.json +8 -8
  257. package/umd/index.umd.js +381 -240
  258. package/umd/index.umd.js.map +1 -1
  259. package/esm/typings/src/book-2.0/commitments/index.d.ts +0 -60
  260. package/esm/typings/src/book-components/BookEditor/BookEditorInner.d.ts +0 -5
  261. package/esm/typings/src/book-components/BookEditor/BookEditorWrapper.d.ts +0 -9
  262. package/esm/typings/src/book-components/BookEditor/config.d.ts +0 -10
  263. package/esm/typings/src/book-components/Chat/utils/renderMarkdown.d.ts +0 -21
  264. package/esm/typings/src/collection/collectionToJson.d.ts +0 -13
  265. package/esm/typings/src/collection/constructors/createCollectionFromJson.d.ts +0 -13
  266. /package/esm/typings/src/{book-components/Chat/utils/renderMarkdown.test.d.ts → book-2.0/agent-source/computeAgentHash.test.d.ts} +0 -0
  267. /package/esm/typings/src/{collection/constructors/createCollectionFromDirectory.test.d.ts → book-2.0/agent-source/normalizeAgentName.test.d.ts} +0 -0
  268. /package/esm/typings/src/{collection/constructors/createCollectionFromJson.test.d.ts → book-components/Chat/AgentChat/AgentChat.test.d.ts} +0 -0
  269. /package/esm/typings/src/collection/{constructors/createCollectionFromPromise.test.d.ts → pipeline-collection/constructors/createPipelineCollectionFromDirectory.test.d.ts} +0 -0
  270. /package/esm/typings/src/{commands/_common/parseCommand.test.d.ts → collection/pipeline-collection/constructors/createPipelineCollectionFromJson.test.d.ts} +0 -0
  271. /package/esm/typings/src/collection/{collectionToJson.test.d.ts → pipeline-collection/pipelineCollectionToJson.test.d.ts} +0 -0
  272. /package/esm/typings/src/{book-2.0/commitments → commitments}/_base/BookCommitment.d.ts +0 -0
  273. /package/esm/typings/src/{book-2.0/commitments → commitments}/_base/ParsedCommitment.d.ts +0 -0
package/umd/index.umd.js CHANGED
@@ -1,8 +1,8 @@
1
1
  (function (global, factory) {
2
2
  typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('colors'), require('fs/promises'), require('path'), require('spacetrim'), require('jszip'), require('crypto'), require('rxjs'), require('waitasecond'), require('papaparse'), require('crypto-js/enc-hex'), require('crypto-js/sha256'), require('crypto-js'), require('mime-types'), require('child_process'), require('dotenv')) :
3
3
  typeof define === 'function' && define.amd ? define(['exports', 'colors', 'fs/promises', 'path', 'spacetrim', 'jszip', 'crypto', 'rxjs', 'waitasecond', 'papaparse', 'crypto-js/enc-hex', 'crypto-js/sha256', 'crypto-js', 'mime-types', 'child_process', 'dotenv'], factory) :
4
- (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global["promptbook-node"] = {}, global.colors, global.promises, global.path, global.spaceTrim, global.JSZip, global.crypto, global.rxjs, global.waitasecond, global.papaparse, global.hexEncoder, global.sha256, global.cryptoJs, global.mimeTypes, global.child_process, global.dotenv));
5
- })(this, (function (exports, colors, promises, path, spaceTrim, JSZip, crypto, rxjs, waitasecond, papaparse, hexEncoder, sha256, cryptoJs, mimeTypes, child_process, dotenv) { 'use strict';
4
+ (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global["promptbook-node"] = {}, global.colors, global.promises, global.path, global.spaceTrim$1, global.JSZip, global.crypto, global.rxjs, global.waitasecond, global.papaparse, global.hexEncoder, global.sha256, global.cryptoJs, global.mimeTypes, global.child_process, global.dotenv));
5
+ })(this, (function (exports, colors, promises, path, spaceTrim$1, JSZip, crypto, rxjs, waitasecond, papaparse, hexEncoder, sha256, cryptoJs, mimeTypes, child_process, dotenv) { 'use strict';
6
6
 
7
7
  function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
8
8
 
@@ -25,7 +25,7 @@
25
25
  }
26
26
 
27
27
  var colors__default = /*#__PURE__*/_interopDefaultLegacy(colors);
28
- var spaceTrim__default = /*#__PURE__*/_interopDefaultLegacy(spaceTrim);
28
+ var spaceTrim__default = /*#__PURE__*/_interopDefaultLegacy(spaceTrim$1);
29
29
  var JSZip__default = /*#__PURE__*/_interopDefaultLegacy(JSZip);
30
30
  var hexEncoder__default = /*#__PURE__*/_interopDefaultLegacy(hexEncoder);
31
31
  var sha256__default = /*#__PURE__*/_interopDefaultLegacy(sha256);
@@ -38,19 +38,30 @@
38
38
  * @generated
39
39
  * @see https://github.com/webgptorg/book
40
40
  */
41
- const BOOK_LANGUAGE_VERSION = '1.0.0';
41
+ const BOOK_LANGUAGE_VERSION = '2.0.0';
42
42
  /**
43
43
  * The version of the Promptbook engine
44
44
  *
45
45
  * @generated
46
46
  * @see https://github.com/webgptorg/promptbook
47
47
  */
48
- const PROMPTBOOK_ENGINE_VERSION = '0.103.0-9';
48
+ const PROMPTBOOK_ENGINE_VERSION = '0.103.0';
49
49
  /**
50
50
  * TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
51
51
  * Note: [💞] Ignore a discrepancy between file name and entity name
52
52
  */
53
53
 
54
+ /**
55
+ * Trims string from all 4 sides
56
+ *
57
+ * Note: This is a re-exported function from the `spacetrim` package which is
58
+ * Developed by same author @hejny as this package
59
+ *
60
+ * @public exported from `@promptbook/utils`
61
+ * @see https://github.com/hejny/spacetrim#usage
62
+ */
63
+ const spaceTrim = spaceTrim$1.spaceTrim;
64
+
54
65
  /**
55
66
  * @private util of `@promptbook/color`
56
67
  * @de
@@ -99,6 +110,7 @@
99
110
  * @public exported from `@promptbook/color`
100
111
  */
101
112
  const CSS_COLORS = {
113
+ promptbook: '#79EAFD',
102
114
  transparent: 'rgba(0,0,0,0)',
103
115
  aliceblue: '#f0f8ff',
104
116
  antiquewhite: '#faebd7',
@@ -280,9 +292,6 @@
280
292
  throw new Error(`${channelName} channel is greater than 255, it is ${value}`);
281
293
  }
282
294
  }
283
- /**
284
- * TODO: [🧠][🚓] Is/which combination it better to use asserts/check, validate or is utility function?
285
- */
286
295
 
287
296
  /**
288
297
  * Color object represents an RGB color with alpha channel
@@ -302,21 +311,61 @@
302
311
  * @param color
303
312
  * @returns Color object
304
313
  */
305
- static from(color) {
306
- if (color instanceof Color) {
314
+ static from(color, _isSingleValue = false) {
315
+ if (color === '') {
316
+ throw new Error(`Can not create color from empty string`);
317
+ }
318
+ else if (color instanceof Color) {
307
319
  return take(color);
308
320
  }
309
321
  else if (Color.isColor(color)) {
310
322
  return take(color);
311
323
  }
312
324
  else if (typeof color === 'string') {
313
- return Color.fromString(color);
325
+ try {
326
+ return Color.fromString(color);
327
+ }
328
+ catch (error) {
329
+ // <- Note: Can not use `assertsError(error)` here because it causes circular dependency
330
+ if (_isSingleValue) {
331
+ throw error;
332
+ }
333
+ const parts = color.split(/[\s+,;|]/);
334
+ if (parts.length > 0) {
335
+ return Color.from(parts[0].trim(), true);
336
+ }
337
+ else {
338
+ throw new Error(`Can not create color from given string "${color}"`);
339
+ }
340
+ }
314
341
  }
315
342
  else {
316
343
  console.error({ color });
317
344
  throw new Error(`Can not create color from given object`);
318
345
  }
319
346
  }
347
+ /**
348
+ * Creates a new Color instance from miscellaneous formats
349
+ * It just does not throw error when it fails, it returns PROMPTBOOK_COLOR instead
350
+ *
351
+ * @param color
352
+ * @returns Color object
353
+ */
354
+ static fromSafe(color) {
355
+ try {
356
+ return Color.from(color);
357
+ }
358
+ catch (error) {
359
+ // <- Note: Can not use `assertsError(error)` here because it causes circular dependency
360
+ console.warn(spaceTrim((block) => `
361
+ Color.fromSafe error:
362
+ ${block(error.message)}
363
+
364
+ Returning default PROMPTBOOK_COLOR.
365
+ `));
366
+ return Color.fromString('promptbook');
367
+ }
368
+ }
320
369
  /**
321
370
  * Creates a new Color instance from miscellaneous string formats
322
371
  *
@@ -384,6 +433,9 @@
384
433
  if (hex.length === 3) {
385
434
  return Color.fromHex3(hex);
386
435
  }
436
+ if (hex.length === 4) {
437
+ return Color.fromHex4(hex);
438
+ }
387
439
  if (hex.length === 6) {
388
440
  return Color.fromHex6(hex);
389
441
  }
@@ -404,6 +456,19 @@
404
456
  const b = parseInt(hex.substr(2, 1), 16) * 16;
405
457
  return take(new Color(r, g, b));
406
458
  }
459
+ /**
460
+ * Creates a new Color instance from color in hex format with 4 digits (with alpha channel)
461
+ *
462
+ * @param color in hex for example `09df`
463
+ * @returns Color object
464
+ */
465
+ static fromHex4(hex) {
466
+ const r = parseInt(hex.substr(0, 1), 16) * 16;
467
+ const g = parseInt(hex.substr(1, 1), 16) * 16;
468
+ const b = parseInt(hex.substr(2, 1), 16) * 16;
469
+ const a = parseInt(hex.substr(3, 1), 16) * 16;
470
+ return take(new Color(r, g, b, a));
471
+ }
407
472
  /**
408
473
  * Creates a new Color instance from color in hex format with 6 color digits (without alpha channel)
409
474
  *
@@ -594,7 +659,8 @@
594
659
  * @returns true if the value is a valid hex color string (e.g., `#009edd`, `#fff`, etc.)
595
660
  */
596
661
  static isHexColorString(value) {
597
- return typeof value === 'string' && /^#(?:[0-9a-fA-F]{3}){1,2}$/.test(value);
662
+ return (typeof value === 'string' &&
663
+ /^#(?:[0-9a-fA-F]{3}|[0-9a-fA-F]{4}|[0-9a-fA-F]{6}|[0-9a-fA-F]{8})$/.test(value));
598
664
  }
599
665
  /**
600
666
  * Creates new Color object
@@ -709,6 +775,23 @@
709
775
  * TODO: Maybe connect with textures
710
776
  */
711
777
 
778
+ /**
779
+ * Makes color transformer which returns a grayscale version of the color
780
+ *
781
+ * @param amount from 0 to 1
782
+ *
783
+ * @public exported from `@promptbook/color`
784
+ */
785
+ function grayscale(amount) {
786
+ return ({ red, green, blue, alpha }) => {
787
+ const average = (red + green + blue) / 3;
788
+ red = Math.round(average * amount + red * (1 - amount));
789
+ green = Math.round(average * amount + green * (1 - amount));
790
+ blue = Math.round(average * amount + blue * (1 - amount));
791
+ return Color.fromValues(red, green, blue, alpha);
792
+ };
793
+ }
794
+
712
795
  /**
713
796
  * Converts HSL values to RGB values
714
797
  *
@@ -824,102 +907,6 @@
824
907
  * TODO: Maybe implement by mix+hsl
825
908
  */
826
909
 
827
- /**
828
- * Calculates distance between two colors
829
- *
830
- * @param color1 first color
831
- * @param color2 second color
832
- *
833
- * Note: This function is inefficient. Use colorDistanceSquared instead if possible.
834
- *
835
- * @public exported from `@promptbook/color`
836
- */
837
- /**
838
- * Calculates distance between two colors without square root
839
- *
840
- * @param color1 first color
841
- * @param color2 second color
842
- *
843
- * @public exported from `@promptbook/color`
844
- */
845
- function colorDistanceSquared(color1, color2) {
846
- const rmean = (color1.red + color2.red) / 2;
847
- const r = color1.red - color2.red;
848
- const g = color1.green - color2.green;
849
- const b = color1.blue - color2.blue;
850
- const weightR = 2 + rmean / 256;
851
- const weightG = 4.0;
852
- const weightB = 2 + (255 - rmean) / 256;
853
- const distance = weightR * r * r + weightG * g * g + weightB * b * b;
854
- return distance;
855
- }
856
-
857
- /**
858
- * Makes color transformer which finds the nearest color from the given list
859
- *
860
- * @param colors array of colors to choose from
861
- *
862
- * @public exported from `@promptbook/color`
863
- */
864
- function nearest(...colors) {
865
- return (color) => {
866
- const distances = colors.map((c) => colorDistanceSquared(c, color));
867
- const minDistance = Math.min(...distances);
868
- const minIndex = distances.indexOf(minDistance);
869
- const nearestColor = colors[minIndex];
870
- return nearestColor;
871
- };
872
- }
873
-
874
- /**
875
- * Color transformer which returns the negative color
876
- *
877
- * @public exported from `@promptbook/color`
878
- */
879
- function negative(color) {
880
- const r = 255 - color.red;
881
- const g = 255 - color.green;
882
- const b = 255 - color.blue;
883
- return Color.fromValues(r, g, b, color.alpha);
884
- }
885
-
886
- /**
887
- * Makes color transformer which finds the furthest color from the given list
888
- *
889
- * @param colors array of colors to choose from
890
- *
891
- * @public exported from `@promptbook/color`
892
- */
893
- function furthest(...colors) {
894
- return (color) => {
895
- const furthestColor = negative(nearest(...colors.map(negative))(color));
896
- return furthestColor;
897
- };
898
- }
899
- /**
900
- * Makes color transformer which finds the best text color (black or white) for the given background color
901
- *
902
- * @public exported from `@promptbook/color`
903
- */
904
- furthest(Color.get('white'), Color.from('black'));
905
-
906
- /**
907
- * Makes color transformer which returns a grayscale version of the color
908
- *
909
- * @param amount from 0 to 1
910
- *
911
- * @public exported from `@promptbook/color`
912
- */
913
- function grayscale(amount) {
914
- return ({ red, green, blue, alpha }) => {
915
- const average = (red + green + blue) / 3;
916
- red = Math.round(average * amount + red * (1 - amount));
917
- green = Math.round(average * amount + green * (1 - amount));
918
- blue = Math.round(average * amount + blue * (1 - amount));
919
- return Color.fromValues(red, green, blue, alpha);
920
- };
921
- }
922
-
923
910
  /**
924
911
  * Makes color transformer which saturate the given color
925
912
  *
@@ -988,16 +975,32 @@
988
975
  *
989
976
  * @public exported from `@promptbook/core`
990
977
  */
991
- const PROMPTBOOK_COLOR = Color.fromHex('#79EAFD');
992
- // <- TODO: [🧠] Using `Color` here increases the package size approx 3kb, maybe remove it
978
+ const PROMPTBOOK_COLOR = Color.fromString('promptbook');
979
+ // <- TODO: [🧠][🈵] Using `Color` here increases the package size approx 3kb, maybe remove it
993
980
  /**
994
- * Dark color of the Promptbook
981
+ * Colors for syntax highlighting in the `<BookEditor/>`
982
+ *
983
+ * TODO: [🗽] Unite branding and make single place for it
984
+ *
985
+ * @public exported from `@promptbook/core`
986
+ */
987
+ ({
988
+ TITLE: Color.fromHex('#244EA8'),
989
+ LINE: Color.fromHex('#eeeeee'),
990
+ SEPARATOR: Color.fromHex('#cccccc'),
991
+ COMMITMENT: Color.fromHex('#DA0F78'),
992
+ PARAMETER: Color.fromHex('#8e44ad'),
993
+ });
994
+ // <- TODO: [🧠][🈵] Using `Color` here increases the package size approx 3kb, maybe remove it
995
+ /**
996
+ * Chat color of the Promptbook (in chat)
995
997
  *
996
998
  * TODO: [🗽] Unite branding and make single place for it
997
999
  *
998
1000
  * @public exported from `@promptbook/core`
999
1001
  */
1000
1002
  PROMPTBOOK_COLOR.then(lighten(0.1)).then(saturate(0.9)).then(grayscale(0.9));
1003
+ // <- TODO: [🧠][🈵] Using `Color` and `lighten`, `saturate`,... here increases the package size approx 3kb, maybe remove it
1001
1004
  /**
1002
1005
  * Color of the user (in chat)
1003
1006
  *
@@ -1006,6 +1009,7 @@
1006
1009
  * @public exported from `@promptbook/core`
1007
1010
  */
1008
1011
  Color.fromHex('#1D4ED8');
1012
+ // <- TODO: [🧠][🈵] Using `Color` here increases the package size approx 3kb, maybe remove it
1009
1013
  /**
1010
1014
  * When the title is not provided, the default title is used
1011
1015
  *
@@ -1104,7 +1108,7 @@
1104
1108
  * @public exported from `@promptbook/core`
1105
1109
  */
1106
1110
  const DEFAULT_MAX_EXECUTION_ATTEMPTS = 7; // <- TODO: [🤹‍♂️]
1107
- // <- TODO: [🕝] Make also `BOOKS_DIRNAME_ALTERNATIVES`
1111
+ // <- TODO: [🕝] Make also `AGENTS_DIRNAME_ALTERNATIVES`
1108
1112
  // TODO: Just `.promptbook` in config, hardcode subfolders like `download-cache` or `execution-cache`
1109
1113
  /**
1110
1114
  * Where to store the temporary downloads
@@ -1132,7 +1136,7 @@
1132
1136
  ex-port const WIZARD_APP_ID: string_app_id = 'wizard';
1133
1137
  */
1134
1138
  /**
1135
- * The name of the builded pipeline collection made by CLI `ptbk make` and for lookup in `createCollectionFromDirectory`
1139
+ * The name of the builded pipeline collection made by CLI `ptbk make` and for lookup in `createPipelineCollectionFromDirectory`
1136
1140
  *
1137
1141
  * @public exported from `@promptbook/core`
1138
1142
  */
@@ -1239,7 +1243,7 @@
1239
1243
  */
1240
1244
  class UnexpectedError extends Error {
1241
1245
  constructor(message) {
1242
- super(spaceTrim.spaceTrim((block) => `
1246
+ super(spaceTrim$1.spaceTrim((block) => `
1243
1247
  ${block(message)}
1244
1248
 
1245
1249
  Note: This error should not happen.
@@ -1343,7 +1347,7 @@
1343
1347
  constructor(whatWasThrown) {
1344
1348
  const tag = `[🤮]`;
1345
1349
  console.error(tag, whatWasThrown);
1346
- super(spaceTrim.spaceTrim(`
1350
+ super(spaceTrim$1.spaceTrim(`
1347
1351
  Non-Error object was thrown
1348
1352
 
1349
1353
  Note: Look for ${tag} in the console for more details
@@ -1536,7 +1540,7 @@
1536
1540
  TODO: [🧠] Is there a better implementation?
1537
1541
  > const propertyNames = Object.getOwnPropertyNames(objectValue);
1538
1542
  > for (const propertyName of propertyNames) {
1539
- > const value = (objectValue as really_any)[propertyName];
1543
+ > const value = (objectValue as chococake)[propertyName];
1540
1544
  > if (value && typeof value === 'object') {
1541
1545
  > deepClone(value);
1542
1546
  > }
@@ -1787,6 +1791,8 @@
1787
1791
  * - if it is valid json
1788
1792
  * - if it is meaningful
1789
1793
  *
1794
+ * Note: [🔂] This function is idempotent.
1795
+ *
1790
1796
  * @param pipeline valid or invalid PipelineJson
1791
1797
  * @returns the same pipeline if it is logically valid
1792
1798
  * @throws {PipelineLogicError} on logical error in the pipeline
@@ -1804,7 +1810,7 @@
1804
1810
  if (!(error instanceof PipelineLogicError)) {
1805
1811
  throw error;
1806
1812
  }
1807
- console.error(spaceTrim.spaceTrim((block) => `
1813
+ console.error(spaceTrim$1.spaceTrim((block) => `
1808
1814
  Pipeline is not valid but logic errors are temporarily disabled via \`IS_PIPELINE_LOGIC_VALIDATED\`
1809
1815
 
1810
1816
  ${block(error.message)}
@@ -1831,7 +1837,7 @@
1831
1837
  })();
1832
1838
  if (pipeline.pipelineUrl !== undefined && !isValidPipelineUrl(pipeline.pipelineUrl)) {
1833
1839
  // <- Note: [🚲]
1834
- throw new PipelineLogicError(spaceTrim.spaceTrim((block) => `
1840
+ throw new PipelineLogicError(spaceTrim$1.spaceTrim((block) => `
1835
1841
  Invalid promptbook URL "${pipeline.pipelineUrl}"
1836
1842
 
1837
1843
  ${block(pipelineIdentification)}
@@ -1839,7 +1845,7 @@
1839
1845
  }
1840
1846
  if (pipeline.bookVersion !== undefined && !isValidPromptbookVersion(pipeline.bookVersion)) {
1841
1847
  // <- Note: [🚲]
1842
- throw new PipelineLogicError(spaceTrim.spaceTrim((block) => `
1848
+ throw new PipelineLogicError(spaceTrim$1.spaceTrim((block) => `
1843
1849
  Invalid Promptbook Version "${pipeline.bookVersion}"
1844
1850
 
1845
1851
  ${block(pipelineIdentification)}
@@ -1848,7 +1854,7 @@
1848
1854
  // TODO: [🧠] Maybe do here some proper JSON-schema / ZOD checking
1849
1855
  if (!Array.isArray(pipeline.parameters)) {
1850
1856
  // TODO: [🧠] what is the correct error tp throw - maybe PromptbookSchemaError
1851
- throw new ParseError(spaceTrim.spaceTrim((block) => `
1857
+ throw new ParseError(spaceTrim$1.spaceTrim((block) => `
1852
1858
  Pipeline is valid JSON but with wrong structure
1853
1859
 
1854
1860
  \`PipelineJson.parameters\` expected to be an array, but got ${typeof pipeline.parameters}
@@ -1859,7 +1865,7 @@
1859
1865
  // TODO: [🧠] Maybe do here some proper JSON-schema / ZOD checking
1860
1866
  if (!Array.isArray(pipeline.tasks)) {
1861
1867
  // TODO: [🧠] what is the correct error tp throw - maybe PromptbookSchemaError
1862
- throw new ParseError(spaceTrim.spaceTrim((block) => `
1868
+ throw new ParseError(spaceTrim$1.spaceTrim((block) => `
1863
1869
  Pipeline is valid JSON but with wrong structure
1864
1870
 
1865
1871
  \`PipelineJson.tasks\` expected to be an array, but got ${typeof pipeline.tasks}
@@ -1885,7 +1891,7 @@
1885
1891
  // Note: Check each parameter individually
1886
1892
  for (const parameter of pipeline.parameters) {
1887
1893
  if (parameter.isInput && parameter.isOutput) {
1888
- throw new PipelineLogicError(spaceTrim.spaceTrim((block) => `
1894
+ throw new PipelineLogicError(spaceTrim$1.spaceTrim((block) => `
1889
1895
 
1890
1896
  Parameter \`{${parameter.name}}\` can not be both input and output
1891
1897
 
@@ -1896,7 +1902,7 @@
1896
1902
  if (!parameter.isInput &&
1897
1903
  !parameter.isOutput &&
1898
1904
  !pipeline.tasks.some((task) => task.dependentParameterNames.includes(parameter.name))) {
1899
- throw new PipelineLogicError(spaceTrim.spaceTrim((block) => `
1905
+ throw new PipelineLogicError(spaceTrim$1.spaceTrim((block) => `
1900
1906
  Parameter \`{${parameter.name}}\` is created but not used
1901
1907
 
1902
1908
  You can declare {${parameter.name}} as output parameter by adding in the header:
@@ -1908,7 +1914,7 @@
1908
1914
  }
1909
1915
  // Note: Testing that parameter is either input or result of some task
1910
1916
  if (!parameter.isInput && !pipeline.tasks.some((task) => task.resultingParameterName === parameter.name)) {
1911
- throw new PipelineLogicError(spaceTrim.spaceTrim((block) => `
1917
+ throw new PipelineLogicError(spaceTrim$1.spaceTrim((block) => `
1912
1918
  Parameter \`{${parameter.name}}\` is declared but not defined
1913
1919
 
1914
1920
  You can do one of these:
@@ -1924,14 +1930,14 @@
1924
1930
  // Note: Checking each task individually
1925
1931
  for (const task of pipeline.tasks) {
1926
1932
  if (definedParameters.has(task.resultingParameterName)) {
1927
- throw new PipelineLogicError(spaceTrim.spaceTrim((block) => `
1933
+ throw new PipelineLogicError(spaceTrim$1.spaceTrim((block) => `
1928
1934
  Parameter \`{${task.resultingParameterName}}\` is defined multiple times
1929
1935
 
1930
1936
  ${block(pipelineIdentification)}
1931
1937
  `));
1932
1938
  }
1933
1939
  if (RESERVED_PARAMETER_NAMES.includes(task.resultingParameterName)) {
1934
- throw new PipelineLogicError(spaceTrim.spaceTrim((block) => `
1940
+ throw new PipelineLogicError(spaceTrim$1.spaceTrim((block) => `
1935
1941
  Parameter name {${task.resultingParameterName}} is reserved, please use different name
1936
1942
 
1937
1943
  ${block(pipelineIdentification)}
@@ -1941,7 +1947,7 @@
1941
1947
  if (task.jokerParameterNames && task.jokerParameterNames.length > 0) {
1942
1948
  if (!task.format &&
1943
1949
  !task.expectations /* <- TODO: Require at least 1 -> min <- expectation to use jokers */) {
1944
- throw new PipelineLogicError(spaceTrim.spaceTrim((block) => `
1950
+ throw new PipelineLogicError(spaceTrim$1.spaceTrim((block) => `
1945
1951
  Joker parameters are used for {${task.resultingParameterName}} but no expectations are defined
1946
1952
 
1947
1953
  ${block(pipelineIdentification)}
@@ -1949,7 +1955,7 @@
1949
1955
  }
1950
1956
  for (const joker of task.jokerParameterNames) {
1951
1957
  if (!task.dependentParameterNames.includes(joker)) {
1952
- throw new PipelineLogicError(spaceTrim.spaceTrim((block) => `
1958
+ throw new PipelineLogicError(spaceTrim$1.spaceTrim((block) => `
1953
1959
  Parameter \`{${joker}}\` is used for {${task.resultingParameterName}} as joker but not in \`dependentParameterNames\`
1954
1960
 
1955
1961
  ${block(pipelineIdentification)}
@@ -1960,21 +1966,21 @@
1960
1966
  if (task.expectations) {
1961
1967
  for (const [unit, { min, max }] of Object.entries(task.expectations)) {
1962
1968
  if (min !== undefined && max !== undefined && min > max) {
1963
- throw new PipelineLogicError(spaceTrim.spaceTrim((block) => `
1969
+ throw new PipelineLogicError(spaceTrim$1.spaceTrim((block) => `
1964
1970
  Min expectation (=${min}) of ${unit} is higher than max expectation (=${max})
1965
1971
 
1966
1972
  ${block(pipelineIdentification)}
1967
1973
  `));
1968
1974
  }
1969
1975
  if (min !== undefined && min < 0) {
1970
- throw new PipelineLogicError(spaceTrim.spaceTrim((block) => `
1976
+ throw new PipelineLogicError(spaceTrim$1.spaceTrim((block) => `
1971
1977
  Min expectation of ${unit} must be zero or positive
1972
1978
 
1973
1979
  ${block(pipelineIdentification)}
1974
1980
  `));
1975
1981
  }
1976
1982
  if (max !== undefined && max <= 0) {
1977
- throw new PipelineLogicError(spaceTrim.spaceTrim((block) => `
1983
+ throw new PipelineLogicError(spaceTrim$1.spaceTrim((block) => `
1978
1984
  Max expectation of ${unit} must be positive
1979
1985
 
1980
1986
  ${block(pipelineIdentification)}
@@ -1996,7 +2002,7 @@
1996
2002
  while (unresovedTasks.length > 0) {
1997
2003
  if (loopLimit-- < 0) {
1998
2004
  // Note: Really UnexpectedError not LimitReachedError - this should not happen and be caught below
1999
- throw new UnexpectedError(spaceTrim.spaceTrim((block) => `
2005
+ throw new UnexpectedError(spaceTrim$1.spaceTrim((block) => `
2000
2006
  Loop limit reached during detection of circular dependencies in \`validatePipeline\`
2001
2007
 
2002
2008
  ${block(pipelineIdentification)}
@@ -2006,7 +2012,7 @@
2006
2012
  if (currentlyResovedTasks.length === 0) {
2007
2013
  throw new PipelineLogicError(
2008
2014
  // TODO: [🐎] DRY
2009
- spaceTrim.spaceTrim((block) => `
2015
+ spaceTrim$1.spaceTrim((block) => `
2010
2016
 
2011
2017
  Can not resolve some parameters:
2012
2018
  Either you are using a parameter that is not defined, or there are some circular dependencies.
@@ -2097,7 +2103,7 @@
2097
2103
  * Note: [🟢] Code in this file should never be never released in packages that could be imported into browser environment
2098
2104
  */
2099
2105
 
2100
- var PipelineCollection = [{title:"Prepare Knowledge from Markdown",pipelineUrl:"https://promptbook.studio/promptbook/prepare-knowledge-from-markdown.book",formfactorName:"GENERIC",parameters:[{name:"knowledgeContent",description:"Markdown document content",isInput:true,isOutput:false},{name:"knowledgePieces",description:"The knowledge JSON object",isInput:false,isOutput:true}],tasks:[{taskType:"PROMPT_TASK",name:"knowledge",title:"Knowledge",content:"You are experienced data researcher, extract the important knowledge from the document.\n\n# Rules\n\n- Make pieces of information concise, clear, and easy to understand\n- One piece of information should be approximately 1 paragraph\n- Divide the paragraphs by markdown horizontal lines ---\n- Omit irrelevant information\n- Group redundant information\n- Write just extracted information, nothing else\n\n# The document\n\nTake information from this document:\n\n> {knowledgeContent}",resultingParameterName:"knowledgePieces",dependentParameterNames:["knowledgeContent"]}],personas:[],preparations:[],knowledgeSources:[],knowledgePieces:[],sources:[{type:"BOOK",path:null,content:"# Prepare Knowledge from Markdown\n\n- PIPELINE URL `https://promptbook.studio/promptbook/prepare-knowledge-from-markdown.book`\n- INPUT PARAMETER `{knowledgeContent}` Markdown document content\n- OUTPUT PARAMETER `{knowledgePieces}` The knowledge JSON object\n\n## Knowledge\n\n<!-- TODO: [🍆] -FORMAT JSON -->\n\n```markdown\nYou are experienced data researcher, extract the important knowledge from the document.\n\n# Rules\n\n- Make pieces of information concise, clear, and easy to understand\n- One piece of information should be approximately 1 paragraph\n- Divide the paragraphs by markdown horizontal lines ---\n- Omit irrelevant information\n- Group redundant information\n- Write just extracted information, nothing else\n\n# The document\n\nTake information from this document:\n\n> {knowledgeContent}\n```\n\n`-> {knowledgePieces}`\n"}],sourceFile:"./books/prepare-knowledge-from-markdown.book"},{title:"Prepare Keywords",pipelineUrl:"https://promptbook.studio/promptbook/prepare-knowledge-keywords.book",formfactorName:"GENERIC",parameters:[{name:"knowledgePieceContent",description:"The content",isInput:true,isOutput:false},{name:"keywords",description:"Keywords separated by comma",isInput:false,isOutput:true}],tasks:[{taskType:"PROMPT_TASK",name:"knowledge",title:"Knowledge",content:"You are experienced data researcher, detect the important keywords in the document.\n\n# Rules\n\n- Write just keywords separated by comma\n\n# The document\n\nTake information from this document:\n\n> {knowledgePieceContent}",resultingParameterName:"keywords",dependentParameterNames:["knowledgePieceContent"]}],personas:[],preparations:[],knowledgeSources:[],knowledgePieces:[],sources:[{type:"BOOK",path:null,content:"# Prepare Keywords\n\n- PIPELINE URL `https://promptbook.studio/promptbook/prepare-knowledge-keywords.book`\n- INPUT PARAMETER `{knowledgePieceContent}` The content\n- OUTPUT PARAMETER `{keywords}` Keywords separated by comma\n\n## Knowledge\n\n<!-- TODO: [🍆] -FORMAT JSON -->\n\n```markdown\nYou are experienced data researcher, detect the important keywords in the document.\n\n# Rules\n\n- Write just keywords separated by comma\n\n# The document\n\nTake information from this document:\n\n> {knowledgePieceContent}\n```\n\n`-> {keywords}`\n"}],sourceFile:"./books/prepare-knowledge-keywords.book"},{title:"Prepare Knowledge-piece Title",pipelineUrl:"https://promptbook.studio/promptbook/prepare-knowledge-title.book",formfactorName:"GENERIC",parameters:[{name:"knowledgePieceContent",description:"The content",isInput:true,isOutput:false},{name:"title",description:"The title of the document",isInput:false,isOutput:true}],tasks:[{taskType:"PROMPT_TASK",name:"knowledge",title:"Knowledge",content:"You are experienced content creator, write best title for the document.\n\n# Rules\n\n- Write just title, nothing else\n- Write maximum 5 words for the title\n\n# The document\n\n> {knowledgePieceContent}",resultingParameterName:"title",expectations:{words:{min:1,max:8}},dependentParameterNames:["knowledgePieceContent"]}],personas:[],preparations:[],knowledgeSources:[],knowledgePieces:[],sources:[{type:"BOOK",path:null,content:"# Prepare Knowledge-piece Title\n\n- PIPELINE URL `https://promptbook.studio/promptbook/prepare-knowledge-title.book`\n- INPUT PARAMETER `{knowledgePieceContent}` The content\n- OUTPUT PARAMETER `{title}` The title of the document\n\n## Knowledge\n\n- EXPECT MIN 1 WORD\n- EXPECT MAX 8 WORDS\n\n```markdown\nYou are experienced content creator, write best title for the document.\n\n# Rules\n\n- Write just title, nothing else\n- Write maximum 5 words for the title\n\n# The document\n\n> {knowledgePieceContent}\n```\n\n`-> {title}`\n"}],sourceFile:"./books/prepare-knowledge-title.book"},{title:"Prepare Persona",pipelineUrl:"https://promptbook.studio/promptbook/prepare-persona.book",formfactorName:"GENERIC",parameters:[{name:"availableModels",description:"List of available model names together with their descriptions as JSON",isInput:true,isOutput:false},{name:"personaDescription",description:"Description of the persona",isInput:true,isOutput:false},{name:"modelsRequirements",description:"Specific requirements for the model",isInput:false,isOutput:true}],tasks:[{taskType:"PROMPT_TASK",name:"make-model-requirements",title:"Make modelRequirements",content:"You are an experienced AI engineer, you need to find the best models for virtual assistants:\n\n## Example\n\n```json\n[\n {\n \"modelName\": \"gpt-4o\",\n \"systemMessage\": \"You are experienced AI engineer and helpful assistant.\",\n \"temperature\": 0.7\n },\n {\n \"modelName\": \"claude-3-5-sonnet\",\n \"systemMessage\": \"You are a friendly and knowledgeable chatbot.\",\n \"temperature\": 0.5\n }\n]\n```\n\n## Instructions\n\n- Your output format is JSON array\n- Sort best-fitting models first\n- Omit any models that are not suitable\n- Write just the JSON, no other text should be present\n- Array contain items with following keys:\n - `modelName`: The name of the model to use\n - `systemMessage`: The system message to provide context to the model\n - `temperature`: The sampling temperature to use\n\n### Key `modelName`\n\nHere are the available models:\n\n```json\n{availableModels}\n```\n\n### Key `systemMessage`\n\nThe system message is used to communicate instructions or provide context to the model at the beginning of a conversation. It is displayed in a different format compared to user messages, helping the model understand its role in the conversation. The system message typically guides the model's behavior, sets the tone, or specifies desired output from the model. By utilizing the system message effectively, users can steer the model towards generating more accurate and relevant responses.\n\nFor example:\n\n> You are an experienced AI engineer and helpful assistant.\n\n> You are a friendly and knowledgeable chatbot.\n\n### Key `temperature`\n\nThe sampling temperature, between 0 and 1. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic. If set to 0, the model will use log probability to automatically increase the temperature until certain thresholds are hit.\n\nYou can pick a value between 0 and 2. For example:\n\n- `0.1`: Low temperature, extremely conservative and deterministic\n- `0.5`: Medium temperature, balanced between conservative and creative\n- `1.0`: High temperature, creative and bit random\n- `1.5`: Very high temperature, extremely creative and often chaotic and unpredictable\n- `2.0`: Maximum temperature, completely random and unpredictable, for some extreme creative use cases\n\n# The assistant\n\nTake this description of the persona:\n\n> {personaDescription}",resultingParameterName:"modelsRequirements",format:"JSON",dependentParameterNames:["availableModels","personaDescription"]}],personas:[],preparations:[],knowledgeSources:[],knowledgePieces:[],sources:[{type:"BOOK",path:null,content:"# Prepare Persona\n\n- PIPELINE URL `https://promptbook.studio/promptbook/prepare-persona.book`\n- INPUT PARAMETER `{availableModels}` List of available model names together with their descriptions as JSON\n- INPUT PARAMETER `{personaDescription}` Description of the persona\n- OUTPUT PARAMETER `{modelsRequirements}` Specific requirements for the model\n\n## Make modelRequirements\n\n- FORMAT JSON\n\n```markdown\nYou are an experienced AI engineer, you need to find the best models for virtual assistants:\n\n## Example\n\n\\`\\`\\`json\n[\n {\n \"modelName\": \"gpt-4o\",\n \"systemMessage\": \"You are experienced AI engineer and helpful assistant.\",\n \"temperature\": 0.7\n },\n {\n \"modelName\": \"claude-3-5-sonnet\",\n \"systemMessage\": \"You are a friendly and knowledgeable chatbot.\",\n \"temperature\": 0.5\n }\n]\n\\`\\`\\`\n\n## Instructions\n\n- Your output format is JSON array\n- Sort best-fitting models first\n- Omit any models that are not suitable\n- Write just the JSON, no other text should be present\n- Array contain items with following keys:\n - `modelName`: The name of the model to use\n - `systemMessage`: The system message to provide context to the model\n - `temperature`: The sampling temperature to use\n\n### Key `modelName`\n\nHere are the available models:\n\n\\`\\`\\`json\n{availableModels}\n\\`\\`\\`\n\n### Key `systemMessage`\n\nThe system message is used to communicate instructions or provide context to the model at the beginning of a conversation. It is displayed in a different format compared to user messages, helping the model understand its role in the conversation. The system message typically guides the model's behavior, sets the tone, or specifies desired output from the model. By utilizing the system message effectively, users can steer the model towards generating more accurate and relevant responses.\n\nFor example:\n\n> You are an experienced AI engineer and helpful assistant.\n\n> You are a friendly and knowledgeable chatbot.\n\n### Key `temperature`\n\nThe sampling temperature, between 0 and 1. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic. If set to 0, the model will use log probability to automatically increase the temperature until certain thresholds are hit.\n\nYou can pick a value between 0 and 2. For example:\n\n- `0.1`: Low temperature, extremely conservative and deterministic\n- `0.5`: Medium temperature, balanced between conservative and creative\n- `1.0`: High temperature, creative and bit random\n- `1.5`: Very high temperature, extremely creative and often chaotic and unpredictable\n- `2.0`: Maximum temperature, completely random and unpredictable, for some extreme creative use cases\n\n# The assistant\n\nTake this description of the persona:\n\n> {personaDescription}\n```\n\n`-> {modelsRequirements}`\n"}],sourceFile:"./books/prepare-persona.book"},{title:"Prepare Title",pipelineUrl:"https://promptbook.studio/promptbook/prepare-title.book",formfactorName:"GENERIC",parameters:[{name:"book",description:"The book to prepare the title for",isInput:true,isOutput:false},{name:"title",description:"Best title for the book",isInput:false,isOutput:true}],tasks:[{taskType:"PROMPT_TASK",name:"make-title",title:"Make title",content:"Make best title for given text which describes the workflow:\n\n## Rules\n\n- Write just title, nothing else\n- Title should be concise and clear - Write maximum ideally 2 words, maximum 5 words\n- Title starts with emoticon\n- Title should not mention the input and output of the workflow but the main purpose of the workflow\n _For example, not \"✍ Convert Knowledge-piece to title\" but \"✍ Title\"_\n\n## The workflow\n\n> {book}",resultingParameterName:"title",expectations:{words:{min:1,max:8},lines:{min:1,max:1}},dependentParameterNames:["book"]}],personas:[],preparations:[],knowledgeSources:[],knowledgePieces:[],sources:[{type:"BOOK",path:null,content:"# Prepare Title\n\n- PIPELINE URL `https://promptbook.studio/promptbook/prepare-title.book`\n- INPUT PARAMETER `{book}` The book to prepare the title for\n- OUTPUT PARAMETER `{title}` Best title for the book\n\n## Make title\n\n- EXPECT MIN 1 Word\n- EXPECT MAX 8 Words\n- EXPECT EXACTLY 1 Line\n\n```markdown\nMake best title for given text which describes the workflow:\n\n## Rules\n\n- Write just title, nothing else\n- Title should be concise and clear - Write maximum ideally 2 words, maximum 5 words\n- Title starts with emoticon\n- Title should not mention the input and output of the workflow but the main purpose of the workflow\n _For example, not \"✍ Convert Knowledge-piece to title\" but \"✍ Title\"_\n\n## The workflow\n\n> {book}\n```\n\n`-> {title}`\n"}],sourceFile:"./books/prepare-title.book"},{title:"📊 Curriculum Audit",pipelineUrl:"https://promptbook.studio/promptbook//examples/lsvp-asistent.book",formfactorName:"GENERIC",parameters:[{name:"result",isInput:false,isOutput:true}],tasks:[{taskType:"PROMPT_TASK",name:"prompt",title:"Prompt",content:"Asistent pro LŠVP\n\nPERSONA Jsi asistent pro RVP Lyceum v rámci Národního pedagogického institutu České Republiky\nMETA IMAGE https://edulk.cz/getFile/id:475818/type:large/02%20zna%C4%8Dka%20npi.jpg\nRULE Pokud jsi nejsi jistý, napiš nevím\nKNOWLEDGE ./241129_Lyceum_final.pdf\nCONTEXT Obecně dokážeš řešit libovolné ŠVP, aktuálně řešíš {Školní vzdělávací program LYCEUM}\nRULE Z {Porovnání RVP a ŠVP - postup} je nejdůležitější fáze 3\nKNOWLEDGE {Školní vzdělávací program LYCEUM} ./ŠVP Lyceum - Finance v digitální době.pdf\nKNOWLEDGE @Slovník\n\n**Interní slovník - RVP/ŠVP**\n\n**RVP**\n\nRámcový vzdělávací program pro obor vzdělání Lyceum je dokument na národní úrovni, který formuluje požadavky na školní vzdělávací programy ve formě především očekávaných výsledků učení, kterých mají žáci absolvováním tohoto programu na dané škole dosáhnout.\n\n**ŠVP**\n\nŠkolní vzdělávací program pro obor vzdělání Lyceum je dokument každé jednotlivé školy, který popisuje v jakých vyučovacích předmětech/ vzdělávacích modulech a v jakých ročnících budou požadované očekávané výsledky učení naplněny. Zároveň formuluje další očekávané výsledky učení, které naplňují disponibilní část vyučovacího času určeného RVP pro tento obor vzdělání.\n\n**Očekávaný výsledek učení (OVU)**\n\nVyjadřuje jednotlivý požadavek na to, co mají žáci umět na konci vzdělávacího programu, tzn. jejich požadované kompetence. Je vyjádřen formulací, která je uvozena činnostním slovesem a dále obsahuje předmět této činnosti. Formulace je konkretizována resp. doplněna zpravidla formou odrážek vymezením dílčích znalostí, dovedností, postojů, jejichž splnění je předpokladem dosažení OVU jako celku.\n\n_Příklad:_\n\n<div class=\"joplin-table-wrapper\"><table><tbody><tr><th><p><strong>Žák/žákyně řídí realizaci jednoduchého projektu</strong></p></th></tr><tr><td><ul><li>naplánuje aktivity projektu</li></ul></td></tr><tr><td><ul><li>navrhne rozpočet projektu vzhledem k navrženým aktivitám</li></ul></td></tr><tr><td><ul><li>stanoví základní ukazatele a sleduje jejich naplňování</li></ul></td></tr><tr><td><ul><li>vede projektový tým</li></ul></td></tr><tr><td><ul><li>uvede, jak by řešil krizové situace v projektu</li></ul></td></tr><tr><td><ul><li>vyhodnotí úspěšnost projektu</li></ul></td></tr></tbody></table></div>\n\n**Vzdělávací oblasti**\n\nOčekávané výsledky učení jsou v **_RVP členěny do 4 vzdělávacích oblastí_**, které tvoří společný všeobecně vzdělávací základ:\n\n- Osobnostní rozvoj, vzdělávání ke zdraví, bezpečí a produktivnímu pracovnímu životu (kariéře)\n- Komunikační a jazykové vzdělávání\n- Aplikované vzdělávání STEM (Science, Technology, Engeneering, Math), tj. přírodní vědy, informatika, technika, matematika\n- Prakticky orientované vzdělávání společenskovědní a humanitní\n\nKaždá vzdělávací oblast se dále člení na okruhy, v jejichž rámci jsou OVU samostatně číslované.\n\n<div class=\"joplin-table-wrapper\"><table><tbody><tr><th rowspan=\"21\"><ul><li>Prakticky orientované vzdělávání společenskovědní a humanitní</li></ul></th><th rowspan=\"21\"><p><strong>Člověk, ekonomie a podnikání</strong></p></th><th rowspan=\"7\"><p><strong>1</strong></p></th><th><p><strong>zpracuje podklady související s podnikáním</strong></p></th></tr><tr><td><p>připraví podnikatelský záměr</p></td></tr><tr><td><p>sestaví zakladatelský rozpočet</p></td></tr><tr><td><p>zkalkuluje cenu zboží nebo služby</p></td></tr><tr><td><p>vysvětlí na příkladu základní povinnosti podnikatele vůči státu a zaměstnancům</p></td></tr><tr><td><p>vede daňovou evidenci</p></td></tr><tr><td><p>vysvětlí na příkladech etiku v podnikání</p></td></tr><tr><td rowspan=\"7\"><p><strong>2</strong></p></td><td><p><strong>řídí realizaci jednoduchého projektu</strong></p></td></tr><tr><td><p>naplánuje aktivity projektu</p></td></tr><tr><td><p>navrhne rozpočet projektu vzhledem k navrženým aktivitám</p></td></tr><tr><td><p>stanoví základní ukazatele a sleduje jejich naplňování</p></td></tr><tr><td><p>vede projektový tým</p></td></tr><tr><td><p>uvede, jak by řešil krizové situace v projektu</p></td></tr><tr><td><p>vyhodnotí úspěšnost projektu</p></td></tr><tr><td rowspan=\"7\"><p><strong>3</strong></p></td><td><p><strong>aplikuje ekonomické teorie v osobním a profesním životě</strong></p></td></tr><tr><td><p>vysvětlí základní ekonomické otázky</p></td></tr><tr><td><p>vysvětí stanovení rovnovážné ceny na dokonalém i nedokonalém trhu</p></td></tr><tr><td><p>charakterizuje výrobní faktory a vysvětlí hranici produkčních možností a náklady obětované příležitosti</p></td></tr><tr><td><p>uvede nejdůležitější makroekonomické pojmy a vliv jejich výše na kvalitu života a podnikání v daném státě</p></td></tr><tr><td><p>vysvětlí podstatu inflace a její důsledky na finanční situaci obyvatel a na příkladu ukáže jak se bránit jejím nepříznivým důsledkům</p></td></tr><tr><td><p>uvede hlavní výhody a nevýhody mezinárodního obchodu a vliv ochranářských opatření na ekonomickou situaci dané země</p></td></tr><tr><td></td><td></td><td><p><strong>4</strong></p></td><td><p>Atd.</p></td></tr></tbody></table></div>\n\n**Vyučovací předmět / vzdělávací modul**\n\nOčekávané výsledky učení jsou v **ŠVP** členěny do vyučovacích předmětů nebo vzdělávacích modulů, které jsou dále zařazeny do jednoho nebo více ročníků 4letého studia. Vyučovací předmět / vzdělávací modul tvoří vyučovací jednotku, kde jsou očekávané výsledky učení dále rozpracovány pro potřeby výuky podle následující šablony\n\n| **A. VSTUPNÍ ČÁST** |\n| --- |\n| **1\\. Název** |\n| **2\\. Kód** (kódy by měly být navázány na obory vzdělání a výsledky učení) |\n| **2a) Kategorie vzdělání** - v případě, že nebude součástí kódu |\n| **3\\. Typ vyučovací jednotky** (modul, předmět, stáž apod.) |\n| **4\\. Délka** (počet hodin - dělitelný čtyřmi (optimální modul 16, 32 hodin = týden výuky) |\n| **5\\. Platnost** (datum, od kterého platí) |\n| **6\\. Vstupní předpoklady** (vymezení požadované úrovně vstupních vědomostí a dovedností, které jsou předpokladem úspěšného studia) |\n| |\n| **B. JÁDRO VYUČOVACÍ JEDNOTKY** |\n| **1\\. Charakteristika** (stručná anotace popisující obecné cíle a pojetí) |\n| **2\\. Očekávané výsledky učení a jejich indikátory (převzaté z RVP nebo dále konkretizované)** |\n| **3\\. Podpora rozvoje klíčových kompetencí a základních gramotností** (které klíčové kompetence jsou v rozvíjeny) |\n| **4\\. Obsah vzdělávání** (rozpis učiva) |\n| **5\\. Vzdělávací strategie** (strategie výuky, resp. učební činnosti žáků, které jsou doporučené pro dosažení výsledků) |\n| |\n| **C. VÝSTUPNÍ ČÁST** |\n| **1\\. Způsob ověřování dosažených výsledků** (ve vazbě na jednotlivé výsledky učení) |\n| **2\\. Kritéria hodnocení** (co znamená splnění výsledků učení, kdy je splněna celá vyučovací jednotka, kritéria pro známky, příp. procentuální, slovní hodnocení) |\n| **3\\. Doporučená studijní literatura, odkazy na ilustrační zdroje** |\n| **4\\. Poznámky** |\n\n**Soulad OVU RVP a ŠVP**\n\nTento soulad je předmětem zjišťování. Soulad nastává, jestliže jsou očekávané výsledky učení z jednotlivých vzdělávacích oblastí RVP **obsaženy** ve vyučovacích předmětech/ vzdělávacích modulech ŠVP jednotlivých škol, tzn. že v ŠVP se objevuje jejich formulace buď v doslovném nebo podobném znění v jednom nebo více vyučovacích předmětech/ vzdělávacích modulech.\n\n_Příklad souladu:_\n\nRVP ŠVP - komunikace a marketing (SŠ obchodní Č.\n\n| **2** | **řídí realizaci jednoduchého projektu** |\n| --- | --- |\n| naplánuje aktivity projektu |\n| navrhne rozpočet projektu vzhledem k navrženým aktivitám |\n| stanoví základní ukazatele a sleduje jejich naplňování |\n| vede projektový tým |\n| uvede, jak by řešil krizové situace v projektu |\n| vyhodnotí úspěšnost projektu |\n\nKNOWLEDGE {Porovnání RVP a ŠVP - postup}\n\n\n# AUDITNÍ PROTOKOL ŠVP-RVP\n\n# (POPIS KONTROLNÍHO ALGORITMU)\n\nMetodika je určena pro **Kvantifikaci Shody** školního vzdělávacího programu (ŠVP) s Rámcovým vzdělávacím programem (RVP).\n\n## FÁZE 1: VALIDACE DOKUMENTACE\n\n**Cíl:** Ověřit platnost, aktuálnost a strukturu zdrojových dokumentů.\n\n- **RVP Verifikace:** Otevřít aktuální verzi RVP (např. RVP ZV/G/SOŠ).\n- **Typová shoda:** Ověřit, že RVP se vztahuje k danému typu školy.\n- **ŠVP Dimenze:** Identifikovat a izolovat relevantní části ŠVP: Profil absolventa, Klíčové kompetence (KK), Vzdělávací oblasti (VO), případně Učební plán (UP).\n- **Verzování:** Potvrdit, že obě verze (RVP a ŠVP) jsou nejnovější a platné (včetně dodatků RVP).\n\n## FÁZE 2: DATABÁZOVÉ MAPOVÁNÍ VÝSTUPŮ (MASTER MATICE)\n\n**Cíl:** Vytvořit systémovou databázi pro křížové porovnání všech povinných komponent RVP se ŠVP.\n\n- **Dekompozice RVP:** Rozložit RVP na základní povinné komponenty: Klíčové kompetence, Vzdělávací oblasti a obory, Očekávané výstupy (OVU), Průřezová témata (PT).\n- **Přiřazovací mapa:** Vytvořit hlavní kontrolní matici (Master Matice) pro záznam vazeb.\n\n| Oblast RVP | Výstup RVP (OVU) | Odpovídající Část ŠVP (Předmět/Ročník) | Konkrétní Tématický Celek v ŠVP | Stav Shody (Protokol) |\n| --- | --- | --- | --- | --- |\n| ... | ... | ... | ... | ... |\n| --- | --- | --- | --- | --- |\n\n## FÁZE 3: ALGORITMICKÁ KONTROLA POKRYTÍ A HLOUBKY\n\n**Cíl:** Posoudit, zda každý povinný výstup RVP je adekvátně reflektován v obsahu ŠVP, a přidělit bodovou hodnotu pro kvantifikaci.\n\n- **Audit OVU:** Projít každý jednotlivý Očekávaný výstup (OVU) z RVP.\n- **Kódování stavu a bodování:** U každého OVU v matici označit stav pokrytí dle následujícího schématu:\n\n| Kód (Protokol) | Popis (Kvalitativní zjištění) | Bodová hodnota (Kvantifikace) |\n| --- | --- | --- |\n| ✅ | Plná shoda (Výstup pokryt v plném rozsahu, odpovídající úrovni RVP) | 1,0 |\n| --- | --- | --- |\n| ⚠️ | Částečná shoda (Formální pokrytí, omezený rozsah, chybná návaznost) | 0,5 |\n| --- | --- | --- |\n| ❌ | Absence (Výstup zcela chybí v obsahu ŠVP) | 0,0 |\n| --- | --- | --- |\n\n- **Defektologie ŠVP:** Identifikovat a zaznamenat deficity ŠVP: Chybějící výstupy (❌), Sémantické překryvy, Přetížení obsahu.\n- **Kvalitativní posun:** Ověřit, zda je formulace výstupů v ŠVP **aktivní, měřitelná a v souladu** s úrovní RVP.\n\n## FÁZE 4: STRUKTURÁLNÍ VERIFIKACE NÁVAZNOSTI (VERTIKÁLA/HORIZONTÁLA)\n\n**Cíl:** Zkontrolovat logickou posloupnost a provázanost učiva v rámci ŠVP.\n\n- **Vertikální Kontrola:** Ověřit posloupnost OVU a učiva uvnitř jednoho předmětu/oblasti (postup od jednodušších ke složitějším konceptům napříč ročníky).\n- **Horizontální Kontrola:** Zkontrolovat logické provázání napříč vzdělávacími oblastmi a předměty (např. fyzika ↔ matematika).\n- **PT Integrace:** Audit reálné integrace Průřezových témat (PT) do konkrétních částí obsahu, metod a projektů.\n\n## FÁZE 5: ANALÝZA ŠKOLNÍ PROFILACE A ROZŠÍŘENÍ RVP\n\n**Cíl:** Validovat, že profilace školy je **v souladu** s RVP a nejedná se o **rozpor**.\n\n- **Nekonfliktnost:** Porovnat definovaný Profil absolventa školy s Klíčovými kompetencemi RVP. Profil ŠVP musí RVP rozvíjet, nikoli mu odporovat.\n- **Modularita:** Zkontrolovat, zda volitelné předměty a rozšiřující moduly logicky navazují na vzdělávací oblasti RVP.\n- **Implementace specializace:** Popisně uvést, jak je školní profilace (např. STEM zaměření, projektová výuka) integrována do OVU a kompetencí definovaných RVP.\n\n## FÁZE 6: GENERÁTOR ZÁVĚREČNÉ ZPRÁVY A KVANTIFIKACE\n\n**Cíl:** Syntetizovat výsledky, kvantifikovat soulad a generovat závazné návrhy na korekce.\n\n### 6.1 Kvantifikace Souladu\n\nVypočítat Index shody (IS) na základě bodového hodnocení (Fáze 3):\n\n### 6.2 Interpretace Indexu Shody (IS)\n\nKlasifikace souladu pro standardizované vyhodnocení:\n\n| Interval IS | Klasifikace souladu | Popis |\n| --- | --- | --- |\n| 95-100 % | Výborný soulad | ŠVP plně odpovídá RVP, pouze stylistické nebo formální rozdíly. |\n| --- | --- | --- |\n| 85-94 % | Dobrá shoda | ŠVP pokrývá všechny klíčové výstupy, menší korekce nutné. |\n| --- | --- | --- |\n| 70-84 % | Částečná shoda | Významné nedostatky v některých oblastech, nutná revize obsahu. |\n| --- | --- | --- |\n| < 70 % | Kritická neshoda | ŠVP neplní rámcové požadavky, ohrožuje legislativní soulad. |\n| --- | --- | --- |\n\n### 6.3 Doplňkové Indexy\n\nVypočítat následující doplňkové indexy pro detailní kvalitativní analýzu:\n\n- **Index kompetenčního souladu (IKS):** Poměr pokrytí klíčových kompetencí RVP v ŠVP.\n- **Index průřezové integrace (IPI):** Míra reálné integrace průřezových témat do výuky.\n- **Index hloubky pokrytí (IHP):** Procento výstupů, které jsou v ŠVP rozvedeny na konkrétní výukové cíle (měřitelné, aktivní formulace).\n- **Index profilové rozšiřitelnosti (IPR):** Kolik rozšiřujících nebo profilových výstupů přesahuje rámec RVP, aniž by narušily jeho strukturu.\n\n### 6.4 Vizuální výstupy\n\nZajistit generování následujících vizualizací pro Závěrečnou zprávu:\n\n- Graf pokrytí po vzdělávacích oblastech (Sloupcový graf IS pro VO).\n- Pavoukový diagram Klíčových kompetencí (RVP vs. ŠVP).\n- Mapa defektů (Vizualizace ❌ a ⚠️ výstupů).\n\n### 6.5 Struktura Závěrečné Zprávy\n\nZpráva musí být strukturována dle standardizovaného formátu:\n\n| Oddíl | Obsah |\n| --- | --- |\n| A. Identifikace | Název školy, IZO, typ školy, datum revize, zpracovatel, verze ŠVP a RVP. |\n| --- | --- |\n| B. Shrnutí výsledků | Celkový Index Shody (IS), hlavní závěry a doporučení. |\n| --- | --- |\n| C. Kvantitativní analýza | Přehled IS v % dle kategorií OVU / VO / kompetencí. |\n| --- | --- |\n| D. Kvalitativní analýza | Slovní zhodnocení kvality souladu (formulace, obtížnost, integrace PT). |\n| --- | --- |\n| E. Rizikové oblasti | Přehled nalezených defektů (chybějící OVU, přetížení, formální shoda). |\n| --- | --- |\n| F. Návrhy opatření (Korekční plán) | Přesné návrhy změn - **Co, Kde, Kdo** má upravit, včetně termínu. |\n| --- | --- |\n| G. Přílohy | Master Matice (Fáze 2-3), revizní tabulka, výstupní grafy a metriky. |\n| --- | --- |\n\n\n\n\n.",resultingParameterName:"result",dependentParameterNames:[]}],personas:[],preparations:[{id:1,promptbookVersion:"0.103.0-8",usage:{price:{value:0},input:{tokensCount:{value:0},charactersCount:{value:0},wordsCount:{value:0},sentencesCount:{value:0},linesCount:{value:0},paragraphsCount:{value:0},pagesCount:{value:0}},output:{tokensCount:{value:0},charactersCount:{value:0},wordsCount:{value:0},sentencesCount:{value:0},linesCount:{value:0},paragraphsCount:{value:0},pagesCount:{value:0}}}}],knowledgeSources:[],knowledgePieces:[],sources:[{type:"BOOK",path:null,content:"Asistent pro LŠVP\n\nPERSONA Jsi asistent pro RVP Lyceum v rámci Národního pedagogického institutu České Republiky\nMETA IMAGE https://edulk.cz/getFile/id:475818/type:large/02%20zna%C4%8Dka%20npi.jpg\nRULE Pokud jsi nejsi jistý, napiš nevím\nKNOWLEDGE ./241129_Lyceum_final.pdf\nCONTEXT Obecně dokážeš řešit libovolné ŠVP, aktuálně řešíš {Školní vzdělávací program LYCEUM}\nRULE Z {Porovnání RVP a ŠVP - postup} je nejdůležitější fáze 3\nKNOWLEDGE {Školní vzdělávací program LYCEUM} ./ŠVP Lyceum - Finance v digitální době.pdf\nKNOWLEDGE @Slovník\n\n**Interní slovník - RVP/ŠVP**\n\n**RVP**\n\nRámcový vzdělávací program pro obor vzdělání Lyceum je dokument na národní úrovni, který formuluje požadavky na školní vzdělávací programy ve formě především očekávaných výsledků učení, kterých mají žáci absolvováním tohoto programu na dané škole dosáhnout.\n\n**ŠVP**\n\nŠkolní vzdělávací program pro obor vzdělání Lyceum je dokument každé jednotlivé školy, který popisuje v jakých vyučovacích předmětech/ vzdělávacích modulech a v jakých ročnících budou požadované očekávané výsledky učení naplněny. Zároveň formuluje další očekávané výsledky učení, které naplňují disponibilní část vyučovacího času určeného RVP pro tento obor vzdělání.\n\n**Očekávaný výsledek učení (OVU)**\n\nVyjadřuje jednotlivý požadavek na to, co mají žáci umět na konci vzdělávacího programu, tzn. jejich požadované kompetence. Je vyjádřen formulací, která je uvozena činnostním slovesem a dále obsahuje předmět této činnosti. Formulace je konkretizována resp. doplněna zpravidla formou odrážek vymezením dílčích znalostí, dovedností, postojů, jejichž splnění je předpokladem dosažení OVU jako celku.\n\n_Příklad:_\n\n<div class=\"joplin-table-wrapper\"><table><tbody><tr><th><p><strong>Žák/žákyně řídí realizaci jednoduchého projektu</strong></p></th></tr><tr><td><ul><li>naplánuje aktivity projektu</li></ul></td></tr><tr><td><ul><li>navrhne rozpočet projektu vzhledem k navrženým aktivitám</li></ul></td></tr><tr><td><ul><li>stanoví základní ukazatele a sleduje jejich naplňování</li></ul></td></tr><tr><td><ul><li>vede projektový tým</li></ul></td></tr><tr><td><ul><li>uvede, jak by řešil krizové situace v projektu</li></ul></td></tr><tr><td><ul><li>vyhodnotí úspěšnost projektu</li></ul></td></tr></tbody></table></div>\n\n**Vzdělávací oblasti**\n\nOčekávané výsledky učení jsou v **_RVP členěny do 4 vzdělávacích oblastí_**, které tvoří společný všeobecně vzdělávací základ:\n\n- Osobnostní rozvoj, vzdělávání ke zdraví, bezpečí a produktivnímu pracovnímu životu (kariéře)\n- Komunikační a jazykové vzdělávání\n- Aplikované vzdělávání STEM (Science, Technology, Engeneering, Math), tj. přírodní vědy, informatika, technika, matematika\n- Prakticky orientované vzdělávání společenskovědní a humanitní\n\nKaždá vzdělávací oblast se dále člení na okruhy, v jejichž rámci jsou OVU samostatně číslované.\n\n<div class=\"joplin-table-wrapper\"><table><tbody><tr><th rowspan=\"21\"><ul><li>Prakticky orientované vzdělávání společenskovědní a humanitní</li></ul></th><th rowspan=\"21\"><p><strong>Člověk, ekonomie a podnikání</strong></p></th><th rowspan=\"7\"><p><strong>1</strong></p></th><th><p><strong>zpracuje podklady související s podnikáním</strong></p></th></tr><tr><td><p>připraví podnikatelský záměr</p></td></tr><tr><td><p>sestaví zakladatelský rozpočet</p></td></tr><tr><td><p>zkalkuluje cenu zboží nebo služby</p></td></tr><tr><td><p>vysvětlí na příkladu základní povinnosti podnikatele vůči státu a zaměstnancům</p></td></tr><tr><td><p>vede daňovou evidenci</p></td></tr><tr><td><p>vysvětlí na příkladech etiku v podnikání</p></td></tr><tr><td rowspan=\"7\"><p><strong>2</strong></p></td><td><p><strong>řídí realizaci jednoduchého projektu</strong></p></td></tr><tr><td><p>naplánuje aktivity projektu</p></td></tr><tr><td><p>navrhne rozpočet projektu vzhledem k navrženým aktivitám</p></td></tr><tr><td><p>stanoví základní ukazatele a sleduje jejich naplňování</p></td></tr><tr><td><p>vede projektový tým</p></td></tr><tr><td><p>uvede, jak by řešil krizové situace v projektu</p></td></tr><tr><td><p>vyhodnotí úspěšnost projektu</p></td></tr><tr><td rowspan=\"7\"><p><strong>3</strong></p></td><td><p><strong>aplikuje ekonomické teorie v osobním a profesním životě</strong></p></td></tr><tr><td><p>vysvětlí základní ekonomické otázky</p></td></tr><tr><td><p>vysvětí stanovení rovnovážné ceny na dokonalém i nedokonalém trhu</p></td></tr><tr><td><p>charakterizuje výrobní faktory a vysvětlí hranici produkčních možností a náklady obětované příležitosti</p></td></tr><tr><td><p>uvede nejdůležitější makroekonomické pojmy a vliv jejich výše na kvalitu života a podnikání v daném státě</p></td></tr><tr><td><p>vysvětlí podstatu inflace a její důsledky na finanční situaci obyvatel a na příkladu ukáže jak se bránit jejím nepříznivým důsledkům</p></td></tr><tr><td><p>uvede hlavní výhody a nevýhody mezinárodního obchodu a vliv ochranářských opatření na ekonomickou situaci dané země</p></td></tr><tr><td></td><td></td><td><p><strong>4</strong></p></td><td><p>Atd.</p></td></tr></tbody></table></div>\n\n**Vyučovací předmět / vzdělávací modul**\n\nOčekávané výsledky učení jsou v **ŠVP** členěny do vyučovacích předmětů nebo vzdělávacích modulů, které jsou dále zařazeny do jednoho nebo více ročníků 4letého studia. Vyučovací předmět / vzdělávací modul tvoří vyučovací jednotku, kde jsou očekávané výsledky učení dále rozpracovány pro potřeby výuky podle následující šablony\n\n| **A. VSTUPNÍ ČÁST** |\n| --- |\n| **1\\. Název** |\n| **2\\. Kód** (kódy by měly být navázány na obory vzdělání a výsledky učení) |\n| **2a) Kategorie vzdělání** - v případě, že nebude součástí kódu |\n| **3\\. Typ vyučovací jednotky** (modul, předmět, stáž apod.) |\n| **4\\. Délka** (počet hodin - dělitelný čtyřmi (optimální modul 16, 32 hodin = týden výuky) |\n| **5\\. Platnost** (datum, od kterého platí) |\n| **6\\. Vstupní předpoklady** (vymezení požadované úrovně vstupních vědomostí a dovedností, které jsou předpokladem úspěšného studia) |\n| |\n| **B. JÁDRO VYUČOVACÍ JEDNOTKY** |\n| **1\\. Charakteristika** (stručná anotace popisující obecné cíle a pojetí) |\n| **2\\. Očekávané výsledky učení a jejich indikátory (převzaté z RVP nebo dále konkretizované)** |\n| **3\\. Podpora rozvoje klíčových kompetencí a základních gramotností** (které klíčové kompetence jsou v rozvíjeny) |\n| **4\\. Obsah vzdělávání** (rozpis učiva) |\n| **5\\. Vzdělávací strategie** (strategie výuky, resp. učební činnosti žáků, které jsou doporučené pro dosažení výsledků) |\n| |\n| **C. VÝSTUPNÍ ČÁST** |\n| **1\\. Způsob ověřování dosažených výsledků** (ve vazbě na jednotlivé výsledky učení) |\n| **2\\. Kritéria hodnocení** (co znamená splnění výsledků učení, kdy je splněna celá vyučovací jednotka, kritéria pro známky, příp. procentuální, slovní hodnocení) |\n| **3\\. Doporučená studijní literatura, odkazy na ilustrační zdroje** |\n| **4\\. Poznámky** |\n\n**Soulad OVU RVP a ŠVP**\n\nTento soulad je předmětem zjišťování. Soulad nastává, jestliže jsou očekávané výsledky učení z jednotlivých vzdělávacích oblastí RVP **obsaženy** ve vyučovacích předmětech/ vzdělávacích modulech ŠVP jednotlivých škol, tzn. že v ŠVP se objevuje jejich formulace buď v doslovném nebo podobném znění v jednom nebo více vyučovacích předmětech/ vzdělávacích modulech.\n\n_Příklad souladu:_\n\nRVP ŠVP - komunikace a marketing (SŠ obchodní Č.\n\n| **2** | **řídí realizaci jednoduchého projektu** |\n| --- | --- |\n| naplánuje aktivity projektu |\n| navrhne rozpočet projektu vzhledem k navrženým aktivitám |\n| stanoví základní ukazatele a sleduje jejich naplňování |\n| vede projektový tým |\n| uvede, jak by řešil krizové situace v projektu |\n| vyhodnotí úspěšnost projektu |\n\nKNOWLEDGE {Porovnání RVP a ŠVP - postup}\n\n\n# AUDITNÍ PROTOKOL ŠVP-RVP\n\n# (POPIS KONTROLNÍHO ALGORITMU)\n\nMetodika je určena pro **Kvantifikaci Shody** školního vzdělávacího programu (ŠVP) s Rámcovým vzdělávacím programem (RVP).\n\n## FÁZE 1: VALIDACE DOKUMENTACE\n\n**Cíl:** Ověřit platnost, aktuálnost a strukturu zdrojových dokumentů.\n\n- **RVP Verifikace:** Otevřít aktuální verzi RVP (např. RVP ZV/G/SOŠ).\n- **Typová shoda:** Ověřit, že RVP se vztahuje k danému typu školy.\n- **ŠVP Dimenze:** Identifikovat a izolovat relevantní části ŠVP: Profil absolventa, Klíčové kompetence (KK), Vzdělávací oblasti (VO), případně Učební plán (UP).\n- **Verzování:** Potvrdit, že obě verze (RVP a ŠVP) jsou nejnovější a platné (včetně dodatků RVP).\n\n## FÁZE 2: DATABÁZOVÉ MAPOVÁNÍ VÝSTUPŮ (MASTER MATICE)\n\n**Cíl:** Vytvořit systémovou databázi pro křížové porovnání všech povinných komponent RVP se ŠVP.\n\n- **Dekompozice RVP:** Rozložit RVP na základní povinné komponenty: Klíčové kompetence, Vzdělávací oblasti a obory, Očekávané výstupy (OVU), Průřezová témata (PT).\n- **Přiřazovací mapa:** Vytvořit hlavní kontrolní matici (Master Matice) pro záznam vazeb.\n\n| Oblast RVP | Výstup RVP (OVU) | Odpovídající Část ŠVP (Předmět/Ročník) | Konkrétní Tématický Celek v ŠVP | Stav Shody (Protokol) |\n| --- | --- | --- | --- | --- |\n| ... | ... | ... | ... | ... |\n| --- | --- | --- | --- | --- |\n\n## FÁZE 3: ALGORITMICKÁ KONTROLA POKRYTÍ A HLOUBKY\n\n**Cíl:** Posoudit, zda každý povinný výstup RVP je adekvátně reflektován v obsahu ŠVP, a přidělit bodovou hodnotu pro kvantifikaci.\n\n- **Audit OVU:** Projít každý jednotlivý Očekávaný výstup (OVU) z RVP.\n- **Kódování stavu a bodování:** U každého OVU v matici označit stav pokrytí dle následujícího schématu:\n\n| Kód (Protokol) | Popis (Kvalitativní zjištění) | Bodová hodnota (Kvantifikace) |\n| --- | --- | --- |\n| ✅ | Plná shoda (Výstup pokryt v plném rozsahu, odpovídající úrovni RVP) | 1,0 |\n| --- | --- | --- |\n| ⚠️ | Částečná shoda (Formální pokrytí, omezený rozsah, chybná návaznost) | 0,5 |\n| --- | --- | --- |\n| ❌ | Absence (Výstup zcela chybí v obsahu ŠVP) | 0,0 |\n| --- | --- | --- |\n\n- **Defektologie ŠVP:** Identifikovat a zaznamenat deficity ŠVP: Chybějící výstupy (❌), Sémantické překryvy, Přetížení obsahu.\n- **Kvalitativní posun:** Ověřit, zda je formulace výstupů v ŠVP **aktivní, měřitelná a v souladu** s úrovní RVP.\n\n## FÁZE 4: STRUKTURÁLNÍ VERIFIKACE NÁVAZNOSTI (VERTIKÁLA/HORIZONTÁLA)\n\n**Cíl:** Zkontrolovat logickou posloupnost a provázanost učiva v rámci ŠVP.\n\n- **Vertikální Kontrola:** Ověřit posloupnost OVU a učiva uvnitř jednoho předmětu/oblasti (postup od jednodušších ke složitějším konceptům napříč ročníky).\n- **Horizontální Kontrola:** Zkontrolovat logické provázání napříč vzdělávacími oblastmi a předměty (např. fyzika ↔ matematika).\n- **PT Integrace:** Audit reálné integrace Průřezových témat (PT) do konkrétních částí obsahu, metod a projektů.\n\n## FÁZE 5: ANALÝZA ŠKOLNÍ PROFILACE A ROZŠÍŘENÍ RVP\n\n**Cíl:** Validovat, že profilace školy je **v souladu** s RVP a nejedná se o **rozpor**.\n\n- **Nekonfliktnost:** Porovnat definovaný Profil absolventa školy s Klíčovými kompetencemi RVP. Profil ŠVP musí RVP rozvíjet, nikoli mu odporovat.\n- **Modularita:** Zkontrolovat, zda volitelné předměty a rozšiřující moduly logicky navazují na vzdělávací oblasti RVP.\n- **Implementace specializace:** Popisně uvést, jak je školní profilace (např. STEM zaměření, projektová výuka) integrována do OVU a kompetencí definovaných RVP.\n\n## FÁZE 6: GENERÁTOR ZÁVĚREČNÉ ZPRÁVY A KVANTIFIKACE\n\n**Cíl:** Syntetizovat výsledky, kvantifikovat soulad a generovat závazné návrhy na korekce.\n\n### 6.1 Kvantifikace Souladu\n\nVypočítat Index shody (IS) na základě bodového hodnocení (Fáze 3):\n\n### 6.2 Interpretace Indexu Shody (IS)\n\nKlasifikace souladu pro standardizované vyhodnocení:\n\n| Interval IS | Klasifikace souladu | Popis |\n| --- | --- | --- |\n| 95-100 % | Výborný soulad | ŠVP plně odpovídá RVP, pouze stylistické nebo formální rozdíly. |\n| --- | --- | --- |\n| 85-94 % | Dobrá shoda | ŠVP pokrývá všechny klíčové výstupy, menší korekce nutné. |\n| --- | --- | --- |\n| 70-84 % | Částečná shoda | Významné nedostatky v některých oblastech, nutná revize obsahu. |\n| --- | --- | --- |\n| < 70 % | Kritická neshoda | ŠVP neplní rámcové požadavky, ohrožuje legislativní soulad. |\n| --- | --- | --- |\n\n### 6.3 Doplňkové Indexy\n\nVypočítat následující doplňkové indexy pro detailní kvalitativní analýzu:\n\n- **Index kompetenčního souladu (IKS):** Poměr pokrytí klíčových kompetencí RVP v ŠVP.\n- **Index průřezové integrace (IPI):** Míra reálné integrace průřezových témat do výuky.\n- **Index hloubky pokrytí (IHP):** Procento výstupů, které jsou v ŠVP rozvedeny na konkrétní výukové cíle (měřitelné, aktivní formulace).\n- **Index profilové rozšiřitelnosti (IPR):** Kolik rozšiřujících nebo profilových výstupů přesahuje rámec RVP, aniž by narušily jeho strukturu.\n\n### 6.4 Vizuální výstupy\n\nZajistit generování následujících vizualizací pro Závěrečnou zprávu:\n\n- Graf pokrytí po vzdělávacích oblastech (Sloupcový graf IS pro VO).\n- Pavoukový diagram Klíčových kompetencí (RVP vs. ŠVP).\n- Mapa defektů (Vizualizace ❌ a ⚠️ výstupů).\n\n### 6.5 Struktura Závěrečné Zprávy\n\nZpráva musí být strukturována dle standardizovaného formátu:\n\n| Oddíl | Obsah |\n| --- | --- |\n| A. Identifikace | Název školy, IZO, typ školy, datum revize, zpracovatel, verze ŠVP a RVP. |\n| --- | --- |\n| B. Shrnutí výsledků | Celkový Index Shody (IS), hlavní závěry a doporučení. |\n| --- | --- |\n| C. Kvantitativní analýza | Přehled IS v % dle kategorií OVU / VO / kompetencí. |\n| --- | --- |\n| D. Kvalitativní analýza | Slovní zhodnocení kvality souladu (formulace, obtížnost, integrace PT). |\n| --- | --- |\n| E. Rizikové oblasti | Přehled nalezených defektů (chybějící OVU, přetížení, formální shoda). |\n| --- | --- |\n| F. Návrhy opatření (Korekční plán) | Přesné návrhy změn - **Co, Kde, Kdo** má upravit, včetně termínu. |\n| --- | --- |\n| G. Přílohy | Master Matice (Fáze 2-3), revizní tabulka, výstupní grafy a metriky. |\n| --- | --- |\n\n\n\n\n.\n"}],sourceFile:"./books/examples/lsvp-asistent.book"}];
2106
+ var PipelineCollection = [{title:"Prepare Knowledge from Markdown",pipelineUrl:"https://promptbook.studio/promptbook/prepare-knowledge-from-markdown.book",formfactorName:"GENERIC",parameters:[{name:"knowledgeContent",description:"Markdown document content",isInput:true,isOutput:false},{name:"knowledgePieces",description:"The knowledge JSON object",isInput:false,isOutput:true}],tasks:[{taskType:"PROMPT_TASK",name:"knowledge",title:"Knowledge",content:"You are experienced data researcher, extract the important knowledge from the document.\n\n# Rules\n\n- Make pieces of information concise, clear, and easy to understand\n- One piece of information should be approximately 1 paragraph\n- Divide the paragraphs by markdown horizontal lines ---\n- Omit irrelevant information\n- Group redundant information\n- Write just extracted information, nothing else\n\n# The document\n\nTake information from this document:\n\n> {knowledgeContent}",resultingParameterName:"knowledgePieces",dependentParameterNames:["knowledgeContent"]}],personas:[],preparations:[],knowledgeSources:[],knowledgePieces:[],sources:[{type:"BOOK",path:null,content:"# Prepare Knowledge from Markdown\n\n- PIPELINE URL `https://promptbook.studio/promptbook/prepare-knowledge-from-markdown.book`\n- INPUT PARAMETER `{knowledgeContent}` Markdown document content\n- OUTPUT PARAMETER `{knowledgePieces}` The knowledge JSON object\n\n## Knowledge\n\n<!-- TODO: [🍆] -FORMAT JSON -->\n\n```markdown\nYou are experienced data researcher, extract the important knowledge from the document.\n\n# Rules\n\n- Make pieces of information concise, clear, and easy to understand\n- One piece of information should be approximately 1 paragraph\n- Divide the paragraphs by markdown horizontal lines ---\n- Omit irrelevant information\n- Group redundant information\n- Write just extracted information, nothing else\n\n# The document\n\nTake information from this document:\n\n> {knowledgeContent}\n```\n\n`-> {knowledgePieces}`\n"}],sourceFile:"./books/prepare-knowledge-from-markdown.book"},{title:"Prepare Keywords",pipelineUrl:"https://promptbook.studio/promptbook/prepare-knowledge-keywords.book",formfactorName:"GENERIC",parameters:[{name:"knowledgePieceContent",description:"The content",isInput:true,isOutput:false},{name:"keywords",description:"Keywords separated by comma",isInput:false,isOutput:true}],tasks:[{taskType:"PROMPT_TASK",name:"knowledge",title:"Knowledge",content:"You are experienced data researcher, detect the important keywords in the document.\n\n# Rules\n\n- Write just keywords separated by comma\n\n# The document\n\nTake information from this document:\n\n> {knowledgePieceContent}",resultingParameterName:"keywords",dependentParameterNames:["knowledgePieceContent"]}],personas:[],preparations:[],knowledgeSources:[],knowledgePieces:[],sources:[{type:"BOOK",path:null,content:"# Prepare Keywords\n\n- PIPELINE URL `https://promptbook.studio/promptbook/prepare-knowledge-keywords.book`\n- INPUT PARAMETER `{knowledgePieceContent}` The content\n- OUTPUT PARAMETER `{keywords}` Keywords separated by comma\n\n## Knowledge\n\n<!-- TODO: [🍆] -FORMAT JSON -->\n\n```markdown\nYou are experienced data researcher, detect the important keywords in the document.\n\n# Rules\n\n- Write just keywords separated by comma\n\n# The document\n\nTake information from this document:\n\n> {knowledgePieceContent}\n```\n\n`-> {keywords}`\n"}],sourceFile:"./books/prepare-knowledge-keywords.book"},{title:"Prepare Knowledge-piece Title",pipelineUrl:"https://promptbook.studio/promptbook/prepare-knowledge-title.book",formfactorName:"GENERIC",parameters:[{name:"knowledgePieceContent",description:"The content",isInput:true,isOutput:false},{name:"title",description:"The title of the document",isInput:false,isOutput:true}],tasks:[{taskType:"PROMPT_TASK",name:"knowledge",title:"Knowledge",content:"You are experienced content creator, write best title for the document.\n\n# Rules\n\n- Write just title, nothing else\n- Write maximum 5 words for the title\n\n# The document\n\n> {knowledgePieceContent}",resultingParameterName:"title",expectations:{words:{min:1,max:8}},dependentParameterNames:["knowledgePieceContent"]}],personas:[],preparations:[],knowledgeSources:[],knowledgePieces:[],sources:[{type:"BOOK",path:null,content:"# Prepare Knowledge-piece Title\n\n- PIPELINE URL `https://promptbook.studio/promptbook/prepare-knowledge-title.book`\n- INPUT PARAMETER `{knowledgePieceContent}` The content\n- OUTPUT PARAMETER `{title}` The title of the document\n\n## Knowledge\n\n- EXPECT MIN 1 WORD\n- EXPECT MAX 8 WORDS\n\n```markdown\nYou are experienced content creator, write best title for the document.\n\n# Rules\n\n- Write just title, nothing else\n- Write maximum 5 words for the title\n\n# The document\n\n> {knowledgePieceContent}\n```\n\n`-> {title}`\n"}],sourceFile:"./books/prepare-knowledge-title.book"},{title:"Prepare Persona",pipelineUrl:"https://promptbook.studio/promptbook/prepare-persona.book",formfactorName:"GENERIC",parameters:[{name:"availableModels",description:"List of available model names together with their descriptions as JSON",isInput:true,isOutput:false},{name:"personaDescription",description:"Description of the persona",isInput:true,isOutput:false},{name:"modelsRequirements",description:"Specific requirements for the model",isInput:false,isOutput:true}],tasks:[{taskType:"PROMPT_TASK",name:"make-model-requirements",title:"Make modelRequirements",content:"You are an experienced AI engineer, you need to find the best models for virtual assistants:\n\n## Example\n\n```json\n[\n {\n \"modelName\": \"gpt-4o\",\n \"systemMessage\": \"You are experienced AI engineer and helpful assistant.\",\n \"temperature\": 0.7\n },\n {\n \"modelName\": \"claude-3-5-sonnet\",\n \"systemMessage\": \"You are a friendly and knowledgeable chatbot.\",\n \"temperature\": 0.5\n }\n]\n```\n\n## Instructions\n\n- Your output format is JSON array\n- Sort best-fitting models first\n- Omit any models that are not suitable\n- Write just the JSON, no other text should be present\n- Array contain items with following keys:\n - `modelName`: The name of the model to use\n - `systemMessage`: The system message to provide context to the model\n - `temperature`: The sampling temperature to use\n\n### Key `modelName`\n\nHere are the available models:\n\n```json\n{availableModels}\n```\n\n### Key `systemMessage`\n\nThe system message is used to communicate instructions or provide context to the model at the beginning of a conversation. It is displayed in a different format compared to user messages, helping the model understand its role in the conversation. The system message typically guides the model's behavior, sets the tone, or specifies desired output from the model. By utilizing the system message effectively, users can steer the model towards generating more accurate and relevant responses.\n\nFor example:\n\n> You are an experienced AI engineer and helpful assistant.\n\n> You are a friendly and knowledgeable chatbot.\n\n### Key `temperature`\n\nThe sampling temperature, between 0 and 1. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic. If set to 0, the model will use log probability to automatically increase the temperature until certain thresholds are hit.\n\nYou can pick a value between 0 and 2. For example:\n\n- `0.1`: Low temperature, extremely conservative and deterministic\n- `0.5`: Medium temperature, balanced between conservative and creative\n- `1.0`: High temperature, creative and bit random\n- `1.5`: Very high temperature, extremely creative and often chaotic and unpredictable\n- `2.0`: Maximum temperature, completely random and unpredictable, for some extreme creative use cases\n\n# The assistant\n\nTake this description of the persona:\n\n> {personaDescription}",resultingParameterName:"modelsRequirements",format:"JSON",dependentParameterNames:["availableModels","personaDescription"]}],personas:[],preparations:[],knowledgeSources:[],knowledgePieces:[],sources:[{type:"BOOK",path:null,content:"# Prepare Persona\n\n- PIPELINE URL `https://promptbook.studio/promptbook/prepare-persona.book`\n- INPUT PARAMETER `{availableModels}` List of available model names together with their descriptions as JSON\n- INPUT PARAMETER `{personaDescription}` Description of the persona\n- OUTPUT PARAMETER `{modelsRequirements}` Specific requirements for the model\n\n## Make modelRequirements\n\n- FORMAT JSON\n\n```markdown\nYou are an experienced AI engineer, you need to find the best models for virtual assistants:\n\n## Example\n\n\\`\\`\\`json\n[\n {\n \"modelName\": \"gpt-4o\",\n \"systemMessage\": \"You are experienced AI engineer and helpful assistant.\",\n \"temperature\": 0.7\n },\n {\n \"modelName\": \"claude-3-5-sonnet\",\n \"systemMessage\": \"You are a friendly and knowledgeable chatbot.\",\n \"temperature\": 0.5\n }\n]\n\\`\\`\\`\n\n## Instructions\n\n- Your output format is JSON array\n- Sort best-fitting models first\n- Omit any models that are not suitable\n- Write just the JSON, no other text should be present\n- Array contain items with following keys:\n - `modelName`: The name of the model to use\n - `systemMessage`: The system message to provide context to the model\n - `temperature`: The sampling temperature to use\n\n### Key `modelName`\n\nHere are the available models:\n\n\\`\\`\\`json\n{availableModels}\n\\`\\`\\`\n\n### Key `systemMessage`\n\nThe system message is used to communicate instructions or provide context to the model at the beginning of a conversation. It is displayed in a different format compared to user messages, helping the model understand its role in the conversation. The system message typically guides the model's behavior, sets the tone, or specifies desired output from the model. By utilizing the system message effectively, users can steer the model towards generating more accurate and relevant responses.\n\nFor example:\n\n> You are an experienced AI engineer and helpful assistant.\n\n> You are a friendly and knowledgeable chatbot.\n\n### Key `temperature`\n\nThe sampling temperature, between 0 and 1. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic. If set to 0, the model will use log probability to automatically increase the temperature until certain thresholds are hit.\n\nYou can pick a value between 0 and 2. For example:\n\n- `0.1`: Low temperature, extremely conservative and deterministic\n- `0.5`: Medium temperature, balanced between conservative and creative\n- `1.0`: High temperature, creative and bit random\n- `1.5`: Very high temperature, extremely creative and often chaotic and unpredictable\n- `2.0`: Maximum temperature, completely random and unpredictable, for some extreme creative use cases\n\n# The assistant\n\nTake this description of the persona:\n\n> {personaDescription}\n```\n\n`-> {modelsRequirements}`\n"}],sourceFile:"./books/prepare-persona.book"},{title:"Prepare Title",pipelineUrl:"https://promptbook.studio/promptbook/prepare-title.book",formfactorName:"GENERIC",parameters:[{name:"book",description:"The book to prepare the title for",isInput:true,isOutput:false},{name:"title",description:"Best title for the book",isInput:false,isOutput:true}],tasks:[{taskType:"PROMPT_TASK",name:"make-title",title:"Make title",content:"Make best title for given text which describes the workflow:\n\n## Rules\n\n- Write just title, nothing else\n- Title should be concise and clear - Write maximum ideally 2 words, maximum 5 words\n- Title starts with emoticon\n- Title should not mention the input and output of the workflow but the main purpose of the workflow\n _For example, not \"✍ Convert Knowledge-piece to title\" but \"✍ Title\"_\n\n## The workflow\n\n> {book}",resultingParameterName:"title",expectations:{words:{min:1,max:8},lines:{min:1,max:1}},dependentParameterNames:["book"]}],personas:[],preparations:[],knowledgeSources:[],knowledgePieces:[],sources:[{type:"BOOK",path:null,content:"# Prepare Title\n\n- PIPELINE URL `https://promptbook.studio/promptbook/prepare-title.book`\n- INPUT PARAMETER `{book}` The book to prepare the title for\n- OUTPUT PARAMETER `{title}` Best title for the book\n\n## Make title\n\n- EXPECT MIN 1 Word\n- EXPECT MAX 8 Words\n- EXPECT EXACTLY 1 Line\n\n```markdown\nMake best title for given text which describes the workflow:\n\n## Rules\n\n- Write just title, nothing else\n- Title should be concise and clear - Write maximum ideally 2 words, maximum 5 words\n- Title starts with emoticon\n- Title should not mention the input and output of the workflow but the main purpose of the workflow\n _For example, not \"✍ Convert Knowledge-piece to title\" but \"✍ Title\"_\n\n## The workflow\n\n> {book}\n```\n\n`-> {title}`\n"}],sourceFile:"./books/prepare-title.book"}];
2101
2107
 
2102
2108
  /**
2103
2109
  * Checks if value is valid email
@@ -2196,6 +2202,8 @@
2196
2202
  * Function `validatePipelineString` will validate the if the string is a valid pipeline string
2197
2203
  * It does not check if the string is fully logically correct, but if it is a string that can be a pipeline string or the string looks completely different.
2198
2204
  *
2205
+ * Note: [🔂] This function is idempotent.
2206
+ *
2199
2207
  * @param {string} pipelineString the candidate for a pipeline string
2200
2208
  * @returns {PipelineString} the same string as input, but validated as valid
2201
2209
  * @throws {ParseError} if the string is not a valid pipeline string
@@ -2469,7 +2477,7 @@
2469
2477
  * Library of pipelines that groups together pipelines for an application.
2470
2478
  * This implementation is a very thin wrapper around the Array / Map of pipelines.
2471
2479
  *
2472
- * @private internal function of `createCollectionFromJson`, use `createCollectionFromJson` instead
2480
+ * @private internal function of `createPipelineCollectionFromJson`, use `createPipelineCollectionFromJson` instead
2473
2481
  * @see https://github.com/webgptorg/pipeline#pipeline-collection
2474
2482
  */
2475
2483
  class SimplePipelineCollection {
@@ -2479,14 +2487,14 @@
2479
2487
  * @param pipelines Array of pipeline JSON objects to include in the collection
2480
2488
  *
2481
2489
  * Note: During the construction logic of all pipelines are validated
2482
- * Note: It is not recommended to use this constructor directly, use `createCollectionFromJson` *(or other variant)* instead
2490
+ * Note: It is not recommended to use this constructor directly, use `createPipelineCollectionFromJson` *(or other variant)* instead
2483
2491
  */
2484
2492
  constructor(...pipelines) {
2485
2493
  this.collection = new Map();
2486
2494
  for (const pipeline of pipelines) {
2487
2495
  // TODO: [👠] DRY
2488
2496
  if (pipeline.pipelineUrl === undefined) {
2489
- throw new PipelineUrlError(spaceTrim.spaceTrim(`
2497
+ throw new PipelineUrlError(spaceTrim$1.spaceTrim(`
2490
2498
  Pipeline with name "${pipeline.title}" does not have defined URL
2491
2499
 
2492
2500
  File:
@@ -2508,7 +2516,7 @@
2508
2516
  pipelineJsonToString(unpreparePipeline(pipeline)) !==
2509
2517
  pipelineJsonToString(unpreparePipeline(this.collection.get(pipeline.pipelineUrl)))) {
2510
2518
  const existing = this.collection.get(pipeline.pipelineUrl);
2511
- throw new PipelineUrlError(spaceTrim.spaceTrim(`
2519
+ throw new PipelineUrlError(spaceTrim$1.spaceTrim(`
2512
2520
  Pipeline with URL ${pipeline.pipelineUrl} is already in the collection 🍎
2513
2521
 
2514
2522
  Conflicting files:
@@ -2540,13 +2548,13 @@
2540
2548
  const pipeline = this.collection.get(url);
2541
2549
  if (!pipeline) {
2542
2550
  if (this.listPipelines().length === 0) {
2543
- throw new NotFoundError(spaceTrim.spaceTrim(`
2551
+ throw new NotFoundError(spaceTrim$1.spaceTrim(`
2544
2552
  Pipeline with url "${url}" not found
2545
2553
 
2546
2554
  No pipelines available
2547
2555
  `));
2548
2556
  }
2549
- throw new NotFoundError(spaceTrim.spaceTrim((block) => `
2557
+ throw new NotFoundError(spaceTrim$1.spaceTrim((block) => `
2550
2558
  Pipeline with url "${url}" not found
2551
2559
 
2552
2560
  Available pipelines:
@@ -2567,16 +2575,16 @@
2567
2575
  }
2568
2576
 
2569
2577
  /**
2570
- * Creates PipelineCollection from array of PipelineJson or PipelineString
2578
+ * Creates `PipelineCollection` from array of PipelineJson or PipelineString
2571
2579
  *
2572
- * Note: Functions `collectionToJson` and `createCollectionFromJson` are complementary
2580
+ * Note: Functions `pipelineCollectionToJson` and `createPipelineCollectionFromJson` are complementary
2573
2581
  * Note: Syntax, parsing, and logic consistency checks are performed on all sources during build
2574
2582
  *
2575
2583
  * @param promptbookSources
2576
2584
  * @returns PipelineCollection
2577
2585
  * @public exported from `@promptbook/core`
2578
2586
  */
2579
- function createCollectionFromJson(...promptbooks) {
2587
+ function createPipelineCollectionFromJson(...promptbooks) {
2580
2588
  return new SimplePipelineCollection(...promptbooks);
2581
2589
  }
2582
2590
 
@@ -2587,7 +2595,7 @@
2587
2595
  */
2588
2596
  class MissingToolsError extends Error {
2589
2597
  constructor(message) {
2590
- super(spaceTrim.spaceTrim((block) => `
2598
+ super(spaceTrim$1.spaceTrim((block) => `
2591
2599
  ${block(message)}
2592
2600
 
2593
2601
  Note: You have probably forgot to provide some tools for pipeline execution or preparation
@@ -2694,6 +2702,22 @@
2694
2702
  }
2695
2703
  }
2696
2704
 
2705
+ /**
2706
+ * This error indicates error from the database
2707
+ *
2708
+ * @public exported from `@promptbook/core`
2709
+ */
2710
+ class DatabaseError extends Error {
2711
+ constructor(message) {
2712
+ super(message);
2713
+ this.name = 'DatabaseError';
2714
+ Object.setPrototypeOf(this, DatabaseError.prototype);
2715
+ }
2716
+ }
2717
+ /**
2718
+ * TODO: [🐱‍🚀] Explain that NotFoundError ([🐱‍🚀] and other specific errors) has priority over DatabaseError in some contexts
2719
+ */
2720
+
2697
2721
  /**
2698
2722
  * This error type indicates that you try to use a feature that is not available in the current environment
2699
2723
  *
@@ -2749,6 +2773,19 @@
2749
2773
  }
2750
2774
  }
2751
2775
 
2776
+ /**
2777
+ * This error indicates that promptbook operation is not allowed
2778
+ *
2779
+ * @public exported from `@promptbook/core`
2780
+ */
2781
+ class NotAllowed extends Error {
2782
+ constructor(message) {
2783
+ super(message);
2784
+ this.name = 'NotAllowed';
2785
+ Object.setPrototypeOf(this, NotAllowed.prototype);
2786
+ }
2787
+ }
2788
+
2752
2789
  /**
2753
2790
  * This error type indicates that some part of the code is not implemented yet
2754
2791
  *
@@ -2756,7 +2793,7 @@
2756
2793
  */
2757
2794
  class NotYetImplementedError extends Error {
2758
2795
  constructor(message) {
2759
- super(spaceTrim.spaceTrim((block) => `
2796
+ super(spaceTrim$1.spaceTrim((block) => `
2760
2797
  ${block(message)}
2761
2798
 
2762
2799
  Note: This feature is not implemented yet but it will be soon.
@@ -2775,6 +2812,7 @@
2775
2812
  /**
2776
2813
  * Generates random token
2777
2814
  *
2815
+ * Note: `$` is used to indicate that this function is not a pure function - it is not deterministic
2778
2816
  * Note: This function is cryptographically secure (it uses crypto.randomBytes internally)
2779
2817
  *
2780
2818
  * @private internal helper function
@@ -2784,6 +2822,7 @@
2784
2822
  return crypto.randomBytes(randomness).toString('hex');
2785
2823
  }
2786
2824
  /**
2825
+ * TODO: [🤶] Maybe export through `@promptbook/utils` or `@promptbook/random` package
2787
2826
  * TODO: Maybe use nanoid instead https://github.com/ai/nanoid
2788
2827
  */
2789
2828
 
@@ -2843,6 +2882,8 @@
2843
2882
  PromptbookFetchError,
2844
2883
  UnexpectedError,
2845
2884
  WrappedError,
2885
+ NotAllowed,
2886
+ DatabaseError,
2846
2887
  // TODO: [🪑]> VersionMismatchError,
2847
2888
  };
2848
2889
  /**
@@ -2991,11 +3032,11 @@
2991
3032
  throw deserializeError(errors[0]);
2992
3033
  }
2993
3034
  else {
2994
- throw new PipelineExecutionError(spaceTrim.spaceTrim((block) => `
3035
+ throw new PipelineExecutionError(spaceTrim$1.spaceTrim((block) => `
2995
3036
  Multiple errors occurred during Promptbook execution
2996
3037
 
2997
3038
  ${block(errors
2998
- .map(({ name, stack, message }, index) => spaceTrim.spaceTrim((block) => `
3039
+ .map(({ name, stack, message }, index) => spaceTrim$1.spaceTrim((block) => `
2999
3040
  ${name} ${index + 1}:
3000
3041
  ${block(stack || message)}
3001
3042
  `))
@@ -3022,6 +3063,7 @@
3022
3063
  let updatedAt = createdAt;
3023
3064
  const errors = [];
3024
3065
  const warnings = [];
3066
+ const llmCalls = [];
3025
3067
  let currentValue = {};
3026
3068
  let customTldr = null;
3027
3069
  const partialResultSubject = new rxjs.Subject();
@@ -3037,6 +3079,9 @@
3037
3079
  }, (tldrInfo) => {
3038
3080
  customTldr = tldrInfo;
3039
3081
  updatedAt = new Date();
3082
+ }, (llmCall) => {
3083
+ llmCalls.push(llmCall);
3084
+ updatedAt = new Date();
3040
3085
  });
3041
3086
  finalResultPromise
3042
3087
  .catch((error) => {
@@ -3159,7 +3204,7 @@
3159
3204
  }
3160
3205
  return {
3161
3206
  percent: percent,
3162
- message,
3207
+ message: message + ' (!!!fallback)',
3163
3208
  };
3164
3209
  },
3165
3210
  get createdAt() {
@@ -3182,6 +3227,10 @@
3182
3227
  return warnings;
3183
3228
  // <- Note: [1] --||--
3184
3229
  },
3230
+ get llmCalls() {
3231
+ return [...llmCalls, { foo: '!!! bar' }];
3232
+ // <- Note: [1] --||--
3233
+ },
3185
3234
  get currentValue() {
3186
3235
  return currentValue;
3187
3236
  // <- Note: [1] --||--
@@ -3441,7 +3490,7 @@
3441
3490
  }
3442
3491
  catch (error) {
3443
3492
  assertsError(error);
3444
- throw new ParseError(spaceTrim.spaceTrim((block) => `
3493
+ throw new ParseError(spaceTrim$1.spaceTrim((block) => `
3445
3494
  Can not extract variables from the script
3446
3495
  ${block(error.stack || error.message)}
3447
3496
 
@@ -4134,6 +4183,7 @@
4134
4183
  return new MultipleLlmExecutionTools(title || 'Multiple LLM Providers joined by `joinLlmExecutionTools`', ...llmExecutionTools);
4135
4184
  }
4136
4185
  /**
4186
+ * TODO: [🙆] `getSingleLlmExecutionTools` vs `joinLlmExecutionTools` - explain difference or pick one
4137
4187
  * TODO: [👷‍♂️] @@@ Manual about construction of llmTools
4138
4188
  */
4139
4189
 
@@ -4150,6 +4200,7 @@
4150
4200
  return llmTools;
4151
4201
  }
4152
4202
  /**
4203
+ * TODO: [🙆] `getSingleLlmExecutionTools` vs `joinLlmExecutionTools` - explain difference or pick one
4153
4204
  * TODO: [👷‍♂️] @@@ Manual about construction of llmTools
4154
4205
  */
4155
4206
 
@@ -4387,10 +4438,13 @@
4387
4438
  * @public exported from `@promptbook/utils`
4388
4439
  */
4389
4440
  function countLines(text) {
4441
+ if (text === '') {
4442
+ return 0;
4443
+ }
4390
4444
  text = text.replace('\r\n', '\n');
4391
4445
  text = text.replace('\r', '\n');
4392
4446
  const lines = text.split('\n');
4393
- return lines.reduce((count, line) => count + Math.ceil(line.length / CHARACTERS_PER_STANDARD_LINE), 0);
4447
+ return lines.reduce((count, line) => count + Math.max(Math.ceil(line.length / CHARACTERS_PER_STANDARD_LINE), 1), 0);
4394
4448
  }
4395
4449
  /**
4396
4450
  * TODO: [🥴] Implement counting in formats - like JSON, CSV, XML,...
@@ -4778,6 +4832,8 @@
4778
4832
  * This function provides a common abstraction for result validation that can be used
4779
4833
  * by both execution logic and caching logic to ensure consistency.
4780
4834
  *
4835
+ * Note: [🔂] This function is idempotent.
4836
+ *
4781
4837
  * @param options - The validation options including result string, expectations, and format
4782
4838
  * @returns Validation result with processed string and validity status
4783
4839
  * @private internal function of `createPipelineExecutor` and `cacheLlmTools`
@@ -4797,7 +4853,7 @@
4797
4853
  }
4798
4854
  catch (error) {
4799
4855
  keepUnused(error);
4800
- throw new ExpectError(spaceTrim.spaceTrim((block) => `
4856
+ throw new ExpectError(spaceTrim$1.spaceTrim((block) => `
4801
4857
  Expected valid JSON string
4802
4858
 
4803
4859
  The expected JSON text:
@@ -4846,7 +4902,7 @@
4846
4902
  */
4847
4903
  async function executeAttempts(options) {
4848
4904
  const { jokerParameterNames, priority, maxAttempts, // <- Note: [💂]
4849
- preparedContent, parameters, task, preparedPipeline, tools, $executionReport, pipelineIdentification, maxExecutionAttempts, onProgress, } = options;
4905
+ preparedContent, parameters, task, preparedPipeline, tools, $executionReport, pipelineIdentification, maxExecutionAttempts, onProgress, logLlmCall, } = options;
4850
4906
  const $ongoingTaskResult = {
4851
4907
  $result: null,
4852
4908
  $resultString: null,
@@ -4860,7 +4916,7 @@
4860
4916
  const jokerParameterName = jokerParameterNames[jokerParameterNames.length + attemptIndex];
4861
4917
  // TODO: [🧠][🍭] JOKERS, EXPECTATIONS, POSTPROCESSING and FOREACH
4862
4918
  if (isJokerAttempt && !jokerParameterName) {
4863
- throw new UnexpectedError(spaceTrim.spaceTrim((block) => `
4919
+ throw new UnexpectedError(spaceTrim$1.spaceTrim((block) => `
4864
4920
  Joker not found in attempt ${attemptIndex}
4865
4921
 
4866
4922
  ${block(pipelineIdentification)}
@@ -4871,7 +4927,7 @@
4871
4927
  $ongoingTaskResult.$expectError = null;
4872
4928
  if (isJokerAttempt) {
4873
4929
  if (parameters[jokerParameterName] === undefined) {
4874
- throw new PipelineExecutionError(spaceTrim.spaceTrim((block) => `
4930
+ throw new PipelineExecutionError(spaceTrim$1.spaceTrim((block) => `
4875
4931
  Joker parameter {${jokerParameterName}} not defined
4876
4932
 
4877
4933
  ${block(pipelineIdentification)}
@@ -4929,7 +4985,7 @@
4929
4985
  $ongoingTaskResult.$resultString = $ongoingTaskResult.$completionResult.content;
4930
4986
  break variant;
4931
4987
  case 'EMBEDDING':
4932
- throw new PipelineExecutionError(spaceTrim.spaceTrim((block) => `
4988
+ throw new PipelineExecutionError(spaceTrim$1.spaceTrim((block) => `
4933
4989
  Embedding model can not be used in pipeline
4934
4990
 
4935
4991
  This should be catched during parsing
@@ -4940,7 +4996,7 @@
4940
4996
  break variant;
4941
4997
  // <- case [🤖]:
4942
4998
  default:
4943
- throw new PipelineExecutionError(spaceTrim.spaceTrim((block) => `
4999
+ throw new PipelineExecutionError(spaceTrim$1.spaceTrim((block) => `
4944
5000
  Unknown model variant "${task.modelRequirements.modelVariant}"
4945
5001
 
4946
5002
  ${block(pipelineIdentification)}
@@ -4951,14 +5007,14 @@
4951
5007
  break;
4952
5008
  case 'SCRIPT_TASK':
4953
5009
  if (arrayableToArray(tools.script).length === 0) {
4954
- throw new PipelineExecutionError(spaceTrim.spaceTrim((block) => `
5010
+ throw new PipelineExecutionError(spaceTrim$1.spaceTrim((block) => `
4955
5011
  No script execution tools are available
4956
5012
 
4957
5013
  ${block(pipelineIdentification)}
4958
5014
  `));
4959
5015
  }
4960
5016
  if (!task.contentLanguage) {
4961
- throw new PipelineExecutionError(spaceTrim.spaceTrim((block) => `
5017
+ throw new PipelineExecutionError(spaceTrim$1.spaceTrim((block) => `
4962
5018
  Script language is not defined for SCRIPT TASK "${task.name}"
4963
5019
 
4964
5020
  ${block(pipelineIdentification)}
@@ -4989,7 +5045,7 @@
4989
5045
  throw $ongoingTaskResult.$scriptPipelineExecutionErrors[0];
4990
5046
  }
4991
5047
  else {
4992
- throw new PipelineExecutionError(spaceTrim.spaceTrim((block) => `
5048
+ throw new PipelineExecutionError(spaceTrim$1.spaceTrim((block) => `
4993
5049
  Script execution failed ${$ongoingTaskResult.$scriptPipelineExecutionErrors.length}x
4994
5050
 
4995
5051
  ${block(pipelineIdentification)}
@@ -5003,7 +5059,7 @@
5003
5059
  break taskType;
5004
5060
  case 'DIALOG_TASK':
5005
5061
  if (tools.userInterface === undefined) {
5006
- throw new PipelineExecutionError(spaceTrim.spaceTrim((block) => `
5062
+ throw new PipelineExecutionError(spaceTrim$1.spaceTrim((block) => `
5007
5063
  User interface tools are not available
5008
5064
 
5009
5065
  ${block(pipelineIdentification)}
@@ -5021,7 +5077,7 @@
5021
5077
  break taskType;
5022
5078
  // <- case: [🅱]
5023
5079
  default:
5024
- throw new PipelineExecutionError(spaceTrim.spaceTrim((block) => `
5080
+ throw new PipelineExecutionError(spaceTrim$1.spaceTrim((block) => `
5025
5081
  Unknown execution type "${task.taskType}"
5026
5082
 
5027
5083
  ${block(pipelineIdentification)}
@@ -5094,14 +5150,10 @@
5094
5150
  });
5095
5151
  }
5096
5152
  finally {
5097
- if (!isJokerAttempt &&
5098
- task.taskType === 'PROMPT_TASK' &&
5099
- $ongoingTaskResult.$prompt
5100
- // <- Note: [2] When some expected parameter is not defined, error will occur in templateParameters
5101
- // In that case we don’t want to make a report about it because it’s not a llm execution error
5102
- ) {
5103
- // TODO: [🧠] Maybe put other taskTypes into report
5104
- $executionReport.promptExecutions.push({
5153
+ if (!isJokerAttempt && task.taskType === 'PROMPT_TASK' && $ongoingTaskResult.$prompt) {
5154
+ // Note: [2] When some expected parameter is not defined, error will occur in templateParameters
5155
+ // In that case we don’t want to make a report about it because it’s not a llm execution error
5156
+ const executionPromptReport = {
5105
5157
  prompt: {
5106
5158
  ...$ongoingTaskResult.$prompt,
5107
5159
  // <- TODO: [🧠] How to pick everyhing except `pipelineUrl`
@@ -5110,13 +5162,20 @@
5110
5162
  error: $ongoingTaskResult.$expectError === null
5111
5163
  ? undefined
5112
5164
  : serializeError($ongoingTaskResult.$expectError),
5113
- });
5165
+ };
5166
+ $executionReport.promptExecutions.push(executionPromptReport);
5167
+ if (logLlmCall) {
5168
+ logLlmCall({
5169
+ modelName: 'model' /* <- TODO: How to get model name from the report */,
5170
+ report: executionPromptReport,
5171
+ });
5172
+ }
5114
5173
  }
5115
5174
  }
5116
5175
  if ($ongoingTaskResult.$expectError !== null && attemptIndex === maxAttempts - 1) {
5117
5176
  // Note: Create a summary of all failures
5118
5177
  const failuresSummary = $ongoingTaskResult.$failedResults
5119
- .map((failure) => spaceTrim.spaceTrim((block) => {
5178
+ .map((failure) => spaceTrim$1.spaceTrim((block) => {
5120
5179
  var _a, _b;
5121
5180
  return `
5122
5181
  Attempt ${failure.attemptIndex + 1}:
@@ -5126,14 +5185,14 @@
5126
5185
  Result:
5127
5186
  ${block(failure.result === null
5128
5187
  ? 'null'
5129
- : spaceTrim.spaceTrim(failure.result)
5188
+ : spaceTrim$1.spaceTrim(failure.result)
5130
5189
  .split('\n')
5131
5190
  .map((line) => `> ${line}`)
5132
5191
  .join('\n'))}
5133
5192
  `;
5134
5193
  }))
5135
5194
  .join('\n\n---\n\n');
5136
- throw new PipelineExecutionError(spaceTrim.spaceTrim((block) => {
5195
+ throw new PipelineExecutionError(spaceTrim$1.spaceTrim((block) => {
5137
5196
  var _a;
5138
5197
  return `
5139
5198
  LLM execution failed ${maxExecutionAttempts}x
@@ -5153,7 +5212,7 @@
5153
5212
  }
5154
5213
  }
5155
5214
  if ($ongoingTaskResult.$resultString === null) {
5156
- throw new UnexpectedError(spaceTrim.spaceTrim((block) => `
5215
+ throw new UnexpectedError(spaceTrim$1.spaceTrim((block) => `
5157
5216
  Something went wrong and prompt result is null
5158
5217
 
5159
5218
  ${block(pipelineIdentification)}
@@ -5175,9 +5234,9 @@
5175
5234
  * @private internal utility of `createPipelineExecutor`
5176
5235
  */
5177
5236
  async function executeFormatSubvalues(options) {
5178
- const { task, jokerParameterNames, parameters, priority, csvSettings, onProgress, pipelineIdentification } = options;
5237
+ const { task, jokerParameterNames, parameters, priority, csvSettings, onProgress, logLlmCall, pipelineIdentification, } = options;
5179
5238
  if (task.foreach === undefined) {
5180
- return /* not await */ executeAttempts(options);
5239
+ return /* not await */ executeAttempts({ ...options, logLlmCall });
5181
5240
  }
5182
5241
  if (jokerParameterNames.length !== 0) {
5183
5242
  throw new UnexpectedError(spaceTrim__default["default"]((block) => `
@@ -5383,7 +5442,7 @@
5383
5442
  },
5384
5443
  content: task.content,
5385
5444
  parameters,
5386
- };
5445
+ }; /* <- Note: [🤛] */
5387
5446
  const taskEmbeddingResult = await llmTools.callEmbeddingModel(taskEmbeddingPrompt);
5388
5447
  const knowledgePiecesWithRelevance = preparedPipeline.knowledgePieces.map((knowledgePiece) => {
5389
5448
  const { index } = knowledgePiece;
@@ -5459,7 +5518,7 @@
5459
5518
  // Note: Doublecheck that ALL reserved parameters are defined:
5460
5519
  for (const parameterName of RESERVED_PARAMETER_NAMES) {
5461
5520
  if (reservedParameters[parameterName] === undefined) {
5462
- throw new UnexpectedError(spaceTrim.spaceTrim((block) => `
5521
+ throw new UnexpectedError(spaceTrim$1.spaceTrim((block) => `
5463
5522
  Reserved parameter {${parameterName}} is not defined
5464
5523
 
5465
5524
  ${block(pipelineIdentification)}
@@ -5478,14 +5537,14 @@
5478
5537
  * @private internal utility of `createPipelineExecutor`
5479
5538
  */
5480
5539
  async function executeTask(options) {
5481
- const { currentTask, preparedPipeline, parametersToPass, tools, onProgress, $executionReport, pipelineIdentification, maxExecutionAttempts, maxParallelCount, csvSettings, isVerbose, rootDirname, cacheDirname, intermediateFilesStrategy, isAutoInstalled, isNotPreparedWarningSuppressed, } = options;
5540
+ const { currentTask, preparedPipeline, parametersToPass, tools, onProgress, logLlmCall, $executionReport, pipelineIdentification, maxExecutionAttempts, maxParallelCount, csvSettings, isVerbose, rootDirname, cacheDirname, intermediateFilesStrategy, isAutoInstalled, isNotPreparedWarningSuppressed, } = options;
5482
5541
  const priority = preparedPipeline.tasks.length - preparedPipeline.tasks.indexOf(currentTask);
5483
5542
  // Note: Check consistency of used and dependent parameters which was also done in `validatePipeline`, but it’s good to doublecheck
5484
5543
  const usedParameterNames = extractParameterNamesFromTask(currentTask);
5485
5544
  const dependentParameterNames = new Set(currentTask.dependentParameterNames);
5486
5545
  // TODO: [👩🏾‍🤝‍👩🏻] Use here `mapAvailableToExpectedParameters`
5487
5546
  if (difference(union(difference(usedParameterNames, dependentParameterNames), difference(dependentParameterNames, usedParameterNames)), new Set(RESERVED_PARAMETER_NAMES)).size !== 0) {
5488
- throw new UnexpectedError(spaceTrim.spaceTrim((block) => `
5547
+ throw new UnexpectedError(spaceTrim$1.spaceTrim((block) => `
5489
5548
  Dependent parameters are not consistent with used parameters:
5490
5549
 
5491
5550
  Dependent parameters:
@@ -5529,7 +5588,7 @@
5529
5588
  else if (!definedParameterNames.has(parameterName) && usedParameterNames.has(parameterName)) {
5530
5589
  // Houston, we have a problem
5531
5590
  // Note: Checking part is also done in `validatePipeline`, but it’s good to doublecheck
5532
- throw new UnexpectedError(spaceTrim.spaceTrim((block) => `
5591
+ throw new UnexpectedError(spaceTrim$1.spaceTrim((block) => `
5533
5592
  Parameter \`{${parameterName}}\` is NOT defined
5534
5593
  BUT used in task "${currentTask.title || currentTask.name}"
5535
5594
 
@@ -5557,6 +5616,7 @@
5557
5616
  tools,
5558
5617
  $executionReport,
5559
5618
  onProgress,
5619
+ logLlmCall,
5560
5620
  pipelineIdentification,
5561
5621
  maxExecutionAttempts,
5562
5622
  maxParallelCount,
@@ -5597,9 +5657,32 @@
5597
5657
  for (const parameter of preparedPipeline.parameters.filter(({ isOutput }) => isOutput)) {
5598
5658
  if (parametersToPass[parameter.name] === undefined) {
5599
5659
  // [4]
5600
- $warnings.push(new PipelineExecutionError(spaceTrim.spaceTrim((block) => `
5660
+ $warnings.push(new PipelineExecutionError(spaceTrim$1.spaceTrim((block) => `
5601
5661
  Parameter \`{${parameter.name}}\` should be an output parameter, but it was not generated during pipeline execution
5602
5662
 
5663
+ Note: This is a warning which happened after the pipeline was executed, and \`{${parameter.name}}\` was not for some reason defined in output parameters
5664
+
5665
+ All parameters:
5666
+ ${block(preparedPipeline.parameters
5667
+ .map(({ name, isInput, isOutput, description }) => {
5668
+ let line = `\`{${name}}\``;
5669
+ if (isInput) {
5670
+ line += ' `[input parameter]`';
5671
+ }
5672
+ if (isOutput) {
5673
+ line += ' `[output parameter]`';
5674
+ }
5675
+ if (parametersToPass[name] === undefined) {
5676
+ line += ` <- Warning: Should be in the output but its not |`;
5677
+ }
5678
+ if (description) {
5679
+ line += ` ${description}`;
5680
+ }
5681
+ return line;
5682
+ })
5683
+ .map((line, index) => `${index + 1}) ${line}`)
5684
+ .join('\n'))}
5685
+
5603
5686
  ${block(pipelineIdentification)}
5604
5687
  `)));
5605
5688
  continue;
@@ -5620,7 +5703,7 @@
5620
5703
  * @private internal utility of `createPipelineExecutor`
5621
5704
  */
5622
5705
  async function executePipeline(options) {
5623
- const { inputParameters, tools, onProgress, pipeline, setPreparedPipeline, pipelineIdentification, maxParallelCount, rootDirname, isVerbose, } = options;
5706
+ const { inputParameters, tools, onProgress, logLlmCall, pipeline, setPreparedPipeline, pipelineIdentification, maxParallelCount, rootDirname, isVerbose, } = options;
5624
5707
  let { preparedPipeline } = options;
5625
5708
  if (preparedPipeline === undefined) {
5626
5709
  preparedPipeline = await preparePipeline(pipeline, tools, {
@@ -5682,7 +5765,7 @@
5682
5765
  for (const parameterName of Object.keys(inputParameters)) {
5683
5766
  const parameter = preparedPipeline.parameters.find(({ name }) => name === parameterName);
5684
5767
  if (parameter === undefined) {
5685
- warnings.push(new PipelineExecutionError(spaceTrim.spaceTrim((block) => `
5768
+ warnings.push(new PipelineExecutionError(spaceTrim$1.spaceTrim((block) => `
5686
5769
  Extra parameter {${parameterName}} is being passed which is not part of the pipeline.
5687
5770
 
5688
5771
  ${block(pipelineIdentification)}
@@ -5697,7 +5780,7 @@
5697
5780
  // TODO: [🧠] This should be also non-critical error
5698
5781
  return exportJson({
5699
5782
  name: 'pipelineExecutorResult',
5700
- message: spaceTrim.spaceTrim((block) => `
5783
+ message: spaceTrim$1.spaceTrim((block) => `
5701
5784
  Unsuccessful PipelineExecutorResult (with extra parameter {${parameter.name}}) PipelineExecutorResult
5702
5785
 
5703
5786
  ${block(pipelineIdentification)}
@@ -5706,7 +5789,7 @@
5706
5789
  value: {
5707
5790
  isSuccessful: false,
5708
5791
  errors: [
5709
- new PipelineExecutionError(spaceTrim.spaceTrim((block) => `
5792
+ new PipelineExecutionError(spaceTrim$1.spaceTrim((block) => `
5710
5793
  Parameter \`{${parameter.name}}\` is passed as input parameter but it is not input
5711
5794
 
5712
5795
  ${block(pipelineIdentification)}
@@ -5733,7 +5816,7 @@
5733
5816
  while (unresovedTasks.length > 0) {
5734
5817
  if (loopLimit-- < 0) {
5735
5818
  // Note: Really UnexpectedError not LimitReachedError - this should be catched during validatePipeline
5736
- throw new UnexpectedError(spaceTrim.spaceTrim((block) => `
5819
+ throw new UnexpectedError(spaceTrim$1.spaceTrim((block) => `
5737
5820
  Loop limit reached during resolving parameters pipeline execution
5738
5821
 
5739
5822
  ${block(pipelineIdentification)}
@@ -5743,7 +5826,7 @@
5743
5826
  if (!currentTask && resolving.length === 0) {
5744
5827
  throw new UnexpectedError(
5745
5828
  // TODO: [🐎] DRY
5746
- spaceTrim.spaceTrim((block) => `
5829
+ spaceTrim$1.spaceTrim((block) => `
5747
5830
  Can not resolve some parameters:
5748
5831
 
5749
5832
  ${block(pipelineIdentification)}
@@ -5783,7 +5866,7 @@
5783
5866
  tools,
5784
5867
  onProgress(newOngoingResult) {
5785
5868
  if (isReturned) {
5786
- throw new UnexpectedError(spaceTrim.spaceTrim((block) => `
5869
+ throw new UnexpectedError(spaceTrim$1.spaceTrim((block) => `
5787
5870
  Can not call \`onProgress\` after pipeline execution is finished
5788
5871
 
5789
5872
  ${block(pipelineIdentification)}
@@ -5798,8 +5881,9 @@
5798
5881
  onProgress(newOngoingResult);
5799
5882
  }
5800
5883
  },
5884
+ logLlmCall,
5801
5885
  $executionReport: executionReport,
5802
- pipelineIdentification: spaceTrim.spaceTrim((block) => `
5886
+ pipelineIdentification: spaceTrim$1.spaceTrim((block) => `
5803
5887
  ${block(pipelineIdentification)}
5804
5888
  Task name: ${currentTask.name}
5805
5889
  Task title: ${currentTask.title}
@@ -5908,7 +5992,7 @@
5908
5992
  preparedPipeline = pipeline;
5909
5993
  }
5910
5994
  else if (isNotPreparedWarningSuppressed !== true) {
5911
- console.warn(spaceTrim.spaceTrim((block) => `
5995
+ console.warn(spaceTrim$1.spaceTrim((block) => `
5912
5996
  Pipeline is not prepared
5913
5997
 
5914
5998
  ${block(pipelineIdentification)}
@@ -5921,7 +6005,7 @@
5921
6005
  // <- TODO: [🏮] Some standard way how to transform errors into warnings and how to handle non-critical fails during the tasks
5922
6006
  }
5923
6007
  let runCount = 0;
5924
- const pipelineExecutorWithCallback = async (inputParameters, onProgress) => {
6008
+ const pipelineExecutorWithCallback = async (inputParameters, onProgress, logLlmCall) => {
5925
6009
  runCount++;
5926
6010
  return /* not await */ executePipeline({
5927
6011
  pipeline,
@@ -5932,7 +6016,8 @@
5932
6016
  inputParameters,
5933
6017
  tools,
5934
6018
  onProgress,
5935
- pipelineIdentification: spaceTrim.spaceTrim((block) => `
6019
+ logLlmCall,
6020
+ pipelineIdentification: spaceTrim$1.spaceTrim((block) => `
5936
6021
  ${block(pipelineIdentification)}
5937
6022
  ${runCount === 1 ? '' : `Run #${runCount}`}
5938
6023
  `),
@@ -6149,7 +6234,7 @@
6149
6234
  throw new MissingToolsError('LLM tools are required for preparing persona');
6150
6235
  }
6151
6236
  // TODO: [🌼] In future use `ptbk make` and made getPipelineCollection
6152
- const collection = createCollectionFromJson(...PipelineCollection);
6237
+ const collection = createPipelineCollectionFromJson(...PipelineCollection);
6153
6238
  const preparePersonaExecutor = createPipelineExecutor({
6154
6239
  pipeline: await collection.getPipelineByUrl('https://promptbook.studio/promptbook/prepare-persona.book'),
6155
6240
  tools,
@@ -6452,6 +6537,8 @@
6452
6537
  /**
6453
6538
  * Converts a given text to kebab-case format.
6454
6539
  *
6540
+ * Note: [🔂] This function is idempotent.
6541
+ *
6455
6542
  * @param text The text to be converted.
6456
6543
  * @returns The kebab-case formatted string.
6457
6544
  * @example 'hello-world'
@@ -6607,6 +6694,8 @@
6607
6694
  /**
6608
6695
  * Converts a title string into a normalized name.
6609
6696
  *
6697
+ * Note: [🔂] This function is idempotent.
6698
+ *
6610
6699
  * @param value The title string to be converted to a name.
6611
6700
  * @returns A normalized name derived from the input title.
6612
6701
  * @example 'Hello World!' -> 'hello-world'
@@ -6995,7 +7084,7 @@
6995
7084
  if (task.taskType === 'PROMPT_TASK' &&
6996
7085
  knowledgePiecesCount > 0 &&
6997
7086
  !dependentParameterNames.includes('knowledge')) {
6998
- preparedContent = spaceTrim.spaceTrim(`
7087
+ preparedContent = spaceTrim$1.spaceTrim(`
6999
7088
  {content}
7000
7089
 
7001
7090
  ## Knowledge
@@ -7081,7 +7170,7 @@
7081
7170
  let title = pipeline.title;
7082
7171
  if (title === undefined || title === '' || title === DEFAULT_BOOK_TITLE) {
7083
7172
  // TODO: [🌼] In future use `ptbk make` and made getPipelineCollection
7084
- const collection = createCollectionFromJson(...PipelineCollection);
7173
+ const collection = createPipelineCollectionFromJson(...PipelineCollection);
7085
7174
  const prepareTitleExecutor = createPipelineExecutor({
7086
7175
  pipeline: await collection.getPipelineByUrl('https://promptbook.studio/promptbook/prepare-title.book'),
7087
7176
  tools,
@@ -7889,6 +7978,8 @@
7889
7978
  /**
7890
7979
  * Normalizes a given text to camelCase format.
7891
7980
  *
7981
+ * Note: [🔂] This function is idempotent.
7982
+ *
7892
7983
  * @param text The text to be normalized.
7893
7984
  * @param _isFirstLetterCapital Whether the first letter should be capitalized.
7894
7985
  * @returns The camelCase formatted string.
@@ -7966,6 +8057,8 @@
7966
8057
  * Function `validateParameterName` will normalize and validate a parameter name for use in pipelines.
7967
8058
  * It removes diacritics, emojis, and quotes, normalizes to camelCase, and checks for reserved names and invalid characters.
7968
8059
  *
8060
+ * Note: [🔂] This function is idempotent.
8061
+ *
7969
8062
  * @param parameterName The parameter name to validate and normalize.
7970
8063
  * @returns The validated and normalized parameter name.
7971
8064
  * @throws {ParseError} If the parameter name is empty, reserved, or contains invalid characters.
@@ -8718,7 +8811,7 @@
8718
8811
  * @see {@link ModelVariant}
8719
8812
  * @public exported from `@promptbook/core`
8720
8813
  */
8721
- const MODEL_VARIANTS = ['COMPLETION', 'CHAT', 'EMBEDDING' /* <- TODO [🏳] */ /* <- [🤖] */];
8814
+ const MODEL_VARIANTS = ['COMPLETION', 'CHAT', 'IMAGE_GENERATION', 'EMBEDDING' /* <- TODO [🏳] */ /* <- [🤖] */];
8722
8815
 
8723
8816
  /**
8724
8817
  * Parses the model command
@@ -9508,7 +9601,7 @@
9508
9601
  function getParserForCommand(command) {
9509
9602
  const commandParser = COMMANDS.find((commandParser) => commandParser.name === command.type);
9510
9603
  if (commandParser === undefined) {
9511
- throw new UnexpectedError(spaceTrim.spaceTrim((block) => `
9604
+ throw new UnexpectedError(spaceTrim$1.spaceTrim((block) => `
9512
9605
  Command ${command.type} parser is not found
9513
9606
 
9514
9607
  ${block(JSON.stringify(command, null, 4)
@@ -9584,7 +9677,7 @@
9584
9677
  .map(removeMarkdownFormatting)
9585
9678
  .map((item) => item.trim());
9586
9679
  if (items.length === 0 || items[0] === '') {
9587
- throw new ParseError(spaceTrim.spaceTrim((block) => `
9680
+ throw new ParseError(spaceTrim$1.spaceTrim((block) => `
9588
9681
  Malformed command:
9589
9682
  - ${raw}
9590
9683
 
@@ -9620,7 +9713,7 @@
9620
9713
  return command;
9621
9714
  }
9622
9715
  }
9623
- throw new ParseError(spaceTrim.spaceTrim((block) => `
9716
+ throw new ParseError(spaceTrim$1.spaceTrim((block) => `
9624
9717
  Malformed or unknown command:
9625
9718
  - ${raw}
9626
9719
 
@@ -9671,7 +9764,7 @@
9671
9764
  if (!(error instanceof ParseError)) {
9672
9765
  throw error;
9673
9766
  }
9674
- throw new ParseError(spaceTrim.spaceTrim((block) => `
9767
+ throw new ParseError(spaceTrim$1.spaceTrim((block) => `
9675
9768
  Invalid ${commandName} command:
9676
9769
 
9677
9770
  Your command:
@@ -9937,6 +10030,48 @@
9937
10030
  const SUPPORTED_SCRIPT_LANGUAGES = ['javascript', 'typescript', 'python'];
9938
10031
  // <- TODO: [🏥] DRY
9939
10032
 
10033
+ /**
10034
+ * Number of padding lines to add at the end of the book content
10035
+ *
10036
+ * @public exported from `@promptbook/core`
10037
+ */
10038
+ const PADDING_LINES = 11;
10039
+ /**
10040
+ * A function that adds padding to the book content
10041
+ *
10042
+ * Note: [🔂] This function is idempotent.
10043
+ *
10044
+ * @public exported from `@promptbook/core`
10045
+ */
10046
+ function padBook(content) {
10047
+ if (!content) {
10048
+ return '\n'.repeat(PADDING_LINES);
10049
+ }
10050
+ const lines = content.split('\n');
10051
+ let trailingEmptyLines = 0;
10052
+ for (let i = lines.length - 1; i >= 0; i--) {
10053
+ const line = lines[i];
10054
+ if (line === undefined) {
10055
+ // Note: This should not happen in reality, but it's here to satisfy TypeScript's noUncheckedIndexedAccess option
10056
+ continue;
10057
+ }
10058
+ if (line.trim() === '') {
10059
+ trailingEmptyLines++;
10060
+ }
10061
+ else {
10062
+ break;
10063
+ }
10064
+ }
10065
+ if (trailingEmptyLines >= PADDING_LINES) {
10066
+ return content;
10067
+ }
10068
+ const linesToAdd = PADDING_LINES - trailingEmptyLines;
10069
+ return (content + '\n'.repeat(linesToAdd));
10070
+ }
10071
+ /**
10072
+ * TODO: [🧠] Maybe export
10073
+ */
10074
+
9940
10075
  /**
9941
10076
  * Removes Markdown (or HTML) comments
9942
10077
  *
@@ -9945,7 +10080,7 @@
9945
10080
  * @public exported from `@promptbook/markdown-utils`
9946
10081
  */
9947
10082
  function removeMarkdownComments(content) {
9948
- return spaceTrim.spaceTrim(content.replace(/<!--(.*?)-->/gs, ''));
10083
+ return spaceTrim$1.spaceTrim(content.replace(/<!--(.*?)-->/gs, ''));
9949
10084
  }
9950
10085
 
9951
10086
  /**
@@ -9982,6 +10117,7 @@
9982
10117
  if (!isFlatPipeline(pipelineString)) {
9983
10118
  return pipelineString;
9984
10119
  }
10120
+ pipelineString = spaceTrim__default["default"](pipelineString);
9985
10121
  const pipelineStringLines = pipelineString.split('\n');
9986
10122
  const potentialReturnStatement = pipelineStringLines.pop();
9987
10123
  let returnStatement;
@@ -10016,7 +10152,7 @@
10016
10152
  ${returnStatement}
10017
10153
  `));
10018
10154
  // <- TODO: Maybe use book` notation
10019
- return pipelineString;
10155
+ return padBook(pipelineString);
10020
10156
  }
10021
10157
  /**
10022
10158
  * TODO: Unit test
@@ -10260,7 +10396,7 @@
10260
10396
  if (pipelineString.startsWith('#!')) {
10261
10397
  const [shebangLine, ...restLines] = pipelineString.split('\n');
10262
10398
  if (!(shebangLine || '').includes('ptbk')) {
10263
- throw new ParseError(spaceTrim.spaceTrim((block) => `
10399
+ throw new ParseError(spaceTrim$1.spaceTrim((block) => `
10264
10400
  It seems that you try to parse a book file which has non-standard shebang line for book files:
10265
10401
  Shebang line must contain 'ptbk'
10266
10402
 
@@ -10276,7 +10412,7 @@
10276
10412
  pipelineString = validatePipelineString(restLines.join('\n'));
10277
10413
  }
10278
10414
  pipelineString = removeMarkdownComments(pipelineString);
10279
- pipelineString = spaceTrim.spaceTrim(pipelineString);
10415
+ pipelineString = spaceTrim$1.spaceTrim(pipelineString);
10280
10416
  // <- TODO: [😧] `spaceTrim` should preserve discriminated type *(or at lease `PipelineString`)*
10281
10417
  pipelineString = deflatePipeline(pipelineString);
10282
10418
  // ==============
@@ -10288,7 +10424,7 @@
10288
10424
  // ==============
10289
10425
  // Note: 1️⃣◽4️⃣ Check markdown structure
10290
10426
  if (pipelineHead === undefined) {
10291
- throw new UnexpectedError(spaceTrim.spaceTrim((block) => `
10427
+ throw new UnexpectedError(spaceTrim$1.spaceTrim((block) => `
10292
10428
  Pipeline head is not defined
10293
10429
 
10294
10430
  ${block(getPipelineIdentification())}
@@ -10297,7 +10433,7 @@
10297
10433
  `));
10298
10434
  }
10299
10435
  if (pipelineHead.level !== 1) {
10300
- throw new UnexpectedError(spaceTrim.spaceTrim((block) => `
10436
+ throw new UnexpectedError(spaceTrim$1.spaceTrim((block) => `
10301
10437
  Pipeline head is not h1
10302
10438
 
10303
10439
  ${block(getPipelineIdentification())}
@@ -10306,7 +10442,7 @@
10306
10442
  `));
10307
10443
  }
10308
10444
  if (!pipelineSections.every((section) => section.level === 2)) {
10309
- throw new UnexpectedError(spaceTrim.spaceTrim((block) => `
10445
+ throw new UnexpectedError(spaceTrim$1.spaceTrim((block) => `
10310
10446
  Not every pipeline section is h2
10311
10447
 
10312
10448
  ${block(getPipelineIdentification())}
@@ -10319,7 +10455,7 @@
10319
10455
  const defineParam = (parameterCommand) => {
10320
10456
  const { parameterName, parameterDescription, isInput, isOutput } = parameterCommand;
10321
10457
  if (RESERVED_PARAMETER_NAMES.includes(parameterName)) {
10322
- throw new ParseError(spaceTrim.spaceTrim((block) => `
10458
+ throw new ParseError(spaceTrim$1.spaceTrim((block) => `
10323
10459
  Parameter name {${parameterName}} is reserved and cannot be used as resulting parameter name
10324
10460
 
10325
10461
  ${block(getPipelineIdentification())}
@@ -10330,7 +10466,7 @@
10330
10466
  existingParameter.description &&
10331
10467
  existingParameter.description !== parameterDescription &&
10332
10468
  parameterDescription) {
10333
- throw new ParseError(spaceTrim.spaceTrim((block) => `
10469
+ throw new ParseError(spaceTrim$1.spaceTrim((block) => `
10334
10470
  Parameter \`{${parameterName}}\` is defined multiple times with different description:
10335
10471
 
10336
10472
  ${block(getPipelineIdentification())}
@@ -10368,7 +10504,7 @@
10368
10504
  description = description.split(/^>.*$/gm).join('');
10369
10505
  //Note: Remove lists and return statement - TODO: [🎾] Make util (exported from `@promptbool/utils`)
10370
10506
  description = description.split(/^(?:(?:-)|(?:\d\))|(?:`?->))\s+.*$/gm).join('');
10371
- description = spaceTrim.spaceTrim(description);
10507
+ description = spaceTrim$1.spaceTrim(description);
10372
10508
  if (description === '') {
10373
10509
  description = undefined;
10374
10510
  }
@@ -10379,7 +10515,7 @@
10379
10515
  const command = parseCommand(listItem, 'PIPELINE_HEAD');
10380
10516
  const commandParser = getParserForCommand(command);
10381
10517
  if (commandParser.isUsedInPipelineHead !== true /* <- Note: [🦦][4] */) {
10382
- throw new ParseError(spaceTrim.spaceTrim((block) => `
10518
+ throw new ParseError(spaceTrim$1.spaceTrim((block) => `
10383
10519
  Command \`${command.type}\` is not allowed in the head of the pipeline ONLY at the pipeline task
10384
10520
 
10385
10521
  ${block(getPipelineIdentification())}
@@ -10393,7 +10529,7 @@
10393
10529
  if (!(error instanceof ParseError)) {
10394
10530
  throw error;
10395
10531
  }
10396
- throw new ParseError(spaceTrim.spaceTrim((block) => `
10532
+ throw new ParseError(spaceTrim$1.spaceTrim((block) => `
10397
10533
  Command ${command.type} failed to apply to the pipeline
10398
10534
 
10399
10535
  The error:
@@ -10446,7 +10582,7 @@
10446
10582
  description = description.split(/^>.*$/gm).join('');
10447
10583
  //Note: Remove lists and return statement - TODO: [🎾]
10448
10584
  description = description.split(/^(?:(?:-)|(?:\d\))|(?:`?->))\s+.*$/gm).join('');
10449
- description = spaceTrim.spaceTrim(description);
10585
+ description = spaceTrim$1.spaceTrim(description);
10450
10586
  if (description === '') {
10451
10587
  description = undefined;
10452
10588
  }
@@ -10480,7 +10616,7 @@
10480
10616
  for (const { listItem, command } of commands) {
10481
10617
  const commandParser = getParserForCommand(command);
10482
10618
  if (commandParser.isUsedInPipelineTask !== true /* <- Note: [🦦][4] */) {
10483
- throw new ParseError(spaceTrim.spaceTrim((block) => `
10619
+ throw new ParseError(spaceTrim$1.spaceTrim((block) => `
10484
10620
  Command \`${command.type}\` is not allowed in the task of the promptbook ONLY at the pipeline head
10485
10621
 
10486
10622
  ${block(getPipelineIdentification())}
@@ -10495,7 +10631,7 @@
10495
10631
  if (!(error instanceof ParseError)) {
10496
10632
  throw error;
10497
10633
  }
10498
- throw new ParseError(spaceTrim.spaceTrim((block) => `
10634
+ throw new ParseError(spaceTrim$1.spaceTrim((block) => `
10499
10635
  Command \`${command.type}\` failed to apply to the task
10500
10636
 
10501
10637
  The error:
@@ -10526,14 +10662,14 @@
10526
10662
  // TODO: [🍧] Should be done in SECTION command
10527
10663
  if ($taskJson.taskType === 'SCRIPT_TASK') {
10528
10664
  if (!language) {
10529
- throw new ParseError(spaceTrim.spaceTrim((block) => `
10665
+ throw new ParseError(spaceTrim$1.spaceTrim((block) => `
10530
10666
  You must specify the language of the script in the \`SCRIPT\` task
10531
10667
 
10532
10668
  ${block(getPipelineIdentification())}
10533
10669
  `));
10534
10670
  }
10535
10671
  if (!SUPPORTED_SCRIPT_LANGUAGES.includes(language)) {
10536
- throw new ParseError(spaceTrim.spaceTrim((block) => `
10672
+ throw new ParseError(spaceTrim$1.spaceTrim((block) => `
10537
10673
  Script language ${language} is not supported.
10538
10674
 
10539
10675
  Supported languages are:
@@ -10829,11 +10965,11 @@
10829
10965
  console.warn(`Command "${humanReadableCommand}" exited with code ${code}`);
10830
10966
  // <- TODO: [🏮] Some standard way how to transform errors into warnings and how to handle non-critical fails during the tasks
10831
10967
  }
10832
- resolve(spaceTrim.spaceTrim(output.join('\n')));
10968
+ resolve(spaceTrim$1.spaceTrim(output.join('\n')));
10833
10969
  }
10834
10970
  }
10835
10971
  else {
10836
- resolve(spaceTrim.spaceTrim(output.join('\n')));
10972
+ resolve(spaceTrim$1.spaceTrim(output.join('\n')));
10837
10973
  }
10838
10974
  };
10839
10975
  commandProcess.on('close', finishWithCode);
@@ -10851,7 +10987,7 @@
10851
10987
  console.warn(error);
10852
10988
  // <- TODO: [🏮] Some standard way how to transform errors into warnings and how to handle non-critical fails during the tasks
10853
10989
  }
10854
- resolve(spaceTrim.spaceTrim(output.join('\n')));
10990
+ resolve(spaceTrim$1.spaceTrim(output.join('\n')));
10855
10991
  }
10856
10992
  });
10857
10993
  }
@@ -10904,6 +11040,7 @@
10904
11040
  writeFile: promises.writeFile,
10905
11041
  readdir: promises.readdir,
10906
11042
  mkdir: promises.mkdir,
11043
+ watch: promises.watch,
10907
11044
  };
10908
11045
  }
10909
11046
  /**
@@ -11191,10 +11328,10 @@
11191
11328
  var _a, _b;
11192
11329
  const isMetadataAviailable = $llmToolsMetadataRegister
11193
11330
  .list()
11194
- .find(({ packageName, className }) => metadata.packageName === packageName && metadata.className === className);
11331
+ .some(({ packageName, className }) => metadata.packageName === packageName && metadata.className === className);
11195
11332
  const isInstalled = $llmToolsRegister
11196
11333
  .list()
11197
- .find(({ packageName, className }) => metadata.packageName === packageName && metadata.className === className);
11334
+ .some(({ packageName, className }) => metadata.packageName === packageName && metadata.className === className);
11198
11335
  const isFullyConfigured = ((_a = metadata.envVariables) === null || _a === void 0 ? void 0 : _a.every((envVariableName) => env[envVariableName] !== undefined)) || false;
11199
11336
  const isPartiallyConfigured = ((_b = metadata.envVariables) === null || _b === void 0 ? void 0 : _b.some((envVariableName) => env[envVariableName] !== undefined)) || false;
11200
11337
  // <- Note: [🗨]
@@ -11622,6 +11759,9 @@
11622
11759
  }
11623
11760
 
11624
11761
  /**
11762
+ * Normalizes a given text to PascalCase format.
11763
+ *
11764
+ * Note: [🔂] This function is idempotent.
11625
11765
  *
11626
11766
  * @param text @public exported from `@promptbook/utils`
11627
11767
  * @returns
@@ -11662,7 +11802,7 @@
11662
11802
  let trimmedText = text;
11663
11803
  // Remove leading and trailing spaces and newlines
11664
11804
  if (isTrimmed) {
11665
- trimmedText = spaceTrim.spaceTrim(trimmedText);
11805
+ trimmedText = spaceTrim$1.spaceTrim(trimmedText);
11666
11806
  }
11667
11807
  let processedText = trimmedText;
11668
11808
  if (isIntroduceSentenceRemoved) {
@@ -11671,7 +11811,7 @@
11671
11811
  // Remove the introduce sentence and quotes by replacing it with an empty string
11672
11812
  processedText = processedText.replace(introduceSentenceRegex, '');
11673
11813
  }
11674
- processedText = spaceTrim.spaceTrim(processedText);
11814
+ processedText = spaceTrim$1.spaceTrim(processedText);
11675
11815
  }
11676
11816
  if (processedText.length < 3) {
11677
11817
  return trimmedText;
@@ -11778,13 +11918,13 @@
11778
11918
  * @public exported from `@promptbook/markdown-utils`
11779
11919
  */
11780
11920
  function trimCodeBlock(value) {
11781
- value = spaceTrim.spaceTrim(value);
11921
+ value = spaceTrim$1.spaceTrim(value);
11782
11922
  if (!/^```[a-z]*(.*)```$/is.test(value)) {
11783
11923
  return value;
11784
11924
  }
11785
11925
  value = value.replace(/^```[a-z]*/i, '');
11786
11926
  value = value.replace(/```$/i, '');
11787
- value = spaceTrim.spaceTrim(value);
11927
+ value = spaceTrim$1.spaceTrim(value);
11788
11928
  return value;
11789
11929
  }
11790
11930
 
@@ -11797,9 +11937,9 @@
11797
11937
  * @public exported from `@promptbook/markdown-utils`
11798
11938
  */
11799
11939
  function trimEndOfCodeBlock(value) {
11800
- value = spaceTrim.spaceTrim(value);
11940
+ value = spaceTrim$1.spaceTrim(value);
11801
11941
  value = value.replace(/```$/g, '');
11802
- value = spaceTrim.spaceTrim(value);
11942
+ value = spaceTrim$1.spaceTrim(value);
11803
11943
  return value;
11804
11944
  }
11805
11945
 
@@ -12088,7 +12228,7 @@
12088
12228
  * @param path
12089
12229
  * @param isRecursive
12090
12230
  * @returns List of all files in the directory
12091
- * @private internal function of `createCollectionFromDirectory`
12231
+ * @private internal function of `AgentCollectionInDirectory` and `createPipelineCollectionFromDirectory`
12092
12232
  */
12093
12233
  async function listAllFiles(path$1, isRecursive, fs) {
12094
12234
  if (!(await isDirectoryExisting(path$1, fs))) {
@@ -12116,26 +12256,27 @@
12116
12256
  */
12117
12257
 
12118
12258
  /**
12119
- * Constructs Promptbook from async sources
12259
+ * Constructs `PipelineCollection` from async sources
12260
+ *
12120
12261
  * It can be one of the following:
12121
12262
  * - Promise of array of PipelineJson or PipelineString
12122
12263
  * - Factory function that returns Promise of array of PipelineJson or PipelineString
12123
12264
  *
12124
12265
  * Note: This is useful as internal tool for other constructor functions like
12125
- * `createCollectionFromUrl` or `createCollectionFromDirectory`
12266
+ * `createPipelineCollectionFromUrl` or `createPipelineCollectionFromDirectory`
12126
12267
  * Consider using those functions instead of this one
12127
12268
  *
12128
12269
  * Note: The function does NOT return promise it returns the collection directly which waits for the sources to be resolved
12129
12270
  * when error occurs in given promise or factory function, it is thrown during `listPipelines` or `getPipelineByUrl` call
12130
12271
  *
12131
- * Note: Consider using `createCollectionFromDirectory` or `createCollectionFromUrl`
12272
+ * Note: Consider using `createPipelineCollectionFromDirectory` or `createPipelineCollectionFromUrl`
12132
12273
  *
12133
12274
  * @param promptbookSourcesPromiseOrFactory
12134
12275
  * @returns PipelineCollection
12135
12276
  * @deprecated Do not use, it will became internal tool for other constructor functions
12136
12277
  * @public exported from `@promptbook/core`
12137
12278
  */
12138
- function createCollectionFromPromise(promptbookSourcesPromiseOrFactory) {
12279
+ function createPipelineCollectionFromPromise(promptbookSourcesPromiseOrFactory) {
12139
12280
  let collection = null;
12140
12281
  async function load() {
12141
12282
  if (collection !== null) {
@@ -12146,7 +12287,7 @@
12146
12287
  promptbookSourcesPromiseOrFactory = promptbookSourcesPromiseOrFactory();
12147
12288
  }
12148
12289
  const promptbookSources = await promptbookSourcesPromiseOrFactory;
12149
- collection = createCollectionFromJson(...promptbookSources);
12290
+ collection = createPipelineCollectionFromJson(...promptbookSources);
12150
12291
  }
12151
12292
  async function listPipelines() {
12152
12293
  await load();
@@ -12168,7 +12309,7 @@
12168
12309
  }
12169
12310
 
12170
12311
  /**
12171
- * Constructs Pipeline from given directory
12312
+ * Constructs `PipelineCollection` from given directory
12172
12313
  *
12173
12314
  * Note: Works only in Node.js environment because it reads the file system
12174
12315
  *
@@ -12178,7 +12319,7 @@
12178
12319
  * @returns PipelineCollection
12179
12320
  * @public exported from `@promptbook/node`
12180
12321
  */
12181
- async function createCollectionFromDirectory(rootPath, tools, options) {
12322
+ async function createPipelineCollectionFromDirectory(rootPath, tools, options) {
12182
12323
  if (tools === undefined) {
12183
12324
  tools = await $provideExecutionToolsForNode();
12184
12325
  }
@@ -12197,7 +12338,7 @@
12197
12338
  // TODO: [🌗]
12198
12339
  }
12199
12340
  const { isRecursive = true, isVerbose = DEFAULT_IS_VERBOSE, isLazyLoaded = false, isCrashedOnError = true, rootUrl, } = options || {};
12200
- const collection = createCollectionFromPromise(async () => {
12341
+ const collection = createPipelineCollectionFromPromise(async () => {
12201
12342
  if (isVerbose) {
12202
12343
  console.info(colors__default["default"].cyan(`Creating pipeline collection from path ${rootPath.split('\\').join('/')}`));
12203
12344
  }
@@ -12360,7 +12501,7 @@
12360
12501
  return collection;
12361
12502
  }
12362
12503
  /**
12363
- * TODO: [🖇] What about symlinks? Maybe option isSymlinksFollowed
12504
+ * TODO: [🖇] What about symlinks? Maybe option `isSymlinksFollowed`
12364
12505
  * TODO: Maybe move from `@promptbook/node` to `@promptbook/core` as we removes direct dependency on `fs`
12365
12506
  */
12366
12507
 
@@ -12537,7 +12678,7 @@
12537
12678
  exports.BOOK_LANGUAGE_VERSION = BOOK_LANGUAGE_VERSION;
12538
12679
  exports.FileCacheStorage = FileCacheStorage;
12539
12680
  exports.PROMPTBOOK_ENGINE_VERSION = PROMPTBOOK_ENGINE_VERSION;
12540
- exports.createCollectionFromDirectory = createCollectionFromDirectory;
12681
+ exports.createPipelineCollectionFromDirectory = createPipelineCollectionFromDirectory;
12541
12682
 
12542
12683
  Object.defineProperty(exports, '__esModule', { value: true });
12543
12684