@promptbook/cli 0.63.0-0 → 0.63.0-10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (493) hide show
  1. package/README.md +4 -2
  2. package/esm/index.es.js +357 -206
  3. package/esm/index.es.js.map +1 -1
  4. package/esm/typings/src/_packages/anthropic-claude.index.d.ts +2 -0
  5. package/esm/typings/src/_packages/browser.index.d.ts +2 -0
  6. package/esm/typings/src/_packages/core.index.d.ts +6 -4
  7. package/esm/typings/src/_packages/types.index.d.ts +0 -48
  8. package/esm/typings/src/_packages/utils.index.d.ts +6 -2
  9. package/esm/typings/src/cli/cli-commands/about.d.ts +11 -0
  10. package/esm/typings/src/cli/cli-commands/hello.d.ts +2 -2
  11. package/esm/typings/src/cli/cli-commands/make.d.ts +4 -1
  12. package/esm/typings/src/cli/cli-commands/prettify.d.ts +2 -1
  13. package/esm/typings/src/cli/promptbookCli.d.ts +3 -1
  14. package/esm/typings/src/cli/test/ptbk.d.ts +2 -0
  15. package/esm/typings/src/collection/SimplePipelineCollection.d.ts +1 -2
  16. package/esm/typings/src/collection/constructors/createCollectionFromDirectory.d.ts +2 -1
  17. package/esm/typings/src/commands/_BOILERPLATE/boilerplateCommandParser.d.ts +0 -1
  18. package/esm/typings/src/commands/_common/types/CommandUsagePlaces.d.ts +2 -0
  19. package/esm/typings/src/commands/index.d.ts +2 -0
  20. package/esm/typings/src/config.d.ts +33 -5
  21. package/esm/typings/src/conversion/pipelineJsonToString.d.ts +1 -0
  22. package/esm/typings/src/conversion/pipelineStringToJson.d.ts +1 -0
  23. package/esm/typings/src/conversion/validation/_importPipeline.d.ts +8 -1
  24. package/esm/typings/src/errors/_ExpectError.d.ts +2 -1
  25. package/esm/typings/src/execution/translation/automatic-translate/automatic-translators/AutomaticTranslator.d.ts +3 -0
  26. package/esm/typings/src/execution/translation/automatic-translate/automatic-translators/DebugAutomaticTranslator.d.ts +2 -0
  27. package/esm/typings/src/execution/translation/automatic-translate/automatic-translators/FakeAutomaticTranslator.d.ts +3 -0
  28. package/esm/typings/src/execution/translation/automatic-translate/automatic-translators/LindatAutomaticTranslator.d.ts +3 -0
  29. package/esm/typings/src/execution/translation/automatic-translate/automatic-translators/TranslatorOptions.d.ts +3 -0
  30. package/esm/typings/src/execution/translation/automatic-translate/automatic-translators/utils/extractMultiplicatedOccurrence.d.ts +1 -0
  31. package/esm/typings/src/execution/translation/automatic-translate/translateMessages.d.ts +3 -0
  32. package/esm/typings/src/execution/utils/checkExpectations.d.ts +1 -1
  33. package/esm/typings/src/execution/utils/computeUsageCounts.d.ts +1 -1
  34. package/esm/typings/src/expectations/drafts/isDomainNameFree.d.ts +3 -0
  35. package/esm/typings/src/expectations/drafts/isGithubNameFree.d.ts +3 -0
  36. package/esm/typings/src/formats/_common/FormatDefinition.d.ts +1 -1
  37. package/esm/typings/src/formats/csv/ListFormatDefinition.d.ts +2 -0
  38. package/esm/typings/src/formats/index.d.ts +2 -0
  39. package/esm/typings/src/formats/json/JsonFormatDefinition.d.ts +2 -0
  40. package/esm/typings/src/formats/list/ListFormatDefinition.d.ts +2 -0
  41. package/esm/typings/src/formats/xml/XmlFormatDefinition.d.ts +2 -0
  42. package/esm/typings/src/knowledge/dialogs/simple-prompt/SimplePromptInterfaceTools.d.ts +1 -1
  43. package/esm/typings/src/knowledge/prepare-knowledge/pdf/prepareKnowledgeFromPdf.d.ts +2 -0
  44. package/esm/typings/src/llm-providers/_common/createLlmToolsFromEnv.d.ts +4 -2
  45. package/esm/typings/src/llm-providers/anthropic-claude/anthropic-claude-models.d.ts +1 -0
  46. package/esm/typings/src/llm-providers/mocked/fakeTextToExpectations.d.ts +1 -1
  47. package/esm/typings/src/llm-providers/multiple/MultipleLlmExecutionTools.d.ts +1 -1
  48. package/esm/typings/src/llm-providers/openai/computeOpenaiUsage.d.ts +1 -1
  49. package/esm/typings/src/scripting/javascript/utils/preserve.d.ts +1 -0
  50. package/esm/typings/src/scripting/javascript/utils/unknownToString.d.ts +1 -1
  51. package/esm/typings/src/scripting/python/PythonExecutionTools.d.ts +2 -0
  52. package/esm/typings/src/scripting/typescript/TypescriptExecutionTools.d.ts +2 -0
  53. package/esm/typings/src/storage/files-storage/FilesStorage.d.ts +1 -1
  54. package/esm/typings/src/types/Arrayable.d.ts +1 -1
  55. package/esm/typings/src/types/ModelVariant.d.ts +8 -7
  56. package/esm/typings/src/types/PipelineJson/Expectations.d.ts +10 -4
  57. package/esm/typings/src/types/PipelineJson/LlmTemplateJson.d.ts +1 -1
  58. package/esm/typings/src/types/ScriptLanguage.d.ts +6 -4
  59. package/esm/typings/src/types/execution-report/executionReportJsonToString.d.ts +1 -0
  60. package/esm/typings/src/types/typeAliases.d.ts +2 -1
  61. package/esm/typings/src/utils/arrayableToArray.d.ts +1 -1
  62. package/esm/typings/src/utils/deepFreeze.d.ts +6 -5
  63. package/esm/typings/src/utils/files/isDirectoryExisting.d.ts +13 -0
  64. package/esm/typings/src/utils/files/isFileExisting.d.ts +12 -0
  65. package/esm/typings/src/utils/files/listAllFiles.d.ts +15 -0
  66. package/esm/typings/src/utils/getCurrentIsoDate.d.ts +1 -1
  67. package/esm/typings/src/utils/markdown/extractOneBlockFromMarkdown.d.ts +1 -1
  68. package/esm/typings/src/utils/normalization/normalizeWhitespaces.d.ts +3 -1
  69. package/esm/typings/src/utils/validators/email/isValidEmail.d.ts +2 -0
  70. package/esm/typings/src/version.d.ts +0 -2
  71. package/package.json +10 -16
  72. package/umd/index.umd.js +354 -204
  73. package/umd/index.umd.js.map +1 -1
  74. package/esm/typings/src/types/execution-report/config.d.ts +0 -8
  75. package/umd/typings/promptbook-collection/index.d.ts +0 -252
  76. package/umd/typings/src/_packages/anthropic-claude.index.d.ts +0 -6
  77. package/umd/typings/src/_packages/azure-openai.index.d.ts +0 -6
  78. package/umd/typings/src/_packages/browser.index.d.ts +0 -6
  79. package/umd/typings/src/_packages/cli.index.d.ts +0 -4
  80. package/umd/typings/src/_packages/core.index.d.ts +0 -124
  81. package/umd/typings/src/_packages/execute-javascript.index.d.ts +0 -8
  82. package/umd/typings/src/_packages/fake-llm.index.d.ts +0 -6
  83. package/umd/typings/src/_packages/langtail.index.d.ts +0 -6
  84. package/umd/typings/src/_packages/markdown-utils.index.d.ts +0 -36
  85. package/umd/typings/src/_packages/node.index.d.ts +0 -8
  86. package/umd/typings/src/_packages/openai.index.d.ts +0 -8
  87. package/umd/typings/src/_packages/remote-client.index.d.ts +0 -8
  88. package/umd/typings/src/_packages/remote-server.index.d.ts +0 -6
  89. package/umd/typings/src/_packages/types.index.d.ts +0 -462
  90. package/umd/typings/src/_packages/utils.index.d.ts +0 -130
  91. package/umd/typings/src/cli/cli-commands/hello.d.ts +0 -10
  92. package/umd/typings/src/cli/cli-commands/make.d.ts +0 -10
  93. package/umd/typings/src/cli/cli-commands/prettify.d.ts +0 -10
  94. package/umd/typings/src/cli/main.d.ts +0 -12
  95. package/umd/typings/src/cli/promptbookCli.d.ts +0 -10
  96. package/umd/typings/src/collection/PipelineCollection.d.ts +0 -25
  97. package/umd/typings/src/collection/SimplePipelineCollection.d.ts +0 -38
  98. package/umd/typings/src/collection/collectionToJson.d.ts +0 -13
  99. package/umd/typings/src/collection/collectionToJson.test.d.ts +0 -7
  100. package/umd/typings/src/collection/constructors/createCollectionFromDirectory.d.ts +0 -48
  101. package/umd/typings/src/collection/constructors/createCollectionFromJson.d.ts +0 -13
  102. package/umd/typings/src/collection/constructors/createCollectionFromPromise.d.ts +0 -23
  103. package/umd/typings/src/collection/constructors/createCollectionFromUrl.d.ts +0 -29
  104. package/umd/typings/src/collection/constructors/createSubcollection.d.ts +0 -13
  105. package/umd/typings/src/commands/BLOCK/BlockCommand.d.ts +0 -11
  106. package/umd/typings/src/commands/BLOCK/BlockTypes.d.ts +0 -15
  107. package/umd/typings/src/commands/BLOCK/blockCommandParser.d.ts +0 -9
  108. package/umd/typings/src/commands/EXPECT/ExpectAmountCommand.d.ts +0 -14
  109. package/umd/typings/src/commands/EXPECT/ExpectCommand.d.ts +0 -9
  110. package/umd/typings/src/commands/EXPECT/ExpectFormatCommand.d.ts +0 -7
  111. package/umd/typings/src/commands/EXPECT/expectCommand.test.d.ts +0 -1
  112. package/umd/typings/src/commands/EXPECT/expectCommandParser.d.ts +0 -9
  113. package/umd/typings/src/commands/JOKER/JokerCommand.d.ts +0 -11
  114. package/umd/typings/src/commands/JOKER/jokerCommand.test.d.ts +0 -1
  115. package/umd/typings/src/commands/JOKER/jokerCommandParser.d.ts +0 -9
  116. package/umd/typings/src/commands/KNOWLEDGE/KnowledgeCommand.d.ts +0 -11
  117. package/umd/typings/src/commands/KNOWLEDGE/knowledgeCommand.test.d.ts +0 -1
  118. package/umd/typings/src/commands/KNOWLEDGE/knowledgeCommandParser.d.ts +0 -9
  119. package/umd/typings/src/commands/MODEL/ModelCommand.d.ts +0 -13
  120. package/umd/typings/src/commands/MODEL/modelCommand.test.d.ts +0 -1
  121. package/umd/typings/src/commands/MODEL/modelCommandParser.d.ts +0 -9
  122. package/umd/typings/src/commands/PARAMETER/ParameterCommand.d.ts +0 -15
  123. package/umd/typings/src/commands/PARAMETER/parameterCommand.test.d.ts +0 -1
  124. package/umd/typings/src/commands/PARAMETER/parameterCommandParser.d.ts +0 -9
  125. package/umd/typings/src/commands/PERSONA/PersonaCommand.d.ts +0 -13
  126. package/umd/typings/src/commands/PERSONA/personaCommand.test.d.ts +0 -1
  127. package/umd/typings/src/commands/PERSONA/personaCommandParser.d.ts +0 -9
  128. package/umd/typings/src/commands/POSTPROCESS/PostprocessCommand.d.ts +0 -11
  129. package/umd/typings/src/commands/POSTPROCESS/postprocessCommand.test.d.ts +0 -1
  130. package/umd/typings/src/commands/POSTPROCESS/postprocessCommandParser.d.ts +0 -9
  131. package/umd/typings/src/commands/PROMPTBOOK_VERSION/PromptbookVersionCommand.d.ts +0 -11
  132. package/umd/typings/src/commands/PROMPTBOOK_VERSION/promptbookVersionCommand.test.d.ts +0 -1
  133. package/umd/typings/src/commands/PROMPTBOOK_VERSION/promptbookVersionCommandParser.d.ts +0 -9
  134. package/umd/typings/src/commands/URL/UrlCommand.d.ts +0 -10
  135. package/umd/typings/src/commands/URL/urlCommand.test.d.ts +0 -1
  136. package/umd/typings/src/commands/URL/urlCommandParser.d.ts +0 -9
  137. package/umd/typings/src/commands/X_ACTION/ActionCommand.d.ts +0 -9
  138. package/umd/typings/src/commands/X_ACTION/actionCommand.test.d.ts +0 -1
  139. package/umd/typings/src/commands/X_ACTION/actionCommandParser.d.ts +0 -9
  140. package/umd/typings/src/commands/X_INSTRUMENT/InstrumentCommand.d.ts +0 -9
  141. package/umd/typings/src/commands/X_INSTRUMENT/instrumentCommand.test.d.ts +0 -1
  142. package/umd/typings/src/commands/X_INSTRUMENT/instrumentCommandParser.d.ts +0 -9
  143. package/umd/typings/src/commands/_BOILERPLATE/BoilerplateCommand.d.ts +0 -10
  144. package/umd/typings/src/commands/_BOILERPLATE/boilerplateCommand.test.d.ts +0 -1
  145. package/umd/typings/src/commands/_BOILERPLATE/boilerplateCommandParser.d.ts +0 -13
  146. package/umd/typings/src/commands/_common/parseCommand.d.ts +0 -12
  147. package/umd/typings/src/commands/_common/parseCommand.test.d.ts +0 -1
  148. package/umd/typings/src/commands/_common/types/Command.d.ts +0 -6
  149. package/umd/typings/src/commands/_common/types/CommandParser.d.ts +0 -64
  150. package/umd/typings/src/commands/_common/types/CommandUsagePlaces.d.ts +0 -9
  151. package/umd/typings/src/commands/index.d.ts +0 -4
  152. package/umd/typings/src/config.d.ts +0 -87
  153. package/umd/typings/src/config.test.d.ts +0 -4
  154. package/umd/typings/src/conversion/pipelineJsonToString.d.ts +0 -16
  155. package/umd/typings/src/conversion/pipelineStringToJson.d.ts +0 -38
  156. package/umd/typings/src/conversion/pipelineStringToJson.test.d.ts +0 -1
  157. package/umd/typings/src/conversion/pipelineStringToJsonSync.d.ts +0 -29
  158. package/umd/typings/src/conversion/pipelineStringToJsonSync.test.d.ts +0 -1
  159. package/umd/typings/src/conversion/prettify/PrettifyOptions.d.ts +0 -13
  160. package/umd/typings/src/conversion/prettify/prettifyPipelineString.d.ts +0 -12
  161. package/umd/typings/src/conversion/prettify/renderPipelineMermaidOptions.d.ts +0 -27
  162. package/umd/typings/src/conversion/utils/extractParameterNamesFromPromptTemplate.d.ts +0 -14
  163. package/umd/typings/src/conversion/utils/extractParameterNamesFromPromptTemplate.test.d.ts +0 -1
  164. package/umd/typings/src/conversion/utils/extractVariables.d.ts +0 -14
  165. package/umd/typings/src/conversion/utils/extractVariables.test.d.ts +0 -1
  166. package/umd/typings/src/conversion/utils/renameParameter.d.ts +0 -26
  167. package/umd/typings/src/conversion/utils/renameParameter.test.d.ts +0 -1
  168. package/umd/typings/src/conversion/utils/stringifyPipelineJson.d.ts +0 -16
  169. package/umd/typings/src/conversion/utils/stringifyPipelineJson.test.d.ts +0 -1
  170. package/umd/typings/src/conversion/utils/titleToName.d.ts +0 -9
  171. package/umd/typings/src/conversion/utils/titleToName.test.d.ts +0 -1
  172. package/umd/typings/src/conversion/validation/_importPipeline.d.ts +0 -22
  173. package/umd/typings/src/conversion/validation/pipelineStringToJson-syntaxErrors.test.d.ts +0 -1
  174. package/umd/typings/src/conversion/validation/validatePipeline-logicErrors.test.d.ts +0 -4
  175. package/umd/typings/src/conversion/validation/validatePipeline.d.ts +0 -37
  176. package/umd/typings/src/conversion/validation/validatePipeline.test.d.ts +0 -1
  177. package/umd/typings/src/errors/CollectionError.d.ts +0 -9
  178. package/umd/typings/src/errors/EnvironmentMismatchError.d.ts +0 -9
  179. package/umd/typings/src/errors/LimitReachedError.d.ts +0 -9
  180. package/umd/typings/src/errors/NotFoundError.d.ts +0 -9
  181. package/umd/typings/src/errors/NotYetImplementedError.d.ts +0 -9
  182. package/umd/typings/src/errors/ParsingError.d.ts +0 -9
  183. package/umd/typings/src/errors/PipelineExecutionError.d.ts +0 -9
  184. package/umd/typings/src/errors/PipelineLogicError.d.ts +0 -9
  185. package/umd/typings/src/errors/ReferenceError.d.ts +0 -9
  186. package/umd/typings/src/errors/UnexpectedError.d.ts +0 -9
  187. package/umd/typings/src/errors/VersionMismatchError.d.ts +0 -10
  188. package/umd/typings/src/errors/_ExpectError.d.ts +0 -10
  189. package/umd/typings/src/execution/CommonExecutionToolsOptions.d.ts +0 -10
  190. package/umd/typings/src/execution/EmbeddingVector.d.ts +0 -8
  191. package/umd/typings/src/execution/ExecutionTools.d.ts +0 -33
  192. package/umd/typings/src/execution/LlmExecutionTools.d.ts +0 -72
  193. package/umd/typings/src/execution/PipelineExecutor.d.ts +0 -64
  194. package/umd/typings/src/execution/PromptResult.d.ts +0 -99
  195. package/umd/typings/src/execution/PromptResultUsage.d.ts +0 -29
  196. package/umd/typings/src/execution/ScriptExecutionTools.d.ts +0 -39
  197. package/umd/typings/src/execution/UncertainNumber.d.ts +0 -18
  198. package/umd/typings/src/execution/UserInterfaceTools.d.ts +0 -46
  199. package/umd/typings/src/execution/assertsExecutionSuccessful.d.ts +0 -12
  200. package/umd/typings/src/execution/createPipelineExecutor.d.ts +0 -71
  201. package/umd/typings/src/execution/embeddingVectorToString.d.ts +0 -7
  202. package/umd/typings/src/execution/translation/automatic-translate/automatic-translators/AutomaticTranslator.d.ts +0 -4
  203. package/umd/typings/src/execution/translation/automatic-translate/automatic-translators/DebugAutomaticTranslator.d.ts +0 -9
  204. package/umd/typings/src/execution/translation/automatic-translate/automatic-translators/FakeAutomaticTranslator.d.ts +0 -5
  205. package/umd/typings/src/execution/translation/automatic-translate/automatic-translators/LindatAutomaticTranslator.d.ts +0 -11
  206. package/umd/typings/src/execution/translation/automatic-translate/automatic-translators/TranslatorOptions.d.ts +0 -4
  207. package/umd/typings/src/execution/translation/automatic-translate/automatic-translators/utils/extractMultiplicatedOccurrence.d.ts +0 -7
  208. package/umd/typings/src/execution/translation/automatic-translate/automatic-translators/utils/extractMultiplicatedOccurrence.test.d.ts +0 -1
  209. package/umd/typings/src/execution/translation/automatic-translate/translateMessages.d.ts +0 -5
  210. package/umd/typings/src/execution/utils/addUsage.d.ts +0 -65
  211. package/umd/typings/src/execution/utils/addUsage.test.d.ts +0 -1
  212. package/umd/typings/src/execution/utils/checkExpectations.d.ts +0 -27
  213. package/umd/typings/src/execution/utils/checkExpectations.test.d.ts +0 -1
  214. package/umd/typings/src/execution/utils/computeUsageCounts.d.ts +0 -10
  215. package/umd/typings/src/execution/utils/forEachAsync.d.ts +0 -19
  216. package/umd/typings/src/execution/utils/uncertainNumber.d.ts +0 -9
  217. package/umd/typings/src/execution/utils/usageToHuman.d.ts +0 -17
  218. package/umd/typings/src/execution/utils/usageToHuman.test.d.ts +0 -1
  219. package/umd/typings/src/execution/utils/usageToWorktime.d.ts +0 -12
  220. package/umd/typings/src/execution/utils/usageToWorktime.test.d.ts +0 -1
  221. package/umd/typings/src/expectations/drafts/isDomainNameFree.d.ts +0 -6
  222. package/umd/typings/src/expectations/drafts/isGithubNameFree.d.ts +0 -6
  223. package/umd/typings/src/formats/_common/FormatDefinition.d.ts +0 -70
  224. package/umd/typings/src/formats/csv/ListFormatDefinition.d.ts +0 -12
  225. package/umd/typings/src/formats/index.d.ts +0 -4
  226. package/umd/typings/src/formats/json/JsonFormatDefinition.d.ts +0 -16
  227. package/umd/typings/src/formats/json/utils/isValidJsonString.d.ts +0 -6
  228. package/umd/typings/src/formats/json/utils/isValidJsonString.test.d.ts +0 -1
  229. package/umd/typings/src/formats/list/ListFormatDefinition.d.ts +0 -14
  230. package/umd/typings/src/formats/xml/XmlFormatDefinition.d.ts +0 -16
  231. package/umd/typings/src/knowledge/dialogs/callback/CallbackInterfaceTools.d.ts +0 -17
  232. package/umd/typings/src/knowledge/dialogs/callback/CallbackInterfaceToolsOptions.d.ts +0 -14
  233. package/umd/typings/src/knowledge/dialogs/simple-prompt/SimplePromptInterfaceTools.d.ts +0 -22
  234. package/umd/typings/src/knowledge/dialogs/user-interface-execution-tools.test.d.ts +0 -1
  235. package/umd/typings/src/knowledge/prepare-knowledge/_common/Scraper.d.ts +0 -37
  236. package/umd/typings/src/knowledge/prepare-knowledge/_common/prepareKnowledgePieces.d.ts +0 -18
  237. package/umd/typings/src/knowledge/prepare-knowledge/_common/prepareKnowledgePieces.test.d.ts +0 -1
  238. package/umd/typings/src/knowledge/prepare-knowledge/markdown/playground/markdown-knowledge-playground.d.ts +0 -2
  239. package/umd/typings/src/knowledge/prepare-knowledge/markdown/prepareKnowledgeFromMarkdown.d.ts +0 -14
  240. package/umd/typings/src/knowledge/prepare-knowledge/markdown/prepareKnowledgeFromMarkdown.test.d.ts +0 -4
  241. package/umd/typings/src/knowledge/prepare-knowledge/pdf/prepareKnowledgeFromPdf.d.ts +0 -13
  242. package/umd/typings/src/knowledge/prepare-knowledge/pdf/prepareKnowledgeFromPdf.test.d.ts +0 -1
  243. package/umd/typings/src/llm-providers/_common/createLlmToolsFromEnv.d.ts +0 -37
  244. package/umd/typings/src/llm-providers/_common/getLlmToolsForCli.d.ts +0 -20
  245. package/umd/typings/src/llm-providers/_common/getLlmToolsForTestingAndScriptsAndPlayground.d.ts +0 -21
  246. package/umd/typings/src/llm-providers/_common/utils/cache/CacheItem.d.ts +0 -29
  247. package/umd/typings/src/llm-providers/_common/utils/cache/CacheLlmToolsOptions.d.ts +0 -16
  248. package/umd/typings/src/llm-providers/_common/utils/cache/cacheLlmTools.d.ts +0 -19
  249. package/umd/typings/src/llm-providers/_common/utils/count-total-usage/LlmExecutionToolsWithTotalUsage.d.ts +0 -15
  250. package/umd/typings/src/llm-providers/_common/utils/count-total-usage/countTotalUsage.d.ts +0 -17
  251. package/umd/typings/src/llm-providers/_common/utils/count-total-usage/limitTotalUsage.d.ts +0 -36
  252. package/umd/typings/src/llm-providers/anthropic-claude/AnthropicClaudeExecutionTools.d.ts +0 -52
  253. package/umd/typings/src/llm-providers/anthropic-claude/AnthropicClaudeExecutionToolsOptions.d.ts +0 -12
  254. package/umd/typings/src/llm-providers/anthropic-claude/anthropic-claude-models.d.ts +0 -22
  255. package/umd/typings/src/llm-providers/anthropic-claude/playground/playground.d.ts +0 -6
  256. package/umd/typings/src/llm-providers/azure-openai/AzureOpenAiExecutionTools.d.ts +0 -50
  257. package/umd/typings/src/llm-providers/azure-openai/AzureOpenAiExecutionToolsOptions.d.ts +0 -36
  258. package/umd/typings/src/llm-providers/azure-openai/playground/playground.d.ts +0 -5
  259. package/umd/typings/src/llm-providers/langtail/LangtailExecutionTools.d.ts +0 -17
  260. package/umd/typings/src/llm-providers/langtail/LangtailExecutionToolsOptions.d.ts +0 -13
  261. package/umd/typings/src/llm-providers/langtail/playground/playground.d.ts +0 -2
  262. package/umd/typings/src/llm-providers/mocked/MockedEchoLlmExecutionTools.d.ts +0 -36
  263. package/umd/typings/src/llm-providers/mocked/MockedFackedLlmExecutionTools.d.ts +0 -40
  264. package/umd/typings/src/llm-providers/mocked/fakeTextToExpectations.d.ts +0 -14
  265. package/umd/typings/src/llm-providers/mocked/test/fakeTextToExpectations.test.d.ts +0 -1
  266. package/umd/typings/src/llm-providers/mocked/test/faked-completion.test.d.ts +0 -1
  267. package/umd/typings/src/llm-providers/mocked/test/joker.test.d.ts +0 -4
  268. package/umd/typings/src/llm-providers/mocked/test/mocked-chat.test.d.ts +0 -5
  269. package/umd/typings/src/llm-providers/mocked/test/mocked-completion.test.d.ts +0 -4
  270. package/umd/typings/src/llm-providers/multiple/MultipleLlmExecutionTools.d.ts +0 -54
  271. package/umd/typings/src/llm-providers/multiple/joinLlmExecutionTools.d.ts +0 -21
  272. package/umd/typings/src/llm-providers/multiple/playground/playground.d.ts +0 -2
  273. package/umd/typings/src/llm-providers/openai/OpenAiExecutionTools.d.ts +0 -68
  274. package/umd/typings/src/llm-providers/openai/OpenAiExecutionToolsOptions.d.ts +0 -20
  275. package/umd/typings/src/llm-providers/openai/computeOpenaiUsage.d.ts +0 -14
  276. package/umd/typings/src/llm-providers/openai/computeOpenaiUsage.test.d.ts +0 -1
  277. package/umd/typings/src/llm-providers/openai/computeUsage.d.ts +0 -16
  278. package/umd/typings/src/llm-providers/openai/computeUsage.test.d.ts +0 -1
  279. package/umd/typings/src/llm-providers/openai/openai-models.d.ts +0 -29
  280. package/umd/typings/src/llm-providers/openai/playground/playground.d.ts +0 -5
  281. package/umd/typings/src/llm-providers/remote/RemoteLlmExecutionTools.d.ts +0 -56
  282. package/umd/typings/src/llm-providers/remote/RemoteLlmExecutionToolsOptions.d.ts +0 -26
  283. package/umd/typings/src/llm-providers/remote/interfaces/Promptbook_Server_Error.d.ts +0 -11
  284. package/umd/typings/src/llm-providers/remote/interfaces/Promptbook_Server_Progress.d.ts +0 -12
  285. package/umd/typings/src/llm-providers/remote/interfaces/Promptbook_Server_Request.d.ts +0 -17
  286. package/umd/typings/src/llm-providers/remote/interfaces/Promptbook_Server_Response.d.ts +0 -12
  287. package/umd/typings/src/llm-providers/remote/interfaces/RemoteServerOptions.d.ts +0 -37
  288. package/umd/typings/src/llm-providers/remote/startRemoteServer.d.ts +0 -21
  289. package/umd/typings/src/personas/preparePersona.d.ts +0 -15
  290. package/umd/typings/src/personas/preparePersona.test.d.ts +0 -1
  291. package/umd/typings/src/postprocessing/utils/extractBlock.d.ts +0 -17
  292. package/umd/typings/src/prepare/PrepareOptions.d.ts +0 -22
  293. package/umd/typings/src/prepare/isPipelinePrepared.d.ts +0 -15
  294. package/umd/typings/src/prepare/isPipelinePrepared.test.d.ts +0 -1
  295. package/umd/typings/src/prepare/preparePipeline.d.ts +0 -16
  296. package/umd/typings/src/prepare/prepareTemplates.d.ts +0 -32
  297. package/umd/typings/src/prepare/unpreparePipeline.d.ts +0 -12
  298. package/umd/typings/src/scripting/_test/custom-function-async.test.ts.test.d.ts +0 -1
  299. package/umd/typings/src/scripting/_test/custom-function-missing.test.d.ts +0 -1
  300. package/umd/typings/src/scripting/_test/custom-function-with-dependencies.test.d.ts +0 -1
  301. package/umd/typings/src/scripting/_test/custom-function.test.d.ts +0 -1
  302. package/umd/typings/src/scripting/_test/postprocessing.test.d.ts +0 -1
  303. package/umd/typings/src/scripting/_test/script-execution-errors.test.d.ts +0 -1
  304. package/umd/typings/src/scripting/_test/script-execution-tools.test.d.ts +0 -1
  305. package/umd/typings/src/scripting/javascript/JavascriptEvalExecutionTools.d.ts +0 -22
  306. package/umd/typings/src/scripting/javascript/JavascriptEvalExecutionTools.test.d.ts +0 -4
  307. package/umd/typings/src/scripting/javascript/JavascriptExecutionTools.d.ts +0 -8
  308. package/umd/typings/src/scripting/javascript/JavascriptExecutionToolsOptions.d.ts +0 -26
  309. package/umd/typings/src/scripting/javascript/postprocessing-functions.d.ts +0 -51
  310. package/umd/typings/src/scripting/javascript/utils/preserve.d.ts +0 -12
  311. package/umd/typings/src/scripting/javascript/utils/unknownToString.d.ts +0 -8
  312. package/umd/typings/src/scripting/python/PythonExecutionTools.d.ts +0 -16
  313. package/umd/typings/src/scripting/typescript/TypescriptExecutionTools.d.ts +0 -16
  314. package/umd/typings/src/storage/_common/PromptbookStorage.d.ts +0 -24
  315. package/umd/typings/src/storage/_common/PromptbookStorage.test-type.d.ts +0 -5
  316. package/umd/typings/src/storage/files-storage/FilesStorage.d.ts +0 -31
  317. package/umd/typings/src/storage/files-storage/FilesStorageOptions.d.ts +0 -10
  318. package/umd/typings/src/storage/files-storage/utils/nameToSubfolderPath.d.ts +0 -7
  319. package/umd/typings/src/storage/files-storage/utils/nameToSubfolderPath.test.d.ts +0 -1
  320. package/umd/typings/src/storage/local-storage/getLocalStorage.d.ts +0 -10
  321. package/umd/typings/src/storage/local-storage/getSessionStorage.d.ts +0 -10
  322. package/umd/typings/src/storage/memory/MemoryStorage.d.ts +0 -33
  323. package/umd/typings/src/storage/utils/PrefixStorage.d.ts +0 -25
  324. package/umd/typings/src/storage/utils/makePromptbookStorageFromWebStorage.d.ts +0 -11
  325. package/umd/typings/src/types/Arrayable.d.ts +0 -10
  326. package/umd/typings/src/types/ModelRequirements.d.ts +0 -102
  327. package/umd/typings/src/types/ModelVariant.d.ts +0 -14
  328. package/umd/typings/src/types/PipelineJson/Expectations.d.ts +0 -32
  329. package/umd/typings/src/types/PipelineJson/KnowledgePieceJson.d.ts +0 -70
  330. package/umd/typings/src/types/PipelineJson/KnowledgeSourceJson.d.ts +0 -27
  331. package/umd/typings/src/types/PipelineJson/LlmTemplateJson.d.ts +0 -25
  332. package/umd/typings/src/types/PipelineJson/PersonaJson.d.ts +0 -41
  333. package/umd/typings/src/types/PipelineJson/PipelineJson.d.ts +0 -87
  334. package/umd/typings/src/types/PipelineJson/PreparationJson.d.ts +0 -22
  335. package/umd/typings/src/types/PipelineJson/PromptDialogJson.d.ts +0 -13
  336. package/umd/typings/src/types/PipelineJson/PromptTemplateJson.d.ts +0 -13
  337. package/umd/typings/src/types/PipelineJson/PromptTemplateJsonCommon.d.ts +0 -96
  338. package/umd/typings/src/types/PipelineJson/PromptTemplateParameterJson.d.ts +0 -36
  339. package/umd/typings/src/types/PipelineJson/ScriptJson.d.ts +0 -19
  340. package/umd/typings/src/types/PipelineJson/SimpleTemplateJson.d.ts +0 -12
  341. package/umd/typings/src/types/PipelineString.d.ts +0 -12
  342. package/umd/typings/src/types/Prompt.d.ts +0 -108
  343. package/umd/typings/src/types/ScriptLanguage.d.ts +0 -9
  344. package/umd/typings/src/types/TaskProgress.d.ts +0 -43
  345. package/umd/typings/src/types/execution-report/ExecutionReportJson.d.ts +0 -58
  346. package/umd/typings/src/types/execution-report/ExecutionReportString.d.ts +0 -16
  347. package/umd/typings/src/types/execution-report/ExecutionReportStringOptions.d.ts +0 -25
  348. package/umd/typings/src/types/execution-report/config.d.ts +0 -8
  349. package/umd/typings/src/types/execution-report/countWorkingDuration.d.ts +0 -7
  350. package/umd/typings/src/types/execution-report/countWorkingDuration.test.d.ts +0 -1
  351. package/umd/typings/src/types/execution-report/executionReportJsonToString.d.ts +0 -13
  352. package/umd/typings/src/types/typeAliasEmoji.d.ts +0 -9
  353. package/umd/typings/src/types/typeAliases.d.ts +0 -586
  354. package/umd/typings/src/utils/FromtoItems.d.ts +0 -19
  355. package/umd/typings/src/utils/arrayableToArray.d.ts +0 -11
  356. package/umd/typings/src/utils/arrayableToArray.test.d.ts +0 -1
  357. package/umd/typings/src/utils/currentDate.d.ts +0 -8
  358. package/umd/typings/src/utils/deepClone.d.ts +0 -10
  359. package/umd/typings/src/utils/deepFreeze.d.ts +0 -22
  360. package/umd/typings/src/utils/emojis.d.ts +0 -23
  361. package/umd/typings/src/utils/expectation-counters/countCharacters.d.ts +0 -7
  362. package/umd/typings/src/utils/expectation-counters/countCharacters.test.d.ts +0 -1
  363. package/umd/typings/src/utils/expectation-counters/countLines.d.ts +0 -7
  364. package/umd/typings/src/utils/expectation-counters/countLines.test.d.ts +0 -1
  365. package/umd/typings/src/utils/expectation-counters/countPages.d.ts +0 -7
  366. package/umd/typings/src/utils/expectation-counters/countPages.test.d.ts +0 -1
  367. package/umd/typings/src/utils/expectation-counters/countParagraphs.d.ts +0 -7
  368. package/umd/typings/src/utils/expectation-counters/countParagraphs.test.d.ts +0 -1
  369. package/umd/typings/src/utils/expectation-counters/countSentences.d.ts +0 -13
  370. package/umd/typings/src/utils/expectation-counters/countSentences.test.d.ts +0 -1
  371. package/umd/typings/src/utils/expectation-counters/countWords.d.ts +0 -7
  372. package/umd/typings/src/utils/expectation-counters/countWords.test.d.ts +0 -1
  373. package/umd/typings/src/utils/expectation-counters/index.d.ts +0 -8
  374. package/umd/typings/src/utils/extractParameterNames.d.ts +0 -10
  375. package/umd/typings/src/utils/extractParameterNames.test.d.ts +0 -1
  376. package/umd/typings/src/utils/formatNumber.d.ts +0 -6
  377. package/umd/typings/src/utils/formatNumber.test.d.ts +0 -1
  378. package/umd/typings/src/utils/getCurrentIsoDate.d.ts +0 -7
  379. package/umd/typings/src/utils/isRunningInWhatever.d.ts +0 -18
  380. package/umd/typings/src/utils/markdown/addAutoGeneratedSection.d.ts +0 -14
  381. package/umd/typings/src/utils/markdown/addAutoGeneratedSection.test.d.ts +0 -1
  382. package/umd/typings/src/utils/markdown/createMarkdownChart.d.ts +0 -38
  383. package/umd/typings/src/utils/markdown/createMarkdownChart.test.d.ts +0 -1
  384. package/umd/typings/src/utils/markdown/createMarkdownTable.d.ts +0 -11
  385. package/umd/typings/src/utils/markdown/createMarkdownTable.test.d.ts +0 -1
  386. package/umd/typings/src/utils/markdown/escapeMarkdownBlock.d.ts +0 -11
  387. package/umd/typings/src/utils/markdown/escapeMarkdownBlock.test.d.ts +0 -1
  388. package/umd/typings/src/utils/markdown/extractAllBlocksFromMarkdown-real.test.d.ts +0 -1
  389. package/umd/typings/src/utils/markdown/extractAllBlocksFromMarkdown.d.ts +0 -34
  390. package/umd/typings/src/utils/markdown/extractAllBlocksFromMarkdown.test.d.ts +0 -1
  391. package/umd/typings/src/utils/markdown/extractAllListItemsFromMarkdown.d.ts +0 -15
  392. package/umd/typings/src/utils/markdown/extractAllListItemsFromMarkdown.test.d.ts +0 -1
  393. package/umd/typings/src/utils/markdown/extractOneBlockFromMarkdown.d.ts +0 -20
  394. package/umd/typings/src/utils/markdown/extractOneBlockFromMarkdown.test.d.ts +0 -1
  395. package/umd/typings/src/utils/markdown/flattenMarkdown.d.ts +0 -17
  396. package/umd/typings/src/utils/markdown/flattenMarkdown.test.d.ts +0 -1
  397. package/umd/typings/src/utils/markdown/parseMarkdownSection.d.ts +0 -34
  398. package/umd/typings/src/utils/markdown/parseMarkdownSection.test.d.ts +0 -1
  399. package/umd/typings/src/utils/markdown/prettifyMarkdown.d.ts +0 -9
  400. package/umd/typings/src/utils/markdown/prettifyMarkdown.test.d.ts +0 -1
  401. package/umd/typings/src/utils/markdown/removeContentComments.d.ts +0 -10
  402. package/umd/typings/src/utils/markdown/removeContentComments.test.d.ts +0 -1
  403. package/umd/typings/src/utils/markdown/removeMarkdownFormatting.d.ts +0 -9
  404. package/umd/typings/src/utils/markdown/removeMarkdownFormatting.test.d.ts +0 -1
  405. package/umd/typings/src/utils/markdown/splitMarkdownIntoSections.d.ts +0 -15
  406. package/umd/typings/src/utils/markdown/splitMarkdownIntoSections.test.d.ts +0 -1
  407. package/umd/typings/src/utils/normalization/DIACRITIC_VARIANTS_LETTERS.d.ts +0 -12
  408. package/umd/typings/src/utils/normalization/IKeywords.d.ts +0 -21
  409. package/umd/typings/src/utils/normalization/capitalize.d.ts +0 -6
  410. package/umd/typings/src/utils/normalization/capitalize.test.d.ts +0 -1
  411. package/umd/typings/src/utils/normalization/decapitalize.d.ts +0 -6
  412. package/umd/typings/src/utils/normalization/decapitalize.test.d.ts +0 -1
  413. package/umd/typings/src/utils/normalization/isValidKeyword.d.ts +0 -10
  414. package/umd/typings/src/utils/normalization/isValidKeyword.test.d.ts +0 -1
  415. package/umd/typings/src/utils/normalization/nameToUriPart.d.ts +0 -9
  416. package/umd/typings/src/utils/normalization/nameToUriPart.test.d.ts +0 -1
  417. package/umd/typings/src/utils/normalization/nameToUriParts.d.ts +0 -9
  418. package/umd/typings/src/utils/normalization/nameToUriParts.test.d.ts +0 -1
  419. package/umd/typings/src/utils/normalization/normalize-to-kebab-case.d.ts +0 -18
  420. package/umd/typings/src/utils/normalization/normalize-to-kebab-case.test.d.ts +0 -1
  421. package/umd/typings/src/utils/normalization/normalizeTo_PascalCase.d.ts +0 -17
  422. package/umd/typings/src/utils/normalization/normalizeTo_PascalCase.test.d.ts +0 -1
  423. package/umd/typings/src/utils/normalization/normalizeTo_SCREAMING_CASE.d.ts +0 -26
  424. package/umd/typings/src/utils/normalization/normalizeTo_SCREAMING_CASE.test.d.ts +0 -1
  425. package/umd/typings/src/utils/normalization/normalizeTo_camelCase.d.ts +0 -22
  426. package/umd/typings/src/utils/normalization/normalizeTo_camelCase.test.d.ts +0 -1
  427. package/umd/typings/src/utils/normalization/normalizeTo_snake_case.d.ts +0 -17
  428. package/umd/typings/src/utils/normalization/normalizeTo_snake_case.test.d.ts +0 -1
  429. package/umd/typings/src/utils/normalization/normalizeWhitespaces.d.ts +0 -4
  430. package/umd/typings/src/utils/normalization/normalizeWhitespaces.test.d.ts +0 -1
  431. package/umd/typings/src/utils/normalization/parseKeywords.d.ts +0 -16
  432. package/umd/typings/src/utils/normalization/parseKeywords.test.d.ts +0 -1
  433. package/umd/typings/src/utils/normalization/parseKeywordsFromString.d.ts +0 -9
  434. package/umd/typings/src/utils/normalization/parseKeywordsFromString.test.d.ts +0 -1
  435. package/umd/typings/src/utils/normalization/removeDiacritics.d.ts +0 -11
  436. package/umd/typings/src/utils/normalization/removeDiacritics.test.d.ts +0 -1
  437. package/umd/typings/src/utils/normalization/searchKeywords.d.ts +0 -10
  438. package/umd/typings/src/utils/normalization/searchKeywords.test.d.ts +0 -1
  439. package/umd/typings/src/utils/organization/TODO_USE.d.ts +0 -12
  440. package/umd/typings/src/utils/organization/TODO_any.d.ts +0 -6
  441. package/umd/typings/src/utils/organization/TODO_object.d.ts +0 -6
  442. package/umd/typings/src/utils/organization/TODO_unknown.d.ts +0 -6
  443. package/umd/typings/src/utils/organization/___.d.ts +0 -6
  444. package/umd/typings/src/utils/organization/just.d.ts +0 -14
  445. package/umd/typings/src/utils/organization/keepUnused.d.ts +0 -16
  446. package/umd/typings/src/utils/organization/really_any.d.ts +0 -6
  447. package/umd/typings/src/utils/organization/really_unknown.d.ts +0 -6
  448. package/umd/typings/src/utils/parseNumber.d.ts +0 -16
  449. package/umd/typings/src/utils/parseNumber.test.d.ts +0 -1
  450. package/umd/typings/src/utils/random/randomSeed.d.ts +0 -8
  451. package/umd/typings/src/utils/removeEmojis.d.ts +0 -8
  452. package/umd/typings/src/utils/removeEmojis.test.d.ts +0 -1
  453. package/umd/typings/src/utils/removeQuotes.d.ts +0 -14
  454. package/umd/typings/src/utils/removeQuotes.test.d.ts +0 -1
  455. package/umd/typings/src/utils/replaceParameters.d.ts +0 -12
  456. package/umd/typings/src/utils/replaceParameters.test.d.ts +0 -1
  457. package/umd/typings/src/utils/sets/difference.d.ts +0 -10
  458. package/umd/typings/src/utils/sets/difference.test.d.ts +0 -1
  459. package/umd/typings/src/utils/sets/intersection.d.ts +0 -7
  460. package/umd/typings/src/utils/sets/intersection.test.d.ts +0 -1
  461. package/umd/typings/src/utils/sets/union.d.ts +0 -7
  462. package/umd/typings/src/utils/sets/union.test.d.ts +0 -1
  463. package/umd/typings/src/utils/trimCodeBlock.d.ts +0 -9
  464. package/umd/typings/src/utils/trimCodeBlock.test.d.ts +0 -1
  465. package/umd/typings/src/utils/trimEndOfCodeBlock.d.ts +0 -9
  466. package/umd/typings/src/utils/trimEndOfCodeBlock.test.d.ts +0 -1
  467. package/umd/typings/src/utils/unwrapResult.d.ts +0 -37
  468. package/umd/typings/src/utils/unwrapResult.test.d.ts +0 -1
  469. package/umd/typings/src/utils/validators/email/isValidEmail.d.ts +0 -6
  470. package/umd/typings/src/utils/validators/email/isValidEmail.test.d.ts +0 -1
  471. package/umd/typings/src/utils/validators/filePath/isValidFilePath.d.ts +0 -9
  472. package/umd/typings/src/utils/validators/filePath/isValidFilePath.test.d.ts +0 -1
  473. package/umd/typings/src/utils/validators/javascriptName/isValidJavascriptName.d.ts +0 -10
  474. package/umd/typings/src/utils/validators/javascriptName/isValidJavascriptName.test.d.ts +0 -1
  475. package/umd/typings/src/utils/validators/semanticVersion/isValidPromptbookVersion.d.ts +0 -15
  476. package/umd/typings/src/utils/validators/semanticVersion/isValidPromptbookVersion.test.d.ts +0 -1
  477. package/umd/typings/src/utils/validators/semanticVersion/isValidSemanticVersion.d.ts +0 -12
  478. package/umd/typings/src/utils/validators/semanticVersion/isValidSemanticVersion.test.d.ts +0 -1
  479. package/umd/typings/src/utils/validators/url/isHostnameOnPrivateNetwork.d.ts +0 -11
  480. package/umd/typings/src/utils/validators/url/isHostnameOnPrivateNetwork.test.d.ts +0 -1
  481. package/umd/typings/src/utils/validators/url/isUrlOnPrivateNetwork.d.ts +0 -13
  482. package/umd/typings/src/utils/validators/url/isUrlOnPrivateNetwork.test.d.ts +0 -1
  483. package/umd/typings/src/utils/validators/url/isValidPipelineUrl.d.ts +0 -15
  484. package/umd/typings/src/utils/validators/url/isValidPipelineUrl.test.d.ts +0 -1
  485. package/umd/typings/src/utils/validators/url/isValidUrl.d.ts +0 -13
  486. package/umd/typings/src/utils/validators/url/isValidUrl.test.d.ts +0 -1
  487. package/umd/typings/src/utils/validators/uuid/isValidUuid.d.ts +0 -8
  488. package/umd/typings/src/utils/validators/uuid/isValidUuid.test.d.ts +0 -1
  489. package/umd/typings/src/version.d.ts +0 -8
  490. /package/{umd/typings/src/collection/constructors/createCollectionFromDirectory.test.d.ts → esm/typings/src/cli/test/ptbk.test.d.ts} +0 -0
  491. /package/{umd/typings/src/collection/constructors/createCollectionFromJson.test.d.ts → esm/typings/src/utils/files/isDirectoryExisting.test.d.ts} +0 -0
  492. /package/{umd/typings/src/collection/constructors/createCollectionFromPromise.test.d.ts → esm/typings/src/utils/files/isFileExisting.test.d.ts} +0 -0
  493. /package/{umd/typings/src/commands/BLOCK/blockCommand.test.d.ts → esm/typings/src/utils/files/listAllFiles.test.d.ts} +0 -0
