@promptbook/cli 0.63.0-1 → 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 (492) hide show
  1. package/README.md +4 -2
  2. package/esm/index.es.js +357 -204
  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/package.json +10 -16
  71. package/umd/index.umd.js +354 -202
  72. package/umd/index.umd.js.map +1 -1
  73. package/esm/typings/src/types/execution-report/config.d.ts +0 -8
  74. package/umd/typings/promptbook-collection/index.d.ts +0 -252
  75. package/umd/typings/src/_packages/anthropic-claude.index.d.ts +0 -6
  76. package/umd/typings/src/_packages/azure-openai.index.d.ts +0 -6
  77. package/umd/typings/src/_packages/browser.index.d.ts +0 -6
  78. package/umd/typings/src/_packages/cli.index.d.ts +0 -4
  79. package/umd/typings/src/_packages/core.index.d.ts +0 -124
  80. package/umd/typings/src/_packages/execute-javascript.index.d.ts +0 -8
  81. package/umd/typings/src/_packages/fake-llm.index.d.ts +0 -6
  82. package/umd/typings/src/_packages/langtail.index.d.ts +0 -6
  83. package/umd/typings/src/_packages/markdown-utils.index.d.ts +0 -36
  84. package/umd/typings/src/_packages/node.index.d.ts +0 -8
  85. package/umd/typings/src/_packages/openai.index.d.ts +0 -8
  86. package/umd/typings/src/_packages/remote-client.index.d.ts +0 -8
  87. package/umd/typings/src/_packages/remote-server.index.d.ts +0 -6
  88. package/umd/typings/src/_packages/types.index.d.ts +0 -462
  89. package/umd/typings/src/_packages/utils.index.d.ts +0 -130
  90. package/umd/typings/src/cli/cli-commands/hello.d.ts +0 -10
  91. package/umd/typings/src/cli/cli-commands/make.d.ts +0 -10
  92. package/umd/typings/src/cli/cli-commands/prettify.d.ts +0 -10
  93. package/umd/typings/src/cli/main.d.ts +0 -12
  94. package/umd/typings/src/cli/promptbookCli.d.ts +0 -10
  95. package/umd/typings/src/collection/PipelineCollection.d.ts +0 -25
  96. package/umd/typings/src/collection/SimplePipelineCollection.d.ts +0 -38
  97. package/umd/typings/src/collection/collectionToJson.d.ts +0 -13
  98. package/umd/typings/src/collection/collectionToJson.test.d.ts +0 -7
  99. package/umd/typings/src/collection/constructors/createCollectionFromDirectory.d.ts +0 -48
  100. package/umd/typings/src/collection/constructors/createCollectionFromJson.d.ts +0 -13
  101. package/umd/typings/src/collection/constructors/createCollectionFromPromise.d.ts +0 -23
  102. package/umd/typings/src/collection/constructors/createCollectionFromUrl.d.ts +0 -29
  103. package/umd/typings/src/collection/constructors/createSubcollection.d.ts +0 -13
  104. package/umd/typings/src/commands/BLOCK/BlockCommand.d.ts +0 -11
  105. package/umd/typings/src/commands/BLOCK/BlockTypes.d.ts +0 -15
  106. package/umd/typings/src/commands/BLOCK/blockCommandParser.d.ts +0 -9
  107. package/umd/typings/src/commands/EXPECT/ExpectAmountCommand.d.ts +0 -14
  108. package/umd/typings/src/commands/EXPECT/ExpectCommand.d.ts +0 -9
  109. package/umd/typings/src/commands/EXPECT/ExpectFormatCommand.d.ts +0 -7
  110. package/umd/typings/src/commands/EXPECT/expectCommand.test.d.ts +0 -1
  111. package/umd/typings/src/commands/EXPECT/expectCommandParser.d.ts +0 -9
  112. package/umd/typings/src/commands/JOKER/JokerCommand.d.ts +0 -11
  113. package/umd/typings/src/commands/JOKER/jokerCommand.test.d.ts +0 -1
  114. package/umd/typings/src/commands/JOKER/jokerCommandParser.d.ts +0 -9
  115. package/umd/typings/src/commands/KNOWLEDGE/KnowledgeCommand.d.ts +0 -11
  116. package/umd/typings/src/commands/KNOWLEDGE/knowledgeCommand.test.d.ts +0 -1
  117. package/umd/typings/src/commands/KNOWLEDGE/knowledgeCommandParser.d.ts +0 -9
  118. package/umd/typings/src/commands/MODEL/ModelCommand.d.ts +0 -13
  119. package/umd/typings/src/commands/MODEL/modelCommand.test.d.ts +0 -1
  120. package/umd/typings/src/commands/MODEL/modelCommandParser.d.ts +0 -9
  121. package/umd/typings/src/commands/PARAMETER/ParameterCommand.d.ts +0 -15
  122. package/umd/typings/src/commands/PARAMETER/parameterCommand.test.d.ts +0 -1
  123. package/umd/typings/src/commands/PARAMETER/parameterCommandParser.d.ts +0 -9
  124. package/umd/typings/src/commands/PERSONA/PersonaCommand.d.ts +0 -13
  125. package/umd/typings/src/commands/PERSONA/personaCommand.test.d.ts +0 -1
  126. package/umd/typings/src/commands/PERSONA/personaCommandParser.d.ts +0 -9
  127. package/umd/typings/src/commands/POSTPROCESS/PostprocessCommand.d.ts +0 -11
  128. package/umd/typings/src/commands/POSTPROCESS/postprocessCommand.test.d.ts +0 -1
  129. package/umd/typings/src/commands/POSTPROCESS/postprocessCommandParser.d.ts +0 -9
  130. package/umd/typings/src/commands/PROMPTBOOK_VERSION/PromptbookVersionCommand.d.ts +0 -11
  131. package/umd/typings/src/commands/PROMPTBOOK_VERSION/promptbookVersionCommand.test.d.ts +0 -1
  132. package/umd/typings/src/commands/PROMPTBOOK_VERSION/promptbookVersionCommandParser.d.ts +0 -9
  133. package/umd/typings/src/commands/URL/UrlCommand.d.ts +0 -10
  134. package/umd/typings/src/commands/URL/urlCommand.test.d.ts +0 -1
  135. package/umd/typings/src/commands/URL/urlCommandParser.d.ts +0 -9
  136. package/umd/typings/src/commands/X_ACTION/ActionCommand.d.ts +0 -9
  137. package/umd/typings/src/commands/X_ACTION/actionCommand.test.d.ts +0 -1
  138. package/umd/typings/src/commands/X_ACTION/actionCommandParser.d.ts +0 -9
  139. package/umd/typings/src/commands/X_INSTRUMENT/InstrumentCommand.d.ts +0 -9
  140. package/umd/typings/src/commands/X_INSTRUMENT/instrumentCommand.test.d.ts +0 -1
  141. package/umd/typings/src/commands/X_INSTRUMENT/instrumentCommandParser.d.ts +0 -9
  142. package/umd/typings/src/commands/_BOILERPLATE/BoilerplateCommand.d.ts +0 -10
  143. package/umd/typings/src/commands/_BOILERPLATE/boilerplateCommand.test.d.ts +0 -1
  144. package/umd/typings/src/commands/_BOILERPLATE/boilerplateCommandParser.d.ts +0 -13
  145. package/umd/typings/src/commands/_common/parseCommand.d.ts +0 -12
  146. package/umd/typings/src/commands/_common/parseCommand.test.d.ts +0 -1
  147. package/umd/typings/src/commands/_common/types/Command.d.ts +0 -6
  148. package/umd/typings/src/commands/_common/types/CommandParser.d.ts +0 -64
  149. package/umd/typings/src/commands/_common/types/CommandUsagePlaces.d.ts +0 -9
  150. package/umd/typings/src/commands/index.d.ts +0 -4
  151. package/umd/typings/src/config.d.ts +0 -87
  152. package/umd/typings/src/config.test.d.ts +0 -4
  153. package/umd/typings/src/conversion/pipelineJsonToString.d.ts +0 -16
  154. package/umd/typings/src/conversion/pipelineStringToJson.d.ts +0 -38
  155. package/umd/typings/src/conversion/pipelineStringToJson.test.d.ts +0 -1
  156. package/umd/typings/src/conversion/pipelineStringToJsonSync.d.ts +0 -29
  157. package/umd/typings/src/conversion/pipelineStringToJsonSync.test.d.ts +0 -1
  158. package/umd/typings/src/conversion/prettify/PrettifyOptions.d.ts +0 -13
  159. package/umd/typings/src/conversion/prettify/prettifyPipelineString.d.ts +0 -12
  160. package/umd/typings/src/conversion/prettify/renderPipelineMermaidOptions.d.ts +0 -27
  161. package/umd/typings/src/conversion/utils/extractParameterNamesFromPromptTemplate.d.ts +0 -14
  162. package/umd/typings/src/conversion/utils/extractParameterNamesFromPromptTemplate.test.d.ts +0 -1
  163. package/umd/typings/src/conversion/utils/extractVariables.d.ts +0 -14
  164. package/umd/typings/src/conversion/utils/extractVariables.test.d.ts +0 -1
  165. package/umd/typings/src/conversion/utils/renameParameter.d.ts +0 -26
  166. package/umd/typings/src/conversion/utils/renameParameter.test.d.ts +0 -1
  167. package/umd/typings/src/conversion/utils/stringifyPipelineJson.d.ts +0 -16
  168. package/umd/typings/src/conversion/utils/stringifyPipelineJson.test.d.ts +0 -1
  169. package/umd/typings/src/conversion/utils/titleToName.d.ts +0 -9
  170. package/umd/typings/src/conversion/utils/titleToName.test.d.ts +0 -1
  171. package/umd/typings/src/conversion/validation/_importPipeline.d.ts +0 -22
  172. package/umd/typings/src/conversion/validation/pipelineStringToJson-syntaxErrors.test.d.ts +0 -1
  173. package/umd/typings/src/conversion/validation/validatePipeline-logicErrors.test.d.ts +0 -4
  174. package/umd/typings/src/conversion/validation/validatePipeline.d.ts +0 -37
  175. package/umd/typings/src/conversion/validation/validatePipeline.test.d.ts +0 -1
  176. package/umd/typings/src/errors/CollectionError.d.ts +0 -9
  177. package/umd/typings/src/errors/EnvironmentMismatchError.d.ts +0 -9
  178. package/umd/typings/src/errors/LimitReachedError.d.ts +0 -9
  179. package/umd/typings/src/errors/NotFoundError.d.ts +0 -9
  180. package/umd/typings/src/errors/NotYetImplementedError.d.ts +0 -9
  181. package/umd/typings/src/errors/ParsingError.d.ts +0 -9
  182. package/umd/typings/src/errors/PipelineExecutionError.d.ts +0 -9
  183. package/umd/typings/src/errors/PipelineLogicError.d.ts +0 -9
  184. package/umd/typings/src/errors/ReferenceError.d.ts +0 -9
  185. package/umd/typings/src/errors/UnexpectedError.d.ts +0 -9
  186. package/umd/typings/src/errors/VersionMismatchError.d.ts +0 -10
  187. package/umd/typings/src/errors/_ExpectError.d.ts +0 -10
  188. package/umd/typings/src/execution/CommonExecutionToolsOptions.d.ts +0 -10
  189. package/umd/typings/src/execution/EmbeddingVector.d.ts +0 -8
  190. package/umd/typings/src/execution/ExecutionTools.d.ts +0 -33
  191. package/umd/typings/src/execution/LlmExecutionTools.d.ts +0 -72
  192. package/umd/typings/src/execution/PipelineExecutor.d.ts +0 -64
  193. package/umd/typings/src/execution/PromptResult.d.ts +0 -99
  194. package/umd/typings/src/execution/PromptResultUsage.d.ts +0 -29
  195. package/umd/typings/src/execution/ScriptExecutionTools.d.ts +0 -39
  196. package/umd/typings/src/execution/UncertainNumber.d.ts +0 -18
  197. package/umd/typings/src/execution/UserInterfaceTools.d.ts +0 -46
  198. package/umd/typings/src/execution/assertsExecutionSuccessful.d.ts +0 -12
  199. package/umd/typings/src/execution/createPipelineExecutor.d.ts +0 -71
  200. package/umd/typings/src/execution/embeddingVectorToString.d.ts +0 -7
  201. package/umd/typings/src/execution/translation/automatic-translate/automatic-translators/AutomaticTranslator.d.ts +0 -4
  202. package/umd/typings/src/execution/translation/automatic-translate/automatic-translators/DebugAutomaticTranslator.d.ts +0 -9
  203. package/umd/typings/src/execution/translation/automatic-translate/automatic-translators/FakeAutomaticTranslator.d.ts +0 -5
  204. package/umd/typings/src/execution/translation/automatic-translate/automatic-translators/LindatAutomaticTranslator.d.ts +0 -11
  205. package/umd/typings/src/execution/translation/automatic-translate/automatic-translators/TranslatorOptions.d.ts +0 -4
  206. package/umd/typings/src/execution/translation/automatic-translate/automatic-translators/utils/extractMultiplicatedOccurrence.d.ts +0 -7
  207. package/umd/typings/src/execution/translation/automatic-translate/automatic-translators/utils/extractMultiplicatedOccurrence.test.d.ts +0 -1
  208. package/umd/typings/src/execution/translation/automatic-translate/translateMessages.d.ts +0 -5
  209. package/umd/typings/src/execution/utils/addUsage.d.ts +0 -65
  210. package/umd/typings/src/execution/utils/addUsage.test.d.ts +0 -1
  211. package/umd/typings/src/execution/utils/checkExpectations.d.ts +0 -27
  212. package/umd/typings/src/execution/utils/checkExpectations.test.d.ts +0 -1
  213. package/umd/typings/src/execution/utils/computeUsageCounts.d.ts +0 -10
  214. package/umd/typings/src/execution/utils/forEachAsync.d.ts +0 -19
  215. package/umd/typings/src/execution/utils/uncertainNumber.d.ts +0 -9
  216. package/umd/typings/src/execution/utils/usageToHuman.d.ts +0 -17
  217. package/umd/typings/src/execution/utils/usageToHuman.test.d.ts +0 -1
  218. package/umd/typings/src/execution/utils/usageToWorktime.d.ts +0 -12
  219. package/umd/typings/src/execution/utils/usageToWorktime.test.d.ts +0 -1
  220. package/umd/typings/src/expectations/drafts/isDomainNameFree.d.ts +0 -6
  221. package/umd/typings/src/expectations/drafts/isGithubNameFree.d.ts +0 -6
  222. package/umd/typings/src/formats/_common/FormatDefinition.d.ts +0 -70
  223. package/umd/typings/src/formats/csv/ListFormatDefinition.d.ts +0 -12
  224. package/umd/typings/src/formats/index.d.ts +0 -4
  225. package/umd/typings/src/formats/json/JsonFormatDefinition.d.ts +0 -16
  226. package/umd/typings/src/formats/json/utils/isValidJsonString.d.ts +0 -6
  227. package/umd/typings/src/formats/json/utils/isValidJsonString.test.d.ts +0 -1
  228. package/umd/typings/src/formats/list/ListFormatDefinition.d.ts +0 -14
  229. package/umd/typings/src/formats/xml/XmlFormatDefinition.d.ts +0 -16
  230. package/umd/typings/src/knowledge/dialogs/callback/CallbackInterfaceTools.d.ts +0 -17
  231. package/umd/typings/src/knowledge/dialogs/callback/CallbackInterfaceToolsOptions.d.ts +0 -14
  232. package/umd/typings/src/knowledge/dialogs/simple-prompt/SimplePromptInterfaceTools.d.ts +0 -22
  233. package/umd/typings/src/knowledge/dialogs/user-interface-execution-tools.test.d.ts +0 -1
  234. package/umd/typings/src/knowledge/prepare-knowledge/_common/Scraper.d.ts +0 -37
  235. package/umd/typings/src/knowledge/prepare-knowledge/_common/prepareKnowledgePieces.d.ts +0 -18
  236. package/umd/typings/src/knowledge/prepare-knowledge/_common/prepareKnowledgePieces.test.d.ts +0 -1
  237. package/umd/typings/src/knowledge/prepare-knowledge/markdown/playground/markdown-knowledge-playground.d.ts +0 -2
  238. package/umd/typings/src/knowledge/prepare-knowledge/markdown/prepareKnowledgeFromMarkdown.d.ts +0 -14
  239. package/umd/typings/src/knowledge/prepare-knowledge/markdown/prepareKnowledgeFromMarkdown.test.d.ts +0 -4
  240. package/umd/typings/src/knowledge/prepare-knowledge/pdf/prepareKnowledgeFromPdf.d.ts +0 -13
  241. package/umd/typings/src/knowledge/prepare-knowledge/pdf/prepareKnowledgeFromPdf.test.d.ts +0 -1
  242. package/umd/typings/src/llm-providers/_common/createLlmToolsFromEnv.d.ts +0 -37
  243. package/umd/typings/src/llm-providers/_common/getLlmToolsForCli.d.ts +0 -20
  244. package/umd/typings/src/llm-providers/_common/getLlmToolsForTestingAndScriptsAndPlayground.d.ts +0 -21
  245. package/umd/typings/src/llm-providers/_common/utils/cache/CacheItem.d.ts +0 -29
  246. package/umd/typings/src/llm-providers/_common/utils/cache/CacheLlmToolsOptions.d.ts +0 -16
  247. package/umd/typings/src/llm-providers/_common/utils/cache/cacheLlmTools.d.ts +0 -19
  248. package/umd/typings/src/llm-providers/_common/utils/count-total-usage/LlmExecutionToolsWithTotalUsage.d.ts +0 -15
  249. package/umd/typings/src/llm-providers/_common/utils/count-total-usage/countTotalUsage.d.ts +0 -17
  250. package/umd/typings/src/llm-providers/_common/utils/count-total-usage/limitTotalUsage.d.ts +0 -36
  251. package/umd/typings/src/llm-providers/anthropic-claude/AnthropicClaudeExecutionTools.d.ts +0 -52
  252. package/umd/typings/src/llm-providers/anthropic-claude/AnthropicClaudeExecutionToolsOptions.d.ts +0 -12
  253. package/umd/typings/src/llm-providers/anthropic-claude/anthropic-claude-models.d.ts +0 -22
  254. package/umd/typings/src/llm-providers/anthropic-claude/playground/playground.d.ts +0 -6
  255. package/umd/typings/src/llm-providers/azure-openai/AzureOpenAiExecutionTools.d.ts +0 -50
  256. package/umd/typings/src/llm-providers/azure-openai/AzureOpenAiExecutionToolsOptions.d.ts +0 -36
  257. package/umd/typings/src/llm-providers/azure-openai/playground/playground.d.ts +0 -5
  258. package/umd/typings/src/llm-providers/langtail/LangtailExecutionTools.d.ts +0 -17
  259. package/umd/typings/src/llm-providers/langtail/LangtailExecutionToolsOptions.d.ts +0 -13
  260. package/umd/typings/src/llm-providers/langtail/playground/playground.d.ts +0 -2
  261. package/umd/typings/src/llm-providers/mocked/MockedEchoLlmExecutionTools.d.ts +0 -36
  262. package/umd/typings/src/llm-providers/mocked/MockedFackedLlmExecutionTools.d.ts +0 -40
  263. package/umd/typings/src/llm-providers/mocked/fakeTextToExpectations.d.ts +0 -14
  264. package/umd/typings/src/llm-providers/mocked/test/fakeTextToExpectations.test.d.ts +0 -1
  265. package/umd/typings/src/llm-providers/mocked/test/faked-completion.test.d.ts +0 -1
  266. package/umd/typings/src/llm-providers/mocked/test/joker.test.d.ts +0 -4
  267. package/umd/typings/src/llm-providers/mocked/test/mocked-chat.test.d.ts +0 -5
  268. package/umd/typings/src/llm-providers/mocked/test/mocked-completion.test.d.ts +0 -4
  269. package/umd/typings/src/llm-providers/multiple/MultipleLlmExecutionTools.d.ts +0 -54
  270. package/umd/typings/src/llm-providers/multiple/joinLlmExecutionTools.d.ts +0 -21
  271. package/umd/typings/src/llm-providers/multiple/playground/playground.d.ts +0 -2
  272. package/umd/typings/src/llm-providers/openai/OpenAiExecutionTools.d.ts +0 -68
  273. package/umd/typings/src/llm-providers/openai/OpenAiExecutionToolsOptions.d.ts +0 -20
  274. package/umd/typings/src/llm-providers/openai/computeOpenaiUsage.d.ts +0 -14
  275. package/umd/typings/src/llm-providers/openai/computeOpenaiUsage.test.d.ts +0 -1
  276. package/umd/typings/src/llm-providers/openai/computeUsage.d.ts +0 -16
  277. package/umd/typings/src/llm-providers/openai/computeUsage.test.d.ts +0 -1
  278. package/umd/typings/src/llm-providers/openai/openai-models.d.ts +0 -29
  279. package/umd/typings/src/llm-providers/openai/playground/playground.d.ts +0 -5
  280. package/umd/typings/src/llm-providers/remote/RemoteLlmExecutionTools.d.ts +0 -56
  281. package/umd/typings/src/llm-providers/remote/RemoteLlmExecutionToolsOptions.d.ts +0 -26
  282. package/umd/typings/src/llm-providers/remote/interfaces/Promptbook_Server_Error.d.ts +0 -11
  283. package/umd/typings/src/llm-providers/remote/interfaces/Promptbook_Server_Progress.d.ts +0 -12
  284. package/umd/typings/src/llm-providers/remote/interfaces/Promptbook_Server_Request.d.ts +0 -17
  285. package/umd/typings/src/llm-providers/remote/interfaces/Promptbook_Server_Response.d.ts +0 -12
  286. package/umd/typings/src/llm-providers/remote/interfaces/RemoteServerOptions.d.ts +0 -37
  287. package/umd/typings/src/llm-providers/remote/startRemoteServer.d.ts +0 -21
  288. package/umd/typings/src/personas/preparePersona.d.ts +0 -15
  289. package/umd/typings/src/personas/preparePersona.test.d.ts +0 -1
  290. package/umd/typings/src/postprocessing/utils/extractBlock.d.ts +0 -17
  291. package/umd/typings/src/prepare/PrepareOptions.d.ts +0 -22
  292. package/umd/typings/src/prepare/isPipelinePrepared.d.ts +0 -15
  293. package/umd/typings/src/prepare/isPipelinePrepared.test.d.ts +0 -1
  294. package/umd/typings/src/prepare/preparePipeline.d.ts +0 -16
  295. package/umd/typings/src/prepare/prepareTemplates.d.ts +0 -32
  296. package/umd/typings/src/prepare/unpreparePipeline.d.ts +0 -12
  297. package/umd/typings/src/scripting/_test/custom-function-async.test.ts.test.d.ts +0 -1
  298. package/umd/typings/src/scripting/_test/custom-function-missing.test.d.ts +0 -1
  299. package/umd/typings/src/scripting/_test/custom-function-with-dependencies.test.d.ts +0 -1
  300. package/umd/typings/src/scripting/_test/custom-function.test.d.ts +0 -1
  301. package/umd/typings/src/scripting/_test/postprocessing.test.d.ts +0 -1
  302. package/umd/typings/src/scripting/_test/script-execution-errors.test.d.ts +0 -1
  303. package/umd/typings/src/scripting/_test/script-execution-tools.test.d.ts +0 -1
  304. package/umd/typings/src/scripting/javascript/JavascriptEvalExecutionTools.d.ts +0 -22
  305. package/umd/typings/src/scripting/javascript/JavascriptEvalExecutionTools.test.d.ts +0 -4
  306. package/umd/typings/src/scripting/javascript/JavascriptExecutionTools.d.ts +0 -8
  307. package/umd/typings/src/scripting/javascript/JavascriptExecutionToolsOptions.d.ts +0 -26
  308. package/umd/typings/src/scripting/javascript/postprocessing-functions.d.ts +0 -51
  309. package/umd/typings/src/scripting/javascript/utils/preserve.d.ts +0 -12
  310. package/umd/typings/src/scripting/javascript/utils/unknownToString.d.ts +0 -8
  311. package/umd/typings/src/scripting/python/PythonExecutionTools.d.ts +0 -16
  312. package/umd/typings/src/scripting/typescript/TypescriptExecutionTools.d.ts +0 -16
  313. package/umd/typings/src/storage/_common/PromptbookStorage.d.ts +0 -24
  314. package/umd/typings/src/storage/_common/PromptbookStorage.test-type.d.ts +0 -5
  315. package/umd/typings/src/storage/files-storage/FilesStorage.d.ts +0 -31
  316. package/umd/typings/src/storage/files-storage/FilesStorageOptions.d.ts +0 -10
  317. package/umd/typings/src/storage/files-storage/utils/nameToSubfolderPath.d.ts +0 -7
  318. package/umd/typings/src/storage/files-storage/utils/nameToSubfolderPath.test.d.ts +0 -1
  319. package/umd/typings/src/storage/local-storage/getLocalStorage.d.ts +0 -10
  320. package/umd/typings/src/storage/local-storage/getSessionStorage.d.ts +0 -10
  321. package/umd/typings/src/storage/memory/MemoryStorage.d.ts +0 -33
  322. package/umd/typings/src/storage/utils/PrefixStorage.d.ts +0 -25
  323. package/umd/typings/src/storage/utils/makePromptbookStorageFromWebStorage.d.ts +0 -11
  324. package/umd/typings/src/types/Arrayable.d.ts +0 -10
  325. package/umd/typings/src/types/ModelRequirements.d.ts +0 -102
  326. package/umd/typings/src/types/ModelVariant.d.ts +0 -14
  327. package/umd/typings/src/types/PipelineJson/Expectations.d.ts +0 -32
  328. package/umd/typings/src/types/PipelineJson/KnowledgePieceJson.d.ts +0 -70
  329. package/umd/typings/src/types/PipelineJson/KnowledgeSourceJson.d.ts +0 -27
  330. package/umd/typings/src/types/PipelineJson/LlmTemplateJson.d.ts +0 -25
  331. package/umd/typings/src/types/PipelineJson/PersonaJson.d.ts +0 -41
  332. package/umd/typings/src/types/PipelineJson/PipelineJson.d.ts +0 -87
  333. package/umd/typings/src/types/PipelineJson/PreparationJson.d.ts +0 -22
  334. package/umd/typings/src/types/PipelineJson/PromptDialogJson.d.ts +0 -13
  335. package/umd/typings/src/types/PipelineJson/PromptTemplateJson.d.ts +0 -13
  336. package/umd/typings/src/types/PipelineJson/PromptTemplateJsonCommon.d.ts +0 -96
  337. package/umd/typings/src/types/PipelineJson/PromptTemplateParameterJson.d.ts +0 -36
  338. package/umd/typings/src/types/PipelineJson/ScriptJson.d.ts +0 -19
  339. package/umd/typings/src/types/PipelineJson/SimpleTemplateJson.d.ts +0 -12
  340. package/umd/typings/src/types/PipelineString.d.ts +0 -12
  341. package/umd/typings/src/types/Prompt.d.ts +0 -108
  342. package/umd/typings/src/types/ScriptLanguage.d.ts +0 -9
  343. package/umd/typings/src/types/TaskProgress.d.ts +0 -43
  344. package/umd/typings/src/types/execution-report/ExecutionReportJson.d.ts +0 -58
  345. package/umd/typings/src/types/execution-report/ExecutionReportString.d.ts +0 -16
  346. package/umd/typings/src/types/execution-report/ExecutionReportStringOptions.d.ts +0 -25
  347. package/umd/typings/src/types/execution-report/config.d.ts +0 -8
  348. package/umd/typings/src/types/execution-report/countWorkingDuration.d.ts +0 -7
  349. package/umd/typings/src/types/execution-report/countWorkingDuration.test.d.ts +0 -1
  350. package/umd/typings/src/types/execution-report/executionReportJsonToString.d.ts +0 -13
  351. package/umd/typings/src/types/typeAliasEmoji.d.ts +0 -9
  352. package/umd/typings/src/types/typeAliases.d.ts +0 -586
  353. package/umd/typings/src/utils/FromtoItems.d.ts +0 -19
  354. package/umd/typings/src/utils/arrayableToArray.d.ts +0 -11
  355. package/umd/typings/src/utils/arrayableToArray.test.d.ts +0 -1
  356. package/umd/typings/src/utils/currentDate.d.ts +0 -8
  357. package/umd/typings/src/utils/deepClone.d.ts +0 -10
  358. package/umd/typings/src/utils/deepFreeze.d.ts +0 -22
  359. package/umd/typings/src/utils/emojis.d.ts +0 -23
  360. package/umd/typings/src/utils/expectation-counters/countCharacters.d.ts +0 -7
  361. package/umd/typings/src/utils/expectation-counters/countCharacters.test.d.ts +0 -1
  362. package/umd/typings/src/utils/expectation-counters/countLines.d.ts +0 -7
  363. package/umd/typings/src/utils/expectation-counters/countLines.test.d.ts +0 -1
  364. package/umd/typings/src/utils/expectation-counters/countPages.d.ts +0 -7
  365. package/umd/typings/src/utils/expectation-counters/countPages.test.d.ts +0 -1
  366. package/umd/typings/src/utils/expectation-counters/countParagraphs.d.ts +0 -7
  367. package/umd/typings/src/utils/expectation-counters/countParagraphs.test.d.ts +0 -1
  368. package/umd/typings/src/utils/expectation-counters/countSentences.d.ts +0 -13
  369. package/umd/typings/src/utils/expectation-counters/countSentences.test.d.ts +0 -1
  370. package/umd/typings/src/utils/expectation-counters/countWords.d.ts +0 -7
  371. package/umd/typings/src/utils/expectation-counters/countWords.test.d.ts +0 -1
  372. package/umd/typings/src/utils/expectation-counters/index.d.ts +0 -8
  373. package/umd/typings/src/utils/extractParameterNames.d.ts +0 -10
  374. package/umd/typings/src/utils/extractParameterNames.test.d.ts +0 -1
  375. package/umd/typings/src/utils/formatNumber.d.ts +0 -6
  376. package/umd/typings/src/utils/formatNumber.test.d.ts +0 -1
  377. package/umd/typings/src/utils/getCurrentIsoDate.d.ts +0 -7
  378. package/umd/typings/src/utils/isRunningInWhatever.d.ts +0 -18
  379. package/umd/typings/src/utils/markdown/addAutoGeneratedSection.d.ts +0 -14
  380. package/umd/typings/src/utils/markdown/addAutoGeneratedSection.test.d.ts +0 -1
  381. package/umd/typings/src/utils/markdown/createMarkdownChart.d.ts +0 -38
  382. package/umd/typings/src/utils/markdown/createMarkdownChart.test.d.ts +0 -1
  383. package/umd/typings/src/utils/markdown/createMarkdownTable.d.ts +0 -11
  384. package/umd/typings/src/utils/markdown/createMarkdownTable.test.d.ts +0 -1
  385. package/umd/typings/src/utils/markdown/escapeMarkdownBlock.d.ts +0 -11
  386. package/umd/typings/src/utils/markdown/escapeMarkdownBlock.test.d.ts +0 -1
  387. package/umd/typings/src/utils/markdown/extractAllBlocksFromMarkdown-real.test.d.ts +0 -1
  388. package/umd/typings/src/utils/markdown/extractAllBlocksFromMarkdown.d.ts +0 -34
  389. package/umd/typings/src/utils/markdown/extractAllBlocksFromMarkdown.test.d.ts +0 -1
  390. package/umd/typings/src/utils/markdown/extractAllListItemsFromMarkdown.d.ts +0 -15
  391. package/umd/typings/src/utils/markdown/extractAllListItemsFromMarkdown.test.d.ts +0 -1
  392. package/umd/typings/src/utils/markdown/extractOneBlockFromMarkdown.d.ts +0 -20
  393. package/umd/typings/src/utils/markdown/extractOneBlockFromMarkdown.test.d.ts +0 -1
  394. package/umd/typings/src/utils/markdown/flattenMarkdown.d.ts +0 -17
  395. package/umd/typings/src/utils/markdown/flattenMarkdown.test.d.ts +0 -1
  396. package/umd/typings/src/utils/markdown/parseMarkdownSection.d.ts +0 -34
  397. package/umd/typings/src/utils/markdown/parseMarkdownSection.test.d.ts +0 -1
  398. package/umd/typings/src/utils/markdown/prettifyMarkdown.d.ts +0 -9
  399. package/umd/typings/src/utils/markdown/prettifyMarkdown.test.d.ts +0 -1
  400. package/umd/typings/src/utils/markdown/removeContentComments.d.ts +0 -10
  401. package/umd/typings/src/utils/markdown/removeContentComments.test.d.ts +0 -1
  402. package/umd/typings/src/utils/markdown/removeMarkdownFormatting.d.ts +0 -9
  403. package/umd/typings/src/utils/markdown/removeMarkdownFormatting.test.d.ts +0 -1
  404. package/umd/typings/src/utils/markdown/splitMarkdownIntoSections.d.ts +0 -15
  405. package/umd/typings/src/utils/markdown/splitMarkdownIntoSections.test.d.ts +0 -1
  406. package/umd/typings/src/utils/normalization/DIACRITIC_VARIANTS_LETTERS.d.ts +0 -12
  407. package/umd/typings/src/utils/normalization/IKeywords.d.ts +0 -21
  408. package/umd/typings/src/utils/normalization/capitalize.d.ts +0 -6
  409. package/umd/typings/src/utils/normalization/capitalize.test.d.ts +0 -1
  410. package/umd/typings/src/utils/normalization/decapitalize.d.ts +0 -6
  411. package/umd/typings/src/utils/normalization/decapitalize.test.d.ts +0 -1
  412. package/umd/typings/src/utils/normalization/isValidKeyword.d.ts +0 -10
  413. package/umd/typings/src/utils/normalization/isValidKeyword.test.d.ts +0 -1
  414. package/umd/typings/src/utils/normalization/nameToUriPart.d.ts +0 -9
  415. package/umd/typings/src/utils/normalization/nameToUriPart.test.d.ts +0 -1
  416. package/umd/typings/src/utils/normalization/nameToUriParts.d.ts +0 -9
  417. package/umd/typings/src/utils/normalization/nameToUriParts.test.d.ts +0 -1
  418. package/umd/typings/src/utils/normalization/normalize-to-kebab-case.d.ts +0 -18
  419. package/umd/typings/src/utils/normalization/normalize-to-kebab-case.test.d.ts +0 -1
  420. package/umd/typings/src/utils/normalization/normalizeTo_PascalCase.d.ts +0 -17
  421. package/umd/typings/src/utils/normalization/normalizeTo_PascalCase.test.d.ts +0 -1
  422. package/umd/typings/src/utils/normalization/normalizeTo_SCREAMING_CASE.d.ts +0 -26
  423. package/umd/typings/src/utils/normalization/normalizeTo_SCREAMING_CASE.test.d.ts +0 -1
  424. package/umd/typings/src/utils/normalization/normalizeTo_camelCase.d.ts +0 -22
  425. package/umd/typings/src/utils/normalization/normalizeTo_camelCase.test.d.ts +0 -1
  426. package/umd/typings/src/utils/normalization/normalizeTo_snake_case.d.ts +0 -17
  427. package/umd/typings/src/utils/normalization/normalizeTo_snake_case.test.d.ts +0 -1
  428. package/umd/typings/src/utils/normalization/normalizeWhitespaces.d.ts +0 -4
  429. package/umd/typings/src/utils/normalization/normalizeWhitespaces.test.d.ts +0 -1
  430. package/umd/typings/src/utils/normalization/parseKeywords.d.ts +0 -16
  431. package/umd/typings/src/utils/normalization/parseKeywords.test.d.ts +0 -1
  432. package/umd/typings/src/utils/normalization/parseKeywordsFromString.d.ts +0 -9
  433. package/umd/typings/src/utils/normalization/parseKeywordsFromString.test.d.ts +0 -1
  434. package/umd/typings/src/utils/normalization/removeDiacritics.d.ts +0 -11
  435. package/umd/typings/src/utils/normalization/removeDiacritics.test.d.ts +0 -1
  436. package/umd/typings/src/utils/normalization/searchKeywords.d.ts +0 -10
  437. package/umd/typings/src/utils/normalization/searchKeywords.test.d.ts +0 -1
  438. package/umd/typings/src/utils/organization/TODO_USE.d.ts +0 -12
  439. package/umd/typings/src/utils/organization/TODO_any.d.ts +0 -6
  440. package/umd/typings/src/utils/organization/TODO_object.d.ts +0 -6
  441. package/umd/typings/src/utils/organization/TODO_unknown.d.ts +0 -6
  442. package/umd/typings/src/utils/organization/___.d.ts +0 -6
  443. package/umd/typings/src/utils/organization/just.d.ts +0 -14
  444. package/umd/typings/src/utils/organization/keepUnused.d.ts +0 -16
  445. package/umd/typings/src/utils/organization/really_any.d.ts +0 -6
  446. package/umd/typings/src/utils/organization/really_unknown.d.ts +0 -6
  447. package/umd/typings/src/utils/parseNumber.d.ts +0 -16
  448. package/umd/typings/src/utils/parseNumber.test.d.ts +0 -1
  449. package/umd/typings/src/utils/random/randomSeed.d.ts +0 -8
  450. package/umd/typings/src/utils/removeEmojis.d.ts +0 -8
  451. package/umd/typings/src/utils/removeEmojis.test.d.ts +0 -1
  452. package/umd/typings/src/utils/removeQuotes.d.ts +0 -14
  453. package/umd/typings/src/utils/removeQuotes.test.d.ts +0 -1
  454. package/umd/typings/src/utils/replaceParameters.d.ts +0 -12
  455. package/umd/typings/src/utils/replaceParameters.test.d.ts +0 -1
  456. package/umd/typings/src/utils/sets/difference.d.ts +0 -10
  457. package/umd/typings/src/utils/sets/difference.test.d.ts +0 -1
  458. package/umd/typings/src/utils/sets/intersection.d.ts +0 -7
  459. package/umd/typings/src/utils/sets/intersection.test.d.ts +0 -1
  460. package/umd/typings/src/utils/sets/union.d.ts +0 -7
  461. package/umd/typings/src/utils/sets/union.test.d.ts +0 -1
  462. package/umd/typings/src/utils/trimCodeBlock.d.ts +0 -9
  463. package/umd/typings/src/utils/trimCodeBlock.test.d.ts +0 -1
  464. package/umd/typings/src/utils/trimEndOfCodeBlock.d.ts +0 -9
  465. package/umd/typings/src/utils/trimEndOfCodeBlock.test.d.ts +0 -1
  466. package/umd/typings/src/utils/unwrapResult.d.ts +0 -37
  467. package/umd/typings/src/utils/unwrapResult.test.d.ts +0 -1
  468. package/umd/typings/src/utils/validators/email/isValidEmail.d.ts +0 -6
  469. package/umd/typings/src/utils/validators/email/isValidEmail.test.d.ts +0 -1
  470. package/umd/typings/src/utils/validators/filePath/isValidFilePath.d.ts +0 -9
  471. package/umd/typings/src/utils/validators/filePath/isValidFilePath.test.d.ts +0 -1
  472. package/umd/typings/src/utils/validators/javascriptName/isValidJavascriptName.d.ts +0 -10
  473. package/umd/typings/src/utils/validators/javascriptName/isValidJavascriptName.test.d.ts +0 -1
  474. package/umd/typings/src/utils/validators/semanticVersion/isValidPromptbookVersion.d.ts +0 -15
  475. package/umd/typings/src/utils/validators/semanticVersion/isValidPromptbookVersion.test.d.ts +0 -1
  476. package/umd/typings/src/utils/validators/semanticVersion/isValidSemanticVersion.d.ts +0 -12
  477. package/umd/typings/src/utils/validators/semanticVersion/isValidSemanticVersion.test.d.ts +0 -1
  478. package/umd/typings/src/utils/validators/url/isHostnameOnPrivateNetwork.d.ts +0 -11
  479. package/umd/typings/src/utils/validators/url/isHostnameOnPrivateNetwork.test.d.ts +0 -1
  480. package/umd/typings/src/utils/validators/url/isUrlOnPrivateNetwork.d.ts +0 -13
  481. package/umd/typings/src/utils/validators/url/isUrlOnPrivateNetwork.test.d.ts +0 -1
  482. package/umd/typings/src/utils/validators/url/isValidPipelineUrl.d.ts +0 -15
  483. package/umd/typings/src/utils/validators/url/isValidPipelineUrl.test.d.ts +0 -1
  484. package/umd/typings/src/utils/validators/url/isValidUrl.d.ts +0 -13
  485. package/umd/typings/src/utils/validators/url/isValidUrl.test.d.ts +0 -1
  486. package/umd/typings/src/utils/validators/uuid/isValidUuid.d.ts +0 -8
  487. package/umd/typings/src/utils/validators/uuid/isValidUuid.test.d.ts +0 -1
  488. package/umd/typings/src/version.d.ts +0 -6
  489. /package/{umd/typings/src/collection/constructors/createCollectionFromDirectory.test.d.ts → esm/typings/src/cli/test/ptbk.test.d.ts} +0 -0
  490. /package/{umd/typings/src/collection/constructors/createCollectionFromJson.test.d.ts → esm/typings/src/utils/files/isDirectoryExisting.test.d.ts} +0 -0
  491. /package/{umd/typings/src/collection/constructors/createCollectionFromPromise.test.d.ts → esm/typings/src/utils/files/isFileExisting.test.d.ts} +0 -0
  492. /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,10 +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
