@promptbook/cli 0.63.0-0 → 0.63.0-10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (493) hide show
  1. package/README.md +4 -2
  2. package/esm/index.es.js +357 -206
  3. package/esm/index.es.js.map +1 -1
  4. package/esm/typings/src/_packages/anthropic-claude.index.d.ts +2 -0
  5. package/esm/typings/src/_packages/browser.index.d.ts +2 -0
  6. package/esm/typings/src/_packages/core.index.d.ts +6 -4
  7. package/esm/typings/src/_packages/types.index.d.ts +0 -48
  8. package/esm/typings/src/_packages/utils.index.d.ts +6 -2
  9. package/esm/typings/src/cli/cli-commands/about.d.ts +11 -0
  10. package/esm/typings/src/cli/cli-commands/hello.d.ts +2 -2
  11. package/esm/typings/src/cli/cli-commands/make.d.ts +4 -1
  12. package/esm/typings/src/cli/cli-commands/prettify.d.ts +2 -1
  13. package/esm/typings/src/cli/promptbookCli.d.ts +3 -1
  14. package/esm/typings/src/cli/test/ptbk.d.ts +2 -0
  15. package/esm/typings/src/collection/SimplePipelineCollection.d.ts +1 -2
  16. package/esm/typings/src/collection/constructors/createCollectionFromDirectory.d.ts +2 -1
  17. package/esm/typings/src/commands/_BOILERPLATE/boilerplateCommandParser.d.ts +0 -1
  18. package/esm/typings/src/commands/_common/types/CommandUsagePlaces.d.ts +2 -0
  19. package/esm/typings/src/commands/index.d.ts +2 -0
  20. package/esm/typings/src/config.d.ts +33 -5
  21. package/esm/typings/src/conversion/pipelineJsonToString.d.ts +1 -0
  22. package/esm/typings/src/conversion/pipelineStringToJson.d.ts +1 -0
  23. package/esm/typings/src/conversion/validation/_importPipeline.d.ts +8 -1
  24. package/esm/typings/src/errors/_ExpectError.d.ts +2 -1
  25. package/esm/typings/src/execution/translation/automatic-translate/automatic-translators/AutomaticTranslator.d.ts +3 -0
  26. package/esm/typings/src/execution/translation/automatic-translate/automatic-translators/DebugAutomaticTranslator.d.ts +2 -0
  27. package/esm/typings/src/execution/translation/automatic-translate/automatic-translators/FakeAutomaticTranslator.d.ts +3 -0
  28. package/esm/typings/src/execution/translation/automatic-translate/automatic-translators/LindatAutomaticTranslator.d.ts +3 -0
  29. package/esm/typings/src/execution/translation/automatic-translate/automatic-translators/TranslatorOptions.d.ts +3 -0
  30. package/esm/typings/src/execution/translation/automatic-translate/automatic-translators/utils/extractMultiplicatedOccurrence.d.ts +1 -0
  31. package/esm/typings/src/execution/translation/automatic-translate/translateMessages.d.ts +3 -0
  32. package/esm/typings/src/execution/utils/checkExpectations.d.ts +1 -1
  33. package/esm/typings/src/execution/utils/computeUsageCounts.d.ts +1 -1
  34. package/esm/typings/src/expectations/drafts/isDomainNameFree.d.ts +3 -0
  35. package/esm/typings/src/expectations/drafts/isGithubNameFree.d.ts +3 -0
  36. package/esm/typings/src/formats/_common/FormatDefinition.d.ts +1 -1
  37. package/esm/typings/src/formats/csv/ListFormatDefinition.d.ts +2 -0
  38. package/esm/typings/src/formats/index.d.ts +2 -0
  39. package/esm/typings/src/formats/json/JsonFormatDefinition.d.ts +2 -0
  40. package/esm/typings/src/formats/list/ListFormatDefinition.d.ts +2 -0
  41. package/esm/typings/src/formats/xml/XmlFormatDefinition.d.ts +2 -0
  42. package/esm/typings/src/knowledge/dialogs/simple-prompt/SimplePromptInterfaceTools.d.ts +1 -1
  43. package/esm/typings/src/knowledge/prepare-knowledge/pdf/prepareKnowledgeFromPdf.d.ts +2 -0
  44. package/esm/typings/src/llm-providers/_common/createLlmToolsFromEnv.d.ts +4 -2
  45. package/esm/typings/src/llm-providers/anthropic-claude/anthropic-claude-models.d.ts +1 -0
  46. package/esm/typings/src/llm-providers/mocked/fakeTextToExpectations.d.ts +1 -1
  47. package/esm/typings/src/llm-providers/multiple/MultipleLlmExecutionTools.d.ts +1 -1
  48. package/esm/typings/src/llm-providers/openai/computeOpenaiUsage.d.ts +1 -1
  49. package/esm/typings/src/scripting/javascript/utils/preserve.d.ts +1 -0
  50. package/esm/typings/src/scripting/javascript/utils/unknownToString.d.ts +1 -1
  51. package/esm/typings/src/scripting/python/PythonExecutionTools.d.ts +2 -0
  52. package/esm/typings/src/scripting/typescript/TypescriptExecutionTools.d.ts +2 -0
  53. package/esm/typings/src/storage/files-storage/FilesStorage.d.ts +1 -1
  54. package/esm/typings/src/types/Arrayable.d.ts +1 -1
  55. package/esm/typings/src/types/ModelVariant.d.ts +8 -7
  56. package/esm/typings/src/types/PipelineJson/Expectations.d.ts +10 -4
  57. package/esm/typings/src/types/PipelineJson/LlmTemplateJson.d.ts +1 -1
  58. package/esm/typings/src/types/ScriptLanguage.d.ts +6 -4
  59. package/esm/typings/src/types/execution-report/executionReportJsonToString.d.ts +1 -0
  60. package/esm/typings/src/types/typeAliases.d.ts +2 -1
  61. package/esm/typings/src/utils/arrayableToArray.d.ts +1 -1
  62. package/esm/typings/src/utils/deepFreeze.d.ts +6 -5
  63. package/esm/typings/src/utils/files/isDirectoryExisting.d.ts +13 -0
  64. package/esm/typings/src/utils/files/isFileExisting.d.ts +12 -0
  65. package/esm/typings/src/utils/files/listAllFiles.d.ts +15 -0
  66. package/esm/typings/src/utils/getCurrentIsoDate.d.ts +1 -1
  67. package/esm/typings/src/utils/markdown/extractOneBlockFromMarkdown.d.ts +1 -1
  68. package/esm/typings/src/utils/normalization/normalizeWhitespaces.d.ts +3 -1
  69. package/esm/typings/src/utils/validators/email/isValidEmail.d.ts +2 -0
  70. package/esm/typings/src/version.d.ts +0 -2
  71. package/package.json +10 -16
  72. package/umd/index.umd.js +354 -204
  73. package/umd/index.umd.js.map +1 -1
  74. package/esm/typings/src/types/execution-report/config.d.ts +0 -8
  75. package/umd/typings/promptbook-collection/index.d.ts +0 -252
  76. package/umd/typings/src/_packages/anthropic-claude.index.d.ts +0 -6
  77. package/umd/typings/src/_packages/azure-openai.index.d.ts +0 -6
  78. package/umd/typings/src/_packages/browser.index.d.ts +0 -6
  79. package/umd/typings/src/_packages/cli.index.d.ts +0 -4
  80. package/umd/typings/src/_packages/core.index.d.ts +0 -124
  81. package/umd/typings/src/_packages/execute-javascript.index.d.ts +0 -8
  82. package/umd/typings/src/_packages/fake-llm.index.d.ts +0 -6
  83. package/umd/typings/src/_packages/langtail.index.d.ts +0 -6
  84. package/umd/typings/src/_packages/markdown-utils.index.d.ts +0 -36
  85. package/umd/typings/src/_packages/node.index.d.ts +0 -8
  86. package/umd/typings/src/_packages/openai.index.d.ts +0 -8
  87. package/umd/typings/src/_packages/remote-client.index.d.ts +0 -8
  88. package/umd/typings/src/_packages/remote-server.index.d.ts +0 -6
  89. package/umd/typings/src/_packages/types.index.d.ts +0 -462
  90. package/umd/typings/src/_packages/utils.index.d.ts +0 -130
  91. package/umd/typings/src/cli/cli-commands/hello.d.ts +0 -10
  92. package/umd/typings/src/cli/cli-commands/make.d.ts +0 -10
  93. package/umd/typings/src/cli/cli-commands/prettify.d.ts +0 -10
  94. package/umd/typings/src/cli/main.d.ts +0 -12
  95. package/umd/typings/src/cli/promptbookCli.d.ts +0 -10
  96. package/umd/typings/src/collection/PipelineCollection.d.ts +0 -25
  97. package/umd/typings/src/collection/SimplePipelineCollection.d.ts +0 -38
  98. package/umd/typings/src/collection/collectionToJson.d.ts +0 -13
  99. package/umd/typings/src/collection/collectionToJson.test.d.ts +0 -7
  100. package/umd/typings/src/collection/constructors/createCollectionFromDirectory.d.ts +0 -48
  101. package/umd/typings/src/collection/constructors/createCollectionFromJson.d.ts +0 -13
  102. package/umd/typings/src/collection/constructors/createCollectionFromPromise.d.ts +0 -23
  103. package/umd/typings/src/collection/constructors/createCollectionFromUrl.d.ts +0 -29
  104. package/umd/typings/src/collection/constructors/createSubcollection.d.ts +0 -13
  105. package/umd/typings/src/commands/BLOCK/BlockCommand.d.ts +0 -11
  106. package/umd/typings/src/commands/BLOCK/BlockTypes.d.ts +0 -15
  107. package/umd/typings/src/commands/BLOCK/blockCommandParser.d.ts +0 -9
  108. package/umd/typings/src/commands/EXPECT/ExpectAmountCommand.d.ts +0 -14
  109. package/umd/typings/src/commands/EXPECT/ExpectCommand.d.ts +0 -9
  110. package/umd/typings/src/commands/EXPECT/ExpectFormatCommand.d.ts +0 -7
  111. package/umd/typings/src/commands/EXPECT/expectCommand.test.d.ts +0 -1
  112. package/umd/typings/src/commands/EXPECT/expectCommandParser.d.ts +0 -9
  113. package/umd/typings/src/commands/JOKER/JokerCommand.d.ts +0 -11
  114. package/umd/typings/src/commands/JOKER/jokerCommand.test.d.ts +0 -1
  115. package/umd/typings/src/commands/JOKER/jokerCommandParser.d.ts +0 -9
  116. package/umd/typings/src/commands/KNOWLEDGE/KnowledgeCommand.d.ts +0 -11
  117. package/umd/typings/src/commands/KNOWLEDGE/knowledgeCommand.test.d.ts +0 -1
  118. package/umd/typings/src/commands/KNOWLEDGE/knowledgeCommandParser.d.ts +0 -9
  119. package/umd/typings/src/commands/MODEL/ModelCommand.d.ts +0 -13
  120. package/umd/typings/src/commands/MODEL/modelCommand.test.d.ts +0 -1
  121. package/umd/typings/src/commands/MODEL/modelCommandParser.d.ts +0 -9
  122. package/umd/typings/src/commands/PARAMETER/ParameterCommand.d.ts +0 -15
  123. package/umd/typings/src/commands/PARAMETER/parameterCommand.test.d.ts +0 -1
  124. package/umd/typings/src/commands/PARAMETER/parameterCommandParser.d.ts +0 -9
  125. package/umd/typings/src/commands/PERSONA/PersonaCommand.d.ts +0 -13
  126. package/umd/typings/src/commands/PERSONA/personaCommand.test.d.ts +0 -1
  127. package/umd/typings/src/commands/PERSONA/personaCommandParser.d.ts +0 -9
  128. package/umd/typings/src/commands/POSTPROCESS/PostprocessCommand.d.ts +0 -11
  129. package/umd/typings/src/commands/POSTPROCESS/postprocessCommand.test.d.ts +0 -1
  130. package/umd/typings/src/commands/POSTPROCESS/postprocessCommandParser.d.ts +0 -9
  131. package/umd/typings/src/commands/PROMPTBOOK_VERSION/PromptbookVersionCommand.d.ts +0 -11
  132. package/umd/typings/src/commands/PROMPTBOOK_VERSION/promptbookVersionCommand.test.d.ts +0 -1
  133. package/umd/typings/src/commands/PROMPTBOOK_VERSION/promptbookVersionCommandParser.d.ts +0 -9
  134. package/umd/typings/src/commands/URL/UrlCommand.d.ts +0 -10
  135. package/umd/typings/src/commands/URL/urlCommand.test.d.ts +0 -1
  136. package/umd/typings/src/commands/URL/urlCommandParser.d.ts +0 -9
  137. package/umd/typings/src/commands/X_ACTION/ActionCommand.d.ts +0 -9
  138. package/umd/typings/src/commands/X_ACTION/actionCommand.test.d.ts +0 -1
  139. package/umd/typings/src/commands/X_ACTION/actionCommandParser.d.ts +0 -9
  140. package/umd/typings/src/commands/X_INSTRUMENT/InstrumentCommand.d.ts +0 -9
  141. package/umd/typings/src/commands/X_INSTRUMENT/instrumentCommand.test.d.ts +0 -1
  142. package/umd/typings/src/commands/X_INSTRUMENT/instrumentCommandParser.d.ts +0 -9
  143. package/umd/typings/src/commands/_BOILERPLATE/BoilerplateCommand.d.ts +0 -10
  144. package/umd/typings/src/commands/_BOILERPLATE/boilerplateCommand.test.d.ts +0 -1
  145. package/umd/typings/src/commands/_BOILERPLATE/boilerplateCommandParser.d.ts +0 -13
  146. package/umd/typings/src/commands/_common/parseCommand.d.ts +0 -12
  147. package/umd/typings/src/commands/_common/parseCommand.test.d.ts +0 -1
  148. package/umd/typings/src/commands/_common/types/Command.d.ts +0 -6
  149. package/umd/typings/src/commands/_common/types/CommandParser.d.ts +0 -64
  150. package/umd/typings/src/commands/_common/types/CommandUsagePlaces.d.ts +0 -9
  151. package/umd/typings/src/commands/index.d.ts +0 -4
  152. package/umd/typings/src/config.d.ts +0 -87
  153. package/umd/typings/src/config.test.d.ts +0 -4
  154. package/umd/typings/src/conversion/pipelineJsonToString.d.ts +0 -16
  155. package/umd/typings/src/conversion/pipelineStringToJson.d.ts +0 -38
  156. package/umd/typings/src/conversion/pipelineStringToJson.test.d.ts +0 -1
  157. package/umd/typings/src/conversion/pipelineStringToJsonSync.d.ts +0 -29
  158. package/umd/typings/src/conversion/pipelineStringToJsonSync.test.d.ts +0 -1
  159. package/umd/typings/src/conversion/prettify/PrettifyOptions.d.ts +0 -13
  160. package/umd/typings/src/conversion/prettify/prettifyPipelineString.d.ts +0 -12
  161. package/umd/typings/src/conversion/prettify/renderPipelineMermaidOptions.d.ts +0 -27
  162. package/umd/typings/src/conversion/utils/extractParameterNamesFromPromptTemplate.d.ts +0 -14
  163. package/umd/typings/src/conversion/utils/extractParameterNamesFromPromptTemplate.test.d.ts +0 -1
  164. package/umd/typings/src/conversion/utils/extractVariables.d.ts +0 -14
  165. package/umd/typings/src/conversion/utils/extractVariables.test.d.ts +0 -1
  166. package/umd/typings/src/conversion/utils/renameParameter.d.ts +0 -26
  167. package/umd/typings/src/conversion/utils/renameParameter.test.d.ts +0 -1
  168. package/umd/typings/src/conversion/utils/stringifyPipelineJson.d.ts +0 -16
  169. package/umd/typings/src/conversion/utils/stringifyPipelineJson.test.d.ts +0 -1
  170. package/umd/typings/src/conversion/utils/titleToName.d.ts +0 -9
  171. package/umd/typings/src/conversion/utils/titleToName.test.d.ts +0 -1
  172. package/umd/typings/src/conversion/validation/_importPipeline.d.ts +0 -22
  173. package/umd/typings/src/conversion/validation/pipelineStringToJson-syntaxErrors.test.d.ts +0 -1
  174. package/umd/typings/src/conversion/validation/validatePipeline-logicErrors.test.d.ts +0 -4
  175. package/umd/typings/src/conversion/validation/validatePipeline.d.ts +0 -37
  176. package/umd/typings/src/conversion/validation/validatePipeline.test.d.ts +0 -1
  177. package/umd/typings/src/errors/CollectionError.d.ts +0 -9
  178. package/umd/typings/src/errors/EnvironmentMismatchError.d.ts +0 -9
  179. package/umd/typings/src/errors/LimitReachedError.d.ts +0 -9
  180. package/umd/typings/src/errors/NotFoundError.d.ts +0 -9
  181. package/umd/typings/src/errors/NotYetImplementedError.d.ts +0 -9
  182. package/umd/typings/src/errors/ParsingError.d.ts +0 -9
  183. package/umd/typings/src/errors/PipelineExecutionError.d.ts +0 -9
  184. package/umd/typings/src/errors/PipelineLogicError.d.ts +0 -9
  185. package/umd/typings/src/errors/ReferenceError.d.ts +0 -9
  186. package/umd/typings/src/errors/UnexpectedError.d.ts +0 -9
  187. package/umd/typings/src/errors/VersionMismatchError.d.ts +0 -10
  188. package/umd/typings/src/errors/_ExpectError.d.ts +0 -10
  189. package/umd/typings/src/execution/CommonExecutionToolsOptions.d.ts +0 -10
  190. package/umd/typings/src/execution/EmbeddingVector.d.ts +0 -8
  191. package/umd/typings/src/execution/ExecutionTools.d.ts +0 -33
  192. package/umd/typings/src/execution/LlmExecutionTools.d.ts +0 -72
  193. package/umd/typings/src/execution/PipelineExecutor.d.ts +0 -64
  194. package/umd/typings/src/execution/PromptResult.d.ts +0 -99
  195. package/umd/typings/src/execution/PromptResultUsage.d.ts +0 -29
  196. package/umd/typings/src/execution/ScriptExecutionTools.d.ts +0 -39
  197. package/umd/typings/src/execution/UncertainNumber.d.ts +0 -18
  198. package/umd/typings/src/execution/UserInterfaceTools.d.ts +0 -46
  199. package/umd/typings/src/execution/assertsExecutionSuccessful.d.ts +0 -12
  200. package/umd/typings/src/execution/createPipelineExecutor.d.ts +0 -71
  201. package/umd/typings/src/execution/embeddingVectorToString.d.ts +0 -7
  202. package/umd/typings/src/execution/translation/automatic-translate/automatic-translators/AutomaticTranslator.d.ts +0 -4
  203. package/umd/typings/src/execution/translation/automatic-translate/automatic-translators/DebugAutomaticTranslator.d.ts +0 -9
  204. package/umd/typings/src/execution/translation/automatic-translate/automatic-translators/FakeAutomaticTranslator.d.ts +0 -5
  205. package/umd/typings/src/execution/translation/automatic-translate/automatic-translators/LindatAutomaticTranslator.d.ts +0 -11
  206. package/umd/typings/src/execution/translation/automatic-translate/automatic-translators/TranslatorOptions.d.ts +0 -4
  207. package/umd/typings/src/execution/translation/automatic-translate/automatic-translators/utils/extractMultiplicatedOccurrence.d.ts +0 -7
  208. package/umd/typings/src/execution/translation/automatic-translate/automatic-translators/utils/extractMultiplicatedOccurrence.test.d.ts +0 -1
  209. package/umd/typings/src/execution/translation/automatic-translate/translateMessages.d.ts +0 -5
  210. package/umd/typings/src/execution/utils/addUsage.d.ts +0 -65
  211. package/umd/typings/src/execution/utils/addUsage.test.d.ts +0 -1
  212. package/umd/typings/src/execution/utils/checkExpectations.d.ts +0 -27
  213. package/umd/typings/src/execution/utils/checkExpectations.test.d.ts +0 -1
  214. package/umd/typings/src/execution/utils/computeUsageCounts.d.ts +0 -10
  215. package/umd/typings/src/execution/utils/forEachAsync.d.ts +0 -19
  216. package/umd/typings/src/execution/utils/uncertainNumber.d.ts +0 -9
  217. package/umd/typings/src/execution/utils/usageToHuman.d.ts +0 -17
  218. package/umd/typings/src/execution/utils/usageToHuman.test.d.ts +0 -1
  219. package/umd/typings/src/execution/utils/usageToWorktime.d.ts +0 -12
  220. package/umd/typings/src/execution/utils/usageToWorktime.test.d.ts +0 -1
  221. package/umd/typings/src/expectations/drafts/isDomainNameFree.d.ts +0 -6
  222. package/umd/typings/src/expectations/drafts/isGithubNameFree.d.ts +0 -6
  223. package/umd/typings/src/formats/_common/FormatDefinition.d.ts +0 -70
  224. package/umd/typings/src/formats/csv/ListFormatDefinition.d.ts +0 -12
  225. package/umd/typings/src/formats/index.d.ts +0 -4
  226. package/umd/typings/src/formats/json/JsonFormatDefinition.d.ts +0 -16
  227. package/umd/typings/src/formats/json/utils/isValidJsonString.d.ts +0 -6
  228. package/umd/typings/src/formats/json/utils/isValidJsonString.test.d.ts +0 -1
  229. package/umd/typings/src/formats/list/ListFormatDefinition.d.ts +0 -14
  230. package/umd/typings/src/formats/xml/XmlFormatDefinition.d.ts +0 -16
  231. package/umd/typings/src/knowledge/dialogs/callback/CallbackInterfaceTools.d.ts +0 -17
  232. package/umd/typings/src/knowledge/dialogs/callback/CallbackInterfaceToolsOptions.d.ts +0 -14
  233. package/umd/typings/src/knowledge/dialogs/simple-prompt/SimplePromptInterfaceTools.d.ts +0 -22
  234. package/umd/typings/src/knowledge/dialogs/user-interface-execution-tools.test.d.ts +0 -1
  235. package/umd/typings/src/knowledge/prepare-knowledge/_common/Scraper.d.ts +0 -37
  236. package/umd/typings/src/knowledge/prepare-knowledge/_common/prepareKnowledgePieces.d.ts +0 -18
  237. package/umd/typings/src/knowledge/prepare-knowledge/_common/prepareKnowledgePieces.test.d.ts +0 -1
  238. package/umd/typings/src/knowledge/prepare-knowledge/markdown/playground/markdown-knowledge-playground.d.ts +0 -2
  239. package/umd/typings/src/knowledge/prepare-knowledge/markdown/prepareKnowledgeFromMarkdown.d.ts +0 -14
  240. package/umd/typings/src/knowledge/prepare-knowledge/markdown/prepareKnowledgeFromMarkdown.test.d.ts +0 -4
  241. package/umd/typings/src/knowledge/prepare-knowledge/pdf/prepareKnowledgeFromPdf.d.ts +0 -13
  242. package/umd/typings/src/knowledge/prepare-knowledge/pdf/prepareKnowledgeFromPdf.test.d.ts +0 -1
  243. package/umd/typings/src/llm-providers/_common/createLlmToolsFromEnv.d.ts +0 -37
  244. package/umd/typings/src/llm-providers/_common/getLlmToolsForCli.d.ts +0 -20
  245. package/umd/typings/src/llm-providers/_common/getLlmToolsForTestingAndScriptsAndPlayground.d.ts +0 -21
  246. package/umd/typings/src/llm-providers/_common/utils/cache/CacheItem.d.ts +0 -29
  247. package/umd/typings/src/llm-providers/_common/utils/cache/CacheLlmToolsOptions.d.ts +0 -16
  248. package/umd/typings/src/llm-providers/_common/utils/cache/cacheLlmTools.d.ts +0 -19
  249. package/umd/typings/src/llm-providers/_common/utils/count-total-usage/LlmExecutionToolsWithTotalUsage.d.ts +0 -15
  250. package/umd/typings/src/llm-providers/_common/utils/count-total-usage/countTotalUsage.d.ts +0 -17
  251. package/umd/typings/src/llm-providers/_common/utils/count-total-usage/limitTotalUsage.d.ts +0 -36
  252. package/umd/typings/src/llm-providers/anthropic-claude/AnthropicClaudeExecutionTools.d.ts +0 -52
  253. package/umd/typings/src/llm-providers/anthropic-claude/AnthropicClaudeExecutionToolsOptions.d.ts +0 -12
  254. package/umd/typings/src/llm-providers/anthropic-claude/anthropic-claude-models.d.ts +0 -22
  255. package/umd/typings/src/llm-providers/anthropic-claude/playground/playground.d.ts +0 -6
  256. package/umd/typings/src/llm-providers/azure-openai/AzureOpenAiExecutionTools.d.ts +0 -50
  257. package/umd/typings/src/llm-providers/azure-openai/AzureOpenAiExecutionToolsOptions.d.ts +0 -36
  258. package/umd/typings/src/llm-providers/azure-openai/playground/playground.d.ts +0 -5
  259. package/umd/typings/src/llm-providers/langtail/LangtailExecutionTools.d.ts +0 -17
  260. package/umd/typings/src/llm-providers/langtail/LangtailExecutionToolsOptions.d.ts +0 -13
  261. package/umd/typings/src/llm-providers/langtail/playground/playground.d.ts +0 -2
  262. package/umd/typings/src/llm-providers/mocked/MockedEchoLlmExecutionTools.d.ts +0 -36
  263. package/umd/typings/src/llm-providers/mocked/MockedFackedLlmExecutionTools.d.ts +0 -40
  264. package/umd/typings/src/llm-providers/mocked/fakeTextToExpectations.d.ts +0 -14
  265. package/umd/typings/src/llm-providers/mocked/test/fakeTextToExpectations.test.d.ts +0 -1
  266. package/umd/typings/src/llm-providers/mocked/test/faked-completion.test.d.ts +0 -1
  267. package/umd/typings/src/llm-providers/mocked/test/joker.test.d.ts +0 -4
  268. package/umd/typings/src/llm-providers/mocked/test/mocked-chat.test.d.ts +0 -5
  269. package/umd/typings/src/llm-providers/mocked/test/mocked-completion.test.d.ts +0 -4
  270. package/umd/typings/src/llm-providers/multiple/MultipleLlmExecutionTools.d.ts +0 -54
  271. package/umd/typings/src/llm-providers/multiple/joinLlmExecutionTools.d.ts +0 -21
  272. package/umd/typings/src/llm-providers/multiple/playground/playground.d.ts +0 -2
  273. package/umd/typings/src/llm-providers/openai/OpenAiExecutionTools.d.ts +0 -68
  274. package/umd/typings/src/llm-providers/openai/OpenAiExecutionToolsOptions.d.ts +0 -20
  275. package/umd/typings/src/llm-providers/openai/computeOpenaiUsage.d.ts +0 -14
  276. package/umd/typings/src/llm-providers/openai/computeOpenaiUsage.test.d.ts +0 -1
  277. package/umd/typings/src/llm-providers/openai/computeUsage.d.ts +0 -16
  278. package/umd/typings/src/llm-providers/openai/computeUsage.test.d.ts +0 -1
  279. package/umd/typings/src/llm-providers/openai/openai-models.d.ts +0 -29
  280. package/umd/typings/src/llm-providers/openai/playground/playground.d.ts +0 -5
  281. package/umd/typings/src/llm-providers/remote/RemoteLlmExecutionTools.d.ts +0 -56
  282. package/umd/typings/src/llm-providers/remote/RemoteLlmExecutionToolsOptions.d.ts +0 -26
  283. package/umd/typings/src/llm-providers/remote/interfaces/Promptbook_Server_Error.d.ts +0 -11
  284. package/umd/typings/src/llm-providers/remote/interfaces/Promptbook_Server_Progress.d.ts +0 -12
  285. package/umd/typings/src/llm-providers/remote/interfaces/Promptbook_Server_Request.d.ts +0 -17
  286. package/umd/typings/src/llm-providers/remote/interfaces/Promptbook_Server_Response.d.ts +0 -12
  287. package/umd/typings/src/llm-providers/remote/interfaces/RemoteServerOptions.d.ts +0 -37
  288. package/umd/typings/src/llm-providers/remote/startRemoteServer.d.ts +0 -21
  289. package/umd/typings/src/personas/preparePersona.d.ts +0 -15
  290. package/umd/typings/src/personas/preparePersona.test.d.ts +0 -1
  291. package/umd/typings/src/postprocessing/utils/extractBlock.d.ts +0 -17
  292. package/umd/typings/src/prepare/PrepareOptions.d.ts +0 -22
  293. package/umd/typings/src/prepare/isPipelinePrepared.d.ts +0 -15
  294. package/umd/typings/src/prepare/isPipelinePrepared.test.d.ts +0 -1
  295. package/umd/typings/src/prepare/preparePipeline.d.ts +0 -16
  296. package/umd/typings/src/prepare/prepareTemplates.d.ts +0 -32
  297. package/umd/typings/src/prepare/unpreparePipeline.d.ts +0 -12
  298. package/umd/typings/src/scripting/_test/custom-function-async.test.ts.test.d.ts +0 -1
  299. package/umd/typings/src/scripting/_test/custom-function-missing.test.d.ts +0 -1
  300. package/umd/typings/src/scripting/_test/custom-function-with-dependencies.test.d.ts +0 -1
  301. package/umd/typings/src/scripting/_test/custom-function.test.d.ts +0 -1
  302. package/umd/typings/src/scripting/_test/postprocessing.test.d.ts +0 -1
  303. package/umd/typings/src/scripting/_test/script-execution-errors.test.d.ts +0 -1
  304. package/umd/typings/src/scripting/_test/script-execution-tools.test.d.ts +0 -1
  305. package/umd/typings/src/scripting/javascript/JavascriptEvalExecutionTools.d.ts +0 -22
  306. package/umd/typings/src/scripting/javascript/JavascriptEvalExecutionTools.test.d.ts +0 -4
  307. package/umd/typings/src/scripting/javascript/JavascriptExecutionTools.d.ts +0 -8
  308. package/umd/typings/src/scripting/javascript/JavascriptExecutionToolsOptions.d.ts +0 -26
  309. package/umd/typings/src/scripting/javascript/postprocessing-functions.d.ts +0 -51
  310. package/umd/typings/src/scripting/javascript/utils/preserve.d.ts +0 -12
  311. package/umd/typings/src/scripting/javascript/utils/unknownToString.d.ts +0 -8
  312. package/umd/typings/src/scripting/python/PythonExecutionTools.d.ts +0 -16
  313. package/umd/typings/src/scripting/typescript/TypescriptExecutionTools.d.ts +0 -16
  314. package/umd/typings/src/storage/_common/PromptbookStorage.d.ts +0 -24
  315. package/umd/typings/src/storage/_common/PromptbookStorage.test-type.d.ts +0 -5
  316. package/umd/typings/src/storage/files-storage/FilesStorage.d.ts +0 -31
  317. package/umd/typings/src/storage/files-storage/FilesStorageOptions.d.ts +0 -10
  318. package/umd/typings/src/storage/files-storage/utils/nameToSubfolderPath.d.ts +0 -7
  319. package/umd/typings/src/storage/files-storage/utils/nameToSubfolderPath.test.d.ts +0 -1
  320. package/umd/typings/src/storage/local-storage/getLocalStorage.d.ts +0 -10
  321. package/umd/typings/src/storage/local-storage/getSessionStorage.d.ts +0 -10
  322. package/umd/typings/src/storage/memory/MemoryStorage.d.ts +0 -33
  323. package/umd/typings/src/storage/utils/PrefixStorage.d.ts +0 -25
  324. package/umd/typings/src/storage/utils/makePromptbookStorageFromWebStorage.d.ts +0 -11
  325. package/umd/typings/src/types/Arrayable.d.ts +0 -10
  326. package/umd/typings/src/types/ModelRequirements.d.ts +0 -102
  327. package/umd/typings/src/types/ModelVariant.d.ts +0 -14
  328. package/umd/typings/src/types/PipelineJson/Expectations.d.ts +0 -32
  329. package/umd/typings/src/types/PipelineJson/KnowledgePieceJson.d.ts +0 -70
  330. package/umd/typings/src/types/PipelineJson/KnowledgeSourceJson.d.ts +0 -27
  331. package/umd/typings/src/types/PipelineJson/LlmTemplateJson.d.ts +0 -25
  332. package/umd/typings/src/types/PipelineJson/PersonaJson.d.ts +0 -41
  333. package/umd/typings/src/types/PipelineJson/PipelineJson.d.ts +0 -87
  334. package/umd/typings/src/types/PipelineJson/PreparationJson.d.ts +0 -22
  335. package/umd/typings/src/types/PipelineJson/PromptDialogJson.d.ts +0 -13
  336. package/umd/typings/src/types/PipelineJson/PromptTemplateJson.d.ts +0 -13
  337. package/umd/typings/src/types/PipelineJson/PromptTemplateJsonCommon.d.ts +0 -96
  338. package/umd/typings/src/types/PipelineJson/PromptTemplateParameterJson.d.ts +0 -36
  339. package/umd/typings/src/types/PipelineJson/ScriptJson.d.ts +0 -19
  340. package/umd/typings/src/types/PipelineJson/SimpleTemplateJson.d.ts +0 -12
  341. package/umd/typings/src/types/PipelineString.d.ts +0 -12
  342. package/umd/typings/src/types/Prompt.d.ts +0 -108
  343. package/umd/typings/src/types/ScriptLanguage.d.ts +0 -9
  344. package/umd/typings/src/types/TaskProgress.d.ts +0 -43
  345. package/umd/typings/src/types/execution-report/ExecutionReportJson.d.ts +0 -58
  346. package/umd/typings/src/types/execution-report/ExecutionReportString.d.ts +0 -16
  347. package/umd/typings/src/types/execution-report/ExecutionReportStringOptions.d.ts +0 -25
  348. package/umd/typings/src/types/execution-report/config.d.ts +0 -8
  349. package/umd/typings/src/types/execution-report/countWorkingDuration.d.ts +0 -7
  350. package/umd/typings/src/types/execution-report/countWorkingDuration.test.d.ts +0 -1
  351. package/umd/typings/src/types/execution-report/executionReportJsonToString.d.ts +0 -13
  352. package/umd/typings/src/types/typeAliasEmoji.d.ts +0 -9
  353. package/umd/typings/src/types/typeAliases.d.ts +0 -586
  354. package/umd/typings/src/utils/FromtoItems.d.ts +0 -19
  355. package/umd/typings/src/utils/arrayableToArray.d.ts +0 -11
  356. package/umd/typings/src/utils/arrayableToArray.test.d.ts +0 -1
  357. package/umd/typings/src/utils/currentDate.d.ts +0 -8
  358. package/umd/typings/src/utils/deepClone.d.ts +0 -10
  359. package/umd/typings/src/utils/deepFreeze.d.ts +0 -22
  360. package/umd/typings/src/utils/emojis.d.ts +0 -23
  361. package/umd/typings/src/utils/expectation-counters/countCharacters.d.ts +0 -7
  362. package/umd/typings/src/utils/expectation-counters/countCharacters.test.d.ts +0 -1
  363. package/umd/typings/src/utils/expectation-counters/countLines.d.ts +0 -7
  364. package/umd/typings/src/utils/expectation-counters/countLines.test.d.ts +0 -1
  365. package/umd/typings/src/utils/expectation-counters/countPages.d.ts +0 -7
  366. package/umd/typings/src/utils/expectation-counters/countPages.test.d.ts +0 -1
  367. package/umd/typings/src/utils/expectation-counters/countParagraphs.d.ts +0 -7
  368. package/umd/typings/src/utils/expectation-counters/countParagraphs.test.d.ts +0 -1
  369. package/umd/typings/src/utils/expectation-counters/countSentences.d.ts +0 -13
  370. package/umd/typings/src/utils/expectation-counters/countSentences.test.d.ts +0 -1
  371. package/umd/typings/src/utils/expectation-counters/countWords.d.ts +0 -7
  372. package/umd/typings/src/utils/expectation-counters/countWords.test.d.ts +0 -1
  373. package/umd/typings/src/utils/expectation-counters/index.d.ts +0 -8
  374. package/umd/typings/src/utils/extractParameterNames.d.ts +0 -10
  375. package/umd/typings/src/utils/extractParameterNames.test.d.ts +0 -1
  376. package/umd/typings/src/utils/formatNumber.d.ts +0 -6
  377. package/umd/typings/src/utils/formatNumber.test.d.ts +0 -1
  378. package/umd/typings/src/utils/getCurrentIsoDate.d.ts +0 -7
  379. package/umd/typings/src/utils/isRunningInWhatever.d.ts +0 -18
  380. package/umd/typings/src/utils/markdown/addAutoGeneratedSection.d.ts +0 -14
  381. package/umd/typings/src/utils/markdown/addAutoGeneratedSection.test.d.ts +0 -1
  382. package/umd/typings/src/utils/markdown/createMarkdownChart.d.ts +0 -38
  383. package/umd/typings/src/utils/markdown/createMarkdownChart.test.d.ts +0 -1
  384. package/umd/typings/src/utils/markdown/createMarkdownTable.d.ts +0 -11
  385. package/umd/typings/src/utils/markdown/createMarkdownTable.test.d.ts +0 -1
  386. package/umd/typings/src/utils/markdown/escapeMarkdownBlock.d.ts +0 -11
  387. package/umd/typings/src/utils/markdown/escapeMarkdownBlock.test.d.ts +0 -1
  388. package/umd/typings/src/utils/markdown/extractAllBlocksFromMarkdown-real.test.d.ts +0 -1
  389. package/umd/typings/src/utils/markdown/extractAllBlocksFromMarkdown.d.ts +0 -34
  390. package/umd/typings/src/utils/markdown/extractAllBlocksFromMarkdown.test.d.ts +0 -1
  391. package/umd/typings/src/utils/markdown/extractAllListItemsFromMarkdown.d.ts +0 -15
  392. package/umd/typings/src/utils/markdown/extractAllListItemsFromMarkdown.test.d.ts +0 -1
  393. package/umd/typings/src/utils/markdown/extractOneBlockFromMarkdown.d.ts +0 -20
  394. package/umd/typings/src/utils/markdown/extractOneBlockFromMarkdown.test.d.ts +0 -1
  395. package/umd/typings/src/utils/markdown/flattenMarkdown.d.ts +0 -17
  396. package/umd/typings/src/utils/markdown/flattenMarkdown.test.d.ts +0 -1
  397. package/umd/typings/src/utils/markdown/parseMarkdownSection.d.ts +0 -34
  398. package/umd/typings/src/utils/markdown/parseMarkdownSection.test.d.ts +0 -1
  399. package/umd/typings/src/utils/markdown/prettifyMarkdown.d.ts +0 -9
  400. package/umd/typings/src/utils/markdown/prettifyMarkdown.test.d.ts +0 -1
  401. package/umd/typings/src/utils/markdown/removeContentComments.d.ts +0 -10
  402. package/umd/typings/src/utils/markdown/removeContentComments.test.d.ts +0 -1
  403. package/umd/typings/src/utils/markdown/removeMarkdownFormatting.d.ts +0 -9
  404. package/umd/typings/src/utils/markdown/removeMarkdownFormatting.test.d.ts +0 -1
  405. package/umd/typings/src/utils/markdown/splitMarkdownIntoSections.d.ts +0 -15
  406. package/umd/typings/src/utils/markdown/splitMarkdownIntoSections.test.d.ts +0 -1
  407. package/umd/typings/src/utils/normalization/DIACRITIC_VARIANTS_LETTERS.d.ts +0 -12
  408. package/umd/typings/src/utils/normalization/IKeywords.d.ts +0 -21
  409. package/umd/typings/src/utils/normalization/capitalize.d.ts +0 -6
  410. package/umd/typings/src/utils/normalization/capitalize.test.d.ts +0 -1
  411. package/umd/typings/src/utils/normalization/decapitalize.d.ts +0 -6
  412. package/umd/typings/src/utils/normalization/decapitalize.test.d.ts +0 -1
  413. package/umd/typings/src/utils/normalization/isValidKeyword.d.ts +0 -10
  414. package/umd/typings/src/utils/normalization/isValidKeyword.test.d.ts +0 -1
  415. package/umd/typings/src/utils/normalization/nameToUriPart.d.ts +0 -9
  416. package/umd/typings/src/utils/normalization/nameToUriPart.test.d.ts +0 -1
  417. package/umd/typings/src/utils/normalization/nameToUriParts.d.ts +0 -9
  418. package/umd/typings/src/utils/normalization/nameToUriParts.test.d.ts +0 -1
  419. package/umd/typings/src/utils/normalization/normalize-to-kebab-case.d.ts +0 -18
  420. package/umd/typings/src/utils/normalization/normalize-to-kebab-case.test.d.ts +0 -1
  421. package/umd/typings/src/utils/normalization/normalizeTo_PascalCase.d.ts +0 -17
  422. package/umd/typings/src/utils/normalization/normalizeTo_PascalCase.test.d.ts +0 -1
  423. package/umd/typings/src/utils/normalization/normalizeTo_SCREAMING_CASE.d.ts +0 -26
  424. package/umd/typings/src/utils/normalization/normalizeTo_SCREAMING_CASE.test.d.ts +0 -1
  425. package/umd/typings/src/utils/normalization/normalizeTo_camelCase.d.ts +0 -22
  426. package/umd/typings/src/utils/normalization/normalizeTo_camelCase.test.d.ts +0 -1
  427. package/umd/typings/src/utils/normalization/normalizeTo_snake_case.d.ts +0 -17
  428. package/umd/typings/src/utils/normalization/normalizeTo_snake_case.test.d.ts +0 -1
  429. package/umd/typings/src/utils/normalization/normalizeWhitespaces.d.ts +0 -4
  430. package/umd/typings/src/utils/normalization/normalizeWhitespaces.test.d.ts +0 -1
  431. package/umd/typings/src/utils/normalization/parseKeywords.d.ts +0 -16
  432. package/umd/typings/src/utils/normalization/parseKeywords.test.d.ts +0 -1
  433. package/umd/typings/src/utils/normalization/parseKeywordsFromString.d.ts +0 -9
  434. package/umd/typings/src/utils/normalization/parseKeywordsFromString.test.d.ts +0 -1
  435. package/umd/typings/src/utils/normalization/removeDiacritics.d.ts +0 -11
  436. package/umd/typings/src/utils/normalization/removeDiacritics.test.d.ts +0 -1
  437. package/umd/typings/src/utils/normalization/searchKeywords.d.ts +0 -10
  438. package/umd/typings/src/utils/normalization/searchKeywords.test.d.ts +0 -1
  439. package/umd/typings/src/utils/organization/TODO_USE.d.ts +0 -12
  440. package/umd/typings/src/utils/organization/TODO_any.d.ts +0 -6
  441. package/umd/typings/src/utils/organization/TODO_object.d.ts +0 -6
  442. package/umd/typings/src/utils/organization/TODO_unknown.d.ts +0 -6
  443. package/umd/typings/src/utils/organization/___.d.ts +0 -6
  444. package/umd/typings/src/utils/organization/just.d.ts +0 -14
  445. package/umd/typings/src/utils/organization/keepUnused.d.ts +0 -16
  446. package/umd/typings/src/utils/organization/really_any.d.ts +0 -6
  447. package/umd/typings/src/utils/organization/really_unknown.d.ts +0 -6
  448. package/umd/typings/src/utils/parseNumber.d.ts +0 -16
  449. package/umd/typings/src/utils/parseNumber.test.d.ts +0 -1
  450. package/umd/typings/src/utils/random/randomSeed.d.ts +0 -8
  451. package/umd/typings/src/utils/removeEmojis.d.ts +0 -8
  452. package/umd/typings/src/utils/removeEmojis.test.d.ts +0 -1
  453. package/umd/typings/src/utils/removeQuotes.d.ts +0 -14
  454. package/umd/typings/src/utils/removeQuotes.test.d.ts +0 -1
  455. package/umd/typings/src/utils/replaceParameters.d.ts +0 -12
  456. package/umd/typings/src/utils/replaceParameters.test.d.ts +0 -1
  457. package/umd/typings/src/utils/sets/difference.d.ts +0 -10
  458. package/umd/typings/src/utils/sets/difference.test.d.ts +0 -1
  459. package/umd/typings/src/utils/sets/intersection.d.ts +0 -7
  460. package/umd/typings/src/utils/sets/intersection.test.d.ts +0 -1
  461. package/umd/typings/src/utils/sets/union.d.ts +0 -7
  462. package/umd/typings/src/utils/sets/union.test.d.ts +0 -1
  463. package/umd/typings/src/utils/trimCodeBlock.d.ts +0 -9
  464. package/umd/typings/src/utils/trimCodeBlock.test.d.ts +0 -1
  465. package/umd/typings/src/utils/trimEndOfCodeBlock.d.ts +0 -9
  466. package/umd/typings/src/utils/trimEndOfCodeBlock.test.d.ts +0 -1
  467. package/umd/typings/src/utils/unwrapResult.d.ts +0 -37
  468. package/umd/typings/src/utils/unwrapResult.test.d.ts +0 -1
  469. package/umd/typings/src/utils/validators/email/isValidEmail.d.ts +0 -6
  470. package/umd/typings/src/utils/validators/email/isValidEmail.test.d.ts +0 -1
  471. package/umd/typings/src/utils/validators/filePath/isValidFilePath.d.ts +0 -9
  472. package/umd/typings/src/utils/validators/filePath/isValidFilePath.test.d.ts +0 -1
  473. package/umd/typings/src/utils/validators/javascriptName/isValidJavascriptName.d.ts +0 -10
  474. package/umd/typings/src/utils/validators/javascriptName/isValidJavascriptName.test.d.ts +0 -1
  475. package/umd/typings/src/utils/validators/semanticVersion/isValidPromptbookVersion.d.ts +0 -15
  476. package/umd/typings/src/utils/validators/semanticVersion/isValidPromptbookVersion.test.d.ts +0 -1
  477. package/umd/typings/src/utils/validators/semanticVersion/isValidSemanticVersion.d.ts +0 -12
  478. package/umd/typings/src/utils/validators/semanticVersion/isValidSemanticVersion.test.d.ts +0 -1
  479. package/umd/typings/src/utils/validators/url/isHostnameOnPrivateNetwork.d.ts +0 -11
  480. package/umd/typings/src/utils/validators/url/isHostnameOnPrivateNetwork.test.d.ts +0 -1
  481. package/umd/typings/src/utils/validators/url/isUrlOnPrivateNetwork.d.ts +0 -13
  482. package/umd/typings/src/utils/validators/url/isUrlOnPrivateNetwork.test.d.ts +0 -1
  483. package/umd/typings/src/utils/validators/url/isValidPipelineUrl.d.ts +0 -15
  484. package/umd/typings/src/utils/validators/url/isValidPipelineUrl.test.d.ts +0 -1
  485. package/umd/typings/src/utils/validators/url/isValidUrl.d.ts +0 -13
  486. package/umd/typings/src/utils/validators/url/isValidUrl.test.d.ts +0 -1
  487. package/umd/typings/src/utils/validators/uuid/isValidUuid.d.ts +0 -8
  488. package/umd/typings/src/utils/validators/uuid/isValidUuid.test.d.ts +0 -1
  489. package/umd/typings/src/version.d.ts +0 -8
  490. /package/{umd/typings/src/collection/constructors/createCollectionFromDirectory.test.d.ts → esm/typings/src/cli/test/ptbk.test.d.ts} +0 -0
  491. /package/{umd/typings/src/collection/constructors/createCollectionFromJson.test.d.ts → esm/typings/src/utils/files/isDirectoryExisting.test.d.ts} +0 -0
  492. /package/{umd/typings/src/collection/constructors/createCollectionFromPromise.test.d.ts → esm/typings/src/utils/files/isFileExisting.test.d.ts} +0 -0
  493. /package/{umd/typings/src/commands/BLOCK/blockCommand.test.d.ts → esm/typings/src/utils/files/listAllFiles.test.d.ts} +0 -0