package/esm/index.es.js CHANGED
@@ -2,10 +2,11 @@ import commander from 'commander';
2
2
  import spaceTrim, { spaceTrim as spaceTrim$1 } from 'spacetrim';
3
3
  import colors from 'colors';
4
4
  import { forTime } from 'waitasecond';
5
- import { access, constants, readFile, readdir, stat, writeFile, mkdir, unlink } from 'fs/promises';
6
- import { join, dirname } from 'path';
5
+ import { stat, access, constants, readdir, readFile, writeFile, mkdir, unlink } from 'fs/promises';
6
+ import { join as join$1, dirname } from 'path';
7
7
  import { format } from 'prettier';
8
8
  import parserHtml from 'prettier/parser-html';
9
+ import { join } from 'path/posix';
9
10
  import hexEncoder from 'crypto-js/enc-hex';
10
11
  import sha256 from 'crypto-js/sha256';
11
12
  import * as dotenv from 'dotenv';
@@ -13,12 +14,11 @@ import Anthropic from '@anthropic-ai/sdk';
13
14
  import OpenAI from 'openai';
14
15
  import glob from 'glob-promise';
15
16
 
17
+ // ⚠️ WARNING: This code has been generated so that any manual changes will be overwritten
16
18
  /**
17
19
  * The version of the Promptbook library
18
- *
19
- * @public exported from all packages
20
20
  */
