@promptbook/cli 0.62.1 → 0.63.0-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 (333) hide show
  1. package/esm/index.es.js +229 -39
  2. package/esm/index.es.js.map +1 -1
  3. package/esm/typings/src/_packages/anthropic-claude.index.d.ts +3 -2
  4. package/esm/typings/src/_packages/azure-openai.index.d.ts +4 -2
  5. package/esm/typings/src/_packages/browser.index.d.ts +6 -0
  6. package/esm/typings/src/_packages/cli.index.d.ts +1 -7
  7. package/esm/typings/src/_packages/core.index.d.ts +87 -13
  8. package/esm/typings/src/_packages/execute-javascript.index.d.ts +5 -45
  9. package/esm/typings/src/_packages/fake-llm.index.d.ts +4 -5
  10. package/esm/typings/src/_packages/langtail.index.d.ts +4 -2
  11. package/esm/typings/src/_packages/markdown-utils.index.d.ts +23 -4
  12. package/esm/typings/src/_packages/node.index.d.ts +5 -2
  13. package/esm/typings/src/_packages/openai.index.d.ts +5 -2
  14. package/esm/typings/src/_packages/remote-client.index.d.ts +5 -2
  15. package/esm/typings/src/_packages/remote-server.index.d.ts +4 -2
  16. package/esm/typings/src/_packages/types.index.d.ts +441 -21
  17. package/esm/typings/src/_packages/utils.index.d.ts +84 -31
  18. package/esm/typings/src/cli/main.d.ts +12 -0
  19. package/esm/typings/src/collection/collectionToJson.d.ts +2 -0
  20. package/esm/typings/src/collection/constructors/createCollectionFromDirectory.d.ts +1 -0
  21. package/esm/typings/src/collection/constructors/createCollectionFromJson.d.ts +1 -0
  22. package/esm/typings/src/collection/constructors/createCollectionFromPromise.d.ts +1 -0
  23. package/esm/typings/src/collection/constructors/createCollectionFromUrl.d.ts +1 -1
  24. package/esm/typings/src/collection/constructors/createSubcollection.d.ts +1 -0
  25. package/esm/typings/src/commands/BLOCK/BlockTypes.d.ts +2 -0
  26. package/esm/typings/src/config.d.ts +27 -1
  27. package/esm/typings/src/conversion/pipelineJsonToString.d.ts +1 -0
  28. package/esm/typings/src/conversion/pipelineStringToJson.d.ts +6 -3
  29. package/esm/typings/src/conversion/pipelineStringToJsonSync.d.ts +4 -3
  30. package/esm/typings/src/conversion/prettify/prettifyPipelineString.d.ts +2 -0
  31. package/esm/typings/src/conversion/prettify/renderPipelineMermaidOptions.d.ts +2 -0
  32. package/esm/typings/src/conversion/utils/extractParameterNamesFromPromptTemplate.d.ts +1 -0
  33. package/esm/typings/src/conversion/utils/extractVariables.d.ts +1 -0
  34. package/esm/typings/src/conversion/utils/renameParameter.d.ts +1 -0
  35. package/esm/typings/src/conversion/utils/stringifyPipelineJson.d.ts +2 -0
  36. package/esm/typings/src/conversion/utils/titleToName.d.ts +6 -1
  37. package/esm/typings/src/conversion/validation/validatePipeline.d.ts +1 -0
  38. package/esm/typings/src/errors/CollectionError.d.ts +2 -0
  39. package/esm/typings/src/errors/EnvironmentMismatchError.d.ts +2 -0
  40. package/esm/typings/src/errors/LimitReachedError.d.ts +2 -0
  41. package/esm/typings/src/errors/NotFoundError.d.ts +2 -0
  42. package/esm/typings/src/errors/NotYetImplementedError.d.ts +2 -0
  43. package/esm/typings/src/errors/ParsingError.d.ts +2 -0
  44. package/esm/typings/src/errors/PipelineExecutionError.d.ts +2 -0
  45. package/esm/typings/src/errors/PipelineLogicError.d.ts +2 -0
  46. package/esm/typings/src/errors/ReferenceError.d.ts +2 -0
  47. package/esm/typings/src/errors/UnexpectedError.d.ts +2 -0
  48. package/esm/typings/src/errors/VersionMismatchError.d.ts +2 -0
  49. package/esm/typings/src/execution/assertsExecutionSuccessful.d.ts +1 -0
  50. package/esm/typings/src/execution/createPipelineExecutor.d.ts +1 -0
  51. package/esm/typings/src/execution/embeddingVectorToString.d.ts +2 -0
  52. package/esm/typings/src/execution/utils/addUsage.d.ts +3 -1
  53. package/esm/typings/src/execution/utils/checkExpectations.d.ts +2 -0
  54. package/esm/typings/src/execution/utils/forEachAsync.d.ts +1 -0
  55. package/esm/typings/src/execution/utils/usageToHuman.d.ts +2 -0
  56. package/esm/typings/src/execution/utils/usageToWorktime.d.ts +2 -0
  57. package/esm/typings/src/formats/_common/FormatDefinition.d.ts +2 -1
  58. package/esm/typings/src/formats/json/utils/isValidJsonString.d.ts +2 -0
  59. package/esm/typings/src/knowledge/dialogs/callback/CallbackInterfaceTools.d.ts +2 -0
  60. package/esm/typings/src/knowledge/dialogs/callback/CallbackInterfaceToolsOptions.d.ts +2 -0
  61. package/esm/typings/src/knowledge/dialogs/simple-prompt/SimplePromptInterfaceTools.d.ts +3 -1
  62. package/esm/typings/src/knowledge/prepare-knowledge/_common/Scraper.d.ts +10 -0
  63. package/esm/typings/src/knowledge/prepare-knowledge/_common/prepareKnowledgePieces.d.ts +1 -1
  64. package/esm/typings/src/knowledge/prepare-knowledge/markdown/prepareKnowledgeFromMarkdown.d.ts +2 -0
  65. package/esm/typings/src/llm-providers/_common/createLlmToolsFromEnv.d.ts +4 -1
  66. package/esm/typings/src/llm-providers/_common/utils/cache/cacheLlmTools.d.ts +1 -1
  67. package/esm/typings/src/llm-providers/_common/utils/count-total-usage/countTotalUsage.d.ts +1 -1
  68. package/esm/typings/src/llm-providers/_common/utils/count-total-usage/limitTotalUsage.d.ts +2 -1
  69. package/esm/typings/src/llm-providers/anthropic-claude/AnthropicClaudeExecutionTools.d.ts +2 -0
  70. package/esm/typings/src/llm-providers/anthropic-claude/AnthropicClaudeExecutionToolsOptions.d.ts +2 -1
  71. package/esm/typings/src/llm-providers/azure-openai/AzureOpenAiExecutionTools.d.ts +2 -0
  72. package/esm/typings/src/llm-providers/azure-openai/AzureOpenAiExecutionToolsOptions.d.ts +1 -0
  73. package/esm/typings/src/llm-providers/langtail/LangtailExecutionTools.d.ts +2 -0
  74. package/esm/typings/src/llm-providers/langtail/LangtailExecutionToolsOptions.d.ts +2 -0
  75. package/esm/typings/src/llm-providers/mocked/MockedEchoLlmExecutionTools.d.ts +2 -0
  76. package/esm/typings/src/llm-providers/mocked/MockedFackedLlmExecutionTools.d.ts +2 -0
  77. package/esm/typings/src/llm-providers/multiple/joinLlmExecutionTools.d.ts +2 -0
  78. package/esm/typings/src/llm-providers/openai/OpenAiExecutionTools.d.ts +2 -0
  79. package/esm/typings/src/llm-providers/openai/OpenAiExecutionToolsOptions.d.ts +2 -0
  80. package/esm/typings/src/llm-providers/openai/openai-models.d.ts +1 -0
  81. package/esm/typings/src/llm-providers/remote/RemoteLlmExecutionTools.d.ts +1 -0
  82. package/esm/typings/src/llm-providers/remote/RemoteLlmExecutionToolsOptions.d.ts +2 -0
  83. package/esm/typings/src/llm-providers/remote/interfaces/RemoteServerOptions.d.ts +7 -1
  84. package/esm/typings/src/llm-providers/remote/startRemoteServer.d.ts +1 -0
  85. package/esm/typings/src/personas/preparePersona.d.ts +1 -1
  86. package/esm/typings/src/postprocessing/utils/extractBlock.d.ts +5 -0
  87. package/esm/typings/src/prepare/isPipelinePrepared.d.ts +2 -1
  88. package/esm/typings/src/prepare/preparePipeline.d.ts +1 -1
  89. package/esm/typings/src/prepare/prepareTemplates.d.ts +2 -1
  90. package/esm/typings/src/prepare/unpreparePipeline.d.ts +2 -1
  91. package/esm/typings/src/scripting/javascript/JavascriptEvalExecutionTools.d.ts +2 -0
  92. package/esm/typings/src/scripting/javascript/JavascriptExecutionTools.d.ts +1 -0
  93. package/esm/typings/src/scripting/javascript/postprocessing-functions.d.ts +51 -0
  94. package/esm/typings/src/storage/_common/PromptbookStorage.d.ts +0 -1
  95. package/esm/typings/src/storage/files-storage/FilesStorage.d.ts +2 -1
  96. package/esm/typings/src/storage/files-storage/FilesStorageOptions.d.ts +0 -3
  97. package/esm/typings/src/storage/local-storage/getLocalStorage.d.ts +2 -1
  98. package/esm/typings/src/storage/local-storage/getSessionStorage.d.ts +2 -1
  99. package/esm/typings/src/storage/memory/MemoryStorage.d.ts +2 -3
  100. package/esm/typings/src/storage/utils/PrefixStorage.d.ts +2 -3
  101. package/esm/typings/src/types/ModelRequirements.d.ts +0 -1
  102. package/esm/typings/src/types/Prompt.d.ts +0 -1
  103. package/esm/typings/src/types/execution-report/ExecutionReportStringOptions.d.ts +4 -0
  104. package/esm/typings/src/types/execution-report/executionReportJsonToString.d.ts +2 -0
  105. package/esm/typings/src/types/typeAliases.d.ts +9 -2
  106. package/esm/typings/src/utils/currentDate.d.ts +1 -0
  107. package/esm/typings/src/utils/deepClone.d.ts +2 -1
  108. package/esm/typings/src/utils/deepFreeze.d.ts +1 -1
  109. package/esm/typings/src/utils/expectation-counters/countCharacters.d.ts +2 -0
  110. package/esm/typings/src/utils/expectation-counters/countLines.d.ts +2 -0
  111. package/esm/typings/src/utils/expectation-counters/countPages.d.ts +2 -0
  112. package/esm/typings/src/utils/expectation-counters/countParagraphs.d.ts +2 -0
  113. package/esm/typings/src/utils/expectation-counters/countSentences.d.ts +4 -0
  114. package/esm/typings/src/utils/expectation-counters/countWords.d.ts +2 -0
  115. package/esm/typings/src/utils/expectation-counters/index.d.ts +2 -0
  116. package/esm/typings/src/utils/extractParameterNames.d.ts +1 -0
  117. package/esm/typings/src/utils/isRunningInWhatever.d.ts +6 -3
  118. package/esm/typings/src/utils/markdown/addAutoGeneratedSection.d.ts +4 -1
  119. package/esm/typings/src/utils/markdown/createMarkdownChart.d.ts +1 -1
  120. package/esm/typings/src/utils/markdown/createMarkdownTable.d.ts +4 -1
  121. package/esm/typings/src/utils/markdown/escapeMarkdownBlock.d.ts +5 -0
  122. package/esm/typings/src/utils/markdown/extractAllBlocksFromMarkdown.d.ts +1 -1
  123. package/esm/typings/src/utils/markdown/extractAllListItemsFromMarkdown.d.ts +2 -1
  124. package/esm/typings/src/utils/markdown/extractOneBlockFromMarkdown.d.ts +1 -0
  125. package/esm/typings/src/utils/markdown/flattenMarkdown.d.ts +3 -0
  126. package/esm/typings/src/utils/markdown/parseMarkdownSection.d.ts +4 -0
  127. package/esm/typings/src/utils/markdown/removeContentComments.d.ts +1 -0
  128. package/esm/typings/src/utils/markdown/removeMarkdownFormatting.d.ts +1 -0
  129. package/esm/typings/src/utils/markdown/splitMarkdownIntoSections.d.ts +3 -0
  130. package/esm/typings/src/utils/normalization/DIACRITIC_VARIANTS_LETTERS.d.ts +2 -0
  131. package/esm/typings/src/utils/normalization/IKeywords.d.ts +3 -0
  132. package/esm/typings/src/utils/normalization/capitalize.d.ts +1 -0
  133. package/esm/typings/src/utils/normalization/decapitalize.d.ts +1 -0
  134. package/esm/typings/src/utils/normalization/isValidKeyword.d.ts +2 -0
  135. package/esm/typings/src/utils/normalization/nameToUriPart.d.ts +8 -0
  136. package/esm/typings/src/utils/normalization/nameToUriParts.d.ts +8 -0
  137. package/esm/typings/src/utils/normalization/normalize-to-kebab-case.d.ts +10 -0
  138. package/esm/typings/src/utils/normalization/normalizeTo_PascalCase.d.ts +9 -0
  139. package/esm/typings/src/utils/normalization/normalizeTo_SCREAMING_CASE.d.ts +10 -0
  140. package/esm/typings/src/utils/normalization/normalizeTo_camelCase.d.ts +11 -0
  141. package/esm/typings/src/utils/normalization/normalizeTo_snake_case.d.ts +9 -0
  142. package/esm/typings/src/utils/normalization/parseKeywords.d.ts +1 -0
  143. package/esm/typings/src/utils/normalization/parseKeywordsFromString.d.ts +1 -0
  144. package/esm/typings/src/utils/normalization/removeDiacritics.d.ts +7 -0
  145. package/esm/typings/src/utils/normalization/searchKeywords.d.ts +5 -0
  146. package/esm/typings/src/utils/parseNumber.d.ts +2 -1
  147. package/esm/typings/src/utils/random/randomSeed.d.ts +1 -0
  148. package/esm/typings/src/utils/removeEmojis.d.ts +1 -0
  149. package/esm/typings/src/utils/removeQuotes.d.ts +1 -0
  150. package/esm/typings/src/utils/replaceParameters.d.ts +1 -0
  151. package/esm/typings/src/utils/sets/difference.d.ts +1 -0
  152. package/esm/typings/src/utils/sets/intersection.d.ts +1 -0
  153. package/esm/typings/src/utils/sets/union.d.ts +1 -0
  154. package/esm/typings/src/utils/trimCodeBlock.d.ts +1 -0
  155. package/esm/typings/src/utils/trimEndOfCodeBlock.d.ts +2 -0
  156. package/esm/typings/src/utils/unwrapResult.d.ts +1 -0
  157. package/esm/typings/src/utils/validators/filePath/isValidFilePath.d.ts +1 -0
  158. package/esm/typings/src/utils/validators/javascriptName/isValidJavascriptName.d.ts +7 -0
  159. package/esm/typings/src/utils/validators/semanticVersion/isValidPromptbookVersion.d.ts +2 -0
  160. package/esm/typings/src/utils/validators/semanticVersion/isValidSemanticVersion.d.ts +2 -0
  161. package/esm/typings/src/utils/validators/url/isHostnameOnPrivateNetwork.d.ts +2 -0
  162. package/esm/typings/src/utils/validators/url/isUrlOnPrivateNetwork.d.ts +1 -0
  163. package/esm/typings/src/utils/validators/url/isValidPipelineUrl.d.ts +2 -0
  164. package/esm/typings/src/utils/validators/url/isValidUrl.d.ts +2 -0
  165. package/esm/typings/src/utils/validators/uuid/isValidUuid.d.ts +2 -0
  166. package/esm/typings/src/version.d.ts +2 -0
  167. package/package.json +2 -2
  168. package/umd/index.umd.js +229 -39
  169. package/umd/index.umd.js.map +1 -1
  170. package/umd/typings/src/_packages/anthropic-claude.index.d.ts +3 -2
  171. package/umd/typings/src/_packages/azure-openai.index.d.ts +4 -2
  172. package/umd/typings/src/_packages/browser.index.d.ts +6 -0
  173. package/umd/typings/src/_packages/cli.index.d.ts +1 -7
  174. package/umd/typings/src/_packages/core.index.d.ts +87 -13
  175. package/umd/typings/src/_packages/execute-javascript.index.d.ts +5 -45
  176. package/umd/typings/src/_packages/fake-llm.index.d.ts +4 -5
  177. package/umd/typings/src/_packages/langtail.index.d.ts +4 -2
  178. package/umd/typings/src/_packages/markdown-utils.index.d.ts +23 -4
  179. package/umd/typings/src/_packages/node.index.d.ts +5 -2
  180. package/umd/typings/src/_packages/openai.index.d.ts +5 -2
  181. package/umd/typings/src/_packages/remote-client.index.d.ts +5 -2
  182. package/umd/typings/src/_packages/remote-server.index.d.ts +4 -2
  183. package/umd/typings/src/_packages/types.index.d.ts +441 -21
  184. package/umd/typings/src/_packages/utils.index.d.ts +84 -31
  185. package/umd/typings/src/cli/main.d.ts +12 -0
  186. package/umd/typings/src/collection/collectionToJson.d.ts +2 -0
  187. package/umd/typings/src/collection/constructors/createCollectionFromDirectory.d.ts +1 -0
  188. package/umd/typings/src/collection/constructors/createCollectionFromJson.d.ts +1 -0
  189. package/umd/typings/src/collection/constructors/createCollectionFromPromise.d.ts +1 -0
  190. package/umd/typings/src/collection/constructors/createCollectionFromUrl.d.ts +1 -1
  191. package/umd/typings/src/collection/constructors/createSubcollection.d.ts +1 -0
  192. package/umd/typings/src/commands/BLOCK/BlockTypes.d.ts +2 -0
  193. package/umd/typings/src/config.d.ts +27 -1
  194. package/umd/typings/src/conversion/pipelineJsonToString.d.ts +1 -0
  195. package/umd/typings/src/conversion/pipelineStringToJson.d.ts +6 -3
  196. package/umd/typings/src/conversion/pipelineStringToJsonSync.d.ts +4 -3
  197. package/umd/typings/src/conversion/prettify/prettifyPipelineString.d.ts +2 -0
  198. package/umd/typings/src/conversion/prettify/renderPipelineMermaidOptions.d.ts +2 -0
  199. package/umd/typings/src/conversion/utils/extractParameterNamesFromPromptTemplate.d.ts +1 -0
  200. package/umd/typings/src/conversion/utils/extractVariables.d.ts +1 -0
  201. package/umd/typings/src/conversion/utils/renameParameter.d.ts +1 -0
  202. package/umd/typings/src/conversion/utils/stringifyPipelineJson.d.ts +2 -0
  203. package/umd/typings/src/conversion/utils/titleToName.d.ts +6 -1
  204. package/umd/typings/src/conversion/validation/validatePipeline.d.ts +1 -0
  205. package/umd/typings/src/errors/CollectionError.d.ts +2 -0
  206. package/umd/typings/src/errors/EnvironmentMismatchError.d.ts +2 -0
  207. package/umd/typings/src/errors/LimitReachedError.d.ts +2 -0
  208. package/umd/typings/src/errors/NotFoundError.d.ts +2 -0
  209. package/umd/typings/src/errors/NotYetImplementedError.d.ts +2 -0
  210. package/umd/typings/src/errors/ParsingError.d.ts +2 -0
  211. package/umd/typings/src/errors/PipelineExecutionError.d.ts +2 -0
  212. package/umd/typings/src/errors/PipelineLogicError.d.ts +2 -0
  213. package/umd/typings/src/errors/ReferenceError.d.ts +2 -0
  214. package/umd/typings/src/errors/UnexpectedError.d.ts +2 -0
  215. package/umd/typings/src/errors/VersionMismatchError.d.ts +2 -0
  216. package/umd/typings/src/execution/assertsExecutionSuccessful.d.ts +1 -0
  217. package/umd/typings/src/execution/createPipelineExecutor.d.ts +1 -0
  218. package/umd/typings/src/execution/embeddingVectorToString.d.ts +2 -0
  219. package/umd/typings/src/execution/utils/addUsage.d.ts +3 -1
  220. package/umd/typings/src/execution/utils/checkExpectations.d.ts +2 -0
  221. package/umd/typings/src/execution/utils/forEachAsync.d.ts +1 -0
  222. package/umd/typings/src/execution/utils/usageToHuman.d.ts +2 -0
  223. package/umd/typings/src/execution/utils/usageToWorktime.d.ts +2 -0
  224. package/umd/typings/src/formats/_common/FormatDefinition.d.ts +2 -1
  225. package/umd/typings/src/formats/json/utils/isValidJsonString.d.ts +2 -0
  226. package/umd/typings/src/knowledge/dialogs/callback/CallbackInterfaceTools.d.ts +2 -0
  227. package/umd/typings/src/knowledge/dialogs/callback/CallbackInterfaceToolsOptions.d.ts +2 -0
  228. package/umd/typings/src/knowledge/dialogs/simple-prompt/SimplePromptInterfaceTools.d.ts +3 -1
  229. package/umd/typings/src/knowledge/prepare-knowledge/_common/Scraper.d.ts +10 -0
  230. package/umd/typings/src/knowledge/prepare-knowledge/_common/prepareKnowledgePieces.d.ts +1 -1
  231. package/umd/typings/src/knowledge/prepare-knowledge/markdown/prepareKnowledgeFromMarkdown.d.ts +2 -0
  232. package/umd/typings/src/llm-providers/_common/createLlmToolsFromEnv.d.ts +4 -1
  233. package/umd/typings/src/llm-providers/_common/utils/cache/cacheLlmTools.d.ts +1 -1
  234. package/umd/typings/src/llm-providers/_common/utils/count-total-usage/countTotalUsage.d.ts +1 -1
  235. package/umd/typings/src/llm-providers/_common/utils/count-total-usage/limitTotalUsage.d.ts +2 -1
  236. package/umd/typings/src/llm-providers/anthropic-claude/AnthropicClaudeExecutionTools.d.ts +2 -0
  237. package/umd/typings/src/llm-providers/anthropic-claude/AnthropicClaudeExecutionToolsOptions.d.ts +2 -1
  238. package/umd/typings/src/llm-providers/azure-openai/AzureOpenAiExecutionTools.d.ts +2 -0
  239. package/umd/typings/src/llm-providers/azure-openai/AzureOpenAiExecutionToolsOptions.d.ts +1 -0
  240. package/umd/typings/src/llm-providers/langtail/LangtailExecutionTools.d.ts +2 -0
  241. package/umd/typings/src/llm-providers/langtail/LangtailExecutionToolsOptions.d.ts +2 -0
  242. package/umd/typings/src/llm-providers/mocked/MockedEchoLlmExecutionTools.d.ts +2 -0
  243. package/umd/typings/src/llm-providers/mocked/MockedFackedLlmExecutionTools.d.ts +2 -0
  244. package/umd/typings/src/llm-providers/multiple/joinLlmExecutionTools.d.ts +2 -0
  245. package/umd/typings/src/llm-providers/openai/OpenAiExecutionTools.d.ts +2 -0
  246. package/umd/typings/src/llm-providers/openai/OpenAiExecutionToolsOptions.d.ts +2 -0
  247. package/umd/typings/src/llm-providers/openai/openai-models.d.ts +1 -0
  248. package/umd/typings/src/llm-providers/remote/RemoteLlmExecutionTools.d.ts +1 -0
  249. package/umd/typings/src/llm-providers/remote/RemoteLlmExecutionToolsOptions.d.ts +2 -0
  250. package/umd/typings/src/llm-providers/remote/interfaces/RemoteServerOptions.d.ts +7 -1
  251. package/umd/typings/src/llm-providers/remote/startRemoteServer.d.ts +1 -0
  252. package/umd/typings/src/personas/preparePersona.d.ts +1 -1
  253. package/umd/typings/src/postprocessing/utils/extractBlock.d.ts +5 -0
  254. package/umd/typings/src/prepare/isPipelinePrepared.d.ts +2 -1
  255. package/umd/typings/src/prepare/preparePipeline.d.ts +1 -1
  256. package/umd/typings/src/prepare/prepareTemplates.d.ts +2 -1
  257. package/umd/typings/src/prepare/unpreparePipeline.d.ts +2 -1
  258. package/umd/typings/src/scripting/javascript/JavascriptEvalExecutionTools.d.ts +2 -0
  259. package/umd/typings/src/scripting/javascript/JavascriptExecutionTools.d.ts +1 -0
  260. package/umd/typings/src/scripting/javascript/postprocessing-functions.d.ts +51 -0
  261. package/umd/typings/src/storage/_common/PromptbookStorage.d.ts +0 -1
  262. package/umd/typings/src/storage/files-storage/FilesStorage.d.ts +2 -1
  263. package/umd/typings/src/storage/files-storage/FilesStorageOptions.d.ts +0 -3
  264. package/umd/typings/src/storage/local-storage/getLocalStorage.d.ts +2 -1
  265. package/umd/typings/src/storage/local-storage/getSessionStorage.d.ts +2 -1
  266. package/umd/typings/src/storage/memory/MemoryStorage.d.ts +2 -3
  267. package/umd/typings/src/storage/utils/PrefixStorage.d.ts +2 -3
  268. package/umd/typings/src/types/ModelRequirements.d.ts +0 -1
  269. package/umd/typings/src/types/Prompt.d.ts +0 -1
  270. package/umd/typings/src/types/execution-report/ExecutionReportStringOptions.d.ts +4 -0
  271. package/umd/typings/src/types/execution-report/executionReportJsonToString.d.ts +2 -0
  272. package/umd/typings/src/types/typeAliases.d.ts +9 -2
  273. package/umd/typings/src/utils/currentDate.d.ts +1 -0
  274. package/umd/typings/src/utils/deepClone.d.ts +2 -1
  275. package/umd/typings/src/utils/deepFreeze.d.ts +1 -1
  276. package/umd/typings/src/utils/expectation-counters/countCharacters.d.ts +2 -0
  277. package/umd/typings/src/utils/expectation-counters/countLines.d.ts +2 -0
  278. package/umd/typings/src/utils/expectation-counters/countPages.d.ts +2 -0
  279. package/umd/typings/src/utils/expectation-counters/countParagraphs.d.ts +2 -0
  280. package/umd/typings/src/utils/expectation-counters/countSentences.d.ts +4 -0
  281. package/umd/typings/src/utils/expectation-counters/countWords.d.ts +2 -0
  282. package/umd/typings/src/utils/expectation-counters/index.d.ts +2 -0
  283. package/umd/typings/src/utils/extractParameterNames.d.ts +1 -0
  284. package/umd/typings/src/utils/isRunningInWhatever.d.ts +6 -3
  285. package/umd/typings/src/utils/markdown/addAutoGeneratedSection.d.ts +4 -1
  286. package/umd/typings/src/utils/markdown/createMarkdownChart.d.ts +1 -1
  287. package/umd/typings/src/utils/markdown/createMarkdownTable.d.ts +4 -1
  288. package/umd/typings/src/utils/markdown/escapeMarkdownBlock.d.ts +5 -0
  289. package/umd/typings/src/utils/markdown/extractAllBlocksFromMarkdown.d.ts +1 -1
  290. package/umd/typings/src/utils/markdown/extractAllListItemsFromMarkdown.d.ts +2 -1
  291. package/umd/typings/src/utils/markdown/extractOneBlockFromMarkdown.d.ts +1 -0
  292. package/umd/typings/src/utils/markdown/flattenMarkdown.d.ts +3 -0
  293. package/umd/typings/src/utils/markdown/parseMarkdownSection.d.ts +4 -0
  294. package/umd/typings/src/utils/markdown/removeContentComments.d.ts +1 -0
  295. package/umd/typings/src/utils/markdown/removeMarkdownFormatting.d.ts +1 -0
  296. package/umd/typings/src/utils/markdown/splitMarkdownIntoSections.d.ts +3 -0
  297. package/umd/typings/src/utils/normalization/DIACRITIC_VARIANTS_LETTERS.d.ts +2 -0
  298. package/umd/typings/src/utils/normalization/IKeywords.d.ts +3 -0
  299. package/umd/typings/src/utils/normalization/capitalize.d.ts +1 -0
  300. package/umd/typings/src/utils/normalization/decapitalize.d.ts +1 -0
  301. package/umd/typings/src/utils/normalization/isValidKeyword.d.ts +2 -0
  302. package/umd/typings/src/utils/normalization/nameToUriPart.d.ts +8 -0
  303. package/umd/typings/src/utils/normalization/nameToUriParts.d.ts +8 -0
  304. package/umd/typings/src/utils/normalization/normalize-to-kebab-case.d.ts +10 -0
  305. package/umd/typings/src/utils/normalization/normalizeTo_PascalCase.d.ts +9 -0
  306. package/umd/typings/src/utils/normalization/normalizeTo_SCREAMING_CASE.d.ts +10 -0
  307. package/umd/typings/src/utils/normalization/normalizeTo_camelCase.d.ts +11 -0
  308. package/umd/typings/src/utils/normalization/normalizeTo_snake_case.d.ts +9 -0
  309. package/umd/typings/src/utils/normalization/parseKeywords.d.ts +1 -0
  310. package/umd/typings/src/utils/normalization/parseKeywordsFromString.d.ts +1 -0
  311. package/umd/typings/src/utils/normalization/removeDiacritics.d.ts +7 -0
  312. package/umd/typings/src/utils/normalization/searchKeywords.d.ts +5 -0
  313. package/umd/typings/src/utils/parseNumber.d.ts +2 -1
  314. package/umd/typings/src/utils/random/randomSeed.d.ts +1 -0
  315. package/umd/typings/src/utils/removeEmojis.d.ts +1 -0
  316. package/umd/typings/src/utils/removeQuotes.d.ts +1 -0
  317. package/umd/typings/src/utils/replaceParameters.d.ts +1 -0
  318. package/umd/typings/src/utils/sets/difference.d.ts +1 -0
  319. package/umd/typings/src/utils/sets/intersection.d.ts +1 -0
  320. package/umd/typings/src/utils/sets/union.d.ts +1 -0
  321. package/umd/typings/src/utils/trimCodeBlock.d.ts +1 -0
  322. package/umd/typings/src/utils/trimEndOfCodeBlock.d.ts +2 -0
  323. package/umd/typings/src/utils/unwrapResult.d.ts +1 -0
  324. package/umd/typings/src/utils/validators/filePath/isValidFilePath.d.ts +1 -0
  325. package/umd/typings/src/utils/validators/javascriptName/isValidJavascriptName.d.ts +7 -0
  326. package/umd/typings/src/utils/validators/semanticVersion/isValidPromptbookVersion.d.ts +2 -0
  327. package/umd/typings/src/utils/validators/semanticVersion/isValidSemanticVersion.d.ts +2 -0
  328. package/umd/typings/src/utils/validators/url/isHostnameOnPrivateNetwork.d.ts +2 -0
  329. package/umd/typings/src/utils/validators/url/isUrlOnPrivateNetwork.d.ts +1 -0
  330. package/umd/typings/src/utils/validators/url/isValidPipelineUrl.d.ts +2 -0
  331. package/umd/typings/src/utils/validators/url/isValidUrl.d.ts +2 -0
  332. package/umd/typings/src/utils/validators/uuid/isValidUuid.d.ts +2 -0
  333. package/umd/typings/src/version.d.ts +2 -0