20
  */
19
- var PROMPTBOOK_VERSION = '0.63.0-0';
21
+ var PROMPTBOOK_VERSION = '0.63.0-9';
20
22
  // TODO: !!!! List here all the versions and annotate + put into script
21
23
 
22
24
  /*! *****************************************************************************
@@ -138,6 +140,22 @@ function __spreadArray(to, from, pack) {
138
140
  return to.concat(ar || Array.prototype.slice.call(from));
139
141
  }
140
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
+
141
159
  /**
142
160
  * Detects if the code is running in a browser environment in main thread (Not in a web worker)
143
161
  *
@@ -157,72 +175,13 @@ var isRunningInNode = new Function("\n try {\n return this === global;
157
175
  */
158
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");
159
177
 
160
- /**
161
- * Initializes testing `hello` command for Promptbook CLI utilities
162
- *
163
- * @private part of `promptbookCli`
164
- */
165
- function initializeHelloCommand(program) {
166
- var _this = this;
167
- var helloCommand = program.command('hello');
168
- helloCommand.description(spaceTrim("\n Just command for testing\n "));
169
- helloCommand.argument('<name>', 'Your name');
170
- helloCommand.option('-g, --greeting <greeting>', "Greeting", 'Hello');
171
- helloCommand.action(function (name, _a) {
172
- var greeting = _a.greeting;
173
- return __awaiter(_this, void 0, void 0, function () {
174
- return __generator(this, function (_b) {
175
- switch (_b.label) {
176
- case 0:
177
- console.info(colors.cyan("".concat(greeting, " ").concat(name)));
178
- return [4 /*yield*/, forTime(1000)];
179
- case 1:
180
- _b.sent();
181
- console.info(colors.rainbow("Nice to meet you!"));
182
- process.exit(0);
183
- return [2 /*return*/];
184
- }
185
- });
186
- });
187
- });
188
- }
189
- /**
190
- * Note: [🟡] This code should never be published outside of `@promptbook/cli`
191
- */
192
-
193
- /**
194
- * Converts PipelineCollection to serialized JSON
195
- *
196
- * Note: Functions `collectionToJson` and `createCollectionFromJson` are complementary
197
- *
198
- * @public exported from `@promptbook/core`
199
- */
200
- function collectionToJson(collection) {
201
- return __awaiter(this, void 0, void 0, function () {
202
- var pipelineUrls, promptbooks;
203
- return __generator(this, function (_a) {
204
- switch (_a.label) {
205
- case 0: return [4 /*yield*/, collection.listPipelines()];
206
- case 1:
207
- pipelineUrls = _a.sent();
208
- return [4 /*yield*/, Promise.all(pipelineUrls.map(function (url) { return collection.getPipelineByUrl(url); }))];
209
- case 2:
210
- promptbooks = _a.sent();
211
- return [2 /*return*/, promptbooks];
212
- }
213
- });
214
- });
215
- }
216
- /**
217
- * TODO: [🧠] Maybe clear `sourceFile` or clear when exposing through API or remote server
218
- */
219
-
220
178
  /**
221
179
  * @@@
222
180
  *
223
- * @returns The same object as the input, but deeply frozen
224
- *
225
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`
226
185
  */