21
- var PROMPTBOOK_VERSION = '0.62.0';
21
+ var PROMPTBOOK_VERSION = '0.63.0-9';
22
22
  // TODO: !!!! List here all the versions and annotate + put into script
23
23
 
24
24
  /*! *****************************************************************************
@@ -140,6 +140,22 @@ function __spreadArray(to, from, pack) {
140
140
  return to.concat(ar || Array.prototype.slice.call(from));
141
141
  }
142
142
 
143
+ /**
144
+ * This error type indicates that you try to use a feature that is not available in the current environment
145
+ *
146
+ * @public exported from `@promptbook/core`
147
+ */
148
+ var EnvironmentMismatchError = /** @class */ (function (_super) {
149
+ __extends(EnvironmentMismatchError, _super);
150
+ function EnvironmentMismatchError(message) {
151
+ var _this = _super.call(this, message) || this;
152
+ _this.name = 'EnvironmentMismatchError';
153
+ Object.setPrototypeOf(_this, EnvironmentMismatchError.prototype);
154
+ return _this;
155
+ }
156
+ return EnvironmentMismatchError;
157
+ }(Error));
158
+
143
159
  /**
144
160
  * Detects if the code is running in a browser environment in main thread (Not in a web worker)
145
161
  *
@@ -159,72 +175,13 @@ var isRunningInNode = new Function("\n try {\n return this === global;
159
175
  */