package/esm/index.es.js CHANGED
@@ -13,6 +13,14 @@ import Anthropic from '@anthropic-ai/sdk';
13
13
  import OpenAI from 'openai';
14
14
  import glob from 'glob-promise';
15
15
 
16
+ /**
17
+ * The version of the Promptbook library
18
+ *
19
+ * @public exported from all packages
20
+ */
21
+ var PROMPTBOOK_VERSION = '0.62.0';
22
+ // TODO: !!!! List here all the versions and annotate + put into script
23
+
16
24
  /*! *****************************************************************************
17
25
  Copyright (c) Microsoft Corporation.
18
26
 
@@ -134,25 +142,22 @@ function __spreadArray(to, from, pack) {
134
142
 
135
143
  /**
136
144
  * Detects if the code is running in a browser environment in main thread (Not in a web worker)
145
+ *
146
+ * @public exported from `@promptbook/utils`
137
147
  */
138
148
  new Function("\n try {\n return this === window;\n } catch (e) {\n return false;\n }\n");
139
149
  /**
140
150
  * Detects if the code is running in a Node.js environment
151
+ *
152
+ * @public exported from `@promptbook/utils`
141
153
  */
142
154
  var isRunningInNode = new Function("\n try {\n return this === global;\n } catch (e) {\n return false;\n }\n");