package/umd/index.umd.js CHANGED
@@ -1,8 +1,8 @@
1
1
  (function (global, factory) {
2
- typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('commander'), require('spacetrim'), require('colors'), require('waitasecond'), require('fs/promises'), require('path'), require('prettier'), require('prettier/parser-html'), require('crypto-js/enc-hex'), require('crypto-js/sha256'), require('dotenv'), require('@anthropic-ai/sdk'), require('openai'), require('glob-promise')) :
3
- typeof define === 'function' && define.amd ? define(['exports', 'commander', 'spacetrim', 'colors', 'waitasecond', 'fs/promises', 'path', 'prettier', 'prettier/parser-html', 'crypto-js/enc-hex', 'crypto-js/sha256', 'dotenv', '@anthropic-ai/sdk', 'openai', 'glob-promise'], factory) :
4
- (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global["promptbook-cli"] = {}, global.commander, global.spaceTrim, global.colors, global.waitasecond, global.promises, global.path, global.prettier, global.parserHtml, global.hexEncoder, global.sha256, global.dotenv, global.Anthropic, global.OpenAI, global.glob));
5
- })(this, (function (exports, commander, spaceTrim, colors, waitasecond, promises, path, prettier, parserHtml, hexEncoder, sha256, dotenv, Anthropic, OpenAI, glob) { 'use strict';
2
+ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('commander'), require('spacetrim'), require('colors'), require('waitasecond'), require('fs/promises'), require('path'), require('prettier'), require('prettier/parser-html'), require('path/posix'), require('crypto-js/enc-hex'), require('crypto-js/sha256'), require('dotenv'), require('@anthropic-ai/sdk'), require('openai'), require('glob-promise')) :
3
+ typeof define === 'function' && define.amd ? define(['exports', 'commander', 'spacetrim', 'colors', 'waitasecond', 'fs/promises', 'path', 'prettier', 'prettier/parser-html', 'path/posix', 'crypto-js/enc-hex', 'crypto-js/sha256', 'dotenv', '@anthropic-ai/sdk', 'openai', 'glob-promise'], factory) :
4
+ (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global["promptbook-cli"] = {}, global.commander, global.spaceTrim, global.colors, global.waitasecond, global.promises, global.path, global.prettier, global.parserHtml, global.posix, global.hexEncoder, global.sha256, global.dotenv, global.Anthropic, global.OpenAI, global.glob));
5
+ })(this, (function (exports, commander, spaceTrim, colors, waitasecond, promises, path, prettier, parserHtml, posix, hexEncoder, sha256, dotenv, Anthropic, OpenAI, glob) { 'use strict';
6
6
 
7
7
  function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
8
8
 
@@ -35,12 +35,11 @@
35
35
  var OpenAI__default = /*#__PURE__*/_interopDefaultLegacy(OpenAI);
36
36
  var glob__default = /*#__PURE__*/_interopDefaultLegacy(glob);
37
37
 
38
+ // ⚠️ WARNING: This code has been generated so that any manual changes will be overwritten
38
39
  /**
39
40
  * The version of the Promptbook library
40
- *
41
- * @public exported from all packages
42
41
  */
43
- var PROMPTBOOK_VERSION = '0.62.0';
42
+ var PROMPTBOOK_VERSION = '0.63.0-9';
44
43
  // TODO: !!!! List here all the versions and annotate + put into script
45
44
 
46
45
  /*! *****************************************************************************
@@ -162,6 +161,22 @@
162
161
  return to.concat(ar || Array.prototype.slice.call(from));
163
162
  }
164
163
 
164
+ /**
165
+ * This error type indicates that you try to use a feature that is not available in the current environment
166
+ *
167
+ * @public exported from `@promptbook/core`
168
+ */
169
+ var EnvironmentMismatchError = /** @class */ (function (_super) {
170
+ __extends(EnvironmentMismatchError, _super);
171
+ function EnvironmentMismatchError(message) {
172
+ var _this = _super.call(this, message) || this;
173
+ _this.name = 'EnvironmentMismatchError';
174
+ Object.setPrototypeOf(_this, EnvironmentMismatchError.prototype);
175
+ return _this;
176
+ }
177
+ return EnvironmentMismatchError;
178
+ }(Error));
179
+
165
180
  /**
166
181
  * Detects if the code is running in a browser environment in main thread (Not in a web worker)
167
182
  *
@@ -181,72 +196,13 @@
181
196
  */
182
197
  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");
183
198
 
184
- /**
185
- * Initializes testing `hello` command for Promptbook CLI utilities
186
- *
187
- * @private part of `promptbookCli`
188
- */
189
- function initializeHelloCommand(program) {
190
- var _this = this;
191
- var helloCommand = program.command('hello');
192
- helloCommand.description(spaceTrim__default["default"]("\n Just command for testing\n "));
193
- helloCommand.argument('<name>', 'Your name');
194
- helloCommand.option('-g, --greeting <greeting>', "Greeting", 'Hello');
195
- helloCommand.action(function (name, _a) {
196
- var greeting = _a.greeting;
197
- return __awaiter(_this, void 0, void 0, function () {
198
- return __generator(this, function (_b) {
199
- switch (_b.label) {
200
- case 0:
201
- console.info(colors__default["default"].cyan("".concat(greeting, " ").concat(name)));
202
- return [4 /*yield*/, waitasecond.forTime(1000)];
203
- case 1:
204
- _b.sent();
205
- console.info(colors__default["default"].rainbow("Nice to meet you!"));
206
- process.exit(0);
207
- return [2 /*return*/];
208
- }
209
- });
210
- });
211
- });
212
- }
213
- /**
214
- * Note: [🟡] This code should never be published outside of `@promptbook/cli`
215
- */
216
-
217
- /**
218
- * Converts PipelineCollection to serialized JSON
219
- *
220
- * Note: Functions `collectionToJson` and `createCollectionFromJson` are complementary
221
- *
222
- * @public exported from `@promptbook/core`
223
- */
224
- function collectionToJson(collection) {
225
- return __awaiter(this, void 0, void 0, function () {
226
- var pipelineUrls, promptbooks;
227
- return __generator(this, function (_a) {
228
- switch (_a.label) {
229
- case 0: return [4 /*yield*/, collection.listPipelines()];
230
- case 1:
231
- pipelineUrls = _a.sent();
232
- return [4 /*yield*/, Promise.all(pipelineUrls.map(function (url) { return collection.getPipelineByUrl(url); }))];
233
- case 2:
234
- promptbooks = _a.sent();
235
- return [2 /*return*/, promptbooks];
236
- }
237
- });
238
- });
239
- }
240
- /**
241
- * TODO: [🧠] Maybe clear `sourceFile` or clear when exposing through API or remote server
242
- */
243
-
244
199
  /**
245
200
  * @@@
246
201
  *
247
- * @returns The same object as the input, but deeply frozen
248
- *
249
202
  * Note: This function mutates the object and returns the original (but mutated-deep-freezed) object
203
+ *
204
+ * @returns The same object as the input, but deeply frozen
205
+ * @public exported from `@promptbook/utils`
250
206
  */
251
207
  function deepFreeze(objectValue) {
252
208
  var e_1, _a;
@@ -273,10 +229,10 @@
273
229
  * @@@
274
230
  * @@@
275
231
  *
276
- * @returns The same object as the input, but deeply frozen
277
- * @public exported from `@promptbook/utils`
278
- *
279
232
  * Note: This function mutates the object and returns the original (but mutated-deep-freezed) object
233
+ *
234
+ * @returns The same object as the input, but deeply frozen
235
+ * @private this is in comparison to `deepFreeze` a more specific utility and maybe not very good practice to use without specific reason and considerations
280
236
  */
281
237
  function deepFreezeWithSameType(objectValue) {
282
238
  return deepFreeze(objectValue);
@@ -285,10 +241,31 @@
285
241
  * TODO: [🧠] Is there a way how to meaningfully test this utility
286
242
  */
287
243
 
244
+ /**
245
+ * Warning message for the generated sections and files files
246
+ *
247
+ * @private within the repository
248
+ */
249
+ var GENERATOR_WARNING = "\u26A0\uFE0F WARNING: This code has been generated so that any manual changes will be overwritten";
250
+ /**
251
+ * Claim for the Promptbook
252
+ *
253
+ * TODO: [🗽] Unite branding and make single place for it
254
+ *
255
+ * @public exported from `@promptbook/core`
256
+ */
257
+ var CLAIM = "Supercharge LLM models with Promptbook";
258
+ /**
259
+ * Warning message for the generated sections and files files
260
+ *
261
+ * @private within the repository
262
+ */
263
+ 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";
264
+ // <- TODO: [🧠] Better system for generator warnings - not always "code" and "by `@promptbook/cli`"
288
265
  /**
289
266
  * The maximum number of iterations for a loops
290
267
  *
291
- * @private within the repository - too low-level in comparison to other `MAX_...`
268
+ * @private within the repository - too low-level in comparison with other `MAX_...`
292
269
  */
293
270
  var LOOP_LIMIT = 1000;
294
271
  /**
@@ -323,6 +300,8 @@
323
300
  var PIPELINE_COLLECTION_BASE_FILENAME = "index";
324
301
  /**
325
302
  * Nonce which is used for replacing things in strings
303
+ *
304
+ * @private within the repository
326
305
  */
327
306
  var REPLACING_NONCE = 'u$k42k%!V2zo34w7Fu#@QUHYPW';
328
307
  /**
@@ -352,12 +331,90 @@
352
331
  * @private within the repository
353
332
  */
354
333
  var RESERVED_PARAMETER_RESTRICTED = 'RESTRICTED-' + REPLACING_NONCE;
355
- /*
356
- TODO: !!! Just testing false-negative detection of [🟡][🟢][🔵][⚪] leak
357
- */
358
- // [🟡][🟢][🔵][⚪]
334
+
359
335
  /**
360
- * TODO: !!!!!! Check that all @private contains some normalized explanation
336
+ * Initializes `about` command for Promptbook CLI utilities
337
+ *
338
+ * @private internal function of `promptbookCli`
339
+ */
340
+ function initializeAboutCommand(program) {
341
+ var _this = this;
342
+ var makeCommand = program.command('about');
343
+ makeCommand.description(spaceTrim__default["default"]("\n Tells about Promptbook CLI and its abilities\n "));
344
+ makeCommand.action(function () { return __awaiter(_this, void 0, void 0, function () {
345
+ return __generator(this, function (_a) {
346
+ console.info(colors__default["default"].cyan("Promptbook"));
347
+ console.info(colors__default["default"].cyan(CLAIM));
348
+ console.info(colors__default["default"].cyan("Version: ".concat(PROMPTBOOK_VERSION)));
349
+ console.info(colors__default["default"].cyan("https://ptbk.io"));
350
+ process.exit(0);
351
+ return [2 /*return*/];
352
+ });
353
+ }); });
354
+ }
355
+ /**
356
+ * TODO: [🗽] Unite branding and make single place for it
357
+ * Note: [🟡] This code should never be published outside of `@promptbook/cli`
358
+ */
359
+
360
+ /**
361
+ * Initializes testing `hello` command for Promptbook CLI utilities
362
+ *
363
+ * @private internal function of `promptbookCli`
364
+ */
365
+ function initializeHelloCommand(program) {
366
+ var _this = this;
367
+ var helloCommand = program.command('hello');
368
+ helloCommand.description(spaceTrim__default["default"]("\n Just command for testing\n "));
369
+ helloCommand.argument('[name]', 'Your name', 'Paul');
370
+ helloCommand.option('-g, --greeting <greeting>', "Greeting", 'Hello');
371
+ helloCommand.action(function (name, _a) {
372
+ var greeting = _a.greeting;
373
+ return __awaiter(_this, void 0, void 0, function () {
374
+ return __generator(this, function (_b) {
375
+ switch (_b.label) {
376
+ case 0:
377
+ console.info(colors__default["default"].cyan("".concat(greeting, " ").concat(name)));
378
+ return [4 /*yield*/, waitasecond.forTime(1000)];
379
+ case 1:
380
+ _b.sent();
381
+ console.info(colors__default["default"].rainbow("Nice to meet you!"));
382
+ process.exit(0);
383
+ return [2 /*return*/];
384
+ }
385
+ });
386
+ });
387
+ });
388
+ }
389
+ /**
390
+ * Note: [🟡] This code should never be published outside of `@promptbook/cli`
391
+ */
392
+
393
+ /**
394
+ * Converts PipelineCollection to serialized JSON
395
+ *
396
+ * Note: Functions `collectionToJson` and `createCollectionFromJson` are complementary
397
+ *
398
+ * @public exported from `@promptbook/core`
399
+ */
400
+ function collectionToJson(collection) {
401
+ return __awaiter(this, void 0, void 0, function () {
402
+ var pipelineUrls, promptbooks;
403
+ return __generator(this, function (_a) {
404
+ switch (_a.label) {
405
+ case 0: return [4 /*yield*/, collection.listPipelines()];
406
+ case 1:
407
+ pipelineUrls = _a.sent();
408
+ return [4 /*yield*/, Promise.all(pipelineUrls.map(function (url) { return collection.getPipelineByUrl(url); }))];
409
+ case 2:
410
+ promptbooks = _a.sent();
411
+ return [2 /*return*/, promptbooks];
412
+ }
413
+ });
414
+ });
415
+ }
416
+ /**
417
+ * TODO: [🧠] Maybe clear `sourceFile` or clear when exposing through API or remote server
361
418
  */
362
419
 
363
420
  /**
@@ -478,7 +535,7 @@
478
535
  var contentLanguage = 'text';
479
536
  if (blockType === 'PROMPT_TEMPLATE') {
480
537
  var modelRequirements = promptTemplate.modelRequirements;
481
- var modelName = modelRequirements.modelName, modelVariant = modelRequirements.modelVariant;
538
+ var _l = modelRequirements || {}, modelName = _l.modelName, modelVariant = _l.modelVariant;
482
539
  commands_1.push("EXECUTE PROMPT TEMPLATE");
483
540
  if (modelVariant) {
484
541
  commands_1.push("MODEL VARIANT ".concat(capitalize(modelVariant)));
@@ -536,8 +593,8 @@
536
593
  } /* not else */
537
594
  if (expectations) {
538
595
  try {
539
- for (var _l = (e_6 = void 0, __values(Object.entries(expectations))), _m = _l.next(); !_m.done; _m = _l.next()) {
540
- var _o = __read(_m.value, 2), unit = _o[0], _p = _o[1], min = _p.min, max = _p.max;
596
+ for (var _m = (e_6 = void 0, __values(Object.entries(expectations))), _o = _m.next(); !_o.done; _o = _m.next()) {
597
+ var _p = __read(_o.value, 2), unit = _p[0], _q = _p[1], min = _q.min, max = _q.max;
541
598
  if (min === max) {
542
599
  commands_1.push("EXPECT EXACTLY ".concat(min, " ").concat(capitalize(unit + (min > 1 ? 's' : ''))));
543
600
  }
@@ -554,7 +611,7 @@
554
611
  catch (e_6_1) { e_6 = { error: e_6_1 }; }
555
612
  finally {
556
613
  try {
557
- if (_m && !_m.done && (_f = _l.return)) _f.call(_l);
614
+ if (_o && !_o.done && (_f = _m.return)) _f.call(_m);
558
615
  }
559
616
  finally { if (e_6) throw e_6.error; }
560
617
  }
@@ -589,7 +646,7 @@
589
646
  return pipelineString;
590
647
  }
591
648
  /**
592
- * @private internal util of pipelineJsonToString
649
+ * @private internal utility of `pipelineJsonToString`
593
650
  */
594
651
  function promptTemplateParameterJsonToString(promptTemplateParameterJson) {
595
652
  var name = promptTemplateParameterJson.name, description = promptTemplateParameterJson.description;
@@ -604,6 +661,7 @@
604
661
  * TODO: [🧠] Is there a way to auto-detect missing features in pipelineJsonToString
605
662
  * TODO: [🏛] Maybe make some markdown builder
606
663
  * TODO: [🏛] Escape all
664
+ * TODO: [🧠] Should be in generated .ptbk.md file GENERATOR_WARNING
607
665
  */
608
666
 
609
667
  /**
@@ -802,7 +860,7 @@
802
860
  });
803
861
  }
804
862
 
805
- var PipelineCollection = [{title:"Prepare Knowledge from Markdown",pipelineUrl:"https://promptbook.studio/promptbook/prepare-knowledge-from-markdown.ptbk.md",promptbookVersion:"0.62.0",parameters:[{name:"knowledgeContent",description:"Markdown document content",isInput:true,isOutput:false},{name:"knowledgePieces",description:"The knowledge JSON object",isInput:false,isOutput:true}],promptTemplates:[{blockType:"PROMPT_TEMPLATE",name:"knowledge",title:"Knowledge",modelRequirements:{modelVariant:"CHAT",modelName:"claude-3-opus-20240229"},content:"You are experienced data researcher, extract the important knowledge from the document.\n\n# Rules\n\n- Make pieces of information concise, clear, and easy to understand\n- One piece of information should be approximately 1 paragraph\n- Divide the paragraphs by markdown horizontal lines ---\n- Omit irrelevant information\n- Group redundant information\n- Write just extracted information, nothing else\n\n# The document\n\nTake information from this document:\n\n> {knowledgeContent}",dependentParameterNames:["knowledgeContent"],resultingParameterName:"knowledgePieces"}],knowledgeSources:[],knowledgePieces:[],personas:[],preparations:[{id:1,promptbookVersion:"0.62.0",usage:{price:{value:0},input:{tokensCount:{value:0},charactersCount:{value:0},wordsCount:{value:0},sentencesCount:{value:0},linesCount:{value:0},paragraphsCount:{value:0},pagesCount:{value:0}},output:{tokensCount:{value:0},charactersCount:{value:0},wordsCount:{value:0},sentencesCount:{value:0},linesCount:{value:0},paragraphsCount:{value:0},pagesCount:{value:0}}}}],sourceFile:"./promptbook-collection/prepare-knowledge-from-markdown.ptbk.md"},{title:"Prepare Keywords",pipelineUrl:"https://promptbook.studio/promptbook/prepare-knowledge-keywords.ptbk.md",promptbookVersion:"0.62.0",parameters:[{name:"knowledgePieceContent",description:"The content",isInput:true,isOutput:false},{name:"keywords",description:"Keywords separated by comma",isInput:false,isOutput:true}],promptTemplates:[{blockType:"PROMPT_TEMPLATE",name:"knowledge",title:"Knowledge",modelRequirements:{modelVariant:"CHAT",modelName:"claude-3-opus-20240229"},content:"You are experienced data researcher, detect the important keywords in the document.\n\n# Rules\n\n- Write just keywords separated by comma\n\n# The document\n\nTake information from this document:\n\n> {knowledgePieceContent}",dependentParameterNames:["knowledgePieceContent"],resultingParameterName:"keywords"}],knowledgeSources:[],knowledgePieces:[],personas:[],preparations:[{id:1,promptbookVersion:"0.62.0",usage:{price:{value:0},input:{tokensCount:{value:0},charactersCount:{value:0},wordsCount:{value:0},sentencesCount:{value:0},linesCount:{value:0},paragraphsCount:{value:0},pagesCount:{value:0}},output:{tokensCount:{value:0},charactersCount:{value:0},wordsCount:{value:0},sentencesCount:{value:0},linesCount:{value:0},paragraphsCount:{value:0},pagesCount:{value:0}}}}],sourceFile:"./promptbook-collection/prepare-knowledge-keywords.ptbk.md"},{title:"Prepare Title",pipelineUrl:"https://promptbook.studio/promptbook/prepare-knowledge-title.ptbk.md",promptbookVersion:"0.62.0",parameters:[{name:"knowledgePieceContent",description:"The content",isInput:true,isOutput:false},{name:"title",description:"The title of the document",isInput:false,isOutput:true}],promptTemplates:[{blockType:"PROMPT_TEMPLATE",name:"knowledge",title:"Knowledge",modelRequirements:{modelVariant:"CHAT",modelName:"claude-3-opus-20240229"},content:"You are experienced content creator, write best title for the document.\n\n# Rules\n\n- Write just title, nothing else\n- Title should be concise and clear\n- Write maximum 5 words for the title\n\n# The document\n\n> {knowledgePieceContent}",expectations:{words:{min:1,max:8}},dependentParameterNames:["knowledgePieceContent"],resultingParameterName:"title"}],knowledgeSources:[],knowledgePieces:[],personas:[],preparations:[{id:1,promptbookVersion:"0.62.0",usage:{price:{value:0},input:{tokensCount:{value:0},charactersCount:{value:0},wordsCount:{value:0},sentencesCount:{value:0},linesCount:{value:0},paragraphsCount:{value:0},pagesCount:{value:0}},output:{tokensCount:{value:0},charactersCount:{value:0},wordsCount:{value:0},sentencesCount:{value:0},linesCount:{value:0},paragraphsCount:{value:0},pagesCount:{value:0}}}}],sourceFile:"./promptbook-collection/prepare-knowledge-title.ptbk.md"},{title:"Prepare Keywords",pipelineUrl:"https://promptbook.studio/promptbook/prepare-persona.ptbk.md",promptbookVersion:"0.62.0",parameters:[{name:"availableModelNames",description:"List of available model names separated by comma (,)",isInput:true,isOutput:false},{name:"personaDescription",description:"Description of the persona",isInput:true,isOutput:false},{name:"modelRequirements",description:"Specific requirements for the model",isInput:false,isOutput:true}],promptTemplates:[{blockType:"PROMPT_TEMPLATE",name:"make-model-requirements",title:"Make modelRequirements",modelRequirements:{modelVariant:"CHAT",modelName:"gpt-4-turbo"},content:"You are experienced AI engineer, you need to create virtual assistant.\nWrite\n\n## Sample\n\n```json\n{\n\"modelName\": \"gpt-4o\",\n\"systemMessage\": \"You are experienced AI engineer and helpfull assistant.\",\n\"temperature\": 0.7\n}\n```\n\n## Instructions\n\n### Option `modelName`\n\nPick from the following models:\n\n- {availableModelNames}\n\n### Option `systemMessage`\n\nThe system message is used to communicate instructions or provide context to the model at the beginning of a conversation. It is displayed in a different format compared to user messages, helping the model understand its role in the conversation. The system message typically guides the model's behavior, sets the tone, or specifies desired output from the model. By utilizing the system message effectively, users can steer the model towards generating more accurate and relevant responses.\n\nFor example:\n\n> You are an experienced AI engineer and helpful assistant.\n\n> You are a friendly and knowledgeable chatbot.\n\n### Option `temperature`\n\nThe sampling temperature, between 0 and 1. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic. If set to 0, the model will use log probability to automatically increase the temperature until certain thresholds are hit.\n\nYou can pick a value between 0 and 2. For example:\n\n- `0.1`: Low temperature, extremely conservative and deterministic\n- `0.5`: Medium temperature, balanced between conservative and creative\n- `1.0`: High temperature, creative and bit random\n- `1.5`: Very high temperature, extremely creative and often chaotic and unpredictable\n- `2.0`: Maximum temperature, completely random and unpredictable, for some extreme creative use cases\n\n# The assistant\n\nTake this description of the persona:\n\n> {personaDescription}",expectFormat:"JSON",dependentParameterNames:["availableModelNames","personaDescription"],resultingParameterName:"modelRequirements"}],knowledgeSources:[],knowledgePieces:[],personas:[],preparations:[{id:1,promptbookVersion:"0.62.0",usage:{price:{value:0},input:{tokensCount:{value:0},charactersCount:{value:0},wordsCount:{value:0},sentencesCount:{value:0},linesCount:{value:0},paragraphsCount:{value:0},pagesCount:{value:0}},output:{tokensCount:{value:0},charactersCount:{value:0},wordsCount:{value:0},sentencesCount:{value:0},linesCount:{value:0},paragraphsCount:{value:0},pagesCount:{value:0}}}}],sourceFile:"./promptbook-collection/prepare-persona.ptbk.md"}];
863
+ 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"}];
806
864
 
807
865
  /**
808
866
  * This error indicates that the promptbook in a markdown format cannot be parsed into a valid promptbook object
@@ -1100,9 +1158,6 @@
1100
1158
  throw new PipelineLogicError(spaceTrim.spaceTrim(function (block) { return "\n Parameter name {".concat(template.resultingParameterName, "} is reserved, please use different name\n\n ").concat(block(pipelineIdentification), "\n "); }));
1101
1159
  }
1102
1160
  definedParameters.add(template.resultingParameterName);
1103
- if (template.blockType === 'PROMPT_TEMPLATE' && template.modelRequirements.modelVariant === undefined) {
1104
- throw new PipelineLogicError(spaceTrim.spaceTrim(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 "); }));
1105
- }
1106
1161
  if (template.jokerParameterNames && template.jokerParameterNames.length > 0) {
1107
1162
  if (!template.expectFormat &&
1108
1163
  !template.expectations /* <- TODO: Require at least 1 -> min <- expectation to use jokers */) {
@@ -1336,7 +1391,7 @@
1336
1391
  * Library of pipelines that groups together pipelines for an application.
1337
1392
  * This implementation is a very thin wrapper around the Array / Map of pipelines.
1338
1393
  *
1339
- * @private use `createCollectionFromJson` instead
1394
+ * @private internal function of `createCollectionFromJson`, use `createCollectionFromJson` instead
1340
1395
  * @see https://github.com/webgptorg/pipeline#pipeline-collection
1341
1396
  */
1342
1397
  var SimplePipelineCollection = /** @class */ (function () {
@@ -1345,7 +1400,6 @@
1345
1400
  *
1346
1401
  * @param pipelines @@@
1347
1402
  *
1348
- * @private Use instead `createCollectionFromJson`
1349
1403
  * Note: During the construction logic of all pipelines are validated
1350
1404
  * Note: It is not recommended to use this constructor directly, use `createCollectionFromJson` *(or other variant)* instead
1351
1405
  */
@@ -1960,7 +2014,8 @@
1960
2014
  /**
1961
2015
  * This error occurs when some expectation is not met in the execution of the pipeline
1962
2016
  *
1963
- * @private Always catched and rethrown as `PipelineExecutionError`
2017
+ * @private error of `checkExpectations` and `createPipelineExecutor`
2018
+ * Note: Always thrown in `checkExpectations` and catched in `createPipelineExecutor` and rethrown as `PipelineExecutionError`
1964
2019
  * Note: This is a kindof subtype of PipelineExecutionError
1965
2020
  */
1966
2021
  var ExpectError = /** @class */ (function (_super) {
@@ -1998,7 +2053,7 @@
1998
2053
  /**
1999
2054
  * Multiple LLM Execution Tools is a proxy server that uses multiple execution tools internally and exposes the executor interface externally.
2000
2055
  *
2001
- * @private Internal utility of `joinLlmExecutionTools`
2056
+ * @private internal utility of `joinLlmExecutionTools`
2002
2057
  */
2003
2058
  var MultipleLlmExecutionTools = /** @class */ (function () {
2004
2059
  /**
@@ -2281,7 +2336,7 @@
2281
2336
  * 2) Undefined returns empty array
2282
2337
  * 3) Array returns itself
2283
2338
  *
2284
- * @private Internal utility
2339
+ * @private internal utility
2285
2340
  */
2286
2341
  function arrayableToArray(input) {
2287
2342
  if (input === undefined) {
@@ -2579,7 +2634,7 @@
2579
2634
  *
2580
2635
  * @throws {ExpectError} if the expectations are not met
2581
2636
  * @returns {void} Nothing
2582
- * @public exported from `@promptbook/core`
2637
+ * @private internal function of `createPipelineExecutor`
2583
2638
  */
2584
2639
  function checkExpectations(expectations, value) {
2585
2640
  var e_1, _a;
@@ -4260,7 +4315,9 @@
4260
4315
 
4261
4316
  /**
4262
4317
  * Units of text measurement
4318
+ *
4263
4319
  * @see https://github.com/webgptorg/promptbook/discussions/30
4320
+ * @public exported from `@promptbook/core`
4264
4321
  */
4265
4322
  var EXPECTATION_UNITS = ['CHARACTERS', 'WORDS', 'SENTENCES', 'LINES', 'PARAGRAPHS', 'PAGES'];
4266
4323
  /**
@@ -4500,7 +4557,7 @@
4500
4557
  /**
4501
4558
  * @@@
4502
4559
  *
4503
- * @private for `ModelVariant` and `modelCommandParser`
4560
+ * @public exported from `@promptbook/core`
4504
4561
  */
4505
4562
  var MODEL_VARIANTS = ['COMPLETION', 'CHAT', 'EMBEDDING' /* <- TODO [🏳] */ /* <- [🤖] */];
4506
4563
 
@@ -4965,11 +5022,12 @@
4965
5022
  };
4966
5023
  /**
4967
5024
  * TODO: [💐] Implement BOILERPLATE command into `pipelineStringToJsonSync` function
4968
- * Note: [⚪] This should never be in any released package
4969
5025
  */
4970
5026
 
4971
5027
  /**
4972
5028
  * All available command parsers
5029
+ *
5030
+ * @private internal index of `parseCommand`
4973
5031
  */
4974
5032
  var COMMANDS = [
4975
5033
  blockCommandParser,
@@ -5139,6 +5197,8 @@
5139
5197
 
5140
5198
  /**
5141
5199
  * Supported script languages
5200
+ *
5201
+ * @private internal base for `ScriptLanguage`
5142
5202
  */
5143
5203
  var SUPPORTED_SCRIPT_LANGUAGES = ['javascript', 'typescript', 'python'];
5144
5204
 
@@ -5279,7 +5339,7 @@
5279
5339
  return codeBlocks[0];
5280
5340
  }
5281
5341
  /***
5282
- * TODO: [🍓][🌻] Decide of this is internal util, external util OR validator/postprocessor
5342
+ * TODO: [🍓][🌻] Decide of this is internal utility, external util OR validator/postprocessor
5283
5343
  */
5284
5344
 
5285
5345
  /**
@@ -5878,6 +5938,7 @@
5878
5938
  /**
5879
5939
  * TODO: [🏏] Leverage the batch API and build queues @see https://platform.openai.com/docs/guides/batch
5880
5940
  * TODO: [🛠] Actions, instruments (and maybe knowledge) => Functions and tools
5941
+ * TODO: [🧠] Should be in generated JSON file GENERATOR_WARNING
5881
5942
  */
5882
5943
 
5883
5944
  /**
@@ -5896,6 +5957,145 @@
5896
5957
  return CollectionError;
5897
5958
  }(Error));
5898
5959
 
5960
+ /**
5961
+ * Checks if the file exists
5962
+ *
5963
+ * @private within the repository
5964
+ */
5965
+ function isFileExisting(filePath) {
5966
+ return __awaiter(this, void 0, void 0, function () {
5967
+ var isReadAccessAllowed, isFile;
5968
+ return __generator(this, function (_a) {
5969
+ switch (_a.label) {
5970
+ case 0: return [4 /*yield*/, promises.access(filePath, promises.constants.R_OK)
5971
+ .then(function () { return true; })
5972
+ .catch(function () { return false; })];
5973
+ case 1:
5974
+ isReadAccessAllowed = _a.sent();
5975
+ if (!isReadAccessAllowed) {
5976
+ return [2 /*return*/, false];
5977
+ }
5978
+ return [4 /*yield*/, promises.stat(filePath)
5979
+ .then(function (fileStat) { return fileStat.isFile(); })
5980
+ .catch(function () { return false; })];
5981
+ case 2:
5982
+ isFile = _a.sent();
5983
+ return [2 /*return*/, isFile];
5984
+ }
5985
+ });
5986
+ });
5987
+ }
5988
+ /**
5989
+ * Note: [🟢] This code should never be published outside of `@promptbook/node` and `@promptbook/cli` and `@promptbook/cli`
5990
+ * TODO: [🐠] This can be a validator - with variants that return true/false and variants that throw errors with meaningless messages
5991
+ * TODO: [🖇] What about symlinks?
5992
+ */
5993
+
5994
+ /**
5995
+ * Checks if the directory exists
5996
+ *
5997
+ * @private within the repository
5998
+ */
5999
+ function isDirectoryExisting(directoryPath) {
6000
+ return __awaiter(this, void 0, void 0, function () {
6001
+ var isReadAccessAllowed, isDirectory;
6002
+ return __generator(this, function (_a) {
6003
+ switch (_a.label) {
6004
+ case 0: return [4 /*yield*/, promises.access(directoryPath, promises.constants.R_OK)
6005
+ .then(function () { return true; })
6006
+ .catch(function () { return false; })];
6007
+ case 1:
6008
+ isReadAccessAllowed = _a.sent();
6009
+ if (!isReadAccessAllowed) {
6010
+ return [2 /*return*/, false];
6011
+ }
6012
+ return [4 /*yield*/, promises.stat(directoryPath)
6013
+ .then(function (fileStat) { return fileStat.isDirectory(); })
6014
+ .catch(function () { return false; })];
6015
+ case 2:
6016
+ isDirectory = _a.sent();
6017
+ return [2 /*return*/, isDirectory];
6018
+ }
6019
+ });
6020
+ });
6021
+ }
6022
+ /**
6023
+ * Note: [🟢] This code should never be published outside of `@promptbook/node` and `@promptbook/cli` and `@promptbook/cli`
6024
+ * TODO: [🐠] This can be a validator - with variants that return true/false and variants that throw errors with meaningless messages
6025
+ * TODO: [🧠][📂] "directory" vs "folder"
6026
+ * TODO: [🖇] What about symlinks?
6027
+ */
6028
+
6029
+ /**
6030
+ * Reads all files in the directory
6031
+ *
6032
+ * @param path
6033
+ * @param isRecursive
6034
+ * @returns List of all files in the directory
6035
+ * @private internal function of `createCollectionFromDirectory`
6036
+ */
6037
+ function listAllFiles(path, isRecursive) {
6038
+ return __awaiter(this, void 0, void 0, function () {
6039
+ var dirents, fileNames, _a, _b, dirent, subPath, _c, _d, _e, _f, e_1_1;
6040
+ var e_1, _g;
6041
+ return __generator(this, function (_h) {
6042
+ switch (_h.label) {
6043
+ case 0: return [4 /*yield*/, isDirectoryExisting(path)];
6044
+ case 1:
6045
+ if (!(_h.sent())) {
6046
+ throw new Error("Directory \"".concat(path, "\" does not exist or is not readable"));
6047
+ // <- TODO: Use some custom error class
6048
+ }
6049
+ return [4 /*yield*/, promises.readdir(path, {
6050
+ withFileTypes: true /* Note: This is not working: recursive: isRecursive */,
6051
+ })];
6052
+ case 2:
6053
+ dirents = _h.sent();
6054
+ fileNames = dirents.filter(function (dirent) { return dirent.isFile(); }).map(function (_a) {
6055
+ var name = _a.name;
6056
+ return posix.join(path, name);
6057
+ });
6058
+ if (!isRecursive) return [3 /*break*/, 10];
6059
+ _h.label = 3;
6060
+ case 3:
6061
+ _h.trys.push([3, 8, 9, 10]);
6062
+ _a = __values(dirents.filter(function (dirent) { return dirent.isDirectory(); })), _b = _a.next();
6063
+ _h.label = 4;
6064
+ case 4:
6065
+ if (!!_b.done) return [3 /*break*/, 7];
6066
+ dirent = _b.value;
6067
+ subPath = posix.join(path, dirent.name);
6068
+ _d = (_c = fileNames.push).apply;
6069
+ _e = [fileNames];
6070
+ _f = [[]];
6071
+ return [4 /*yield*/, listAllFiles(subPath, isRecursive)];
6072
+ case 5:
6073
+ _d.apply(_c, _e.concat([__spreadArray.apply(void 0, _f.concat([__read.apply(void 0, [(_h.sent())]), false]))]));
6074
+ _h.label = 6;
6075
+ case 6:
6076
+ _b = _a.next();
6077
+ return [3 /*break*/, 4];
6078
+ case 7: return [3 /*break*/, 10];
6079
+ case 8:
6080
+ e_1_1 = _h.sent();
6081
+ e_1 = { error: e_1_1 };
6082
+ return [3 /*break*/, 10];
6083
+ case 9:
6084
+ try {
6085
+ if (_b && !_b.done && (_g = _a.return)) _g.call(_a);
6086
+ }
6087
+ finally { if (e_1) throw e_1.error; }
6088
+ return [7 /*endfinally*/];
6089
+ case 10: return [2 /*return*/, fileNames];
6090
+ }
6091
+ });
6092
+ });
6093
+ }
6094
+ /**
6095
+ * Note: [🟢] This code should never be published outside of `@promptbook/node` and `@promptbook/cli` and `@promptbook/cli`
6096
+ * TODO: [🖇] What about symlinks?
6097
+ */
6098
+
5899
6099
  /**
5900
6100
  * Constructs Promptbook from async sources
5901
6101
  * It can be one of the following:
@@ -5995,7 +6195,7 @@
5995
6195
  */
5996
6196
  function createCollectionFromDirectory(path$1, options) {
5997
6197
  return __awaiter(this, void 0, void 0, function () {
5998
- var makedLibraryFilePath, makedLibraryFileExists, _a, _b, isRecursive, _c, isVerbose, _d, isLazyLoaded, _e, isCrashedOnError, collection;
6198
+ var makedLibraryFilePath, _a, _b, isRecursive, _c, isVerbose, _d, isLazyLoaded, _e, isCrashedOnError, collection;
5999
6199
  var _this = this;
6000
6200
  return __generator(this, function (_f) {
6001
6201
  switch (_f.label) {
@@ -6004,12 +6204,9 @@
6004
6204
  throw new Error('Function `createCollectionFromDirectory` can only be run in Node.js environment because it reads the file system.');
6005
6205
  }
6006
6206
  makedLibraryFilePath = path.join(path$1, "".concat(PIPELINE_COLLECTION_BASE_FILENAME, ".json"));
6007
- return [4 /*yield*/, promises.access(makedLibraryFilePath, promises.constants.R_OK)
6008
- .then(function () { return true; })
6009
- .catch(function () { return false; })];
6207
+ return [4 /*yield*/, isFileExisting(makedLibraryFilePath)];
6010
6208
  case 1:
6011
- makedLibraryFileExists = _f.sent();
6012
- if (!makedLibraryFileExists) {
6209
+ if (!(_f.sent())) {
6013
6210
  console.info(colors__default["default"].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.")));
6014
6211
  }
6015
6212
  else {
@@ -6172,66 +6369,8 @@
6172
6369
  });
6173
6370
  }
6174
6371
  /**
6175
- * Reads all files in the directory
6176
- *
6177
- * @param path
6178
- * @param isRecursive
6179
- * @returns List of all files in the directory
6180
- * @private internal function for `createCollectionFromDirectory`
6181
- */
6182
- function listAllFiles(path$1, isRecursive) {
6183
- return __awaiter(this, void 0, void 0, function () {
6184
- var dirents, fileNames, _a, _b, dirent, subPath, _c, _d, _e, _f, e_2_1;
6185
- var e_2, _g;
6186
- return __generator(this, function (_h) {
6187
- switch (_h.label) {
6188
- case 0: return [4 /*yield*/, promises.readdir(path$1, {
6189
- withFileTypes: true /* Note: This is not working: recursive: isRecursive */,
6190
- })];
6191
- case 1:
6192
- dirents = _h.sent();
6193
- fileNames = dirents.filter(function (dirent) { return dirent.isFile(); }).map(function (_a) {
6194
- var name = _a.name;
6195
- return path.join(path$1, name);
6196
- });
6197
- if (!isRecursive) return [3 /*break*/, 9];
6198
- _h.label = 2;
6199
- case 2:
6200
- _h.trys.push([2, 7, 8, 9]);
6201
- _a = __values(dirents.filter(function (dirent) { return dirent.isDirectory(); })), _b = _a.next();
6202
- _h.label = 3;
6203
- case 3:
6204
- if (!!_b.done) return [3 /*break*/, 6];
6205
- dirent = _b.value;
6206
- subPath = path.join(path$1, dirent.name);
6207
- _d = (_c = fileNames.push).apply;
6208
- _e = [fileNames];
6209
- _f = [[]];
6210
- return [4 /*yield*/, listAllFiles(subPath, isRecursive)];
6211
- case 4:
6212
- _d.apply(_c, _e.concat([__spreadArray.apply(void 0, _f.concat([__read.apply(void 0, [(_h.sent())]), false]))]));
6213
- _h.label = 5;
6214
- case 5:
6215
- _b = _a.next();
6216
- return [3 /*break*/, 3];
6217
- case 6: return [3 /*break*/, 9];
6218
- case 7:
6219
- e_2_1 = _h.sent();
6220
- e_2 = { error: e_2_1 };
6221
- return [3 /*break*/, 9];
6222
- case 8:
6223
- try {
6224
- if (_b && !_b.done && (_g = _a.return)) _g.call(_a);
6225
- }
6226
- finally { if (e_2) throw e_2.error; }
6227
- return [7 /*endfinally*/];
6228
- case 9: return [2 /*return*/, fileNames];
6229
- }
6230
- });
6231
- });
6232
- }
6233
- /**
6234
- * Note: [🟢] This code should never be published outside of `@pipeline/node`
6372
+ * Note: [🟢] This code should never be published outside of `@promptbook/node` and `@promptbook/cli` and `@promptbook/cli`
6373
+ * TODO: [🖇] What about symlinks? Maybe option isSymlinksFollowed
6235
6374
  */
6236
6375
 
6237
6376
  /**
@@ -6303,22 +6442,6 @@
6303
6442
  * TODO: [🏛] Maybe make some markdown builder
6304
6443
  */
6305
6444
 
6306
- /**
6307
- * This error type indicates that you try to use a feature that is not available in the current environment
6308
- *
6309
- * @public exported from `@promptbook/core`
6310
- */
6311
- var EnvironmentMismatchError = /** @class */ (function (_super) {
6312
- __extends(EnvironmentMismatchError, _super);
6313
- function EnvironmentMismatchError(message) {
6314
- var _this = _super.call(this, message) || this;
6315
- _this.name = 'EnvironmentMismatchError';
6316
- Object.setPrototypeOf(_this, EnvironmentMismatchError.prototype);
6317
- return _this;
6318
- }
6319
- return EnvironmentMismatchError;
6320
- }(Error));
6321
-
6322
6445
  /**
6323
6446
  * @@@
6324
6447
  *
@@ -6353,17 +6476,14 @@
6353
6476
  */
6354
6477
  FilesStorage.prototype.getItem = function (key) {
6355
6478
  return __awaiter(this, void 0, void 0, function () {
6356
- var filename, isFileExisting, fileContent, value;
6479
+ var filename, fileContent, value;
6357
6480
  return __generator(this, function (_a) {
6358
6481
  switch (_a.label) {
6359
6482
  case 0:
6360
6483
  filename = this.getFilenameForKey(key);
6361
- return [4 /*yield*/, promises.stat(filename)
6362
- .then(function (fileStat) { return fileStat.isFile(); })
6363
- .catch(function () { return false; })];
6484
+ return [4 /*yield*/, isFileExisting(filename)];
6364
6485
  case 1:
6365
- isFileExisting = _a.sent();
6366
- if (!isFileExisting) {
6486
+ if (!(_a.sent())) {
6367
6487
  return [2 /*return*/, null];
6368
6488
  }
6369
6489
  return [4 /*yield*/, promises.readFile(filename, 'utf-8')];
@@ -6422,7 +6542,7 @@
6422
6542
  }());
6423
6543
  /**
6424
6544
  * TODO: [🌗] Maybe some checkers, not all valid JSONs are desired and valid values
6425
- * Note: [🟢] This code should never be published outside of `@promptbook/node`
6545
+ * Note: [🟢] This code should never be published outside of `@promptbook/node` and `@promptbook/cli` and `@promptbook/cli`
6426
6546
  */
6427
6547
 
6428
6548
  /**
@@ -6431,7 +6551,7 @@
6431
6551
  * @param content the content of prompt or response
6432
6552
  * @returns part of PromptResultUsageCounts
6433
6553
  *
6434
- * @private internal util of LlmExecutionTools
6554
+ * @private internal utility of LlmExecutionTools
6435
6555
  */
6436
6556
  function computeUsageCounts(content) {
6437
6557
  return {
@@ -6461,7 +6581,7 @@
6461
6581
  /**
6462
6582
  * Get current date in ISO 8601 format
6463
6583
  *
6464
- * @private This is internal util of the promptbook
6584
+ * @private internal utility
6465
6585
  */
6466
6586
  function getCurrentIsoDate() {
6467
6587
  return new Date().toISOString();
@@ -6483,6 +6603,7 @@
6483
6603
  * Note: Done at 2024-05-25
6484
6604
  *
6485
6605
  * @see https://docs.anthropic.com/en/docs/models-overview
6606
+ * @public exported from `@promptbook/anthropic-claude`
6486
6607
  */
6487
6608
  var ANTHROPIC_CLAUDE_MODELS = [
6488
6609
  {
@@ -7129,7 +7250,7 @@
7129
7250
  * @param resultContent The content of the result (for embedding prompts or failed prompts pass empty string)
7130
7251
  * @param rawResponse The raw response from OpenAI API
7131
7252
  * @throws {PipelineExecutionError} If the usage is not defined in the response from OpenAI
7132
- * @private internal util of `OpenAiExecutionTools`
7253
+ * @private internal utility of `OpenAiExecutionTools`
7133
7254
  */
7134
7255
  function computeOpenaiUsage(promptContent, // <- Note: Intentionally using [] to access type properties to bring jsdoc from Prompt/PromptResult to consumer
7135
7256
  resultContent, rawResponse) {
@@ -7511,7 +7632,7 @@
7511
7632
  * TODO: [🧠] Which name is better `createLlmToolsFromEnv` or `createLlmToolsFromEnvironment`?
7512
7633
  * TODO: [🧠] Is there some meaningfull way how to test this util
7513
7634
  * TODO: [🧠] Maybe pass env as argument
7514
- * Note: [🟢] This code should never be published outside of `@promptbook/node`
7635
+ * Note: [🟢] This code should never be published outside of `@promptbook/node` and `@promptbook/cli` and `@promptbook/cli`
7515
7636
  * TODO: [👷‍♂️] @@@ Manual about construction of llmTools
7516
7637
  */
7517
7638
 
@@ -7713,14 +7834,16 @@
7713
7834
  /**
7714
7835
  * Initializes `make` command for Promptbook CLI utilities
7715
7836
  *
7716
- * @private part of `promptbookCli`
7837
+ * @private internal function of `promptbookCli`
7717
7838
  */
7718
7839
  function initializeMakeCommand(program) {
7719
7840
  var _this = this;
7720
7841
  var makeCommand = program.command('make');
7721
7842
  makeCommand.description(spaceTrim__default["default"]("\n Makes a new pipeline collection in given folder\n "));
7722
- makeCommand.argument('<path>', 'Path to promptbook directory');
7723
- makeCommand.option('--project-name', "Name of the project for whom collection is", 'Project');
7843
+ makeCommand.argument('[path]',
7844
+ // <- TODO: [🧟‍♂️] Unite path to promptbook collection argument
7845
+ 'Path to promptbook directory', './promptbook-collection');
7846
+ makeCommand.option('--project-name', "Name of the project for whom collection is", 'Untitled Promptbook project');
7724
7847
  makeCommand.option('-f, --format <format>', spaceTrim__default["default"]("\n Output format of builded collection \"javascript\", \"typescript\" or \"json\"\n\n Note: You can use multiple formats separated by comma\n "), 'javascript' /* <- Note: [🏳‍🌈] */);
7725
7848
  makeCommand.option('--no-validation', "Do not validate logic of pipelines in collection", true);
7726
7849
  makeCommand.option('--validation', "Types of validations separated by comma (options \"logic\",\"imports\")", 'logic,imports');
@@ -7730,7 +7853,7 @@
7730
7853
  makeCommand.action(function (path$1, _a) {
7731
7854
  var projectName = _a.projectName, format = _a.format, validation = _a.validation, reloadCache = _a.reloadCache, verbose = _a.verbose, outFile = _a.outFile;
7732
7855
  return __awaiter(_this, void 0, void 0, function () {
7733
- 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;
7856
+ 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;
7734
7857
  var e_2, _d, e_1, _e;
7735
7858
  var _this = this;
7736
7859
  return __generator(this, function (_f) {
@@ -7747,7 +7870,7 @@
7747
7870
  .map(function (_) { return _.trim(); })
7748
7871
  .filter(function (_) { return _ !== ''; });
7749
7872
  if (outFile !== PIPELINE_COLLECTION_BASE_FILENAME && formats.length !== 1) {
7750
- console.error(colors__default["default"].red("You can use only one format when saving to a file"));
7873
+ console.error(colors__default["default"].red("You can only use one format if you specify --out-file"));
7751
7874
  process.exit(1);
7752
7875
  }
7753
7876
  llmTools = getLlmToolsForCli({
@@ -7821,7 +7944,18 @@
7821
7944
  case 16: return [4 /*yield*/, collectionToJson(collection)];
7822
7945
  case 17:
7823
7946
  collectionJson = _f.sent();
7824
- collectionJsonString = stringifyPipelineJson(collectionJson);
7947
+ collectionJsonString = stringifyPipelineJson(collectionJson).trim();
7948
+ collectionJsonItems = (function () {
7949
+ var firstChar = collectionJsonString.charAt(0);
7950
+ if (firstChar !== '[') {
7951
+ throw new UnexpectedError("First character of serialized collection should be \"[\" not \"".concat(firstChar, "\""));
7952
+ }
7953
+ var lastChar = collectionJsonString.charAt(collectionJsonString.length - 1);
7954
+ if (lastChar !== ']') {
7955
+ throw new UnexpectedError("Last character of serialized collection should be \"]\" not \"".concat(lastChar, "\""));
7956
+ }
7957
+ return spaceTrim__default["default"](collectionJsonString.substring(1, collectionJsonString.length - 1));
7958
+ })();
7825
7959
  saveFile = function (extension, content) { return __awaiter(_this, void 0, void 0, function () {
7826
7960
  var filePath;
7827
7961
  return __generator(this, function (_a) {
@@ -7846,23 +7980,29 @@
7846
7980
  });
7847
7981
  }); };
7848
7982
  if (!formats.includes('json')) return [3 /*break*/, 19];
7983
+ formats = formats.filter(function (format) { return format !== 'json'; });
7849
7984
  return [4 /*yield*/, saveFile('json', collectionJsonString)];
7850
7985
  case 18:
7851
7986
  _f.sent();
7852
7987
  _f.label = 19;
7853
7988
  case 19:
7854
- if (!formats.includes('javascript')) return [3 /*break*/, 21];
7855
- return [4 /*yield*/, saveFile('js', spaceTrim__default["default"]("\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'))];
7989
+ if (!(formats.includes('javascript') || formats.includes('js'))) return [3 /*break*/, 21];
7990
+ formats = formats.filter(function (format) { return format !== 'javascript' && format !== 'js'; });
7991
+ return [4 /*yield*/, saveFile('js', spaceTrim__default["default"](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 "); }))];
7856
7992
  case 20:
7857
- _f.sent();
7993
+ (_f.sent()) + '\n';
7858
7994
  _f.label = 21;
7859
7995
  case 21:
7860
- if (!formats.includes('typescript')) return [3 /*break*/, 23];
7861
- return [4 /*yield*/, saveFile('ts', spaceTrim__default["default"]("\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'))];
7996
+ if (!(formats.includes('typescript') || formats.includes('ts'))) return [3 /*break*/, 23];
7997
+ formats = formats.filter(function (format) { return format !== 'typescript' && format !== 'ts'; });
7998
+ return [4 /*yield*/, saveFile('ts', spaceTrim__default["default"](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')];
7862
7999
  case 22:
7863
8000
  _f.sent();
7864
8001
  _f.label = 23;
7865
8002
  case 23:
8003
+ if (formats.length > 0) {
8004
+ console.warn(colors__default["default"].yellow("Format ".concat(formats.join(' and '), " is not supported")));
8005
+ }
7866
8006
  if (isVerbose) {
7867
8007
  console.info(colors__default["default"].green("Collection builded"));
7868
8008
  console.info(colors__default["default"].cyan(usageToHuman(llmTools.getTotalUsage())));
@@ -7875,7 +8015,10 @@
7875
8015
  });
7876
8016
  }
7877
8017
  /**
8018
+ * TODO: Maybe remove this command - "about" command should be enough?
8019
+ * TODO: [0] DRY Javascript and typescript - Maybe make ONLY typescript and for javascript just remove types
7878
8020
  * Note: [🟡] This code should never be published outside of `@promptbook/cli`
8021
+ * TODO: [🖇] What about symlinks? Maybe flag --follow-symlinks
7879
8022
  */
7880
8023
 
7881
8024
  /**
@@ -7885,7 +8028,7 @@
7885
8028
  */
7886
8029
  function addAutoGeneratedSection(content, options) {
7887
8030
  var sectionName = options.sectionName, sectionContent = options.sectionContent;
7888
- var warningLine = "<!-- \u26A0\uFE0F WARNING: This section was auto-generated -->";
8031
+ var warningLine = "<!-- ".concat(GENERATOR_WARNING, " -->");
7889
8032
  var sectionRegex = new RegExp("<!--".concat(sectionName, "-->([\\s\\S]*?)<!--/").concat(sectionName, "-->"), 'g');
7890
8033
  var sectionMatch = content.match(sectionRegex);
7891
8034
  if (sectionMatch) {
@@ -8073,13 +8216,15 @@
8073
8216
  /**
8074
8217
  * Initializes `prettify` command for Promptbook CLI utilities
8075
8218
  *
8076
- * @private part of `promptbookCli`
8219
+ * @private internal function of `promptbookCli`
8077
8220
  */
8078
8221
  function initializePrettifyCommand(program) {
8079
8222
  var _this = this;
8080
8223
  var prettifyCommand = program.command('prettify');
8081
8224
  prettifyCommand.description(spaceTrim__default["default"]("\n Iterates over promptbooks and does multiple enhancing operations on them:\n\n 1) Adds Mermaid graph\n 2) Prettifies the markdown\n "));
8082
- prettifyCommand.argument('<filesGlob>', 'Promptbooks to prettify as glob pattern');
8225
+ prettifyCommand.argument('<filesGlob>',
8226
+ // <- TODO: [🧟‍♂️] Unite path to promptbook collection argument
8227
+ 'Promptbooks to prettify as glob pattern');
8083
8228
  prettifyCommand.option('-i, --ignore <glob>', "Ignore as glob pattern");
8084
8229
  prettifyCommand.action(function (filesGlob, _a) {
8085
8230
  var ignore = _a.ignore;
@@ -8155,10 +8300,13 @@
8155
8300
  }
8156
8301
  /**
8157
8302
  * Note: [🟡] This code should never be published outside of `@promptbook/cli`
8303
+ * TODO: [🖇] What about symlinks? Maybe flag --follow-symlinks
8158
8304
  */
8159
8305
 
8160
8306
  /**
8161
8307
  * Runs CLI utilities of Promptbook package
8308
+ *
8309
+ * @private within the `@promptbook/cli`
8162
8310
  */
8163
8311
  function promptbookCli() {
8164
8312
  return __awaiter(this, void 0, void 0, function () {
@@ -8169,8 +8317,10 @@
8169
8317
  }
8170
8318
  program = new commander__default["default"].Command();
8171
8319
  program.name('promptbook');
8320
+ program.alias('ptbk');
8172
8321
  program.version(PROMPTBOOK_VERSION);
8173
8322
  program.description(spaceTrim.spaceTrim("\n Promptbook utilities for enhancing workflow with promptbooks\n "));
8323
+ initializeAboutCommand(program);
8174
8324
  initializeHelloCommand(program);
8175
8325
  initializeMakeCommand(program);
8176
8326
  initializePrettifyCommand(program);
@@ -8180,7 +8330,7 @@
8180
8330
  });
8181
8331
  }
8182
8332
  /**
8183
- * TODO: [🥠] Do not export to utils directly, its just for CLI script
8333
+ * TODO: [🥠] Do not export, its just for CLI script
8184
8334
  * TODO: [🕌] When more functionalities, rename
8185
8335
  * Note: 11:11
8186
8336
  * Note: [🟡] This code should never be published outside of `@promptbook/cli`