160
176
  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");
161
177
 
162
- /**
163
- * Initializes testing `hello` command for Promptbook CLI utilities
164
- *
165
- * @private part of `promptbookCli`
166
- */
167
- function initializeHelloCommand(program) {
168
- var _this = this;
169
- var helloCommand = program.command('hello');
170
- helloCommand.description(spaceTrim("\n Just command for testing\n "));
171
- helloCommand.argument('<name>', 'Your name');
172
- helloCommand.option('-g, --greeting <greeting>', "Greeting", 'Hello');
173
- helloCommand.action(function (name, _a) {
174
- var greeting = _a.greeting;
175
- return __awaiter(_this, void 0, void 0, function () {
176
- return __generator(this, function (_b) {
177
- switch (_b.label) {
178
- case 0:
179
- console.info(colors.cyan("".concat(greeting, " ").concat(name)));
180
- return [4 /*yield*/, forTime(1000)];
181
- case 1:
182
- _b.sent();
183
- console.info(colors.rainbow("Nice to meet you!"));
184
- process.exit(0);
185
- return [2 /*return*/];
186
- }
187
- });
188
- });
189
- });
190
- }
191
- /**
192
- * Note: [🟡] This code should never be published outside of `@promptbook/cli`
193
- */
194
-
195
- /**
196
- * Converts PipelineCollection to serialized JSON
197
- *
198
- * Note: Functions `collectionToJson` and `createCollectionFromJson` are complementary
199
- *
200
- * @public exported from `@promptbook/core`
201
- */
202
- function collectionToJson(collection) {
203
- return __awaiter(this, void 0, void 0, function () {
204
- var pipelineUrls, promptbooks;
205
- return __generator(this, function (_a) {
206
- switch (_a.label) {
207
- case 0: return [4 /*yield*/, collection.listPipelines()];
208
- case 1:
209
- pipelineUrls = _a.sent();
210
- return [4 /*yield*/, Promise.all(pipelineUrls.map(function (url) { return collection.getPipelineByUrl(url); }))];
211
- case 2:
212
- promptbooks = _a.sent();
213
- return [2 /*return*/, promptbooks];
214
- }
215
- });
216
- });
217
- }
218
- /**
219
- * TODO: [🧠] Maybe clear `sourceFile` or clear when exposing through API or remote server
220
- */
221
-
222
178
  /**
223
179
  * @@@
224
180
  *
225
- * @returns The same object as the input, but deeply frozen
226
- *
227
181
  * Note: This function mutates the object and returns the original (but mutated-deep-freezed) object
182
+ *
183
+ * @returns The same object as the input, but deeply frozen
184
+ * @public exported from `@promptbook/utils`
228
185
  */