227
186
  function deepFreeze(objectValue) {
228
187
  var e_1, _a;
@@ -249,10 +208,10 @@ function deepFreeze(objectValue) {
249
208
  * @@@
250
209
  * @@@
251
210
  *
252
- * @returns The same object as the input, but deeply frozen
253
- * @public exported from `@promptbook/utils`
254
- *
255
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
256
215
  */
257
216
  function deepFreezeWithSameType(objectValue) {
258
217
  return deepFreeze(objectValue);
@@ -261,10 +220,31 @@ function deepFreezeWithSameType(objectValue) {
261
220
  * TODO: [🧠] Is there a way how to meaningfully test this utility
262
221
  */
263
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`"
264
244
  /**
265
245
  * The maximum number of iterations for a loops
266
246
  *
267
- * @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_...`
268
248
  */
269
249
  var LOOP_LIMIT = 1000;
270
250
  /**
@@ -299,6 +279,8 @@ var EXECUTIONS_CACHE_DIRNAME = '/.promptbook/executions-cache';
299
279
  var PIPELINE_COLLECTION_BASE_FILENAME = "index";
300
280
  /**
301
281
  * Nonce which is used for replacing things in strings
282
+ *
283
+ * @private within the repository
302
284
  */
303
285
  var REPLACING_NONCE = 'u$k42k%!V2zo34w7Fu#@QUHYPW';
304
286
  /**
@@ -328,12 +310,90 @@ var RESERVED_PARAMETER_MISSING_VALUE = 'MISSING-' + REPLACING_NONCE;
328
310
  * @private within the repository
329
311
  */
330
312
  var RESERVED_PARAMETER_RESTRICTED = 'RESTRICTED-' + REPLACING_NONCE;
331
- /*
332
- TODO: !!! Just testing false-negative detection of [🟡][🟢][🔵][⚪] leak
333
- */
334
- // [🟡][🟢][🔵][⚪]
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
+ }
334
+ /**
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
+ }
335
395
  /**
336
- * TODO: !!!!!! Check that all @private contains some normalized explanation
396
+ * TODO: [🧠] Maybe clear `sourceFile` or clear when exposing through API or remote server
337
397
  */
338
398
 
339
399
  /**
@@ -454,7 +514,7 @@ function pipelineJsonToString(pipelineJson) {
454
514
  var contentLanguage = 'text';
455
515
  if (blockType === 'PROMPT_TEMPLATE') {
456
516
  var modelRequirements = promptTemplate.modelRequirements;
457
- var modelName = modelRequirements.modelName, modelVariant = modelRequirements.modelVariant;
517
+ var _l = modelRequirements || {}, modelName = _l.modelName, modelVariant = _l.modelVariant;
458
518
  commands_1.push("EXECUTE PROMPT TEMPLATE");
459
519
  if (modelVariant) {
460
520
  commands_1.push("MODEL VARIANT ".concat(capitalize(modelVariant)));
@@ -512,8 +572,8 @@ function pipelineJsonToString(pipelineJson) {
512
572
  } /* not else */
513
573
  if (expectations) {
514
574
  try {
515
- for (var _l = (e_6 = void 0, __values(Object.entries(expectations))), _m = _l.next(); !_m.done; _m = _l.next()) {
516
- 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;
517
577
  if (min === max) {
518
578
  commands_1.push("EXPECT EXACTLY ".concat(min, " ").concat(capitalize(unit + (min > 1 ? 's' : ''))));
519
579
  }
@@ -530,7 +590,7 @@ function pipelineJsonToString(pipelineJson) {
530
590
  catch (e_6_1) { e_6 = { error: e_6_1 }; }
531
591
  finally {
532
592
  try {
533
- if (_m && !_m.done && (_f = _l.return)) _f.call(_l);
593
+ if (_o && !_o.done && (_f = _m.return)) _f.call(_m);
534
594
  }
535
595
  finally { if (e_6) throw e_6.error; }
536
596
  }
@@ -565,7 +625,7 @@ function pipelineJsonToString(pipelineJson) {
565
625
  return pipelineString;
566
626
  }
567
627
  /**
568
- * @private internal util of pipelineJsonToString
628
+ * @private internal utility of `pipelineJsonToString`
569
629
  */
570
630
  function promptTemplateParameterJsonToString(promptTemplateParameterJson) {
571
631
  var name = promptTemplateParameterJson.name, description = promptTemplateParameterJson.description;
@@ -580,6 +640,7 @@ function promptTemplateParameterJsonToString(promptTemplateParameterJson) {
580
640
  * TODO: [🧠] Is there a way to auto-detect missing features in pipelineJsonToString
581
641
  * TODO: [🏛] Maybe make some markdown builder
582
642
  * TODO: [🏛] Escape all
643
+ * TODO: [🧠] Should be in generated .ptbk.md file GENERATOR_WARNING
583
644
  */
584
645
 
585
646
  /**
@@ -778,7 +839,7 @@ function forEachAsync(array, options, callbackfunction) {
778
839
  });
779
840
  }
780
841
 
781
- var PipelineCollection = [{title:"Prepare Knowledge from Markdown",pipelineUrl:"https://promptbook.studio/promptbook/prepare-knowledge-from-markdown.ptbk.md",promptbookVersion:"0.63.0-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.63.0-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.63.0-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.63.0-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.63.0-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.63.0-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.63.0-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.63.0-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"}];
782
843
 
783
844
  /**
784
845
  * This error indicates that the promptbook in a markdown format cannot be parsed into a valid promptbook object
@@ -1076,9 +1137,6 @@ function validatePipeline(pipeline) {
1076
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 "); }));
1077
1138
  }
1078
1139
  definedParameters.add(template.resultingParameterName);
1079
- if (template.blockType === 'PROMPT_TEMPLATE' && template.modelRequirements.modelVariant === undefined) {
1080
- 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 "); }));
1081
- }
1082
1140
  if (template.jokerParameterNames && template.jokerParameterNames.length > 0) {
1083
1141
  if (!template.expectFormat &&
1084
1142
  !template.expectations /* <- TODO: Require at least 1 -> min <- expectation to use jokers */) {
@@ -1312,7 +1370,7 @@ function unpreparePipeline(pipeline) {
1312
1370
  * Library of pipelines that groups together pipelines for an application.
1313
1371
  * This implementation is a very thin wrapper around the Array / Map of pipelines.
1314
1372
  *
1315
- * @private use `createCollectionFromJson` instead
1373
+ * @private internal function of `createCollectionFromJson`, use `createCollectionFromJson` instead
1316
1374
  * @see https://github.com/webgptorg/pipeline#pipeline-collection
1317
1375
  */
1318
1376
  var SimplePipelineCollection = /** @class */ (function () {
@@ -1321,7 +1379,6 @@ var SimplePipelineCollection = /** @class */ (function () {
1321
1379
  *
1322
1380
  * @param pipelines @@@
1323
1381
  *
1324
- * @private Use instead `createCollectionFromJson`
1325
1382
  * Note: During the construction logic of all pipelines are validated
1326
1383
  * Note: It is not recommended to use this constructor directly, use `createCollectionFromJson` *(or other variant)* instead
1327
1384
  */
@@ -1936,7 +1993,8 @@ function extractParameterNamesFromPromptTemplate(promptTemplate) {
1936
1993
  /**
1937
1994
  * This error occurs when some expectation is not met in the execution of the pipeline
1938
1995
  *
1939
- * @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`
1940
1998
  * Note: This is a kindof subtype of PipelineExecutionError
1941
1999
  */
1942
2000
  var ExpectError = /** @class */ (function (_super) {
@@ -1974,7 +2032,7 @@ function isValidJsonString(value /* <- [👨‍⚖️] */) {
1974
2032
  /**
1975
2033
  * Multiple LLM Execution Tools is a proxy server that uses multiple execution tools internally and exposes the executor interface externally.
1976
2034
  *
1977
- * @private Internal utility of `joinLlmExecutionTools`
2035
+ * @private internal utility of `joinLlmExecutionTools`
1978
2036
  */
1979
2037
  var MultipleLlmExecutionTools = /** @class */ (function () {
1980
2038
  /**
@@ -2257,7 +2315,7 @@ function isPipelinePrepared(pipeline) {
2257
2315
  * 2) Undefined returns empty array
2258
2316
  * 3) Array returns itself
2259
2317
  *
2260
- * @private Internal utility
2318
+ * @private internal utility
2261
2319
  */
2262
2320
  function arrayableToArray(input) {
2263
2321
  if (input === undefined) {
@@ -2555,7 +2613,7 @@ var CountUtils = {
2555
2613
  *
2556
2614
  * @throws {ExpectError} if the expectations are not met
2557
2615
  * @returns {void} Nothing
2558
- * @public exported from `@promptbook/core`
2616
+ * @private internal function of `createPipelineExecutor`
2559
2617
  */
2560
2618
  function checkExpectations(expectations, value) {
2561
2619
  var e_1, _a;
@@ -4236,7 +4294,9 @@ var blockCommandParser = {
4236
4294
 
4237
4295
  /**
4238
4296
  * Units of text measurement
4297
+ *
4239
4298
  * @see https://github.com/webgptorg/promptbook/discussions/30
4299
+ * @public exported from `@promptbook/core`
4240
4300
  */
4241
4301
  var EXPECTATION_UNITS = ['CHARACTERS', 'WORDS', 'SENTENCES', 'LINES', 'PARAGRAPHS', 'PAGES'];
4242
4302
  /**
@@ -4476,7 +4536,7 @@ var jokerCommandParser = {
4476
4536
  /**
4477
4537
  * @@@
4478
4538
  *
4479
- * @private for `ModelVariant` and `modelCommandParser`
4539
+ * @public exported from `@promptbook/core`
4480
4540
  */
4481
4541
  var MODEL_VARIANTS = ['COMPLETION', 'CHAT', 'EMBEDDING' /* <- TODO [🏳] */ /* <- [🤖] */];
4482
4542
 
@@ -4941,11 +5001,12 @@ var boilerplateCommandParser = {
4941
5001
  };
4942
5002
  /**
4943
5003
  * TODO: [💐] Implement BOILERPLATE command into `pipelineStringToJsonSync` function
4944
- * Note: [⚪] This should never be in any released package
4945
5004
  */
4946
5005
 
4947
5006
  /**
4948
5007
  * All available command parsers
5008
+ *
5009
+ * @private internal index of `parseCommand`
4949
5010
  */
4950
5011
  var COMMANDS = [
4951
5012
  blockCommandParser,
@@ -5115,6 +5176,8 @@ var NotYetImplementedError = /** @class */ (function (_super) {
5115
5176
 
5116
5177
  /**
5117
5178
  * Supported script languages
5179
+ *
5180
+ * @private internal base for `ScriptLanguage`
5118
5181
  */
5119
5182
  var SUPPORTED_SCRIPT_LANGUAGES = ['javascript', 'typescript', 'python'];
5120
5183
 
@@ -5255,7 +5318,7 @@ function extractOneBlockFromMarkdown(markdown) {
5255
5318
  return codeBlocks[0];
5256
5319
  }
5257
5320
  /***
5258
- * 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
5259
5322
  */
5260
5323
 
5261
5324
  /**
@@ -5854,6 +5917,7 @@ function pipelineStringToJson(pipelineString, options) {
5854
5917
  /**
5855
5918
  * TODO: [🏏] Leverage the batch API and build queues @see https://platform.openai.com/docs/guides/batch
5856
5919
  * TODO: [🛠] Actions, instruments (and maybe knowledge) => Functions and tools
5920
+ * TODO: [🧠] Should be in generated JSON file GENERATOR_WARNING
5857
5921
  */
5858
5922
 
5859
5923
  /**
@@ -5872,6 +5936,145 @@ var CollectionError = /** @class */ (function (_super) {
5872
5936
  return CollectionError;
5873
5937
  }(Error));
5874
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
+
5875
6078
  /**
5876
6079
  * Constructs Promptbook from async sources
5877
6080
  * It can be one of the following:
@@ -5971,7 +6174,7 @@ function createCollectionFromPromise(promptbookSourcesPromiseOrFactory) {
5971
6174
  */
5972
6175
  function createCollectionFromDirectory(path, options) {
5973
6176
  return __awaiter(this, void 0, void 0, function () {
5974
- 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;
5975
6178
  var _this = this;
5976
6179
  return __generator(this, function (_f) {
5977
6180
  switch (_f.label) {
@@ -5979,13 +6182,10 @@ function createCollectionFromDirectory(path, options) {
5979
6182
  if (!isRunningInNode()) {
5980
6183
  throw new Error('Function `createCollectionFromDirectory` can only be run in Node.js environment because it reads the file system.');
5981
6184
  }
5982
- makedLibraryFilePath = join(path, "".concat(PIPELINE_COLLECTION_BASE_FILENAME, ".json"));
5983
- return [4 /*yield*/, access(makedLibraryFilePath, constants.R_OK)
5984
- .then(function () { return true; })
5985
- .catch(function () { return false; })];
6185
+ makedLibraryFilePath = join$1(path, "".concat(PIPELINE_COLLECTION_BASE_FILENAME, ".json"));
6186
+ return [4 /*yield*/, isFileExisting(makedLibraryFilePath)];
5986
6187
  case 1:
5987
- makedLibraryFileExists = _f.sent();
5988
- if (!makedLibraryFileExists) {
6188
+ if (!(_f.sent())) {
5989
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.")));
5990
6190
  }
5991
6191
  else {
@@ -6148,66 +6348,8 @@ function createCollectionFromDirectory(path, options) {
6148
6348
  });
6149
6349
  }
6150
6350
  /**
6151
- * Reads all files in the directory
6152
- *
6153
- * @param path
6154
- * @param isRecursive
6155
- * @returns List of all files in the directory
6156
- * @private internal function for `createCollectionFromDirectory`
6157
- */
6158
- function listAllFiles(path, isRecursive) {
6159
- return __awaiter(this, void 0, void 0, function () {
6160
- var dirents, fileNames, _a, _b, dirent, subPath, _c, _d, _e, _f, e_2_1;
6161
- var e_2, _g;
6162
- return __generator(this, function (_h) {
6163
- switch (_h.label) {
6164
- case 0: return [4 /*yield*/, readdir(path, {
6165
- withFileTypes: true /* Note: This is not working: recursive: isRecursive */,
6166
- })];
6167
- case 1:
6168
- dirents = _h.sent();
6169
- fileNames = dirents.filter(function (dirent) { return dirent.isFile(); }).map(function (_a) {
6170
- var name = _a.name;
6171
- return join(path, name);
6172
- });
6173
- if (!isRecursive) return [3 /*break*/, 9];
6174
- _h.label = 2;
6175
- case 2:
6176
- _h.trys.push([2, 7, 8, 9]);
6177
- _a = __values(dirents.filter(function (dirent) { return dirent.isDirectory(); })), _b = _a.next();
6178
- _h.label = 3;
6179
- case 3:
6180
- if (!!_b.done) return [3 /*break*/, 6];
6181
- dirent = _b.value;
6182
- subPath = join(path, dirent.name);
6183
- _d = (_c = fileNames.push).apply;
6184
- _e = [fileNames];
6185
- _f = [[]];
6186
- return [4 /*yield*/, listAllFiles(subPath, isRecursive)];
6187
- case 4:
6188
- _d.apply(_c, _e.concat([__spreadArray.apply(void 0, _f.concat([__read.apply(void 0, [(_h.sent())]), false]))]));
6189
- _h.label = 5;
6190
- case 5:
6191
- _b = _a.next();
6192
- return [3 /*break*/, 3];
6193
- case 6: return [3 /*break*/, 9];
6194
- case 7:
6195
- e_2_1 = _h.sent();
6196
- e_2 = { error: e_2_1 };
6197
- return [3 /*break*/, 9];
6198
- case 8:
6199
- try {
6200
- if (_b && !_b.done && (_g = _a.return)) _g.call(_a);
6201
- }
6202
- finally { if (e_2) throw e_2.error; }
6203
- return [7 /*endfinally*/];
6204
- case 9: return [2 /*return*/, fileNames];
6205
- }
6206
- });
6207
- });
6208
- }
6209
- /**
6210
- * 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
6211
6353
  */
6212
6354
 
6213
6355
  /**
@@ -6279,22 +6421,6 @@ function usageToHuman(usage) {
6279
6421
  * TODO: [🏛] Maybe make some markdown builder
6280
6422
  */
6281
6423
 
6282
- /**
6283
- * This error type indicates that you try to use a feature that is not available in the current environment
6284
- *
6285
- * @public exported from `@promptbook/core`
6286
- */
6287
- var EnvironmentMismatchError = /** @class */ (function (_super) {
6288
- __extends(EnvironmentMismatchError, _super);
6289
- function EnvironmentMismatchError(message) {
6290
- var _this = _super.call(this, message) || this;
6291
- _this.name = 'EnvironmentMismatchError';
6292
- Object.setPrototypeOf(_this, EnvironmentMismatchError.prototype);
6293
- return _this;
6294
- }
6295
- return EnvironmentMismatchError;
6296
- }(Error));
6297
-
6298
6424
  /**
6299
6425
  * @@@
6300
6426
  *
@@ -6322,24 +6448,21 @@ var FilesStorage = /** @class */ (function () {
6322
6448
  FilesStorage.prototype.getFilenameForKey = function (key) {
6323
6449
  var name = titleToName(key);
6324
6450
  var hash = sha256(hexEncoder.parse(name)).toString( /* hex */);
6325
- 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));
6326
6452
  };
6327
6453
  /**
6328
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.
6329
6455
  */
6330
6456
  FilesStorage.prototype.getItem = function (key) {
6331
6457
  return __awaiter(this, void 0, void 0, function () {
6332
- var filename, isFileExisting, fileContent, value;
6458
+ var filename, fileContent, value;
6333
6459
  return __generator(this, function (_a) {
6334
6460
  switch (_a.label) {
6335
6461
  case 0:
6336
6462
  filename = this.getFilenameForKey(key);
6337
- return [4 /*yield*/, stat(filename)
6338
- .then(function (fileStat) { return fileStat.isFile(); })
6339
- .catch(function () { return false; })];
6463
+ return [4 /*yield*/, isFileExisting(filename)];
6340
6464
  case 1:
6341
- isFileExisting = _a.sent();
6342
- if (!isFileExisting) {
6465
+ if (!(_a.sent())) {
6343
6466
  return [2 /*return*/, null];
6344
6467
  }
6345
6468
  return [4 /*yield*/, readFile(filename, 'utf-8')];
@@ -6398,7 +6521,7 @@ var FilesStorage = /** @class */ (function () {
6398
6521
  }());
6399
6522
  /**
6400
6523
  * TODO: [🌗] Maybe some checkers, not all valid JSONs are desired and valid values
6401
- * 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`
6402
6525
  */
6403
6526
 
6404
6527
  /**
@@ -6407,7 +6530,7 @@ var FilesStorage = /** @class */ (function () {
6407
6530
  * @param content the content of prompt or response
6408
6531
  * @returns part of PromptResultUsageCounts
6409
6532
  *
6410
- * @private internal util of LlmExecutionTools
6533
+ * @private internal utility of LlmExecutionTools
6411
6534
  */
6412
6535
  function computeUsageCounts(content) {
6413
6536
  return {
@@ -6437,7 +6560,7 @@ function uncertainNumber(value) {
6437
6560
  /**
6438
6561
  * Get current date in ISO 8601 format
6439
6562
  *
6440
- * @private This is internal util of the promptbook
6563
+ * @private internal utility
6441
6564
  */
6442
6565
  function getCurrentIsoDate() {
6443
6566
  return new Date().toISOString();
@@ -6459,6 +6582,7 @@ function computeUsage(value) {
6459
6582
  * Note: Done at 2024-05-25
6460
6583
  *
6461
6584
  * @see https://docs.anthropic.com/en/docs/models-overview
6585
+ * @public exported from `@promptbook/anthropic-claude`
6462
6586
  */
6463
6587
  var ANTHROPIC_CLAUDE_MODELS = [
6464
6588
  {
@@ -7105,7 +7229,7 @@ var OPENAI_MODELS = [
7105
7229
  * @param resultContent The content of the result (for embedding prompts or failed prompts pass empty string)
7106
7230
  * @param rawResponse The raw response from OpenAI API
7107
7231
  * @throws {PipelineExecutionError} If the usage is not defined in the response from OpenAI
7108
- * @private internal util of `OpenAiExecutionTools`
7232
+ * @private internal utility of `OpenAiExecutionTools`
7109
7233
  */
7110
7234
  function computeOpenaiUsage(promptContent, // <- Note: Intentionally using [] to access type properties to bring jsdoc from Prompt/PromptResult to consumer
7111
7235
  resultContent, rawResponse) {
@@ -7487,7 +7611,7 @@ function createLlmToolsFromEnv(options) {
7487
7611
  * TODO: [🧠] Which name is better `createLlmToolsFromEnv` or `createLlmToolsFromEnvironment`?
7488
7612
  * TODO: [🧠] Is there some meaningfull way how to test this util
7489
7613
  * TODO: [🧠] Maybe pass env as argument
7490
- * 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`
7491
7615
  * TODO: [👷‍♂️] @@@ Manual about construction of llmTools
7492
7616
  */
7493
7617
 
@@ -7677,7 +7801,7 @@ function getLlmToolsForCli(options) {
7677
7801
  return cacheLlmTools(countTotalUsage(
7678
7802
  // <- Note: for example here we don`t want the [🌯]
7679
7803
  createLlmToolsFromEnv()), {
7680
- storage: new FilesStorage({ cacheFolderPath: join(process.cwd(), EXECUTIONS_CACHE_DIRNAME) }),
7804
+ storage: new FilesStorage({ cacheFolderPath: join$1(process.cwd(), EXECUTIONS_CACHE_DIRNAME) }),
7681
7805
  isReloaded: isCacheReloaded,
7682
7806
  });
7683
7807
  }
@@ -7689,14 +7813,16 @@ function getLlmToolsForCli(options) {
7689
7813
  /**
7690
7814
  * Initializes `make` command for Promptbook CLI utilities
7691
7815
  *
7692
- * @private part of `promptbookCli`
7816
+ * @private internal function of `promptbookCli`
7693
7817
  */
7694
7818
  function initializeMakeCommand(program) {
7695
7819
  var _this = this;
7696
7820
  var makeCommand = program.command('make');
7697
7821
  makeCommand.description(spaceTrim("\n Makes a new pipeline collection in given folder\n "));
7698
- makeCommand.argument('<path>', 'Path to promptbook directory');
7699
- 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');
7700
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: [🏳‍🌈] */);
7701
7827
  makeCommand.option('--no-validation', "Do not validate logic of pipelines in collection", true);
7702
7828
  makeCommand.option('--validation', "Types of validations separated by comma (options \"logic\",\"imports\")", 'logic,imports');
@@ -7706,7 +7832,7 @@ function initializeMakeCommand(program) {
7706
7832
  makeCommand.action(function (path, _a) {
7707
7833
  var projectName = _a.projectName, format = _a.format, validation = _a.validation, reloadCache = _a.reloadCache, verbose = _a.verbose, outFile = _a.outFile;
7708
7834
  return __awaiter(_this, void 0, void 0, function () {
7709
- 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;
7710
7836
  var e_2, _d, e_1, _e;
7711
7837
  var _this = this;
7712
7838
  return __generator(this, function (_f) {
@@ -7723,7 +7849,7 @@ function initializeMakeCommand(program) {
7723
7849
  .map(function (_) { return _.trim(); })
7724
7850
  .filter(function (_) { return _ !== ''; });
7725
7851
  if (outFile !== PIPELINE_COLLECTION_BASE_FILENAME && formats.length !== 1) {
7726
- 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"));
7727
7853
  process.exit(1);
7728
7854
  }
7729
7855
  llmTools = getLlmToolsForCli({
@@ -7797,7 +7923,18 @@ function initializeMakeCommand(program) {
7797
7923
  case 16: return [4 /*yield*/, collectionToJson(collection)];
7798
7924
  case 17:
7799
7925
  collectionJson = _f.sent();
7800
- 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
+ })();
7801
7938
  saveFile = function (extension, content) { return __awaiter(_this, void 0, void 0, function () {
7802
7939
  var filePath;
7803
7940
  return __generator(this, function (_a) {
@@ -7805,7 +7942,7 @@ function initializeMakeCommand(program) {
7805
7942
  case 0:
7806
7943
  filePath = outFile !== PIPELINE_COLLECTION_BASE_FILENAME
7807
7944
  ? outFile
7808
- : join(path, "".concat(PIPELINE_COLLECTION_BASE_FILENAME, ".").concat(extension));
7945
+ : join$1(path, "".concat(PIPELINE_COLLECTION_BASE_FILENAME, ".").concat(extension));
7809
7946
  if (!outFile.endsWith(".".concat(extension))) {
7810
7947
  console.warn(colors.yellow("Warning: Extension of output file should be \"".concat(extension, "\"")));
7811
7948
  }
@@ -7822,23 +7959,29 @@ function initializeMakeCommand(program) {
7822
7959
  });
7823
7960
  }); };
7824
7961
  if (!formats.includes('json')) return [3 /*break*/, 19];
7962
+ formats = formats.filter(function (format) { return format !== 'json'; });
7825
7963
  return [4 /*yield*/, saveFile('json', collectionJsonString)];
7826
7964
  case 18:
7827
7965
  _f.sent();
7828
7966
  _f.label = 19;
7829
7967
  case 19:
7830
- if (!formats.includes('javascript')) return [3 /*break*/, 21];
7831
- 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 "); }))];
7832
7971
  case 20:
7833
- _f.sent();
7972
+ (_f.sent()) + '\n';
7834
7973
  _f.label = 21;
7835
7974
  case 21:
7836
- if (!formats.includes('typescript')) return [3 /*break*/, 23];
7837
- 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')];
7838
7978
  case 22:
7839
7979
  _f.sent();
7840
7980
  _f.label = 23;
7841
7981
  case 23:
7982
+ if (formats.length > 0) {
7983
+ console.warn(colors.yellow("Format ".concat(formats.join(' and '), " is not supported")));
7984
+ }
7842
7985
  if (isVerbose) {
7843
7986
  console.info(colors.green("Collection builded"));
7844
7987
  console.info(colors.cyan(usageToHuman(llmTools.getTotalUsage())));
@@ -7851,7 +7994,10 @@ function initializeMakeCommand(program) {
7851
7994
  });
7852
7995
  }
7853
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
7854
7999
  * Note: [🟡] This code should never be published outside of `@promptbook/cli`
8000
+ * TODO: [🖇] What about symlinks? Maybe flag --follow-symlinks
7855
8001
  */
7856
8002
 
7857
8003
  /**
@@ -7861,7 +8007,7 @@ function initializeMakeCommand(program) {
7861
8007
  */
7862
8008
  function addAutoGeneratedSection(content, options) {
7863
8009
  var sectionName = options.sectionName, sectionContent = options.sectionContent;
7864
- var warningLine = "<!-- \u26A0\uFE0F WARNING: This section was auto-generated -->";
8010
+ var warningLine = "<!-- ".concat(GENERATOR_WARNING, " -->");
7865
8011
  var sectionRegex = new RegExp("<!--".concat(sectionName, "-->([\\s\\S]*?)<!--/").concat(sectionName, "-->"), 'g');
7866
8012
  var sectionMatch = content.match(sectionRegex);
7867
8013
  if (sectionMatch) {
@@ -8049,13 +8195,15 @@ function prettifyPipelineString(pipelineString, options) {
8049
8195
  /**
8050
8196
  * Initializes `prettify` command for Promptbook CLI utilities
8051
8197
  *
8052
- * @private part of `promptbookCli`
8198
+ * @private internal function of `promptbookCli`
8053
8199
  */
8054
8200
  function initializePrettifyCommand(program) {
8055
8201
  var _this = this;
8056
8202
  var prettifyCommand = program.command('prettify');
8057
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 "));
8058
- 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');
8059
8207
  prettifyCommand.option('-i, --ignore <glob>', "Ignore as glob pattern");
8060
8208
  prettifyCommand.action(function (filesGlob, _a) {
8061
8209
  var ignore = _a.ignore;
@@ -8131,10 +8279,13 @@ function initializePrettifyCommand(program) {
8131
8279
  }
8132
8280
  /**
8133
8281
  * Note: [🟡] This code should never be published outside of `@promptbook/cli`
8282
+ * TODO: [🖇] What about symlinks? Maybe flag --follow-symlinks
8134
8283
  */
8135
8284
 
8136
8285
  /**
8137
8286
  * Runs CLI utilities of Promptbook package
8287
+ *
8288
+ * @private within the `@promptbook/cli`
8138
8289
  */
8139
8290
  function promptbookCli() {
8140
8291
  return __awaiter(this, void 0, void 0, function () {
@@ -8145,8 +8296,10 @@ function promptbookCli() {
8145
8296
  }
8146
8297
  program = new commander.Command();
8147
8298
  program.name('promptbook');
8299
+ program.alias('ptbk');
8148
8300
  program.version(PROMPTBOOK_VERSION);
8149
8301
  program.description(spaceTrim$1("\n Promptbook utilities for enhancing workflow with promptbooks\n "));
8302
+ initializeAboutCommand(program);
8150
8303
  initializeHelloCommand(program);
8151
8304
  initializeMakeCommand(program);
8152
8305
  initializePrettifyCommand(program);
@@ -8156,7 +8309,7 @@ function promptbookCli() {
8156
8309
  });
8157
8310
  }
8158
8311
  /**
8159
- * TODO: [🥠] Do not export to utils directly, its just for CLI script
8312
+ * TODO: [🥠] Do not export, its just for CLI script
8160
8313
  * TODO: [🕌] When more functionalities, rename
8161
8314
  * Note: 11:11
8162
8315
  * Note: [🟡] This code should never be published outside of `@promptbook/cli`