143
155
  /**
144
156
  * Detects if the code is running in a web worker
157
+ *
158
+ * @public exported from `@promptbook/utils`
145
159
  */
146
160
  new Function("\n try {\n if (typeof WorkerGlobalScope !== 'undefined' && self instanceof WorkerGlobalScope) {\n return true;\n } else {\n return false;\n }\n } catch (e) {\n return false;\n }\n");
147
- /**
148
- * TODO: [🔼] !!! Export via `@promptbook/utils`
149
- */
150
-
151
- /**
152
- * The version of the Promptbook library
153
- */
154
- var PROMPTBOOK_VERSION = '0.62.0';
155
- // TODO: !!!! List here all the versions and annotate + put into script
156
161
 
157
162
  /**
158
163
  * Initializes testing `hello` command for Promptbook CLI utilities
@@ -191,6 +196,8 @@ function initializeHelloCommand(program) {
191
196
  * Converts PipelineCollection to serialized JSON
192
197
  *
193
198
  * Note: Functions `collectionToJson` and `createCollectionFromJson` are complementary
199
+ *
200
+ * @public exported from `@promptbook/core`
194
201
  */
195
202
  function collectionToJson(collection) {
196
203
  return __awaiter(this, void 0, void 0, function () {
@@ -245,6 +252,7 @@ function deepFreeze(objectValue) {
245
252
  * @@@
246
253
  *
247
254
  * @returns The same object as the input, but deeply frozen
255
+ * @public exported from `@promptbook/utils`
248
256
  *
249
257
  * Note: This function mutates the object and returns the original (but mutated-deep-freezed) object
250
258
  */
@@ -252,32 +260,43 @@ function deepFreezeWithSameType(objectValue) {
252
260
  return deepFreeze(objectValue);
253
261
  }
254
262
  /**
255
- * TODO: [🔼] Export from `@promptbook/utils`
256
263
  * TODO: [🧠] Is there a way how to meaningfully test this utility
257
264
  */
258
265
 
259
266
  /**
260
267
  * The maximum number of iterations for a loops
268
+ *
269
+ * @private within the repository - too low-level in comparison to other `MAX_...`
261
270
  */
262
271
  var LOOP_LIMIT = 1000;
263
272
  /**
264
273
  * The maximum number of (LLM) tasks running in parallel
274
+ *
275
+ * @public exported from `@promptbook/core`
265
276
  */
266
277
  var MAX_PARALLEL_COUNT = 5;
267
278
  /**
268
279
  * The maximum number of attempts to execute LLM task before giving up
280
+ *
281
+ * @public exported from `@promptbook/core`
269
282
  */
270
283
  var MAX_EXECUTION_ATTEMPTS = 3;
271
284
  /**
272
285
  * The maximum length of the (generated) filename
286
+ *
287
+ * @public exported from `@promptbook/core`
273
288
  */
274
289
  var MAX_FILENAME_LENGTH = 30;
275
290
  /**
276
291
  * Where to store the cache of executions for promptbook CLI
292
+ *
293
+ * @public exported from `@promptbook/core`
277
294
  */
278
295
  var EXECUTIONS_CACHE_DIRNAME = '/.promptbook/executions-cache';
279
296
  /**
280
297
  * The name of the builded pipeline collection made by CLI `ptbk make` and for lookup in `createCollectionFromDirectory`
298
+ *
299
+ * @public exported from `@promptbook/core`
281
300
  */
282
301
  var PIPELINE_COLLECTION_BASE_FILENAME = "index";
283
302
  /**
@@ -286,6 +305,8 @@ var PIPELINE_COLLECTION_BASE_FILENAME = "index";
286
305
  var REPLACING_NONCE = 'u$k42k%!V2zo34w7Fu#@QUHYPW';
287
306
  /**
288
307
  * The names of the parameters that are reserved for special purposes
308
+ *
309
+ * @public exported from `@promptbook/core`
289
310
  */
290
311
  var RESERVED_PARAMETER_NAMES = deepFreeze([
291
312
  'content',
@@ -299,10 +320,14 @@ var RESERVED_PARAMETER_NAMES = deepFreeze([
299
320
  ]);
300
321
  /**
301
322
  * @@@
323
+ *
324
+ * @private within the repository
302
325
  */
303
326
  var RESERVED_PARAMETER_MISSING_VALUE = 'MISSING-' + REPLACING_NONCE;
304
327
  /**
305
328
  * @@@
329
+ *
330
+ * @private within the repository
306
331
  */
307
332
  var RESERVED_PARAMETER_RESTRICTED = 'RESTRICTED-' + REPLACING_NONCE;
308
333
  /*
@@ -310,7 +335,7 @@ TODO: !!! Just testing false-negative detection of [🟡][🟢][🔵][⚪] leak
310
335
  */
311
336
  // [🟡][🟢][🔵][⚪]
312
337
  /**
313
- * TODO: [🔼] Export all to core
338
+ * TODO: !!!!!! Check that all @private contains some normalized explanation
314
339
  */
315
340
 
316
341
  /**
@@ -350,6 +375,7 @@ function prettifyMarkdown(content) {
350
375
  /**
351
376
  * Makes first letter of a string uppercase
352
377
  *
378
+ * @public exported from `@promptbook/utils`
353
379
  */
354
380
  function capitalize(word) {
355
381
  return word.substring(0, 1).toUpperCase() + word.substring(1);
@@ -360,6 +386,7 @@ function capitalize(word) {
360
386
  *
361
387
  * @param pipelineJson Promptbook in JSON format (.ptbk.json)
362
388
  * @returns Promptbook in string format (.ptbk.md)
389
+ * @public exported from `@promptbook/core`
363
390
  */
364
391
  function pipelineJsonToString(pipelineJson) {
365
392
  var e_1, _a, e_2, _b, e_3, _c, e_4, _d, e_5, _e, e_6, _f;
@@ -559,6 +586,8 @@ function promptTemplateParameterJsonToString(promptTemplateParameterJson) {
559
586
 
560
587
  /**
561
588
  * @@@
589
+ *
590
+ * @public exported from `@promptbook/utils`
562
591
  */
563
592
  function deepClone(objectValue) {
564
593
  return JSON.parse(JSON.stringify(objectValue));
@@ -575,14 +604,13 @@ function deepClone(objectValue) {
575
604
  */
576
605
  }
577
606
  /**
578
- * TODO: [🔼] Export from `@promptbook/utils`
579
607
  * TODO: [🧠] Is there a way how to meaningfully test this utility
580
608
  */
581
609
 
582
610
  /**
583
611
  * @@@
584
612
  *
585
- * TODO: [🔼] Export with addUsage
613
+ * @public exported from `@promptbook/core`
586
614
  */
587
615
  var ZERO_USAGE = deepFreeze({
588
616
  price: { value: 0 },
@@ -609,6 +637,8 @@ var ZERO_USAGE = deepFreeze({
609
637
  * Function `addUsage` will add multiple usages into one
610
638
  *
611
639
  * Note: If you provide 0 values, it returns ZERO_USAGE
640
+ *
641
+ * @public exported from `@promptbook/core`
612
642
  */
613
643
  function addUsage() {
614
644
  var usageItems = [];
@@ -681,6 +711,7 @@ function addUsage() {
681
711
  * @param array - Array to iterate over
682
712
  * @param options - Options for the function
683
713
  * @param callbackfunction - Function to call for each item
714
+ * @public exported from `@promptbook/utils`
684
715
  */
685
716
  function forEachAsync(array, options, callbackfunction) {
686
717
  return __awaiter(this, void 0, void 0, function () {
@@ -753,6 +784,8 @@ var PipelineCollection = [{title:"Prepare Knowledge from Markdown",pipelineUrl:"
753
784
 
754
785
  /**
755
786
  * This error indicates that the promptbook in a markdown format cannot be parsed into a valid promptbook object
787
+ *
788
+ * @public exported from `@promptbook/core`
756
789
  */
757
790
  var ParsingError = /** @class */ (function (_super) {
758
791
  __extends(ParsingError, _super);
@@ -767,6 +800,8 @@ var ParsingError = /** @class */ (function (_super) {
767
800
 
768
801
  /**
769
802
  * This error indicates that the promptbook object has valid syntax but contains logical errors (like circular dependencies)
803
+ *
804
+ * @public exported from `@promptbook/core`
770
805
  */
771
806
  var PipelineLogicError = /** @class */ (function (_super) {
772
807
  __extends(PipelineLogicError, _super);
@@ -781,6 +816,8 @@ var PipelineLogicError = /** @class */ (function (_super) {
781
816
 
782
817
  /**
783
818
  * This error type indicates that the error should not happen and its last check before crashing with some other error
819
+ *
820
+ * @public exported from `@promptbook/core`
784
821
  */
785
822
  var UnexpectedError = /** @class */ (function (_super) {
786
823
  __extends(UnexpectedError, _super);
@@ -799,6 +836,8 @@ var UnexpectedError = /** @class */ (function (_super) {
799
836
  * Note: There are two simmilar functions:
800
837
  * - `isValidSemanticVersion` which tests any semantic version
801
838
  * - `isValidPromptbookVersion` *(this one)* which tests just Promptbook versions
839
+ *
840
+ * @public exported from `@promptbook/utils`
802
841
  */
803
842
  function isValidSemanticVersion(version) {
804
843
  if (typeof version !== 'string') {
@@ -819,6 +858,8 @@ function isValidSemanticVersion(version) {
819
858
  * Note: There are two simmilar functions:
820
859
  * - `isValidSemanticVersion` which tests any semantic version
821
860
  * - `isValidPromptbookVersion` *(this one)* which tests just Promptbook versions
861
+ *
862
+ * @public exported from `@promptbook/utils`
822
863
  */
823
864
  function isValidPromptbookVersion(version) {
824
865
  if (!isValidSemanticVersion(version)) {
@@ -837,6 +878,8 @@ function isValidPromptbookVersion(version) {
837
878
  * Note: There are two simmilar functions:
838
879
  * - `isUrlOnPrivateNetwork` which tests full URL
839
880
  * - `isHostnameOnPrivateNetwork` *(this one)* which tests just hostname
881
+ *
882
+ * @public exported from `@promptbook/utils`
840
883
  */
841
884
  function isHostnameOnPrivateNetwork(hostname) {
842
885
  if (hostname === 'example.com' ||
@@ -871,6 +914,7 @@ function isHostnameOnPrivateNetwork(hostname) {
871
914
  *
872
915
  * @param {string} ipAddress - The IP address to check.
873
916
  * @returns {boolean} Returns true if the IP address is reserved for private networks or localhost, otherwise false.
917
+ * @public exported from `@promptbook/utils`
874
918
  */
875
919
  function isUrlOnPrivateNetwork(url) {
876
920
  if (typeof url === 'string') {
@@ -886,6 +930,8 @@ function isUrlOnPrivateNetwork(url) {
886
930
  * Note: There are two simmilar functions:
887
931
  * - `isValidUrl` which tests any URL
888
932
  * - `isValidPipelineUrl` *(this one)* which tests just promptbook URL
933
+ *
934
+ * @public exported from `@promptbook/utils`
889
935
  */
890
936
  function isValidUrl(url) {
891
937
  if (typeof url !== 'string') {
@@ -912,6 +958,8 @@ function isValidUrl(url) {
912
958
  * Note: There are two simmilar functions:
913
959
  * - `isValidUrl` which tests any URL
914
960
  * - `isValidPipelineUrl` *(this one)* which tests just pipeline URL
961
+ *
962
+ * @public exported from `@promptbook/utils`
915
963
  */
916
964
  function isValidPipelineUrl(url) {
917
965
  if (!isValidUrl(url)) {
@@ -949,6 +997,7 @@ function isValidPipelineUrl(url) {
949
997
  * @param pipeline valid or invalid PipelineJson
950
998
  * @returns the same pipeline if it is logically valid
951
999
  * @throws {PipelineLogicError} on logical error in the pipeline
1000
+ * @public exported from `@promptbook/core`
952
1001
  */
953
1002
  function validatePipeline(pipeline) {
954
1003
  // TODO: [🧠] Maybe test if promptbook is a promise and make specific error case for that
@@ -1178,6 +1227,8 @@ function validatePipeline(pipeline) {
1178
1227
 
1179
1228
  /**
1180
1229
  * This error indicates that promptbook not found in the collection
1230
+ *
1231
+ * @public exported from `@promptbook/core`
1181
1232
  */
1182
1233
  var NotFoundError = /** @class */ (function (_super) {
1183
1234
  __extends(NotFoundError, _super);
@@ -1192,6 +1243,8 @@ var NotFoundError = /** @class */ (function (_super) {
1192
1243
 
1193
1244
  /**
1194
1245
  * This error indicates errors in referencing promptbooks between each other
1246
+ *
1247
+ * @public exported from `@promptbook/core`
1195
1248
  */
1196
1249
  var ReferenceError$1 = /** @class */ (function (_super) {
1197
1250
  __extends(ReferenceError, _super);
@@ -1209,6 +1262,7 @@ var ReferenceError$1 = /** @class */ (function (_super) {
1209
1262
  *
1210
1263
  * @param template the template with parameters in {curly} braces
1211
1264
  * @returns the list of parameter names
1265
+ * @public exported from `@promptbook/utils`
1212
1266
  */
1213
1267
  function extractParameterNames(template) {
1214
1268
  var e_1, _a;
@@ -1233,6 +1287,8 @@ function extractParameterNames(template) {
1233
1287
 
1234
1288
  /**
1235
1289
  * Unprepare just strips the preparation data of the pipeline
1290
+ *
1291
+ * @public exported from `@promptbook/core`
1236
1292
  */
1237
1293
  function unpreparePipeline(pipeline) {
1238
1294
  var personas = pipeline.personas, knowledgeSources = pipeline.knowledgeSources, promptTemplates = pipeline.promptTemplates;
@@ -1249,7 +1305,6 @@ function unpreparePipeline(pipeline) {
1249
1305
  return __assign(__assign({}, pipeline), { promptTemplates: promptTemplates, knowledgeSources: knowledgeSources, knowledgePieces: [], personas: personas, preparations: [] });
1250
1306
  }
1251
1307
  /**
1252
- * TODO: [🔼] !!! Export via `@promptbook/core`
1253
1308
  * TODO: [🧿] Maybe do same process with same granularity and subfinctions as `preparePipeline`
1254
1309
  * TODO: Write tests for `preparePipeline`
1255
1310
  * TODO: [🍙] Make some standart order of json properties
@@ -1351,6 +1406,7 @@ var SimplePipelineCollection = /** @class */ (function () {
1351
1406
  *
1352
1407
  * @param promptbookSources
1353
1408
  * @returns PipelineCollection
1409
+ * @public exported from `@promptbook/core`
1354
1410
  */
1355
1411
  function createCollectionFromJson() {
1356
1412
  var promptbooks = [];
@@ -1576,6 +1632,8 @@ var defaultDiacriticsRemovalMap = [
1576
1632
  * > "ě" => "e"
1577
1633
  * > "Ă" => "A"
1578
1634
  * > ...
1635
+ *
1636
+ * @public exported from `@promptbook/utils`
1579
1637
  */
1580
1638
  var DIACRITIC_VARIANTS_LETTERS = {};
1581
1639
  // tslint:disable-next-line: prefer-for-of
@@ -1603,7 +1661,11 @@ for (var i = 0; i < defaultDiacriticsRemovalMap.length; i++) {
1603
1661
  */
1604
1662
 
1605
1663
  /**
1664
+ * @@@
1606
1665
  *
1666
+ * @param input @@@
1667
+ * @returns @@@
1668
+ * @public exported from `@promptbook/utils`
1607
1669
  */
1608
1670
  function removeDiacritics(input) {
1609
1671
  /*eslint no-control-regex: "off"*/
@@ -1611,7 +1673,19 @@ function removeDiacritics(input) {
1611
1673
  return DIACRITIC_VARIANTS_LETTERS[a] || a;
1612
1674
  });
1613
1675
  }
1676
+ /**
1677
+ * TODO: [Ж] Variant for cyrillic (and in general non-latin) letters
1678
+ */
1614
1679
 
1680
+ /**
1681
+ * @@@
1682
+ *
1683
+ * @param text @@@
1684
+ * @returns @@@
1685
+ * @example 'hello-world'
1686
+ * @example 'i-love-promptbook'
1687
+ * @public exported from `@promptbook/utils`
1688
+ */
1615
1689
  function normalizeToKebabCase(text) {
1616
1690
  var e_1, _a;
1617
1691
  text = removeDiacritics(text);
@@ -1671,6 +1745,7 @@ function normalizeToKebabCase(text) {
1671
1745
  *
1672
1746
  * @param text with emojis
1673
1747
  * @returns text without emojis
1748
+ * @public exported from `@promptbook/utils`
1674
1749
  */
1675
1750
  function removeEmojis(text) {
1676
1751
  // Replace emojis (and also ZWJ sequence) with hyphens
@@ -1682,7 +1757,12 @@ function removeEmojis(text) {
1682
1757
  }
1683
1758
 
1684
1759
  /**
1685
- * Function normalizes title to name which can be used as identifier
1760
+ * @@@
1761
+ *
1762
+ * @param value @@@
1763
+ * @returns @@@
1764
+ * @example @@@
1765
+ * @public exported from `@promptbook/utils`
1686
1766
  */
1687
1767
  function titleToName(value) {
1688
1768
  if (value.startsWith('http://') || value.startsWith('https://')) {
@@ -1701,6 +1781,8 @@ function titleToName(value) {
1701
1781
 
1702
1782
  /**
1703
1783
  * This error indicates errors during the execution of the pipeline
1784
+ *
1785
+ * @public exported from `@promptbook/core`
1704
1786
  */
1705
1787
  var PipelineExecutionError = /** @class */ (function (_super) {
1706
1788
  __extends(PipelineExecutionError, _super);
@@ -1718,6 +1800,7 @@ var PipelineExecutionError = /** @class */ (function (_super) {
1718
1800
  *
1719
1801
  * @param executionResult - The partial result of the promptnook execution
1720
1802
  * @throws {PipelineExecutionError} If the execution is not successful or if multiple errors occurred
1803
+ * @public exported from `@promptbook/core`
1721
1804
  */
1722
1805
  function assertsExecutionSuccessful(executionResult) {
1723
1806
  var isSuccessful = executionResult.isSuccessful, errors = executionResult.errors;
@@ -1748,6 +1831,7 @@ function assertsExecutionSuccessful(executionResult) {
1748
1831
  * @param script from which to extract the variables
1749
1832
  * @returns the list of variable names
1750
1833
  * @throws {ParsingError} if the script is invalid
1834
+ * @public exported from `@promptbook/utils`
1751
1835
  */
1752
1836
  function extractVariables(script) {
1753
1837
  var variables = new Set();
@@ -1796,6 +1880,7 @@ function extractVariables(script) {
1796
1880
  * @param promptTemplate the template with used parameters
1797
1881
  * @returns the set of parameter names
1798
1882
  * @throws {ParsingError} if the script is invalid
1883
+ * @public exported from `@promptbook/utils`
1799
1884
  */
1800
1885
  function extractParameterNamesFromPromptTemplate(promptTemplate) {
1801
1886
  var e_1, _a, e_2, _b, e_3, _c;
@@ -1869,6 +1954,8 @@ var ExpectError = /** @class */ (function (_super) {
1869
1954
 
1870
1955
  /**
1871
1956
  * Function isValidJsonString will tell you if the string is valid JSON or not
1957
+ *
1958
+ * @public exported from `@promptbook/utils`
1872
1959
  */
1873
1960
  function isValidJsonString(value /* <- [👨‍⚖️] */) {
1874
1961
  try {
@@ -2095,6 +2182,8 @@ var MultipleLlmExecutionTools = /** @class */ (function () {
2095
2182
  *
2096
2183
  *
2097
2184
  * Tip: You don't have to use this function directly, just pass an array of LlmExecutionTools to the `ExecutionTools`
2185
+ *
2186
+ * @public exported from `@promptbook/core`
2098
2187
  */
2099
2188
  function joinLlmExecutionTools() {
2100
2189
  var llmExecutionTools = [];
@@ -2134,6 +2223,8 @@ function joinLlmExecutionTools() {
2134
2223
 
2135
2224
  /**
2136
2225
  * Determine if the pipeline is fully prepared
2226
+ *
2227
+ * @public exported from `@promptbook/core`
2137
2228
  */
2138
2229
  function isPipelinePrepared(pipeline) {
2139
2230
  // Note: Ignoring `pipeline.preparations` @@@
@@ -2154,7 +2245,6 @@ function isPipelinePrepared(pipeline) {
2154
2245
  }
2155
2246
  /**
2156
2247
  * TODO: [🐠] Maybe base this on `makeValidator`
2157
- * TODO: [🔼] Export via core or utils
2158
2248
  * TODO: [🧊] Pipeline can be partially prepared, this should return true ONLY if fully prepared
2159
2249
  * TODO: [🧿] Maybe do same process with same granularity and subfinctions as `preparePipeline`
2160
2250
  * - [🏍] ? Is context in each template
@@ -2200,6 +2290,8 @@ function TODO_USE() {
2200
2290
 
2201
2291
  /**
2202
2292
  * This error type indicates that some limit was reached
2293
+ *
2294
+ * @public exported from `@promptbook/core`
2203
2295
  */
2204
2296
  var LimitReachedError = /** @class */ (function (_super) {
2205
2297
  __extends(LimitReachedError, _super);
@@ -2219,6 +2311,7 @@ var LimitReachedError = /** @class */ (function (_super) {
2219
2311
  * @param parameters the object with parameters
2220
2312
  * @returns the template with replaced parameters
2221
2313
  * @throws {PipelineExecutionError} if parameter is not defined, not closed, or not opened
2314
+ * @public exported from `@promptbook/utils`
2222
2315
  */
2223
2316
  function replaceParameters(template, parameters) {
2224
2317
  var e_1, _a;
@@ -2294,6 +2387,7 @@ function replaceParameters(template, parameters) {
2294
2387
  * Create difference set of two sets.
2295
2388
  *
2296
2389
  * @deprecated use new javascript set methods instead @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Set
2390
+ * @public exported from `@promptbook/utils`
2297
2391
  */
2298
2392
  function difference(a, b, isEqual) {
2299
2393
  var e_1, _a;
@@ -2327,6 +2421,7 @@ function difference(a, b, isEqual) {
2327
2421
  * Creates a new set with all elements that are present in either set
2328
2422
  *
2329
2423
  * @deprecated use new javascript set methods instead @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Set
2424
+ * @public exported from `@promptbook/utils`
2330
2425
  */
2331
2426
  function union() {
2332
2427
  var e_1, _a, e_2, _b;
@@ -2365,6 +2460,8 @@ function union() {
2365
2460
 
2366
2461
  /**
2367
2462
  * Counts number of characters in the text
2463
+ *
2464
+ * @public exported from `@promptbook/utils`
2368
2465
  */
2369
2466
  function countCharacters(text) {
2370
2467
  // Remove null characters
@@ -2378,6 +2475,8 @@ function countCharacters(text) {
2378
2475
 
2379
2476
  /**
2380
2477
  * Counts number of lines in the text
2478
+ *
2479
+ * @public exported from `@promptbook/utils`
2381
2480
  */
2382
2481
  function countLines(text) {
2383
2482
  if (text === '') {
@@ -2388,6 +2487,8 @@ function countLines(text) {
2388
2487
 
2389
2488
  /**
2390
2489
  * Counts number of pages in the text
2490
+ *
2491
+ * @public exported from `@promptbook/utils`
2391
2492
  */
2392
2493
  function countPages(text) {
2393
2494
  var sentencesPerPage = 5; // Assuming each page has 5 sentences
@@ -2398,6 +2499,8 @@ function countPages(text) {
2398
2499
 
2399
2500
  /**
2400
2501
  * Counts number of paragraphs in the text
2502
+ *
2503
+ * @public exported from `@promptbook/utils`
2401
2504
  */
2402
2505
  function countParagraphs(text) {
2403
2506
  return text.split(/\n\s*\n/).filter(function (paragraph) { return paragraph.trim() !== ''; }).length;
@@ -2405,12 +2508,16 @@ function countParagraphs(text) {
2405
2508
 
2406
2509
  /**
2407
2510
  * Split text into sentences
2511
+ *
2512
+ * @public exported from `@promptbook/utils`
2408
2513
  */
2409
2514
  function splitIntoSentences(text) {
2410
2515
  return text.split(/[.!?]+/).filter(function (sentence) { return sentence.trim() !== ''; });
2411
2516
  }
2412
2517
  /**
2413
2518
  * Counts number of sentences in the text
2519
+ *
2520
+ * @public exported from `@promptbook/utils`
2414
2521
  */
2415
2522
  function countSentences(text) {
2416
2523
  return splitIntoSentences(text).length;
@@ -2418,6 +2525,8 @@ function countSentences(text) {
2418
2525
 
2419
2526
  /**
2420
2527
  * Counts number of words in the text
2528
+ *
2529
+ * @public exported from `@promptbook/utils`
2421
2530
  */
2422
2531
  function countWords(text) {
2423
2532
  text = text.replace(/[\p{Extended_Pictographic}]/gu, 'a');
@@ -2427,6 +2536,8 @@ function countWords(text) {
2427
2536
 
2428
2537
  /**
2429
2538
  * Index of all counter functions
2539
+ *
2540
+ * @public exported from `@promptbook/utils`
2430
2541
  */
2431
2542
  var CountUtils = {
2432
2543
  CHARACTERS: countCharacters,
@@ -2446,6 +2557,7 @@ var CountUtils = {
2446
2557
  *
2447
2558
  * @throws {ExpectError} if the expectations are not met
2448
2559
  * @returns {void} Nothing
2560
+ * @public exported from `@promptbook/core`
2449
2561
  */
2450
2562
  function checkExpectations(expectations, value) {
2451
2563
  var e_1, _a;
@@ -2478,6 +2590,7 @@ function checkExpectations(expectations, value) {
2478
2590
  *
2479
2591
  * @returns The executor function
2480
2592
  * @throws {PipelineLogicError} on logical error in the pipeline
2593
+ * @public exported from `@promptbook/core`
2481
2594
  */
2482
2595
  function createPipelineExecutor(options) {
2483
2596
  var _this = this;
@@ -3266,6 +3379,8 @@ function createPipelineExecutor(options) {
3266
3379
 
3267
3380
  /**
3268
3381
  * @@@
3382
+ *
3383
+ * @public exported from `@promptbook/core`
3269
3384
  */
3270
3385
  function prepareKnowledgeFromMarkdown(knowledgeContent /* <- TODO: [🖖] (?maybe not) Always the file */, options) {
3271
3386
  return __awaiter(this, void 0, void 0, function () {
@@ -3401,6 +3516,7 @@ function prepareKnowledgeFromMarkdown(knowledgeContent /* <- TODO: [🖖] (?mayb
3401
3516
  * Prepares the knowle
3402
3517
  *
3403
3518
  * @see https://github.com/webgptorg/promptbook/discussions/41
3519
+ * @public exported from `@promptbook/core`
3404
3520
  */
3405
3521
  function prepareKnowledgePieces(knowledgeSources, options) {
3406
3522
  return __awaiter(this, void 0, void 0, function () {
@@ -3415,7 +3531,7 @@ function prepareKnowledgePieces(knowledgeSources, options) {
3415
3531
  var partialPieces, pieces;
3416
3532
  return __generator(this, function (_a) {
3417
3533
  switch (_a.label) {
3418
- case 0: return [4 /*yield*/, prepareKnowledgeFromMarkdown(knowledgeSource.source, // <- TODO: [🐝] !!! Unhardcode markdown, detect which type it is
3534
+ case 0: return [4 /*yield*/, prepareKnowledgeFromMarkdown(knowledgeSource.source, // <- TODO: [🐝] !!! Unhardcode markdown, detect which type it is - BE AWARE of big package size
3419
3535
  options)];
3420
3536
  case 1:
3421
3537
  partialPieces = _a.sent();
@@ -3453,7 +3569,6 @@ TODO: [🧊] This is how it can look in future
3453
3569
  > ):
3454
3570
  */
3455
3571
  /**
3456
- * TODO: [🐝][🔼] !!! Export via `@promptbook/core`
3457
3572
  * TODO: [🧊] In future one preparation can take data from previous preparation and save tokens and time
3458
3573
  * Put `knowledgePieces` into `PrepareKnowledgeOptions`
3459
3574
  * TODO: [🪂] More than max things can run in parallel by acident [1,[2a,2b,_],[3a,3b,_]]
@@ -3467,6 +3582,7 @@ TODO: [🧊] This is how it can look in future
3467
3582
  *
3468
3583
  * @param llmTools LLM tools to be intercepted with usage counting
3469
3584
  * @returns LLM tools with same functionality with added total cost counting
3585
+ * @public exported from `@promptbook/core`
3470
3586
  */
3471
3587
  function countTotalUsage(llmTools) {
3472
3588
  var _this = this;
@@ -3534,7 +3650,6 @@ function countTotalUsage(llmTools) {
3534
3650
  return proxyTools;
3535
3651
  }
3536
3652
  /**
3537
- * TODO: [🔼] !!! Export via `@promptbookcore/`
3538
3653
  * TODO: [🧠][💸] Maybe make some common abstraction `interceptLlmTools` and use here (or use javascript Proxy?)
3539
3654
  * TODO: [🧠] Is there some meaningfull way how to test this util
3540
3655
  * TODO: [🧠][🌯] Maybe a way how to hide ability to `get totalUsage`
@@ -3546,6 +3661,7 @@ function countTotalUsage(llmTools) {
3546
3661
  * Prepares the persona for the pipeline
3547
3662
  *
3548
3663
  * @see https://github.com/webgptorg/promptbook/discussions/22
3664
+ * @public exported from `@promptbook/core`
3549
3665
  */
3550
3666
  function preparePersona(personaDescription, options) {
3551
3667
  return __awaiter(this, void 0, void 0, function () {
@@ -3600,7 +3716,6 @@ function preparePersona(personaDescription, options) {
3600
3716
  });
3601
3717
  }
3602
3718
  /**
3603
- * TODO: [🔼] !!! Export via `@promptbook/core`
3604
3719
  * TODO: [🏢] !! Check validity of `modelName` in pipeline
3605
3720
  * TODO: [🏢] !! Check validity of `systemMessage` in pipeline
3606
3721
  * TODO: [🏢] !! Check validity of `temperature` in pipeline
@@ -3608,6 +3723,8 @@ function preparePersona(personaDescription, options) {
3608
3723
 
3609
3724
  /**
3610
3725
  * @@@
3726
+ *
3727
+ * @public exported from `@promptbook/core`
3611
3728
  */
3612
3729
  function prepareTemplates(pipeline, options) {
3613
3730
  return __awaiter(this, void 0, void 0, function () {
@@ -3649,7 +3766,6 @@ function prepareTemplates(pipeline, options) {
3649
3766
  * TODO: [🧠] Add context to each template (if missing)
3650
3767
  * TODO: [🧠] What is better name `prepareTemplate` or `prepareTemplateAndParameters`
3651
3768
  * TODO: [♨] !!! Prepare index the samples and maybe templates
3652
- * TODO: [🔼] !!! Export via `@promptbook/core`
3653
3769
  * TODO: Write tests for `preparePipeline`
3654
3770
  * TODO: [🏏] Leverage the batch API and build queues @see https://platform.openai.com/docs/guides/batch
3655
3771
  * TODO: [🧊] In future one preparation can take data from previous preparation and save tokens and time
@@ -3662,6 +3778,7 @@ function prepareTemplates(pipeline, options) {
3662
3778
  *
3663
3779
  * Note: This function does not validate logic of the pipeline
3664
3780
  * Note: This function acts as part of compilation process
3781
+ * @public exported from `@promptbook/core`
3665
3782
  */
3666
3783
  function preparePipeline(pipeline, options) {
3667
3784
  return __awaiter(this, void 0, void 0, function () {
@@ -3738,7 +3855,6 @@ function preparePipeline(pipeline, options) {
3738
3855
  });
3739
3856
  }
3740
3857
  /**
3741
- * TODO: [🔼] !!! Export via `@promptbook/core`
3742
3858
  * TODO: Write tests for `preparePipeline`
3743
3859
  * TODO: [🏏] Leverage the batch API and build queues @see https://platform.openai.com/docs/guides/batch
3744
3860
  * TODO: [🧊] In future one preparation can take data from previous preparation and save tokens and time
@@ -3749,6 +3865,7 @@ function preparePipeline(pipeline, options) {
3749
3865
  * Tests if given string is valid URL.
3750
3866
  *
3751
3867
  * Note: This does not check if the file exists only if the path is valid
3868
+ * @public exported from `@promptbook/utils`
3752
3869
  */
3753
3870
  function isValidFilePath(filePath) {
3754
3871
  if (typeof filePath !== 'string') {
@@ -3931,6 +4048,7 @@ var personaCommandParser = {
3931
4048
  *
3932
4049
  * @param {string} str - The string to remove Markdown tags from.
3933
4050
  * @returns {string} The input string with all Markdown tags removed.
4051
+ * @public exported from `@promptbook/markdown-utils`
3934
4052
  */
3935
4053
  function removeMarkdownFormatting(str) {
3936
4054
  // Remove bold formatting
@@ -3942,6 +4060,15 @@ function removeMarkdownFormatting(str) {
3942
4060
  return str;
3943
4061
  }
3944
4062
 
4063
+ /**
4064
+ * @@@
4065
+ *
4066
+ * @param text @@@
4067
+ * @returns @@@
4068
+ * @example 'HELLO_WORLD'
4069
+ * @example 'I_LOVE_PROMPTBOOK'
4070
+ * @public exported from `@promptbook/utils`
4071
+ */
3945
4072
  function normalizeTo_SCREAMING_CASE(text) {
3946
4073
  var e_1, _a;
3947
4074
  var charType;
@@ -4007,6 +4134,7 @@ function normalizeTo_SCREAMING_CASE(text) {
4007
4134
  * Block type describes the way how the block is blockd
4008
4135
  *
4009
4136
  * @see https://github.com/webgptorg/promptbook#block-type
4137
+ * @public exported from `@promptbook/core`
4010
4138
  */
4011
4139
  var BlockTypes = [
4012
4140
  'PROMPT_TEMPLATE',
@@ -4126,7 +4254,7 @@ var EXPECTATION_UNITS = ['CHARACTERS', 'WORDS', 'SENTENCES', 'LINES', 'PARAGRAPH
4126
4254
  * @returns parsed number
4127
4255
  * @throws {ParsingError} if the value is not a number
4128
4256
  *
4129
- * @private within the parseCommand
4257
+ * @public exported from `@promptbook/utils`
4130
4258
  */
4131
4259
  function parseNumber(value) {
4132
4260
  var originalValue = value;
@@ -4182,6 +4310,7 @@ function parseNumber(value) {
4182
4310
  }
4183
4311
  /**
4184
4312
  * TODO: Maybe use sth. like safe-eval in fraction/calculation case @see https://www.npmjs.com/package/safe-eval
4313
+ * TODO: [🧠][🌻] Maybe export through `@promptbook/markdown-utils` not `@promptbook/utils`
4185
4314
  */
4186
4315
 
4187
4316
  /**
@@ -4493,6 +4622,13 @@ var parameterCommandParser = {
4493
4622
  },
4494
4623
  };
4495
4624
 
4625
+ /**
4626
+ * @@@
4627
+ *
4628
+ * @param javascriptName @@@
4629
+ * @returns @@@
4630
+ * @public exported from `@promptbook/utils`
4631
+ */
4496
4632
  function isValidJavascriptName(javascriptName) {
4497
4633
  if (typeof javascriptName !== 'string') {
4498
4634
  return false;
@@ -4965,6 +5101,8 @@ function parseCommandVariant(input) {
4965
5101
 
4966
5102
  /**
4967
5103
  * This error type indicates that some part of the code is not implemented yet
5104
+ *
5105
+ * @public exported from `@promptbook/core`
4968
5106
  */
4969
5107
  var NotYetImplementedError = /** @class */ (function (_super) {
4970
5108
  __extends(NotYetImplementedError, _super);
@@ -4991,7 +5129,8 @@ var SUPPORTED_SCRIPT_LANGUAGES = ['javascript', 'typescript', 'python'];
4991
5129
  * Note: It can not work with html syntax and comments
4992
5130
  *
4993
5131
  * @param markdown any valid markdown
4994
- * @returns
5132
+ * @returns @@@
5133
+ * @public exported from `@promptbook/markdown-utils`
4995
5134
  */
4996
5135
  function extractAllListItemsFromMarkdown(markdown) {
4997
5136
  var e_1, _a;
@@ -5031,7 +5170,7 @@ function extractAllListItemsFromMarkdown(markdown) {
5031
5170
  *
5032
5171
  * @param markdown any valid markdown
5033
5172
  * @returns code blocks with language and content
5034
- *
5173
+ * @public exported from `@promptbook/markdown-utils`
5035
5174
  */
5036
5175
  function extractAllBlocksFromMarkdown(markdown) {
5037
5176
  var e_1, _a;
@@ -5108,6 +5247,7 @@ function extractAllBlocksFromMarkdown(markdown) {
5108
5247
  *
5109
5248
  * @param markdown any valid markdown
5110
5249
  * @returns code block with language and content
5250
+ * @public exported from `@promptbook/markdown-utils`
5111
5251
  */
5112
5252
  function extractOneBlockFromMarkdown(markdown) {
5113
5253
  var codeBlocks = extractAllBlocksFromMarkdown(markdown);
@@ -5122,6 +5262,8 @@ function extractOneBlockFromMarkdown(markdown) {
5122
5262
 
5123
5263
  /**
5124
5264
  * Parses markdown section to title its level and content
5265
+ *
5266
+ * @public exported from `@promptbook/markdown-utils`
5125
5267
  */
5126
5268
  function parseMarkdownSection(value) {
5127
5269
  var _a, _b;
@@ -5146,6 +5288,8 @@ function parseMarkdownSection(value) {
5146
5288
 
5147
5289
  /**
5148
5290
  * Splits the markdown into sections by headings
5291
+ *
5292
+ * @public exported from `@promptbook/markdown-utils`
5149
5293
  */
5150
5294
  function splitMarkdownIntoSections(markdown) {
5151
5295
  var e_1, _a;
@@ -5207,6 +5351,7 @@ function splitMarkdownIntoSections(markdown) {
5207
5351
  return sections;
5208
5352
  }
5209
5353
  /**
5354
+ * TODO: [🏛] This can be part of markdown builder
5210
5355
  * Note: [🕞] In past (commit 42086e1603cbed506482997c00a8ee979af0a247) there was much more
5211
5356
  * sophisticated implementation of this function through parsing markdown into JSON structure
5212
5357
  * and flattening the actual structure
@@ -5218,6 +5363,8 @@ function splitMarkdownIntoSections(markdown) {
5218
5363
  *
5219
5364
  * - It always have h1 - if there is no h1 in the markdown, it will be added "# Untitled"
5220
5365
  * - All other headings are normalized to h2
5366
+ *
5367
+ * @public exported from `@promptbook/markdown-utils`
5221
5368
  */
5222
5369
  function flattenMarkdown(markdown) {
5223
5370
  var e_1, _a;
@@ -5253,6 +5400,7 @@ function flattenMarkdown(markdown) {
5253
5400
  return spaceTrim(flattenedMarkdown);
5254
5401
  }
5255
5402
  /**
5403
+ * TODO: [🏛] This can be part of markdown builder
5256
5404
  * Note: [🕞] In past (commit 42086e1603cbed506482997c00a8ee979af0a247) there was much more
5257
5405
  * sophisticated implementation of this function through parsing markdown into JSON structure
5258
5406
  * and flattening the actual structure
@@ -5264,6 +5412,7 @@ function flattenMarkdown(markdown) {
5264
5412
  *
5265
5413
  * @param {string} content - The string to remove comments from.
5266
5414
  * @returns {string} The input string with all comments removed.
5415
+ * @public exported from `@promptbook/markdown-utils`
5267
5416
  */
5268
5417
  function removeContentComments(content) {
5269
5418
  return spaceTrim$1(content.replace(/<!--(.*?)-->/gs, ''));
@@ -5277,12 +5426,13 @@ function removeContentComments(content) {
5277
5426
  * - `pipelineStringToJsonSync` - use only if you need to compile promptbook synchronously and it contains NO external knowledge
5278
5427
  * - `preparePipeline` - just one step in the compilation process
5279
5428
  *
5429
+ * Note: This function does not validate logic of the pipeline only the syntax
5430
+ * Note: This function acts as compilation process
5431
+ *
5280
5432
  * @param pipelineString {Promptbook} in string markdown format (.ptbk.md)
5281
5433
  * @returns {Promptbook} compiled in JSON format (.ptbk.json)
5282
5434
  * @throws {ParsingError} if the promptbook string is not valid
5283
- *
5284
- * Note: This function does not validate logic of the pipeline only the syntax
5285
- * Note: This function acts as compilation process
5435
+ * @public exported from `@promptbook/core`
5286
5436
  */
5287
5437
  function pipelineStringToJsonSync(pipelineString) {
5288
5438
  var e_1, _a, e_2, _b;
@@ -5675,13 +5825,14 @@ function pipelineStringToJsonSync(pipelineString) {
5675
5825
  * - `pipelineStringToJsonSync` - use only if you need to compile promptbook synchronously and it contains NO external knowledge
5676
5826
  * - `preparePipeline` - just one step in the compilation process
5677
5827
  *
5828
+ * Note: This function does not validate logic of the pipeline only the syntax
5829
+ * Note: This function acts as compilation process
5830
+ *
5678
5831
  * @param pipelineString {Promptbook} in string markdown format (.ptbk.md)
5679
5832
  * @param options - Options and tools for the compilation
5680
5833
  * @returns {Promptbook} compiled in JSON format (.ptbk.json)
5681
5834
  * @throws {ParsingError} if the promptbook string is not valid
5682
- *
5683
- * Note: This function does not validate logic of the pipeline only the syntax
5684
- * Note: This function acts as compilation process
5835
+ * @public exported from `@promptbook/core`
5685
5836
  */
5686
5837
  function pipelineStringToJson(pipelineString, options) {
5687
5838
  if (options === void 0) { options = { llmTools: null }; }
@@ -5709,6 +5860,8 @@ function pipelineStringToJson(pipelineString, options) {
5709
5860
 
5710
5861
  /**
5711
5862
  * This error indicates that the pipeline collection cannot be propperly loaded
5863
+ *
5864
+ * @public exported from `@promptbook/core`
5712
5865
  */
5713
5866
  var CollectionError = /** @class */ (function (_super) {
5714
5867
  __extends(CollectionError, _super);
@@ -5739,6 +5892,7 @@ var CollectionError = /** @class */ (function (_super) {
5739
5892
  * @param promptbookSourcesPromiseOrFactory
5740
5893
  * @returns PipelineCollection
5741
5894
  * @deprecated Do not use, it will became internal tool for other constructor functions
5895
+ * @public exported from `@promptbook/core`
5742
5896
  */
5743
5897
  function createCollectionFromPromise(promptbookSourcesPromiseOrFactory) {
5744
5898
  var collection = null;
@@ -5815,6 +5969,7 @@ function createCollectionFromPromise(promptbookSourcesPromiseOrFactory) {
5815
5969
  * @param path - path to the directory with pipelines
5816
5970
  * @param options - Misc options for the collection
5817
5971
  * @returns PipelineCollection
5972
+ * @public exported from `@promptbook/node`
5818
5973
  */
5819
5974
  function createCollectionFromDirectory(path, options) {
5820
5975
  return __awaiter(this, void 0, void 0, function () {
@@ -6062,6 +6217,8 @@ function listAllFiles(path, isRecursive) {
6062
6217
  *
6063
6218
  * Note: [0] It can be used for more JSON types like whole collection of pipelines, single knowledge piece, etc.
6064
6219
  * Note: In contrast to JSON.stringify, this function ensures that **embedding index** is on single line
6220
+ *
6221
+ * @public exported from `@promptbook/core`
6065
6222
  */
6066
6223
  function stringifyPipelineJson(pipeline) {
6067
6224
  var pipelineJsonStringified = JSON.stringify(pipeline, null, 4);
@@ -6085,6 +6242,8 @@ function stringifyPipelineJson(pipeline) {
6085
6242
  * Note: This is an estimate based of theese sources:
6086
6243
  * - https://jecas.cz/doba-cteni
6087
6244
  * - https://www.originalnitonery.cz/blog/psani-vsemi-deseti-se-muzete-naucit-i-sami-doma
6245
+ *
6246
+ * @public exported from `@promptbook/core`
6088
6247
  */
6089
6248
  function usageToWorktime(usage) {
6090
6249
  var value = usage.input.wordsCount.value / (200 /* words per minute */ * 60) +
@@ -6099,6 +6258,8 @@ function usageToWorktime(usage) {
6099
6258
 
6100
6259
  /**
6101
6260
  * Function `usageToHuman` will take usage and convert it to human readable report
6261
+ *
6262
+ * @public exported from `@promptbook/core`
6102
6263
  */
6103
6264
  function usageToHuman(usage) {
6104
6265
  var report = 'Usage:';
@@ -6122,6 +6283,8 @@ function usageToHuman(usage) {
6122
6283
 
6123
6284
  /**
6124
6285
  * This error type indicates that you try to use a feature that is not available in the current environment
6286
+ *
6287
+ * @public exported from `@promptbook/core`
6125
6288
  */
6126
6289
  var EnvironmentMismatchError = /** @class */ (function (_super) {
6127
6290
  __extends(EnvironmentMismatchError, _super);
@@ -6145,6 +6308,8 @@ function nameToSubfolderPath(name) {
6145
6308
 
6146
6309
  /**
6147
6310
  * @@@
6311
+ *
6312
+ * @public exported from `@promptbook/node`
6148
6313
  */
6149
6314
  var FilesStorage = /** @class */ (function () {
6150
6315
  function FilesStorage(options) {
@@ -6234,7 +6399,6 @@ var FilesStorage = /** @class */ (function () {
6234
6399
  return FilesStorage;
6235
6400
  }());
6236
6401
  /**
6237
- * TODO: [🔼] !!! Export via `@promptbook/node`
6238
6402
  * TODO: [🌗] Maybe some checkers, not all valid JSONs are desired and valid values
6239
6403
  * Note: [🟢] This code should never be published outside of `@promptbook/node`
6240
6404
  */
@@ -6365,6 +6529,8 @@ var ANTHROPIC_CLAUDE_MODELS = [
6365
6529
 
6366
6530
  /**
6367
6531
  * Execution Tools for calling Anthropic Claude API.
6532
+ *
6533
+ * @public exported from `@promptbook/anthropic-claude`
6368
6534
  */
6369
6535
  var AnthropicClaudeExecutionTools = /** @class */ (function () {
6370
6536
  /**
@@ -6590,6 +6756,7 @@ var AnthropicClaudeExecutionTools = /** @class */ (function () {
6590
6756
  *
6591
6757
  * @see https://platform.openai.com/docs/models/
6592
6758
  * @see https://openai.com/api/pricing/
6759
+ * @public exported from `@promptbook/openai`
6593
6760
  */
6594
6761
  var OPENAI_MODELS = [
6595
6762
  /*/
@@ -6970,6 +7137,8 @@ resultContent, rawResponse) {
6970
7137
 
6971
7138
  /**
6972
7139
  * Execution Tools for calling OpenAI API.
7140
+ *
7141
+ * @public exported from `@promptbook/openai`
6973
7142
  */
6974
7143
  var OpenAiExecutionTools = /** @class */ (function () {
6975
7144
  /**
@@ -7281,6 +7450,7 @@ var OpenAiExecutionTools = /** @class */ (function () {
7281
7450
  * - `process.env.ANTHROPIC_CLAUDE_API_KEY`
7282
7451
  *
7283
7452
  * @returns @@@
7453
+ * @public exported from `@promptbook/node`
7284
7454
  */
7285
7455
  function createLlmToolsFromEnv(options) {
7286
7456
  if (options === void 0) { options = {}; }
@@ -7314,7 +7484,6 @@ function createLlmToolsFromEnv(options) {
7314
7484
  }
7315
7485
  /**
7316
7486
  * TODO: [🍜] Use `createLlmToolsFromConfiguration`
7317
- * TODO: [🔼] !!! Export via `@promptbook/node`
7318
7487
  * TODO: @@@ write discussion about this - wizzard
7319
7488
  * TODO: Add Azure
7320
7489
  * TODO: [🧠] Which name is better `createLlmToolsFromEnv` or `createLlmToolsFromEnvironment`?
@@ -7326,6 +7495,8 @@ function createLlmToolsFromEnv(options) {
7326
7495
 
7327
7496
  /**
7328
7497
  * Stores
7498
+ *
7499
+ * @public exported from `@promptbook/core`
7329
7500
  */
7330
7501
  var MemoryStorage = /** @class */ (function () {
7331
7502
  function MemoryStorage() {
@@ -7373,14 +7544,12 @@ var MemoryStorage = /** @class */ (function () {
7373
7544
  };
7374
7545
  return MemoryStorage;
7375
7546
  }());
7376
- /**
7377
- * TODO: [🔼] !!! Export via `@promptbook/core`
7378
- */
7379
7547
 
7380
7548
  /**
7381
7549
  * Simple wrapper `new Date().toISOString()`
7382
7550
  *
7383
7551
  * @returns string_date branded type
7552
+ * @public exported from `@promptbook/utils`
7384
7553
  */
7385
7554
  function $currentDate() {
7386
7555
  return new Date().toISOString();
@@ -7393,6 +7562,7 @@ function $currentDate() {
7393
7562
  *
7394
7563
  * @param llmTools LLM tools to be intercepted with usage counting, it can contain extra methods like `totalUsage`
7395
7564
  * @returns LLM tools with same functionality with added total cost counting
7565
+ * @public exported from `@promptbook/core`
7396
7566
  */
7397
7567
  function cacheLlmTools(llmTools, options) {
7398
7568
  var _this = this;
@@ -7489,7 +7659,6 @@ function cacheLlmTools(llmTools, options) {
7489
7659
  return proxyTools;
7490
7660
  }
7491
7661
  /**
7492
- * TODO: [🔼] !!! Export via `@promptbook/core`
7493
7662
  * TODO: [🧠][💸] Maybe make some common abstraction `interceptLlmTools` and use here (or use javascript Proxy?)
7494
7663
  * TODO: [🧠] Is there some meaningfull way how to test this util
7495
7664
  * TODO: [👷‍♂️] @@@ Manual about construction of llmTools
@@ -7690,7 +7859,7 @@ function initializeMakeCommand(program) {
7690
7859
  /**
7691
7860
  * Add or modify an auto-generated section in a markdown file
7692
7861
  *
7693
- * @private within the repository
7862
+ * @public exported from `@promptbook/markdown-utils`
7694
7863
  */
7695
7864
  function addAutoGeneratedSection(content, options) {
7696
7865
  var sectionName = options.sectionName, sectionContent = options.sectionContent;
@@ -7710,7 +7879,20 @@ function addAutoGeneratedSection(content, options) {
7710
7879
  var _a = __read(placeForSection, 1), heading = _a[0];
7711
7880
  return content.replace(heading, "<!--".concat(sectionName, "-->\n").concat(warningLine, "\n").concat(sectionContent, "\n<!--/").concat(sectionName, "-->\n\n").concat(heading));
7712
7881
  }
7882
+ /**
7883
+ * TODO: [🏛] This can be part of markdown builder
7884
+ */
7713
7885
 
7886
+ /**
7887
+ * @@@
7888
+ *
7889
+ * @param text @@@
7890
+ * @param _isFirstLetterCapital @@@
7891
+ * @returns @@@
7892
+ * @example 'helloWorld'
7893
+ * @example 'iLovePromptbook'
7894
+ * @public exported from `@promptbook/utils`
7895
+ */
7714
7896
  function normalizeTo_camelCase(text, _isFirstLetterCapital) {
7715
7897
  var e_1, _a;
7716
7898
  if (_isFirstLetterCapital === void 0) { _isFirstLetterCapital = false; }
@@ -7769,6 +7951,8 @@ function normalizeTo_camelCase(text, _isFirstLetterCapital) {
7769
7951
  * Creates a Mermaid graph based on the promptbook
7770
7952
  *
7771
7953
  * Note: The result is not wrapped in a Markdown code block
7954
+ *
7955
+ * @public exported from `@promptbook/utils`
7772
7956
  */
7773
7957
  function renderPromptbookMermaid(pipelineJson, options) {
7774
7958
  var _a = (options || {}).linkPromptTemplate, linkPromptTemplate = _a === void 0 ? function () { return null; } : _a;
@@ -7825,6 +8009,8 @@ function renderPromptbookMermaid(pipelineJson, options) {
7825
8009
 
7826
8010
  /**
7827
8011
  * Prettyfies Promptbook string and adds Mermaid graph
8012
+ *
8013
+ * @public exported from `@promptbook/core`
7828
8014
  */
7829
8015
  function prettifyPipelineString(pipelineString, options) {
7830
8016
  return __awaiter(this, void 0, void 0, function () {
@@ -7978,14 +8164,18 @@ function promptbookCli() {
7978
8164
  * Note: [🟡] This code should never be published outside of `@promptbook/cli`
7979
8165
  */
7980
8166
 
7981
- // @promptbook/cli
7982
8167
  /**
7983
8168
  * Hidden utilities which should not be used by external consumers.
8169
+ *
8170
+ * @public exported from `@promptbook/cli`
7984
8171
  */
7985
8172
  var __CLI = {
7986
8173
  // Note: [🥠]
7987
8174
  __initialize: promptbookCli,
7988
8175
  };
8176
+ /**
8177
+ * Note: [🟡] This code should never be published outside of `@promptbook/cli`
8178
+ */
7989
8179
 
7990
8180
  export { PROMPTBOOK_VERSION, __CLI };
7991
8181
  //# sourceMappingURL=index.es.js.map