229
186
  function deepFreeze(objectValue) {
230
187
  var e_1, _a;
@@ -251,10 +208,10 @@ function deepFreeze(objectValue) {
251
208
  * @@@
252
209
  * @@@
253
210
  *
254
- * @returns The same object as the input, but deeply frozen
255
- * @public exported from `@promptbook/utils`
256
- *
257
211
  * Note: This function mutates the object and returns the original (but mutated-deep-freezed) object
212
+ *
213
+ * @returns The same object as the input, but deeply frozen
214
+ * @private this is in comparison to `deepFreeze` a more specific utility and maybe not very good practice to use without specific reason and considerations
258
215
  */
259
216
  function deepFreezeWithSameType(objectValue) {
260
217
  return deepFreeze(objectValue);
@@ -263,10 +220,31 @@ function deepFreezeWithSameType(objectValue) {
263
220
  * TODO: [🧠] Is there a way how to meaningfully test this utility
264
221
  */
265
222
 
223
+ /**
224
+ * Warning message for the generated sections and files files
225
+ *
226
+ * @private within the repository
227
+ */
228
+ var GENERATOR_WARNING = "\u26A0\uFE0F WARNING: This code has been generated so that any manual changes will be overwritten";
229
+ /**
230
+ * Claim for the Promptbook
231
+ *
232
+ * TODO: [🗽] Unite branding and make single place for it
233
+ *
234
+ * @public exported from `@promptbook/core`
235
+ */
236
+ var CLAIM = "Supercharge LLM models with Promptbook";
237
+ /**
238
+ * Warning message for the generated sections and files files
239
+ *
240
+ * @private within the repository
241
+ */
242
+ var GENERATOR_WARNING_BY_PROMPTBOOK_CLI = "\u26A0\uFE0F WARNING: This code has been generated by `@promptbook/cli` so that any manual changes will be overwritten";
243
+ // <- TODO: [🧠] Better system for generator warnings - not always "code" and "by `@promptbook/cli`"
266
244
  /**
267
245
  * The maximum number of iterations for a loops
268
246
  *
269
- * @private within the repository - too low-level in comparison to other `MAX_...`
247
+ * @private within the repository - too low-level in comparison with other `MAX_...`
270
248
  */
271
249
  var LOOP_LIMIT = 1000;
272
250
  /**
@@ -301,6 +279,8 @@ var EXECUTIONS_CACHE_DIRNAME = '/.promptbook/executions-cache';
301
279
  var PIPELINE_COLLECTION_BASE_FILENAME = "index";
302
280
  /**
303
281
  * Nonce which is used for replacing things in strings
282
+ *
283
+ * @private within the repository
304
284
  */
305
285
  var REPLACING_NONCE = 'u$k42k%!V2zo34w7Fu#@QUHYPW';
306
286
  /**
@@ -330,12 +310,90 @@ var RESERVED_PARAMETER_MISSING_VALUE = 'MISSING-' + REPLACING_NONCE;
330
310
  * @private within the repository
331
311
  */
332
312
  var RESERVED_PARAMETER_RESTRICTED = 'RESTRICTED-' + REPLACING_NONCE;
333
- /*
334
- TODO: !!! Just testing false-negative detection of [🟡][🟢][🔵][⚪] leak
335
- */
336
- // [🟡][🟢][🔵][⚪]
313
+
314
+ /**
315
+ * Initializes `about` command for Promptbook CLI utilities
316
+ *
317
+ * @private internal function of `promptbookCli`
318
+ */
319
+ function initializeAboutCommand(program) {
320
+ var _this = this;
321
+ var makeCommand = program.command('about');
322
+ makeCommand.description(spaceTrim("\n Tells about Promptbook CLI and its abilities\n "));
323
+ makeCommand.action(function () { return __awaiter(_this, void 0, void 0, function () {
324
+ return __generator(this, function (_a) {
325
+ console.info(colors.cyan("Promptbook"));
326
+ console.info(colors.cyan(CLAIM));
327
+ console.info(colors.cyan("Version: ".concat(PROMPTBOOK_VERSION)));
328
+ console.info(colors.cyan("https://ptbk.io"));
329
+ process.exit(0);
330
+ return [2 /*return*/];
331
+ });
332
+ }); });
333
+ }
337
334
  /**
338
- * TODO: !!!!!! Check that all @private contains some normalized explanation
335
+ * TODO: [🗽] Unite branding and make single place for it
336
+ * Note: [🟡] This code should never be published outside of `@promptbook/cli`
337
+ */
338
+
339
+ /**
340
+ * Initializes testing `hello` command for Promptbook CLI utilities
341
+ *
342
+ * @private internal function of `promptbookCli`
343
+ */
344
+ function initializeHelloCommand(program) {
345
+ var _this = this;
346
+ var helloCommand = program.command('hello');
347
+ helloCommand.description(spaceTrim("\n Just command for testing\n "));
348
+ helloCommand.argument('[name]', 'Your name', 'Paul');
349
+ helloCommand.option('-g, --greeting <greeting>', "Greeting", 'Hello');
350
+ helloCommand.action(function (name, _a) {
351
+ var greeting = _a.greeting;
352
+ return __awaiter(_this, void 0, void 0, function () {
353
+ return __generator(this, function (_b) {
354
+ switch (_b.label) {
355
+ case 0:
356
+ console.info(colors.cyan("".concat(greeting, " ").concat(name)));
357
+ return [4 /*yield*/, forTime(1000)];
358
+ case 1:
359
+ _b.sent();
360
+ console.info(colors.rainbow("Nice to meet you!"));
361
+ process.exit(0);
362
+ return [2 /*return*/];
363
+ }
364
+ });
365
+ });
366
+ });
367
+ }
368
+ /**
369
+ * Note: [🟡] This code should never be published outside of `@promptbook/cli`
370
+ */
371
+
372
+ /**
373
+ * Converts PipelineCollection to serialized JSON
374
+ *
375
+ * Note: Functions `collectionToJson` and `createCollectionFromJson` are complementary
376
+ *
377
+ * @public exported from `@promptbook/core`
378
+ */
379
+ function collectionToJson(collection) {
380
+ return __awaiter(this, void 0, void 0, function () {
381
+ var pipelineUrls, promptbooks;
382
+ return __generator(this, function (_a) {
383
+ switch (_a.label) {
384
+ case 0: return [4 /*yield*/, collection.listPipelines()];
385
+ case 1:
386
+ pipelineUrls = _a.sent();
387
+ return [4 /*yield*/, Promise.all(pipelineUrls.map(function (url) { return collection.getPipelineByUrl(url); }))];
388
+ case 2:
389
+ promptbooks = _a.sent();
390
+ return [2 /*return*/, promptbooks];
391
+ }
392
+ });
393
+ });
394
+ }
395
+ /**
396
+ * TODO: [🧠] Maybe clear `sourceFile` or clear when exposing through API or remote server
339
397
  */
340
398
 
341
399
  /**
@@ -456,7 +514,7 @@ function pipelineJsonToString(pipelineJson) {
456
514
  var contentLanguage = 'text';
457
515
  if (blockType === 'PROMPT_TEMPLATE') {
458
516
  var modelRequirements = promptTemplate.modelRequirements;
459
- var modelName = modelRequirements.modelName, modelVariant = modelRequirements.modelVariant;
517
+ var _l = modelRequirements || {}, modelName = _l.modelName, modelVariant = _l.modelVariant;
460
518
  commands_1.push("EXECUTE PROMPT TEMPLATE");
461
519
  if (modelVariant) {
462
520
  commands_1.push("MODEL VARIANT ".concat(capitalize(modelVariant)));
@@ -514,8 +572,8 @@ function pipelineJsonToString(pipelineJson) {
514
572
  } /* not else */
515
573
  if (expectations) {
516
574
  try {
517
- for (var _l = (e_6 = void 0, __values(Object.entries(expectations))), _m = _l.next(); !_m.done; _m = _l.next()) {
518
- var _o = __read(_m.value, 2), unit = _o[0], _p = _o[1], min = _p.min, max = _p.max;
575
+ for (var _m = (e_6 = void 0, __values(Object.entries(expectations))), _o = _m.next(); !_o.done; _o = _m.next()) {
576
+ var _p = __read(_o.value, 2), unit = _p[0], _q = _p[1], min = _q.min, max = _q.max;
519
577
  if (min === max) {
520
578
  commands_1.push("EXPECT EXACTLY ".concat(min, " ").concat(capitalize(unit + (min > 1 ? 's' : ''))));
521
579
  }
@@ -532,7 +590,7 @@ function pipelineJsonToString(pipelineJson) {
532
590
  catch (e_6_1) { e_6 = { error: e_6_1 }; }
533
591
  finally {
534
592
  try {
535
- if (_m && !_m.done && (_f = _l.return)) _f.call(_l);
593
+ if (_o && !_o.done && (_f = _m.return)) _f.call(_m);
536
594
  }
537
595
  finally { if (e_6) throw e_6.error; }
538
596
  }
@@ -567,7 +625,7 @@ function pipelineJsonToString(pipelineJson) {
567
625
  return pipelineString;
568
626
  }
569
627
  /**
570
- * @private internal util of pipelineJsonToString
628
+ * @private internal utility of `pipelineJsonToString`
571
629
  */
572
630
  function promptTemplateParameterJsonToString(promptTemplateParameterJson) {
573
631
  var name = promptTemplateParameterJson.name, description = promptTemplateParameterJson.description;
@@ -582,6 +640,7 @@ function promptTemplateParameterJsonToString(promptTemplateParameterJson) {
582
640
  * TODO: [🧠] Is there a way to auto-detect missing features in pipelineJsonToString
583
641
  * TODO: [🏛] Maybe make some markdown builder
584
642
  * TODO: [🏛] Escape all
643
+ * TODO: [🧠] Should be in generated .ptbk.md file GENERATOR_WARNING
585
644
  */
586
645
 
587
646
  /**
@@ -780,7 +839,7 @@ function forEachAsync(array, options, callbackfunction) {
780
839
  });
781
840
  }
782
841
 
783
- var PipelineCollection = [{title:"Prepare Knowledge from Markdown",pipelineUrl:"https://promptbook.studio/promptbook/prepare-knowledge-from-markdown.ptbk.md",promptbookVersion:"0.62.0",parameters:[{name:"knowledgeContent",description:"Markdown document content",isInput:true,isOutput:false},{name:"knowledgePieces",description:"The knowledge JSON object",isInput:false,isOutput:true}],promptTemplates:[{blockType:"PROMPT_TEMPLATE",name:"knowledge",title:"Knowledge",modelRequirements:{modelVariant:"CHAT",modelName:"claude-3-opus-20240229"},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}",dependentParameterNames:["knowledgeContent"],resultingParameterName:"knowledgePieces"}],knowledgeSources:[],knowledgePieces:[],personas:[],preparations:[{id:1,promptbookVersion:"0.62.0",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}}}}],sourceFile:"./promptbook-collection/prepare-knowledge-from-markdown.ptbk.md"},{title:"Prepare Keywords",pipelineUrl:"https://promptbook.studio/promptbook/prepare-knowledge-keywords.ptbk.md",promptbookVersion:"0.62.0",parameters:[{name:"knowledgePieceContent",description:"The content",isInput:true,isOutput:false},{name:"keywords",description:"Keywords separated by comma",isInput:false,isOutput:true}],promptTemplates:[{blockType:"PROMPT_TEMPLATE",name:"knowledge",title:"Knowledge",modelRequirements:{modelVariant:"CHAT",modelName:"claude-3-opus-20240229"},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}",dependentParameterNames:["knowledgePieceContent"],resultingParameterName:"keywords"}],knowledgeSources:[],knowledgePieces:[],personas:[],preparations:[{id:1,promptbookVersion:"0.62.0",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}}}}],sourceFile:"./promptbook-collection/prepare-knowledge-keywords.ptbk.md"},{title:"Prepare Title",pipelineUrl:"https://promptbook.studio/promptbook/prepare-knowledge-title.ptbk.md",promptbookVersion:"0.62.0",parameters:[{name:"knowledgePieceContent",description:"The content",isInput:true,isOutput:false},{name:"title",description:"The title of the document",isInput:false,isOutput:true}],promptTemplates:[{blockType:"PROMPT_TEMPLATE",name:"knowledge",title:"Knowledge",modelRequirements:{modelVariant:"CHAT",modelName:"claude-3-opus-20240229"},content:"You are experienced content creator, write best title for the document.\n\n# Rules\n\n- Write just title, nothing else\n- Title should be concise and clear\n- Write maximum 5 words for the title\n\n# The document\n\n> {knowledgePieceContent}",expectations:{words:{min:1,max:8}},dependentParameterNames:["knowledgePieceContent"],resultingParameterName:"title"}],knowledgeSources:[],knowledgePieces:[],personas:[],preparations:[{id:1,promptbookVersion:"0.62.0",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}}}}],sourceFile:"./promptbook-collection/prepare-knowledge-title.ptbk.md"},{title:"Prepare Keywords",pipelineUrl:"https://promptbook.studio/promptbook/prepare-persona.ptbk.md",promptbookVersion:"0.62.0",parameters:[{name:"availableModelNames",description:"List of available model names separated by comma (,)",isInput:true,isOutput:false},{name:"personaDescription",description:"Description of the persona",isInput:true,isOutput:false},{name:"modelRequirements",description:"Specific requirements for the model",isInput:false,isOutput:true}],promptTemplates:[{blockType:"PROMPT_TEMPLATE",name:"make-model-requirements",title:"Make modelRequirements",modelRequirements:{modelVariant:"CHAT",modelName:"gpt-4-turbo"},content:"You are experienced AI engineer, you need to create virtual assistant.\nWrite\n\n## Sample\n\n```json\n{\n\"modelName\": \"gpt-4o\",\n\"systemMessage\": \"You are experienced AI engineer and helpfull assistant.\",\n\"temperature\": 0.7\n}\n```\n\n## Instructions\n\n### Option `modelName`\n\nPick from the following models:\n\n- {availableModelNames}\n\n### Option `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### Option `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}",expectFormat:"JSON",dependentParameterNames:["availableModelNames","personaDescription"],resultingParameterName:"modelRequirements"}],knowledgeSources:[],knowledgePieces:[],personas:[],preparations:[{id:1,promptbookVersion:"0.62.0",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}}}}],sourceFile:"./promptbook-collection/prepare-persona.ptbk.md"}];
842
+ var PipelineCollection = [{title:"Prepare Knowledge from Markdown",pipelineUrl:"https://promptbook.studio/promptbook/prepare-knowledge-from-markdown.ptbk.md",promptbookVersion:"0.63.0-9",parameters:[{name:"knowledgeContent",description:"Markdown document content",isInput:true,isOutput:false},{name:"knowledgePieces",description:"The knowledge JSON object",isInput:false,isOutput:true}],promptTemplates:[{blockType:"PROMPT_TEMPLATE",name:"knowledge",title:"Knowledge",modelRequirements:{modelVariant:"CHAT",modelName:"claude-3-opus-20240229"},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}",dependentParameterNames:["knowledgeContent"],resultingParameterName:"knowledgePieces"}],knowledgeSources:[],knowledgePieces:[],personas:[],preparations:[{id:1,promptbookVersion:"0.63.0-9",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}}}}],sourceFile:"./promptbook-collection/prepare-knowledge-from-markdown.ptbk.md"},{title:"Prepare Keywords",pipelineUrl:"https://promptbook.studio/promptbook/prepare-knowledge-keywords.ptbk.md",promptbookVersion:"0.63.0-9",parameters:[{name:"knowledgePieceContent",description:"The content",isInput:true,isOutput:false},{name:"keywords",description:"Keywords separated by comma",isInput:false,isOutput:true}],promptTemplates:[{blockType:"PROMPT_TEMPLATE",name:"knowledge",title:"Knowledge",modelRequirements:{modelVariant:"CHAT",modelName:"claude-3-opus-20240229"},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}",dependentParameterNames:["knowledgePieceContent"],resultingParameterName:"keywords"}],knowledgeSources:[],knowledgePieces:[],personas:[],preparations:[{id:1,promptbookVersion:"0.63.0-9",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}}}}],sourceFile:"./promptbook-collection/prepare-knowledge-keywords.ptbk.md"},{title:"Prepare Title",pipelineUrl:"https://promptbook.studio/promptbook/prepare-knowledge-title.ptbk.md",promptbookVersion:"0.63.0-9",parameters:[{name:"knowledgePieceContent",description:"The content",isInput:true,isOutput:false},{name:"title",description:"The title of the document",isInput:false,isOutput:true}],promptTemplates:[{blockType:"PROMPT_TEMPLATE",name:"knowledge",title:"Knowledge",modelRequirements:{modelVariant:"CHAT",modelName:"claude-3-opus-20240229"},content:"You are experienced content creator, write best title for the document.\n\n# Rules\n\n- Write just title, nothing else\n- Title should be concise and clear\n- Write maximum 5 words for the title\n\n# The document\n\n> {knowledgePieceContent}",expectations:{words:{min:1,max:8}},dependentParameterNames:["knowledgePieceContent"],resultingParameterName:"title"}],knowledgeSources:[],knowledgePieces:[],personas:[],preparations:[{id:1,promptbookVersion:"0.63.0-9",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}}}}],sourceFile:"./promptbook-collection/prepare-knowledge-title.ptbk.md"},{title:"Prepare Keywords",pipelineUrl:"https://promptbook.studio/promptbook/prepare-persona.ptbk.md",promptbookVersion:"0.63.0-9",parameters:[{name:"availableModelNames",description:"List of available model names separated by comma (,)",isInput:true,isOutput:false},{name:"personaDescription",description:"Description of the persona",isInput:true,isOutput:false},{name:"modelRequirements",description:"Specific requirements for the model",isInput:false,isOutput:true}],promptTemplates:[{blockType:"PROMPT_TEMPLATE",name:"make-model-requirements",title:"Make modelRequirements",modelRequirements:{modelVariant:"CHAT",modelName:"gpt-4-turbo"},content:"You are experienced AI engineer, you need to create virtual assistant.\nWrite\n\n## Sample\n\n```json\n{\n\"modelName\": \"gpt-4o\",\n\"systemMessage\": \"You are experienced AI engineer and helpfull assistant.\",\n\"temperature\": 0.7\n}\n```\n\n## Instructions\n\n### Option `modelName`\n\nPick from the following models:\n\n- {availableModelNames}\n\n### Option `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### Option `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}",expectFormat:"JSON",dependentParameterNames:["availableModelNames","personaDescription"],resultingParameterName:"modelRequirements"}],knowledgeSources:[],knowledgePieces:[],personas:[],preparations:[{id:1,promptbookVersion:"0.63.0-9",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}}}}],sourceFile:"./promptbook-collection/prepare-persona.ptbk.md"}];
784
843
 
785
844
  /**
786
845
  * This error indicates that the promptbook in a markdown format cannot be parsed into a valid promptbook object
@@ -1078,9 +1137,6 @@ function validatePipeline(pipeline) {
1078
1137
  throw new PipelineLogicError(spaceTrim$1(function (block) { return "\n Parameter name {".concat(template.resultingParameterName, "} is reserved, please use different name\n\n ").concat(block(pipelineIdentification), "\n "); }));
1079
1138
  }
1080
1139
  definedParameters.add(template.resultingParameterName);
1081
- if (template.blockType === 'PROMPT_TEMPLATE' && template.modelRequirements.modelVariant === undefined) {
1082
- throw new PipelineLogicError(spaceTrim$1(function (block) { return "\n\n You must specify MODEL VARIANT in the prompt template \"".concat(template.title, "\"\n\n For example:\n - MODEL VARIANT Chat\n - MODEL NAME `gpt-4-1106-preview`").concat(/* <- TODO: Dynamic listing of command examples */ '', "\n\n ").concat(block(pipelineIdentification), "\n "); }));
1083
- }
1084
1140
  if (template.jokerParameterNames && template.jokerParameterNames.length > 0) {
1085
1141
  if (!template.expectFormat &&
1086
1142
  !template.expectations /* <- TODO: Require at least 1 -> min <- expectation to use jokers */) {
@@ -1314,7 +1370,7 @@ function unpreparePipeline(pipeline) {
1314
1370
  * Library of pipelines that groups together pipelines for an application.
1315
1371
  * This implementation is a very thin wrapper around the Array / Map of pipelines.
1316
1372
  *
1317
- * @private use `createCollectionFromJson` instead
1373
+ * @private internal function of `createCollectionFromJson`, use `createCollectionFromJson` instead
1318
1374
  * @see https://github.com/webgptorg/pipeline#pipeline-collection
1319
1375
  */
1320
1376
  var SimplePipelineCollection = /** @class */ (function () {
@@ -1323,7 +1379,6 @@ var SimplePipelineCollection = /** @class */ (function () {
1323
1379
  *
1324
1380
  * @param pipelines @@@
1325
1381
  *
1326
- * @private Use instead `createCollectionFromJson`
1327
1382
  * Note: During the construction logic of all pipelines are validated
1328
1383
  * Note: It is not recommended to use this constructor directly, use `createCollectionFromJson` *(or other variant)* instead
1329
1384
  */
@@ -1938,7 +1993,8 @@ function extractParameterNamesFromPromptTemplate(promptTemplate) {
1938
1993
  /**
1939
1994
  * This error occurs when some expectation is not met in the execution of the pipeline
1940
1995
  *
1941
- * @private Always catched and rethrown as `PipelineExecutionError`
1996
+ * @private error of `checkExpectations` and `createPipelineExecutor`
1997
+ * Note: Always thrown in `checkExpectations` and catched in `createPipelineExecutor` and rethrown as `PipelineExecutionError`
1942
1998
  * Note: This is a kindof subtype of PipelineExecutionError
1943
1999
  */
1944
2000
  var ExpectError = /** @class */ (function (_super) {
@@ -1976,7 +2032,7 @@ function isValidJsonString(value /* <- [👨‍⚖️] */) {
1976
2032
  /**
1977
2033
  * Multiple LLM Execution Tools is a proxy server that uses multiple execution tools internally and exposes the executor interface externally.
1978
2034
  *
1979
- * @private Internal utility of `joinLlmExecutionTools`
2035
+ * @private internal utility of `joinLlmExecutionTools`
1980
2036
  */
1981
2037
  var MultipleLlmExecutionTools = /** @class */ (function () {
1982
2038
  /**
@@ -2259,7 +2315,7 @@ function isPipelinePrepared(pipeline) {
2259
2315
  * 2) Undefined returns empty array
2260
2316
  * 3) Array returns itself
2261
2317
  *
2262
- * @private Internal utility
2318
+ * @private internal utility
2263
2319
  */
2264
2320
  function arrayableToArray(input) {
2265
2321
  if (input === undefined) {
@@ -2557,7 +2613,7 @@ var CountUtils = {
2557
2613
  *
2558
2614
  * @throws {ExpectError} if the expectations are not met
2559
2615
  * @returns {void} Nothing
2560
- * @public exported from `@promptbook/core`
2616
+ * @private internal function of `createPipelineExecutor`
2561
2617
  */
2562
2618
  function checkExpectations(expectations, value) {
2563
2619
  var e_1, _a;
@@ -4238,7 +4294,9 @@ var blockCommandParser = {
4238
4294
 
4239
4295
  /**
4240
4296
  * Units of text measurement
4297
+ *
4241
4298
  * @see https://github.com/webgptorg/promptbook/discussions/30
4299
+ * @public exported from `@promptbook/core`
4242
4300
  */
4243
4301
  var EXPECTATION_UNITS = ['CHARACTERS', 'WORDS', 'SENTENCES', 'LINES', 'PARAGRAPHS', 'PAGES'];
4244
4302
  /**
@@ -4478,7 +4536,7 @@ var jokerCommandParser = {
4478
4536
  /**
4479
4537
  * @@@
4480
4538
  *
4481
- * @private for `ModelVariant` and `modelCommandParser`
4539
+ * @public exported from `@promptbook/core`
4482
4540
  */
4483
4541
  var MODEL_VARIANTS = ['COMPLETION', 'CHAT', 'EMBEDDING' /* <- TODO [🏳] */ /* <- [🤖] */];
4484
4542
 
@@ -4943,11 +5001,12 @@ var boilerplateCommandParser = {
4943
5001
  };
4944
5002
  /**
4945
5003
  * TODO: [💐] Implement BOILERPLATE command into `pipelineStringToJsonSync` function
4946
- * Note: [⚪] This should never be in any released package
4947
5004
  */
4948
5005
 
4949
5006
  /**
4950
5007
  * All available command parsers
5008
+ *
5009
+ * @private internal index of `parseCommand`
4951
5010
  */
4952
5011
  var COMMANDS = [
4953
5012
  blockCommandParser,
@@ -5117,6 +5176,8 @@ var NotYetImplementedError = /** @class */ (function (_super) {
5117
5176
 
5118
5177
  /**
5119
5178
  * Supported script languages
5179
+ *
5180
+ * @private internal base for `ScriptLanguage`
5120
5181
  */
5121
5182
  var SUPPORTED_SCRIPT_LANGUAGES = ['javascript', 'typescript', 'python'];
5122
5183
 
@@ -5257,7 +5318,7 @@ function extractOneBlockFromMarkdown(markdown) {
5257
5318
  return codeBlocks[0];
5258
5319
  }
5259
5320
  /***
5260
- * TODO: [🍓][🌻] Decide of this is internal util, external util OR validator/postprocessor
5321
+ * TODO: [🍓][🌻] Decide of this is internal utility, external util OR validator/postprocessor
5261
5322
  */
5262
5323
 
5263
5324
  /**
@@ -5856,6 +5917,7 @@ function pipelineStringToJson(pipelineString, options) {
5856
5917
  /**
5857
5918
  * TODO: [🏏] Leverage the batch API and build queues @see https://platform.openai.com/docs/guides/batch
5858
5919
  * TODO: [🛠] Actions, instruments (and maybe knowledge) => Functions and tools
5920
+ * TODO: [🧠] Should be in generated JSON file GENERATOR_WARNING
5859
5921
  */
5860
5922
 
5861
5923
  /**
@@ -5874,6 +5936,145 @@ var CollectionError = /** @class */ (function (_super) {
5874
5936
  return CollectionError;
5875
5937
  }(Error));
5876
5938
 
5939
+ /**
5940
+ * Checks if the file exists
5941
+ *
5942
+ * @private within the repository
5943
+ */
5944
+ function isFileExisting(filePath) {
5945
+ return __awaiter(this, void 0, void 0, function () {
5946
+ var isReadAccessAllowed, isFile;
5947
+ return __generator(this, function (_a) {
5948
+ switch (_a.label) {
5949
+ case 0: return [4 /*yield*/, access(filePath, constants.R_OK)
5950
+ .then(function () { return true; })
5951
+ .catch(function () { return false; })];
5952
+ case 1:
5953
+ isReadAccessAllowed = _a.sent();
5954
+ if (!isReadAccessAllowed) {
5955
+ return [2 /*return*/, false];
5956
+ }
5957
+ return [4 /*yield*/, stat(filePath)
5958
+ .then(function (fileStat) { return fileStat.isFile(); })
5959
+ .catch(function () { return false; })];
5960
+ case 2:
5961
+ isFile = _a.sent();
5962
+ return [2 /*return*/, isFile];
5963
+ }
5964
+ });
5965
+ });
5966
+ }
5967
+ /**
5968
+ * Note: [🟢] This code should never be published outside of `@promptbook/node` and `@promptbook/cli` and `@promptbook/cli`
5969
+ * TODO: [🐠] This can be a validator - with variants that return true/false and variants that throw errors with meaningless messages
5970
+ * TODO: [🖇] What about symlinks?
5971
+ */
5972
+
5973
+ /**
5974
+ * Checks if the directory exists
5975
+ *
5976
+ * @private within the repository
5977
+ */
5978
+ function isDirectoryExisting(directoryPath) {
5979
+ return __awaiter(this, void 0, void 0, function () {
5980
+ var isReadAccessAllowed, isDirectory;
5981
+ return __generator(this, function (_a) {
5982
+ switch (_a.label) {
5983
+ case 0: return [4 /*yield*/, access(directoryPath, constants.R_OK)
5984
+ .then(function () { return true; })
5985
+ .catch(function () { return false; })];
5986
+ case 1:
5987
+ isReadAccessAllowed = _a.sent();
5988
+ if (!isReadAccessAllowed) {
5989
+ return [2 /*return*/, false];
5990
+ }
5991
+ return [4 /*yield*/, stat(directoryPath)
5992
+ .then(function (fileStat) { return fileStat.isDirectory(); })
5993
+ .catch(function () { return false; })];
5994
+ case 2:
5995
+ isDirectory = _a.sent();
5996
+ return [2 /*return*/, isDirectory];
5997
+ }
5998
+ });
5999
+ });
6000
+ }
6001
+ /**
6002
+ * Note: [🟢] This code should never be published outside of `@promptbook/node` and `@promptbook/cli` and `@promptbook/cli`
6003
+ * TODO: [🐠] This can be a validator - with variants that return true/false and variants that throw errors with meaningless messages
6004
+ * TODO: [🧠][📂] "directory" vs "folder"
6005
+ * TODO: [🖇] What about symlinks?
6006
+ */
6007
+
6008
+ /**
6009
+ * Reads all files in the directory
6010
+ *
6011
+ * @param path
6012
+ * @param isRecursive
6013
+ * @returns List of all files in the directory
6014
+ * @private internal function of `createCollectionFromDirectory`
6015
+ */
6016
+ function listAllFiles(path, isRecursive) {
6017
+ return __awaiter(this, void 0, void 0, function () {
6018
+ var dirents, fileNames, _a, _b, dirent, subPath, _c, _d, _e, _f, e_1_1;
6019
+ var e_1, _g;
6020
+ return __generator(this, function (_h) {
6021
+ switch (_h.label) {
6022
+ case 0: return [4 /*yield*/, isDirectoryExisting(path)];
6023
+ case 1:
6024
+ if (!(_h.sent())) {
6025
+ throw new Error("Directory \"".concat(path, "\" does not exist or is not readable"));
6026
+ // <- TODO: Use some custom error class
6027
+ }
6028
+ return [4 /*yield*/, readdir(path, {
6029
+ withFileTypes: true /* Note: This is not working: recursive: isRecursive */,
6030
+ })];
6031
+ case 2:
6032
+ dirents = _h.sent();
6033
+ fileNames = dirents.filter(function (dirent) { return dirent.isFile(); }).map(function (_a) {
6034
+ var name = _a.name;
6035
+ return join(path, name);
6036
+ });
6037
+ if (!isRecursive) return [3 /*break*/, 10];
6038
+ _h.label = 3;
6039
+ case 3:
6040
+ _h.trys.push([3, 8, 9, 10]);
6041
+ _a = __values(dirents.filter(function (dirent) { return dirent.isDirectory(); })), _b = _a.next();
6042
+ _h.label = 4;
6043
+ case 4:
6044
+ if (!!_b.done) return [3 /*break*/, 7];
6045
+ dirent = _b.value;
6046
+ subPath = join(path, dirent.name);
6047
+ _d = (_c = fileNames.push).apply;
6048
+ _e = [fileNames];
6049
+ _f = [[]];
6050
+ return [4 /*yield*/, listAllFiles(subPath, isRecursive)];
6051
+ case 5:
6052
+ _d.apply(_c, _e.concat([__spreadArray.apply(void 0, _f.concat([__read.apply(void 0, [(_h.sent())]), false]))]));
6053
+ _h.label = 6;
6054
+ case 6:
6055
+ _b = _a.next();
6056
+ return [3 /*break*/, 4];
6057
+ case 7: return [3 /*break*/, 10];
6058
+ case 8:
6059
+ e_1_1 = _h.sent();
6060
+ e_1 = { error: e_1_1 };
6061
+ return [3 /*break*/, 10];
6062
+ case 9:
6063
+ try {
6064
+ if (_b && !_b.done && (_g = _a.return)) _g.call(_a);
6065
+ }
6066
+ finally { if (e_1) throw e_1.error; }
6067
+ return [7 /*endfinally*/];
6068
+ case 10: return [2 /*return*/, fileNames];
6069
+ }
6070
+ });
6071
+ });
6072
+ }
6073
+ /**
6074
+ * Note: [🟢] This code should never be published outside of `@promptbook/node` and `@promptbook/cli` and `@promptbook/cli`
6075
+ * TODO: [🖇] What about symlinks?
6076
+ */
6077
+
5877
6078
  /**
5878
6079
  * Constructs Promptbook from async sources
5879
6080
  * It can be one of the following:
@@ -5973,7 +6174,7 @@ function createCollectionFromPromise(promptbookSourcesPromiseOrFactory) {
5973
6174
  */
5974
6175
  function createCollectionFromDirectory(path, options) {
5975
6176
  return __awaiter(this, void 0, void 0, function () {
5976
- var makedLibraryFilePath, makedLibraryFileExists, _a, _b, isRecursive, _c, isVerbose, _d, isLazyLoaded, _e, isCrashedOnError, collection;
6177
+ var makedLibraryFilePath, _a, _b, isRecursive, _c, isVerbose, _d, isLazyLoaded, _e, isCrashedOnError, collection;
5977
6178
  var _this = this;
5978
6179
  return __generator(this, function (_f) {
5979
6180
  switch (_f.label) {
@@ -5981,13 +6182,10 @@ function createCollectionFromDirectory(path, options) {
5981
6182
  if (!isRunningInNode()) {
5982
6183
  throw new Error('Function `createCollectionFromDirectory` can only be run in Node.js environment because it reads the file system.');
5983
6184
  }
5984
- makedLibraryFilePath = join(path, "".concat(PIPELINE_COLLECTION_BASE_FILENAME, ".json"));
5985
- return [4 /*yield*/, access(makedLibraryFilePath, constants.R_OK)
5986
- .then(function () { return true; })
5987
- .catch(function () { return false; })];
6185
+ makedLibraryFilePath = join$1(path, "".concat(PIPELINE_COLLECTION_BASE_FILENAME, ".json"));
6186
+ return [4 /*yield*/, isFileExisting(makedLibraryFilePath)];
5988
6187
  case 1:
5989
- makedLibraryFileExists = _f.sent();
5990
- if (!makedLibraryFileExists) {
6188
+ if (!(_f.sent())) {
5991
6189
  console.info(colors.yellow("Tip: Prebuild your pipeline collection (file with supposed prebuild ".concat(makedLibraryFilePath, " not found) with CLI util \"ptbk make\" to speed up the collection creation.")));
5992
6190
  }
5993
6191
  else {
@@ -6150,66 +6348,8 @@ function createCollectionFromDirectory(path, options) {
6150
6348
  });
6151
6349
  }
6152
6350
  /**
6153
- * Reads all files in the directory
6154
- *
6155
- * @param path
6156
- * @param isRecursive
6157
- * @returns List of all files in the directory
6158
- * @private internal function for `createCollectionFromDirectory`
6159
- */
6160
- function listAllFiles(path, isRecursive) {
6161
- return __awaiter(this, void 0, void 0, function () {
6162
- var dirents, fileNames, _a, _b, dirent, subPath, _c, _d, _e, _f, e_2_1;
6163
- var e_2, _g;
6164
- return __generator(this, function (_h) {
6165
- switch (_h.label) {
6166
- case 0: return [4 /*yield*/, readdir(path, {
6167
- withFileTypes: true /* Note: This is not working: recursive: isRecursive */,
6168
- })];
6169
- case 1:
6170
- dirents = _h.sent();
6171
- fileNames = dirents.filter(function (dirent) { return dirent.isFile(); }).map(function (_a) {
6172
- var name = _a.name;
6173
- return join(path, name);
6174
- });
6175
- if (!isRecursive) return [3 /*break*/, 9];
6176
- _h.label = 2;
6177
- case 2:
6178
- _h.trys.push([2, 7, 8, 9]);
6179
- _a = __values(dirents.filter(function (dirent) { return dirent.isDirectory(); })), _b = _a.next();
6180
- _h.label = 3;
6181
- case 3:
6182
- if (!!_b.done) return [3 /*break*/, 6];
6183
- dirent = _b.value;
6184
- subPath = join(path, dirent.name);
6185
- _d = (_c = fileNames.push).apply;
6186
- _e = [fileNames];
6187
- _f = [[]];
6188
- return [4 /*yield*/, listAllFiles(subPath, isRecursive)];
6189
- case 4:
6190
- _d.apply(_c, _e.concat([__spreadArray.apply(void 0, _f.concat([__read.apply(void 0, [(_h.sent())]), false]))]));
6191
- _h.label = 5;
6192
- case 5:
6193
- _b = _a.next();
6194
- return [3 /*break*/, 3];
6195
- case 6: return [3 /*break*/, 9];
6196
- case 7:
6197
- e_2_1 = _h.sent();
6198
- e_2 = { error: e_2_1 };
6199
- return [3 /*break*/, 9];
6200
- case 8:
6201
- try {
6202
- if (_b && !_b.done && (_g = _a.return)) _g.call(_a);
6203
- }
6204
- finally { if (e_2) throw e_2.error; }
6205
- return [7 /*endfinally*/];
6206
- case 9: return [2 /*return*/, fileNames];
6207
- }
6208
- });
6209
- });
6210
- }
6211
- /**
6212
- * Note: [🟢] This code should never be published outside of `@pipeline/node`
6351
+ * Note: [🟢] This code should never be published outside of `@promptbook/node` and `@promptbook/cli` and `@promptbook/cli`
6352
+ * TODO: [🖇] What about symlinks? Maybe option isSymlinksFollowed
6213
6353
  */
6214
6354
 
6215
6355
  /**
@@ -6281,22 +6421,6 @@ function usageToHuman(usage) {
6281
6421
  * TODO: [🏛] Maybe make some markdown builder
6282
6422
  */
6283
6423
 
6284
- /**
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`
6288
- */
6289
- var EnvironmentMismatchError = /** @class */ (function (_super) {
6290
- __extends(EnvironmentMismatchError, _super);
6291
- function EnvironmentMismatchError(message) {
6292
- var _this = _super.call(this, message) || this;
6293
- _this.name = 'EnvironmentMismatchError';
6294
- Object.setPrototypeOf(_this, EnvironmentMismatchError.prototype);
6295
- return _this;
6296
- }
6297
- return EnvironmentMismatchError;
6298
- }(Error));
6299
-
6300
6424
  /**
6301
6425
  * @@@
6302
6426
  *
@@ -6324,24 +6448,21 @@ var FilesStorage = /** @class */ (function () {
6324
6448
  FilesStorage.prototype.getFilenameForKey = function (key) {
6325
6449
  var name = titleToName(key);
6326
6450
  var hash = sha256(hexEncoder.parse(name)).toString( /* hex */);
6327
- return join.apply(void 0, __spreadArray(__spreadArray([this.options.cacheFolderPath], __read(nameToSubfolderPath(hash /* <- TODO: [🎎] Maybe add some SHA256 prefix */)), false), ["".concat(name.substring(0, MAX_FILENAME_LENGTH), ".json")], false));
6451
+ return join$1.apply(void 0, __spreadArray(__spreadArray([this.options.cacheFolderPath], __read(nameToSubfolderPath(hash /* <- TODO: [🎎] Maybe add some SHA256 prefix */)), false), ["".concat(name.substring(0, MAX_FILENAME_LENGTH), ".json")], false));
6328
6452
  };
6329
6453
  /**
6330
6454
  * @@@ Returns the current value associated with the given key, or null if the given key does not exist in the list associated with the object.
6331
6455
  */
6332
6456
  FilesStorage.prototype.getItem = function (key) {
6333
6457
  return __awaiter(this, void 0, void 0, function () {
6334
- var filename, isFileExisting, fileContent, value;
6458
+ var filename, fileContent, value;
6335
6459
  return __generator(this, function (_a) {
6336
6460
  switch (_a.label) {
6337
6461
  case 0:
6338
6462
  filename = this.getFilenameForKey(key);
6339
- return [4 /*yield*/, stat(filename)
6340
- .then(function (fileStat) { return fileStat.isFile(); })
6341
- .catch(function () { return false; })];
6463
+ return [4 /*yield*/, isFileExisting(filename)];
6342
6464
  case 1:
6343
- isFileExisting = _a.sent();
6344
- if (!isFileExisting) {
6465
+ if (!(_a.sent())) {
6345
6466
  return [2 /*return*/, null];
6346
6467
  }
6347
6468
  return [4 /*yield*/, readFile(filename, 'utf-8')];
@@ -6400,7 +6521,7 @@ var FilesStorage = /** @class */ (function () {
6400
6521
  }());
6401
6522
  /**
6402
6523
  * TODO: [🌗] Maybe some checkers, not all valid JSONs are desired and valid values
6403
- * Note: [🟢] This code should never be published outside of `@promptbook/node`
6524
+ * Note: [🟢] This code should never be published outside of `@promptbook/node` and `@promptbook/cli` and `@promptbook/cli`
6404
6525
  */
6405
6526
 
6406
6527
  /**
@@ -6409,7 +6530,7 @@ var FilesStorage = /** @class */ (function () {
6409
6530
  * @param content the content of prompt or response
6410
6531
  * @returns part of PromptResultUsageCounts
6411
6532
  *
6412
- * @private internal util of LlmExecutionTools
6533
+ * @private internal utility of LlmExecutionTools
6413
6534
  */
6414
6535
  function computeUsageCounts(content) {
6415
6536
  return {
@@ -6439,7 +6560,7 @@ function uncertainNumber(value) {
6439
6560
  /**
6440
6561
  * Get current date in ISO 8601 format
6441
6562
  *
6442
- * @private This is internal util of the promptbook
6563
+ * @private internal utility
6443
6564
  */
6444
6565
  function getCurrentIsoDate() {
6445
6566
  return new Date().toISOString();
@@ -6461,6 +6582,7 @@ function computeUsage(value) {
6461
6582
  * Note: Done at 2024-05-25
6462
6583
  *
6463
6584
  * @see https://docs.anthropic.com/en/docs/models-overview
6585
+ * @public exported from `@promptbook/anthropic-claude`
6464
6586
  */
6465
6587
  var ANTHROPIC_CLAUDE_MODELS = [
6466
6588
  {
@@ -7107,7 +7229,7 @@ var OPENAI_MODELS = [
7107
7229
  * @param resultContent The content of the result (for embedding prompts or failed prompts pass empty string)
7108
7230
  * @param rawResponse The raw response from OpenAI API
7109
7231
  * @throws {PipelineExecutionError} If the usage is not defined in the response from OpenAI
7110
- * @private internal util of `OpenAiExecutionTools`
7232
+ * @private internal utility of `OpenAiExecutionTools`
7111
7233
  */
7112
7234
  function computeOpenaiUsage(promptContent, // <- Note: Intentionally using [] to access type properties to bring jsdoc from Prompt/PromptResult to consumer
7113
7235
  resultContent, rawResponse) {
@@ -7489,7 +7611,7 @@ function createLlmToolsFromEnv(options) {
7489
7611
  * TODO: [🧠] Which name is better `createLlmToolsFromEnv` or `createLlmToolsFromEnvironment`?
7490
7612
  * TODO: [🧠] Is there some meaningfull way how to test this util
7491
7613
  * TODO: [🧠] Maybe pass env as argument
7492
- * Note: [🟢] This code should never be published outside of `@promptbook/node`
7614
+ * Note: [🟢] This code should never be published outside of `@promptbook/node` and `@promptbook/cli` and `@promptbook/cli`
7493
7615
  * TODO: [👷‍♂️] @@@ Manual about construction of llmTools
7494
7616
  */
7495
7617
 
@@ -7679,7 +7801,7 @@ function getLlmToolsForCli(options) {
7679
7801
  return cacheLlmTools(countTotalUsage(
7680
7802
  // <- Note: for example here we don`t want the [🌯]
7681
7803
  createLlmToolsFromEnv()), {
7682
- storage: new FilesStorage({ cacheFolderPath: join(process.cwd(), EXECUTIONS_CACHE_DIRNAME) }),
7804
+ storage: new FilesStorage({ cacheFolderPath: join$1(process.cwd(), EXECUTIONS_CACHE_DIRNAME) }),
7683
7805
  isReloaded: isCacheReloaded,
7684
7806
  });
7685
7807
  }
@@ -7691,14 +7813,16 @@ function getLlmToolsForCli(options) {
7691
7813
  /**
7692
7814
  * Initializes `make` command for Promptbook CLI utilities
7693
7815
  *
7694
- * @private part of `promptbookCli`
7816
+ * @private internal function of `promptbookCli`
7695
7817
  */
7696
7818
  function initializeMakeCommand(program) {
7697
7819
  var _this = this;
7698
7820
  var makeCommand = program.command('make');
7699
7821
  makeCommand.description(spaceTrim("\n Makes a new pipeline collection in given folder\n "));
7700
- makeCommand.argument('<path>', 'Path to promptbook directory');
7701
- makeCommand.option('--project-name', "Name of the project for whom collection is", 'Project');
7822
+ makeCommand.argument('[path]',
7823
+ // <- TODO: [🧟‍♂️] Unite path to promptbook collection argument
7824
+ 'Path to promptbook directory', './promptbook-collection');
7825
+ makeCommand.option('--project-name', "Name of the project for whom collection is", 'Untitled Promptbook project');
7702
7826
  makeCommand.option('-f, --format <format>', spaceTrim("\n Output format of builded collection \"javascript\", \"typescript\" or \"json\"\n\n Note: You can use multiple formats separated by comma\n "), 'javascript' /* <- Note: [🏳‍🌈] */);
7703
7827
  makeCommand.option('--no-validation', "Do not validate logic of pipelines in collection", true);
7704
7828
  makeCommand.option('--validation', "Types of validations separated by comma (options \"logic\",\"imports\")", 'logic,imports');
@@ -7708,7 +7832,7 @@ function initializeMakeCommand(program) {
7708
7832
  makeCommand.action(function (path, _a) {
7709
7833
  var projectName = _a.projectName, format = _a.format, validation = _a.validation, reloadCache = _a.reloadCache, verbose = _a.verbose, outFile = _a.outFile;
7710
7834
  return __awaiter(_this, void 0, void 0, function () {
7711
- var isCacheReloaded, isVerbose, formats, validations, llmTools, collection, validations_1, validations_1_1, validation_1, _b, _c, pipelineUrl, pipeline, e_1_1, e_2_1, collectionJson, collectionJsonString, saveFile;
7835
+ var isCacheReloaded, isVerbose, formats, validations, llmTools, collection, validations_1, validations_1_1, validation_1, _b, _c, pipelineUrl, pipeline, e_1_1, e_2_1, collectionJson, collectionJsonString, collectionJsonItems, saveFile;
7712
7836
  var e_2, _d, e_1, _e;
7713
7837
  var _this = this;
7714
7838
  return __generator(this, function (_f) {
@@ -7725,7 +7849,7 @@ function initializeMakeCommand(program) {
7725
7849
  .map(function (_) { return _.trim(); })
7726
7850
  .filter(function (_) { return _ !== ''; });
7727
7851
  if (outFile !== PIPELINE_COLLECTION_BASE_FILENAME && formats.length !== 1) {
7728
- console.error(colors.red("You can use only one format when saving to a file"));
7852
+ console.error(colors.red("You can only use one format if you specify --out-file"));
7729
7853
  process.exit(1);
7730
7854
  }
7731
7855
  llmTools = getLlmToolsForCli({
@@ -7799,7 +7923,18 @@ function initializeMakeCommand(program) {
7799
7923
  case 16: return [4 /*yield*/, collectionToJson(collection)];
7800
7924
  case 17:
7801
7925
  collectionJson = _f.sent();
7802
- collectionJsonString = stringifyPipelineJson(collectionJson);
7926
+ collectionJsonString = stringifyPipelineJson(collectionJson).trim();
7927
+ collectionJsonItems = (function () {
7928
+ var firstChar = collectionJsonString.charAt(0);
7929
+ if (firstChar !== '[') {
7930
+ throw new UnexpectedError("First character of serialized collection should be \"[\" not \"".concat(firstChar, "\""));
7931
+ }
7932
+ var lastChar = collectionJsonString.charAt(collectionJsonString.length - 1);
7933
+ if (lastChar !== ']') {
7934
+ throw new UnexpectedError("Last character of serialized collection should be \"]\" not \"".concat(lastChar, "\""));
7935
+ }
7936
+ return spaceTrim(collectionJsonString.substring(1, collectionJsonString.length - 1));
7937
+ })();
7803
7938
  saveFile = function (extension, content) { return __awaiter(_this, void 0, void 0, function () {
7804
7939
  var filePath;
7805
7940
  return __generator(this, function (_a) {
@@ -7807,7 +7942,7 @@ function initializeMakeCommand(program) {
7807
7942
  case 0:
7808
7943
  filePath = outFile !== PIPELINE_COLLECTION_BASE_FILENAME
7809
7944
  ? outFile
7810
- : join(path, "".concat(PIPELINE_COLLECTION_BASE_FILENAME, ".").concat(extension));
7945
+ : join$1(path, "".concat(PIPELINE_COLLECTION_BASE_FILENAME, ".").concat(extension));
7811
7946
  if (!outFile.endsWith(".".concat(extension))) {
7812
7947
  console.warn(colors.yellow("Warning: Extension of output file should be \"".concat(extension, "\"")));
7813
7948
  }
@@ -7824,23 +7959,29 @@ function initializeMakeCommand(program) {
7824
7959
  });
7825
7960
  }); };
7826
7961
  if (!formats.includes('json')) return [3 /*break*/, 19];
7962
+ formats = formats.filter(function (format) { return format !== 'json'; });
7827
7963
  return [4 /*yield*/, saveFile('json', collectionJsonString)];
7828
7964
  case 18:
7829
7965
  _f.sent();
7830
7966
  _f.label = 19;
7831
7967
  case 19:
7832
- if (!formats.includes('javascript')) return [3 /*break*/, 21];
7833
- return [4 /*yield*/, saveFile('js', spaceTrim("\n import { createCollectionFromJson } from '@promptbook/core';\n\n /**\n * Pipeline collection for ".concat(projectName, "\n *\n * @private internal cache for `getPipelineCollection`\n */\n let pipelineCollection = null;\n\n\n /**\n * Get pipeline collection for ").concat(projectName, "\n *\n * @returns {PipelineCollection} Library of promptbooks for ").concat(projectName, "\n * @generated by `@promptbook/cli`\n */\n export function getPipelineCollection(){\n if(pipelineCollection===null){\n pipelineCollection = createCollectionFromJson(").concat(collectionJsonString.substring(1, collectionJsonString.length - 1), ");\n }\n\n return pipelineCollection;\n }\n ") + '\n'))];
7968
+ if (!(formats.includes('javascript') || formats.includes('js'))) return [3 /*break*/, 21];
7969
+ formats = formats.filter(function (format) { return format !== 'javascript' && format !== 'js'; });
7970
+ return [4 /*yield*/, saveFile('js', spaceTrim(function (block) { return "\n // ".concat(block(GENERATOR_WARNING_BY_PROMPTBOOK_CLI), "\n\n import { createCollectionFromJson } from '@promptbook/core';\n\n /**\n * Pipeline collection for ").concat(projectName, "\n *\n * ").concat(block(GENERATOR_WARNING_BY_PROMPTBOOK_CLI), "\n *\n * @private internal cache for `getPipelineCollection`\n */\n let pipelineCollection = null;\n\n\n /**\n * Get pipeline collection for ").concat(projectName, "\n *\n * ").concat(block(GENERATOR_WARNING_BY_PROMPTBOOK_CLI), "\n *\n * @returns {PipelineCollection} Library of promptbooks for ").concat(projectName, "\n */\n export function getPipelineCollection(){\n if(pipelineCollection===null){\n pipelineCollection = createCollectionFromJson(\n ").concat(block(collectionJsonItems), "\n );\n }\n\n return pipelineCollection;\n }\n "); }))];
7834
7971
  case 20:
7835
- _f.sent();
7972
+ (_f.sent()) + '\n';
7836
7973
  _f.label = 21;
7837
7974
  case 21:
7838
- if (!formats.includes('typescript')) return [3 /*break*/, 23];
7839
- return [4 /*yield*/, saveFile('ts', spaceTrim("\n import { createCollectionFromJson } from '@promptbook/core';\n import type { PipelineCollection } from '@promptbook/types';\n\n /**\n * Pipeline collection for ".concat(projectName, "\n *\n * @private internal cache for `getPipelineCollection`\n */\n let pipelineCollection: null | PipelineCollection = null;\n\n\n /**\n * Get pipeline collection for ").concat(projectName, "\n *\n * @returns {PipelineCollection} Library of promptbooks for ").concat(projectName, "\n * @generated by `@promptbook/cli`\n */\n export function getPipelineCollection(): PipelineCollection{\n if(pipelineCollection===null){\n pipelineCollection = createCollectionFromJson(").concat(collectionJsonString.substring(1, collectionJsonString.length - 1), ");\n }\n\n return pipelineCollection as PipelineCollection;\n }\n ") + '\n'))];
7975
+ if (!(formats.includes('typescript') || formats.includes('ts'))) return [3 /*break*/, 23];
7976
+ formats = formats.filter(function (format) { return format !== 'typescript' && format !== 'ts'; });
7977
+ return [4 /*yield*/, saveFile('ts', spaceTrim(function (block) { return "\n // ".concat(block(GENERATOR_WARNING_BY_PROMPTBOOK_CLI), "\n\n import { createCollectionFromJson } from '@promptbook/core';\n import type { PipelineCollection } from '@promptbook/types';\n\n /**\n * Pipeline collection for ").concat(projectName, "\n *\n * ").concat(block(GENERATOR_WARNING_BY_PROMPTBOOK_CLI), "\n *\n * @private internal cache for `getPipelineCollection`\n */\n let pipelineCollection: null | PipelineCollection = null;\n\n\n /**\n * Get pipeline collection for ").concat(projectName, "\n *\n * ").concat(block(GENERATOR_WARNING_BY_PROMPTBOOK_CLI), "\n *\n * @returns {PipelineCollection} Library of promptbooks for ").concat(projectName, "\n */\n export function getPipelineCollection(): PipelineCollection{\n if(pipelineCollection===null){\n pipelineCollection = createCollectionFromJson(\n ").concat(block(collectionJsonItems), "\n );\n }\n\n return pipelineCollection;\n }\n "); }) + '\n')];
7840
7978
  case 22:
7841
7979
  _f.sent();
7842
7980
  _f.label = 23;
7843
7981
  case 23:
7982
+ if (formats.length > 0) {
7983
+ console.warn(colors.yellow("Format ".concat(formats.join(' and '), " is not supported")));
7984
+ }
7844
7985
  if (isVerbose) {
7845
7986
  console.info(colors.green("Collection builded"));
7846
7987
  console.info(colors.cyan(usageToHuman(llmTools.getTotalUsage())));
@@ -7853,7 +7994,10 @@ function initializeMakeCommand(program) {
7853
7994
  });
7854
7995
  }
7855
7996
  /**
7997
+ * TODO: Maybe remove this command - "about" command should be enough?
7998
+ * TODO: [0] DRY Javascript and typescript - Maybe make ONLY typescript and for javascript just remove types
7856
7999
  * Note: [🟡] This code should never be published outside of `@promptbook/cli`
8000
+ * TODO: [🖇] What about symlinks? Maybe flag --follow-symlinks
7857
8001
  */
7858
8002
 
7859
8003
  /**
@@ -7863,7 +8007,7 @@ function initializeMakeCommand(program) {
7863
8007
  */
7864
8008
  function addAutoGeneratedSection(content, options) {
7865
8009
  var sectionName = options.sectionName, sectionContent = options.sectionContent;
7866
- var warningLine = "<!-- \u26A0\uFE0F WARNING: This section was auto-generated -->";
8010
+ var warningLine = "<!-- ".concat(GENERATOR_WARNING, " -->");
7867
8011
  var sectionRegex = new RegExp("<!--".concat(sectionName, "-->([\\s\\S]*?)<!--/").concat(sectionName, "-->"), 'g');
7868
8012
  var sectionMatch = content.match(sectionRegex);
7869
8013
  if (sectionMatch) {
@@ -8051,13 +8195,15 @@ function prettifyPipelineString(pipelineString, options) {
8051
8195
  /**
8052
8196
  * Initializes `prettify` command for Promptbook CLI utilities
8053
8197
  *
8054
- * @private part of `promptbookCli`
8198
+ * @private internal function of `promptbookCli`
8055
8199
  */
8056
8200
  function initializePrettifyCommand(program) {
8057
8201
  var _this = this;
8058
8202
  var prettifyCommand = program.command('prettify');
8059
8203
  prettifyCommand.description(spaceTrim("\n Iterates over promptbooks and does multiple enhancing operations on them:\n\n 1) Adds Mermaid graph\n 2) Prettifies the markdown\n "));
8060
- prettifyCommand.argument('<filesGlob>', 'Promptbooks to prettify as glob pattern');
8204
+ prettifyCommand.argument('<filesGlob>',
8205
+ // <- TODO: [🧟‍♂️] Unite path to promptbook collection argument
8206
+ 'Promptbooks to prettify as glob pattern');
8061
8207
  prettifyCommand.option('-i, --ignore <glob>', "Ignore as glob pattern");
8062
8208
  prettifyCommand.action(function (filesGlob, _a) {
8063
8209
  var ignore = _a.ignore;
@@ -8133,10 +8279,13 @@ function initializePrettifyCommand(program) {
8133
8279
  }
8134
8280
  /**
8135
8281
  * Note: [🟡] This code should never be published outside of `@promptbook/cli`
8282
+ * TODO: [🖇] What about symlinks? Maybe flag --follow-symlinks
8136
8283
  */
8137
8284
 
8138
8285
  /**
8139
8286
  * Runs CLI utilities of Promptbook package
8287
+ *
8288
+ * @private within the `@promptbook/cli`
8140
8289
  */
8141
8290
  function promptbookCli() {
8142
8291
  return __awaiter(this, void 0, void 0, function () {
@@ -8147,8 +8296,10 @@ function promptbookCli() {
8147
8296
  }
8148
8297
  program = new commander.Command();
8149
8298
  program.name('promptbook');
8299
+ program.alias('ptbk');
8150
8300
  program.version(PROMPTBOOK_VERSION);
8151
8301
  program.description(spaceTrim$1("\n Promptbook utilities for enhancing workflow with promptbooks\n "));
8302
+ initializeAboutCommand(program);
8152
8303
  initializeHelloCommand(program);
8153
8304
  initializeMakeCommand(program);
8154
8305
  initializePrettifyCommand(program);
@@ -8158,7 +8309,7 @@ function promptbookCli() {
8158
8309
  });
8159
8310
  }
8160
8311
  /**
8161
- * TODO: [🥠] Do not export to utils directly, its just for CLI script
8312
+ * TODO: [🥠] Do not export, its just for CLI script
8162
8313
  * TODO: [🕌] When more functionalities, rename
8163
8314
  * Note: 11:11
8164
8315
  * Note: [🟡] This code should never be published outside of `@promptbook/cli`