@promptbook/node 0.59.0-8 → 0.59.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (591) hide show
  1. package/esm/index.es.js +426 -410
  2. package/esm/index.es.js.map +1 -1
  3. package/esm/typings/promptbook-library/index.d.ts +25 -0
  4. package/esm/typings/src/_packages/cli.index.d.ts +10 -0
  5. package/{umd/typings → esm/typings/src}/_packages/core.index.d.ts +11 -9
  6. package/esm/typings/src/_packages/node.index.d.ts +4 -0
  7. package/{umd/typings → esm/typings/src}/_packages/types.index.d.ts +4 -3
  8. package/esm/typings/src/cli/actions/hello.d.ts +7 -0
  9. package/esm/typings/src/cli/actions/make.d.ts +7 -0
  10. package/esm/typings/src/cli/actions/prettify.d.ts +7 -0
  11. package/esm/typings/{conversion/prettify/prettifyPromptbookStringCli.d.ts → src/cli/promptbookCli.d.ts} +2 -2
  12. package/esm/typings/{config.d.ts → src/config.d.ts} +4 -0
  13. package/esm/typings/{conversion → src/conversion}/promptbookStringToJson.d.ts +5 -3
  14. package/esm/typings/src/conversion/promptbookStringToJsonSync.d.ts +23 -0
  15. package/{umd/typings/conversion/validation/validatePromptbookJson.d.ts → esm/typings/src/conversion/validation/validatePromptbook.d.ts} +2 -2
  16. package/esm/typings/src/execution/EmbeddingVector.d.ts +8 -0
  17. package/esm/typings/{execution → src/execution}/LlmExecutionTools.d.ts +1 -0
  18. package/esm/typings/{execution → src/execution}/PromptResult.d.ts +11 -0
  19. package/esm/typings/src/execution/embeddingVectorToString.d.ts +5 -0
  20. package/esm/typings/src/knowledge/prepare-knowledge/markdown/prepareKnowledgeFromMarkdown.d.ts +21 -0
  21. package/esm/typings/{promptbook-library → src/library}/SimplePromptbookLibrary.d.ts +3 -1
  22. package/esm/typings/{promptbook-library/constructors/createPromptbookLibraryFromDirectory.d.ts → src/library/constructors/createLibraryFromDirectory.d.ts} +2 -2
  23. package/esm/typings/src/library/constructors/createLibraryFromJson.d.ts +12 -0
  24. package/esm/typings/{promptbook-library/constructors/createPromptbookLibraryFromPromise.d.ts → src/library/constructors/createLibraryFromPromise.d.ts} +3 -7
  25. package/esm/typings/{promptbook-library/constructors/createPromptbookLibraryFromUrl.d.ts → src/library/constructors/createLibraryFromUrl.d.ts} +2 -2
  26. package/esm/typings/{promptbook-library/constructors/createPromptbookSublibrary.d.ts → src/library/constructors/createSublibrary.d.ts} +1 -1
  27. package/esm/typings/src/library/libraryToJson.d.ts +8 -0
  28. package/{umd/typings → esm/typings/src}/llm-providers/anthropic-claude/AnthropicClaudeExecutionTools.d.ts +4 -0
  29. package/esm/typings/{llm-providers → src/llm-providers}/anthropic-claude/anthropic-claude-models.d.ts +1 -0
  30. package/{umd/typings → esm/typings/src}/llm-providers/openai/OpenAiExecutionTools.d.ts +13 -0
  31. package/esm/typings/{llm-providers → src/llm-providers}/openai/computeOpenaiUsage.d.ts +4 -2
  32. package/{umd/typings → esm/typings/src}/llm-providers/remote/interfaces/RemoteServerOptions.d.ts +1 -1
  33. package/esm/typings/{llm-providers → src/llm-providers}/remote/startRemoteServer.d.ts +1 -1
  34. package/{umd/typings → esm/typings/src}/types/ModelRequirements.d.ts +1 -1
  35. package/esm/typings/{types → src/types}/PromptbookJson/KnowledgeJson.d.ts +1 -1
  36. package/esm/typings/{types → src/types}/PromptbookJson/MaterialKnowledgePieceJson.d.ts +4 -3
  37. package/package.json +4 -3
  38. package/umd/index.umd.js +430 -414
  39. package/umd/index.umd.js.map +1 -1
  40. package/umd/typings/promptbook-library/index.d.ts +25 -0
  41. package/umd/typings/src/_packages/cli.index.d.ts +10 -0
  42. package/{esm/typings → umd/typings/src}/_packages/core.index.d.ts +11 -9
  43. package/umd/typings/src/_packages/node.index.d.ts +4 -0
  44. package/{esm/typings → umd/typings/src}/_packages/types.index.d.ts +4 -3
  45. package/umd/typings/src/cli/actions/hello.d.ts +7 -0
  46. package/umd/typings/src/cli/actions/make.d.ts +7 -0
  47. package/umd/typings/src/cli/actions/prettify.d.ts +7 -0
  48. package/umd/typings/{conversion/prettify/prettifyPromptbookStringCli.d.ts → src/cli/promptbookCli.d.ts} +2 -2
  49. package/umd/typings/{config.d.ts → src/config.d.ts} +4 -0
  50. package/umd/typings/{conversion → src/conversion}/promptbookStringToJson.d.ts +5 -3
  51. package/umd/typings/src/conversion/promptbookStringToJsonSync.d.ts +23 -0
  52. package/{esm/typings/conversion/validation/validatePromptbookJson.d.ts → umd/typings/src/conversion/validation/validatePromptbook.d.ts} +2 -2
  53. package/umd/typings/src/execution/EmbeddingVector.d.ts +8 -0
  54. package/umd/typings/{execution → src/execution}/LlmExecutionTools.d.ts +1 -0
  55. package/umd/typings/{execution → src/execution}/PromptResult.d.ts +11 -0
  56. package/umd/typings/src/execution/embeddingVectorToString.d.ts +5 -0
  57. package/umd/typings/src/knowledge/prepare-knowledge/markdown/prepareKnowledgeFromMarkdown.d.ts +21 -0
  58. package/umd/typings/{promptbook-library → src/library}/SimplePromptbookLibrary.d.ts +3 -1
  59. package/umd/typings/{promptbook-library/constructors/createPromptbookLibraryFromDirectory.d.ts → src/library/constructors/createLibraryFromDirectory.d.ts} +2 -2
  60. package/umd/typings/src/library/constructors/createLibraryFromJson.d.ts +12 -0
  61. package/umd/typings/{promptbook-library/constructors/createPromptbookLibraryFromPromise.d.ts → src/library/constructors/createLibraryFromPromise.d.ts} +3 -7
  62. package/umd/typings/{promptbook-library/constructors/createPromptbookLibraryFromUrl.d.ts → src/library/constructors/createLibraryFromUrl.d.ts} +2 -2
  63. package/umd/typings/{promptbook-library/constructors/createPromptbookSublibrary.d.ts → src/library/constructors/createSublibrary.d.ts} +1 -1
  64. package/umd/typings/src/library/libraryToJson.d.ts +8 -0
  65. package/{esm/typings → umd/typings/src}/llm-providers/anthropic-claude/AnthropicClaudeExecutionTools.d.ts +4 -0
  66. package/umd/typings/{llm-providers → src/llm-providers}/anthropic-claude/anthropic-claude-models.d.ts +1 -0
  67. package/{esm/typings → umd/typings/src}/llm-providers/openai/OpenAiExecutionTools.d.ts +13 -0
  68. package/umd/typings/{llm-providers → src/llm-providers}/openai/computeOpenaiUsage.d.ts +4 -2
  69. package/{esm/typings → umd/typings/src}/llm-providers/remote/interfaces/RemoteServerOptions.d.ts +1 -1
  70. package/umd/typings/{llm-providers → src/llm-providers}/remote/startRemoteServer.d.ts +1 -1
  71. package/{esm/typings → umd/typings/src}/types/ModelRequirements.d.ts +1 -1
  72. package/umd/typings/{types → src/types}/PromptbookJson/KnowledgeJson.d.ts +1 -1
  73. package/umd/typings/{types → src/types}/PromptbookJson/MaterialKnowledgePieceJson.d.ts +4 -3
  74. package/umd/typings/src/utils/trimCodeBlock.test.d.ts +1 -0
  75. package/umd/typings/src/utils/trimEndOfCodeBlock.test.d.ts +1 -0
  76. package/umd/typings/src/utils/unwrapResult.test.d.ts +1 -0
  77. package/umd/typings/src/utils/validators/url/isValidUrl.test.d.ts +1 -0
  78. package/esm/typings/_packages/cli.index.d.ts +0 -10
  79. package/esm/typings/_packages/node.index.d.ts +0 -4
  80. package/esm/typings/knowledge/prepare-knowledge/_common/IndexPreparer.d.ts +0 -4
  81. package/esm/typings/knowledge/prepare-knowledge/markdown/prepareKnowledgeFromMarkdown.d.ts +0 -7
  82. package/esm/typings/promptbook-library/constructors/createPromptbookLibraryFromSources.d.ts +0 -16
  83. package/umd/typings/_packages/cli.index.d.ts +0 -10
  84. package/umd/typings/_packages/node.index.d.ts +0 -4
  85. package/umd/typings/knowledge/prepare-knowledge/_common/IndexPreparer.d.ts +0 -4
  86. package/umd/typings/knowledge/prepare-knowledge/markdown/prepareKnowledgeFromMarkdown.d.ts +0 -7
  87. package/umd/typings/promptbook-library/constructors/createPromptbookLibraryFromSources.d.ts +0 -16
  88. /package/esm/typings/{_packages → src/_packages}/anthropic-claude.index.d.ts +0 -0
  89. /package/esm/typings/{_packages → src/_packages}/azure-openai.index.d.ts +0 -0
  90. /package/esm/typings/{_packages → src/_packages}/execute-javascript.index.d.ts +0 -0
  91. /package/esm/typings/{_packages → src/_packages}/fake-llm.index.d.ts +0 -0
  92. /package/esm/typings/{_packages → src/_packages}/langtail.index.d.ts +0 -0
  93. /package/esm/typings/{_packages → src/_packages}/openai.index.d.ts +0 -0
  94. /package/esm/typings/{_packages → src/_packages}/remote-client.index.d.ts +0 -0
  95. /package/esm/typings/{_packages → src/_packages}/remote-server.index.d.ts +0 -0
  96. /package/esm/typings/{_packages → src/_packages}/utils.index.d.ts +0 -0
  97. /package/esm/typings/{conversion → src/conversion}/prettify/PrettifyOptions.d.ts +0 -0
  98. /package/esm/typings/{conversion → src/conversion}/prettify/prettifyPromptbookString.d.ts +0 -0
  99. /package/esm/typings/{conversion → src/conversion}/prettify/renderPromptbookMermaid.d.ts +0 -0
  100. /package/esm/typings/{conversion → src/conversion}/promptbookJsonToString.d.ts +0 -0
  101. /package/esm/typings/{conversion → src/conversion}/promptbookStringToJson.test.d.ts +0 -0
  102. /package/esm/typings/{conversion/utils/extractParametersFromPromptTemplate.test.d.ts → src/conversion/promptbookStringToJsonSync.test.d.ts} +0 -0
  103. /package/esm/typings/{conversion → src/conversion}/utils/extractParametersFromPromptTemplate.d.ts +0 -0
  104. /package/{umd/typings → esm/typings/src}/conversion/utils/extractParametersFromPromptTemplate.test.d.ts +0 -0
  105. /package/esm/typings/{conversion → src/conversion}/utils/extractVariables.d.ts +0 -0
  106. /package/esm/typings/{conversion → src/conversion}/utils/extractVariables.test.d.ts +0 -0
  107. /package/esm/typings/{conversion → src/conversion}/utils/parseCommand.d.ts +0 -0
  108. /package/esm/typings/{conversion → src/conversion}/utils/parseCommand.test.d.ts +0 -0
  109. /package/esm/typings/{conversion → src/conversion}/utils/parseNumber.d.ts +0 -0
  110. /package/esm/typings/{conversion → src/conversion}/utils/parseNumber.test.d.ts +0 -0
  111. /package/esm/typings/{conversion → src/conversion}/utils/renameParameter.d.ts +0 -0
  112. /package/esm/typings/{conversion → src/conversion}/utils/renameParameter.test.d.ts +0 -0
  113. /package/esm/typings/{conversion → src/conversion}/utils/titleToName.d.ts +0 -0
  114. /package/esm/typings/{conversion → src/conversion}/utils/titleToName.test.d.ts +0 -0
  115. /package/esm/typings/{conversion → src/conversion}/validation/_importPromptbook.d.ts +0 -0
  116. /package/esm/typings/{conversion → src/conversion}/validation/promptbookStringToJson-syntaxErrors.test.d.ts +0 -0
  117. /package/esm/typings/{conversion/validation/validatePromptbookJson-logicErrors.test.d.ts → src/conversion/validation/validatePromptbook-logicErrors.test.d.ts} +0 -0
  118. /package/esm/typings/{conversion/validation/validatePromptbookJson.test.d.ts → src/conversion/validation/validatePromptbook.test.d.ts} +0 -0
  119. /package/esm/typings/{errors → src/errors}/PromptbookExecutionError.d.ts +0 -0
  120. /package/esm/typings/{errors → src/errors}/PromptbookLibraryError.d.ts +0 -0
  121. /package/esm/typings/{errors → src/errors}/PromptbookLogicError.d.ts +0 -0
  122. /package/esm/typings/{errors → src/errors}/PromptbookNotFoundError.d.ts +0 -0
  123. /package/esm/typings/{errors → src/errors}/PromptbookReferenceError.d.ts +0 -0
  124. /package/esm/typings/{errors → src/errors}/PromptbookSyntaxError.d.ts +0 -0
  125. /package/esm/typings/{errors → src/errors}/TemplateError.d.ts +0 -0
  126. /package/esm/typings/{errors → src/errors}/UnexpectedError.d.ts +0 -0
  127. /package/esm/typings/{errors → src/errors}/_ExpectError.d.ts +0 -0
  128. /package/esm/typings/{execution → src/execution}/CommonExecutionToolsOptions.d.ts +0 -0
  129. /package/esm/typings/{execution → src/execution}/ExecutionTools.d.ts +0 -0
  130. /package/esm/typings/{execution → src/execution}/PromptbookExecutor.d.ts +0 -0
  131. /package/esm/typings/{execution → src/execution}/ScriptExecutionTools.d.ts +0 -0
  132. /package/esm/typings/{execution → src/execution}/UserInterfaceTools.d.ts +0 -0
  133. /package/esm/typings/{execution → src/execution}/addPromptResultUsage.test.d.ts +0 -0
  134. /package/esm/typings/{execution → src/execution}/assertsExecutionSuccessful.d.ts +0 -0
  135. /package/esm/typings/{execution → src/execution}/createPromptbookExecutor.d.ts +0 -0
  136. /package/esm/typings/{execution → src/execution}/translation/automatic-translate/automatic-translators/AutomaticTranslator.d.ts +0 -0
  137. /package/esm/typings/{execution → src/execution}/translation/automatic-translate/automatic-translators/DebugAutomaticTranslator.d.ts +0 -0
  138. /package/esm/typings/{execution → src/execution}/translation/automatic-translate/automatic-translators/FakeAutomaticTranslator.d.ts +0 -0
  139. /package/esm/typings/{execution → src/execution}/translation/automatic-translate/automatic-translators/LindatAutomaticTranslator.d.ts +0 -0
  140. /package/esm/typings/{execution → src/execution}/translation/automatic-translate/automatic-translators/TranslatorOptions.d.ts +0 -0
  141. /package/esm/typings/{execution → src/execution}/translation/automatic-translate/automatic-translators/utils/extractMultiplicatedOccurrence.d.ts +0 -0
  142. /package/esm/typings/{execution → src/execution}/translation/automatic-translate/automatic-translators/utils/extractMultiplicatedOccurrence.test.d.ts +0 -0
  143. /package/esm/typings/{execution → src/execution}/translation/automatic-translate/translateMessages.d.ts +0 -0
  144. /package/esm/typings/{execution → src/execution}/utils/addUsage.d.ts +0 -0
  145. /package/esm/typings/{execution → src/execution}/utils/addUsage.test.d.ts +0 -0
  146. /package/esm/typings/{execution → src/execution}/utils/checkExpectations.d.ts +0 -0
  147. /package/esm/typings/{execution → src/execution}/utils/checkExpectations.test.d.ts +0 -0
  148. /package/esm/typings/{execution → src/execution}/utils/computeUsageCounts.d.ts +0 -0
  149. /package/esm/typings/{execution → src/execution}/utils/forEachAsync.d.ts +0 -0
  150. /package/esm/typings/{execution → src/execution}/utils/replaceParameters.d.ts +0 -0
  151. /package/esm/typings/{execution → src/execution}/utils/replaceParameters.test.d.ts +0 -0
  152. /package/esm/typings/{execution → src/execution}/utils/uncertainNumber.d.ts +0 -0
  153. /package/esm/typings/{execution → src/execution}/utils/usageToWorktime.d.ts +0 -0
  154. /package/esm/typings/{execution → src/execution}/utils/usageToWorktime.test.d.ts +0 -0
  155. /package/esm/typings/{expectations → src/expectations}/drafts/isDomainNameFree.d.ts +0 -0
  156. /package/esm/typings/{expectations → src/expectations}/drafts/isGithubNameFree.d.ts +0 -0
  157. /package/esm/typings/{formats → src/formats}/_common/FormatDefinition.d.ts +0 -0
  158. /package/esm/typings/{formats → src/formats}/csv/ListFormatDefinition.d.ts +0 -0
  159. /package/esm/typings/{formats → src/formats}/index.d.ts +0 -0
  160. /package/esm/typings/{formats → src/formats}/json/JsonFormatDefinition.d.ts +0 -0
  161. /package/esm/typings/{formats → src/formats}/json/utils/isValidJsonString.d.ts +0 -0
  162. /package/esm/typings/{formats → src/formats}/json/utils/isValidJsonString.test.d.ts +0 -0
  163. /package/esm/typings/{formats → src/formats}/list/ListFormatDefinition.d.ts +0 -0
  164. /package/esm/typings/{formats → src/formats}/xml/XmlFormatDefinition.d.ts +0 -0
  165. /package/esm/typings/{knowledge → src/knowledge}/dialogs/callback/CallbackInterfaceTools.d.ts +0 -0
  166. /package/esm/typings/{knowledge → src/knowledge}/dialogs/callback/CallbackInterfaceToolsOptions.d.ts +0 -0
  167. /package/esm/typings/{knowledge → src/knowledge}/dialogs/simple-prompt/SimplePromptInterfaceTools.d.ts +0 -0
  168. /package/esm/typings/{knowledge → src/knowledge}/dialogs/user-interface-execution-tools.test.d.ts +0 -0
  169. /package/esm/typings/{knowledge → src/knowledge}/prepare-knowledge/markdown/playground/markdown-knowledge-playground.d.ts +0 -0
  170. /package/esm/typings/{knowledge → src/knowledge}/prepare-knowledge/markdown/prepareKnowledgeFromMarkdown.test.d.ts +0 -0
  171. /package/esm/typings/{knowledge → src/knowledge}/prepare-knowledge/pdf/prepareKnowledgeFromPdf.d.ts +0 -0
  172. /package/esm/typings/{knowledge → src/knowledge}/prepare-knowledge/pdf/prepareKnowledgeFromPdf.test.d.ts +0 -0
  173. /package/esm/typings/{promptbook-library → src/library}/PromptbookLibrary.d.ts +0 -0
  174. /package/esm/typings/{llm-providers/mocked/fakeTextToExpectations.test.d.ts → src/library/constructors/createLibraryFromDirectory.test.d.ts} +0 -0
  175. /package/esm/typings/{llm-providers/mocked/faked-completion.test.d.ts → src/library/constructors/createLibraryFromJson.test.d.ts} +0 -0
  176. /package/esm/typings/{llm-providers/openai/computeUsage.test.d.ts → src/library/constructors/createLibraryFromPromise.test.d.ts} +0 -0
  177. /package/esm/typings/{promptbook-library → src/library}/constructors/justTestFsImport.d.ts +0 -0
  178. /package/esm/typings/{promptbook-library/constructors/createPromptbookLibraryFromDirectory.test.d.ts → src/library/libraryToJson.test.d.ts} +0 -0
  179. /package/esm/typings/{llm-providers → src/llm-providers}/anthropic-claude/AnthropicClaudeExecutionToolsOptions.d.ts +0 -0
  180. /package/esm/typings/{llm-providers → src/llm-providers}/anthropic-claude/playground/playground.d.ts +0 -0
  181. /package/esm/typings/{llm-providers → src/llm-providers}/azure-openai/AzureOpenAiExecutionTools.d.ts +0 -0
  182. /package/esm/typings/{llm-providers → src/llm-providers}/azure-openai/AzureOpenAiExecutionToolsOptions.d.ts +0 -0
  183. /package/esm/typings/{llm-providers → src/llm-providers}/azure-openai/playground/playground.d.ts +0 -0
  184. /package/esm/typings/{llm-providers → src/llm-providers}/langtail/LangtailExecutionTools.d.ts +0 -0
  185. /package/esm/typings/{llm-providers → src/llm-providers}/langtail/LangtailExecutionToolsOptions.d.ts +0 -0
  186. /package/esm/typings/{llm-providers → src/llm-providers}/langtail/playground/playground.d.ts +0 -0
  187. /package/esm/typings/{llm-providers → src/llm-providers}/mocked/MockedEchoLlmExecutionTools.d.ts +0 -0
  188. /package/esm/typings/{llm-providers → src/llm-providers}/mocked/MockedFackedLlmExecutionTools.d.ts +0 -0
  189. /package/esm/typings/{llm-providers → src/llm-providers}/mocked/fakeTextToExpectations.d.ts +0 -0
  190. /package/{umd/typings → esm/typings/src}/llm-providers/mocked/fakeTextToExpectations.test.d.ts +0 -0
  191. /package/{umd/typings → esm/typings/src}/llm-providers/mocked/faked-completion.test.d.ts +0 -0
  192. /package/esm/typings/{llm-providers → src/llm-providers}/mocked/joker.test.d.ts +0 -0
  193. /package/esm/typings/{llm-providers → src/llm-providers}/mocked/mocked-chat.test.d.ts +0 -0
  194. /package/esm/typings/{llm-providers → src/llm-providers}/mocked/mocked-completion.test.d.ts +0 -0
  195. /package/esm/typings/{llm-providers → src/llm-providers}/multiple/MultipleLlmExecutionTools.d.ts +0 -0
  196. /package/esm/typings/{llm-providers → src/llm-providers}/multiple/MultipleLlmExecutionToolsOptions.d.ts +0 -0
  197. /package/esm/typings/{llm-providers → src/llm-providers}/multiple/playground/playground.d.ts +0 -0
  198. /package/esm/typings/{llm-providers → src/llm-providers}/openai/OpenAiExecutionToolsOptions.d.ts +0 -0
  199. /package/esm/typings/{llm-providers → src/llm-providers}/openai/computeUsage.d.ts +0 -0
  200. /package/{umd/typings → esm/typings/src}/llm-providers/openai/computeUsage.test.d.ts +0 -0
  201. /package/esm/typings/{llm-providers → src/llm-providers}/openai/openai-models.d.ts +0 -0
  202. /package/esm/typings/{llm-providers → src/llm-providers}/openai/playground/playground.d.ts +0 -0
  203. /package/esm/typings/{llm-providers → src/llm-providers}/remote/RemoteLlmExecutionTools.d.ts +0 -0
  204. /package/esm/typings/{llm-providers → src/llm-providers}/remote/RemoteLlmExecutionToolsOptions.d.ts +0 -0
  205. /package/esm/typings/{llm-providers → src/llm-providers}/remote/interfaces/Promptbook_Server_Error.d.ts +0 -0
  206. /package/esm/typings/{llm-providers → src/llm-providers}/remote/interfaces/Promptbook_Server_Progress.d.ts +0 -0
  207. /package/esm/typings/{llm-providers → src/llm-providers}/remote/interfaces/Promptbook_Server_Request.d.ts +0 -0
  208. /package/esm/typings/{llm-providers → src/llm-providers}/remote/interfaces/Promptbook_Server_Response.d.ts +0 -0
  209. /package/esm/typings/{scripting → src/scripting}/_test/custom-function-async.test.ts.test.d.ts +0 -0
  210. /package/esm/typings/{scripting → src/scripting}/_test/custom-function-missing.test.d.ts +0 -0
  211. /package/esm/typings/{scripting → src/scripting}/_test/custom-function-with-dependencies.test.d.ts +0 -0
  212. /package/esm/typings/{scripting → src/scripting}/_test/custom-function.test.d.ts +0 -0
  213. /package/esm/typings/{scripting → src/scripting}/_test/postprocessing.test.d.ts +0 -0
  214. /package/esm/typings/{scripting → src/scripting}/_test/script-execution-errors.test.d.ts +0 -0
  215. /package/esm/typings/{scripting → src/scripting}/_test/script-execution-tools.test.d.ts +0 -0
  216. /package/esm/typings/{scripting → src/scripting}/javascript/JavascriptEvalExecutionTools.d.ts +0 -0
  217. /package/esm/typings/{scripting → src/scripting}/javascript/JavascriptEvalExecutionTools.test.d.ts +0 -0
  218. /package/esm/typings/{scripting → src/scripting}/javascript/JavascriptExecutionTools.d.ts +0 -0
  219. /package/esm/typings/{scripting → src/scripting}/javascript/JavascriptExecutionToolsOptions.d.ts +0 -0
  220. /package/esm/typings/{scripting → src/scripting}/javascript/utils/preserve.d.ts +0 -0
  221. /package/esm/typings/{scripting → src/scripting}/javascript/utils/unknownToString.d.ts +0 -0
  222. /package/esm/typings/{scripting → src/scripting}/python/PythonExecutionTools.d.ts +0 -0
  223. /package/esm/typings/{scripting → src/scripting}/typescript/TypescriptExecutionTools.d.ts +0 -0
  224. /package/esm/typings/{types → src/types}/Command.d.ts +0 -0
  225. /package/esm/typings/{types → src/types}/ExecutionTypes.d.ts +0 -0
  226. /package/esm/typings/{types → src/types}/Parameters.d.ts +0 -0
  227. /package/esm/typings/{types → src/types}/Prompt.d.ts +0 -0
  228. /package/esm/typings/{types → src/types}/PromptbookJson/PromptTemplateJson.d.ts +0 -0
  229. /package/esm/typings/{types → src/types}/PromptbookJson/PromptTemplateParameterJson.d.ts +0 -0
  230. /package/esm/typings/{types → src/types}/PromptbookJson/PromptbookJson.d.ts +0 -0
  231. /package/esm/typings/{types → src/types}/PromptbookString.d.ts +0 -0
  232. /package/esm/typings/{types → src/types}/ScriptLanguage.d.ts +0 -0
  233. /package/esm/typings/{types → src/types}/TaskProgress.d.ts +0 -0
  234. /package/esm/typings/{types → src/types}/execution-report/ExecutionReportJson.d.ts +0 -0
  235. /package/esm/typings/{types → src/types}/execution-report/ExecutionReportString.d.ts +0 -0
  236. /package/esm/typings/{types → src/types}/execution-report/ExecutionReportStringOptions.d.ts +0 -0
  237. /package/esm/typings/{types → src/types}/execution-report/config.d.ts +0 -0
  238. /package/esm/typings/{types → src/types}/execution-report/countWorkingDuration.d.ts +0 -0
  239. /package/esm/typings/{types → src/types}/execution-report/countWorkingDuration.test.d.ts +0 -0
  240. /package/esm/typings/{types → src/types}/execution-report/executionReportJsonToString.d.ts +0 -0
  241. /package/esm/typings/{types → src/types}/typeAliasEmoji.d.ts +0 -0
  242. /package/esm/typings/{types → src/types}/typeAliases.d.ts +0 -0
  243. /package/esm/typings/{utils → src/utils}/FromtoItems.d.ts +0 -0
  244. /package/esm/typings/{utils → src/utils}/emojis.d.ts +0 -0
  245. /package/esm/typings/{utils → src/utils}/expectation-counters/countCharacters.d.ts +0 -0
  246. /package/esm/typings/{utils → src/utils}/expectation-counters/countCharacters.test.d.ts +0 -0
  247. /package/esm/typings/{utils → src/utils}/expectation-counters/countLines.d.ts +0 -0
  248. /package/esm/typings/{utils → src/utils}/expectation-counters/countLines.test.d.ts +0 -0
  249. /package/esm/typings/{utils → src/utils}/expectation-counters/countPages.d.ts +0 -0
  250. /package/esm/typings/{utils → src/utils}/expectation-counters/countPages.test.d.ts +0 -0
  251. /package/esm/typings/{utils → src/utils}/expectation-counters/countParagraphs.d.ts +0 -0
  252. /package/esm/typings/{utils → src/utils}/expectation-counters/countParagraphs.test.d.ts +0 -0
  253. /package/esm/typings/{utils → src/utils}/expectation-counters/countSentences.d.ts +0 -0
  254. /package/esm/typings/{utils → src/utils}/expectation-counters/countSentences.test.d.ts +0 -0
  255. /package/esm/typings/{utils → src/utils}/expectation-counters/countWords.d.ts +0 -0
  256. /package/esm/typings/{utils → src/utils}/expectation-counters/countWords.test.d.ts +0 -0
  257. /package/esm/typings/{utils → src/utils}/expectation-counters/index.d.ts +0 -0
  258. /package/esm/typings/{utils → src/utils}/extractParameters.d.ts +0 -0
  259. /package/esm/typings/{utils → src/utils}/extractParameters.test.d.ts +0 -0
  260. /package/esm/typings/{utils → src/utils}/formatNumber.d.ts +0 -0
  261. /package/esm/typings/{utils → src/utils}/formatNumber.test.d.ts +0 -0
  262. /package/esm/typings/{utils → src/utils}/getCurrentIsoDate.d.ts +0 -0
  263. /package/esm/typings/{utils → src/utils}/isRunningInWhatever.d.ts +0 -0
  264. /package/esm/typings/{utils → src/utils}/just.d.ts +0 -0
  265. /package/esm/typings/{utils → src/utils}/markdown/addAutoGeneratedSection.d.ts +0 -0
  266. /package/esm/typings/{utils → src/utils}/markdown/addAutoGeneratedSection.test.d.ts +0 -0
  267. /package/esm/typings/{utils → src/utils}/markdown/createMarkdownChart.d.ts +0 -0
  268. /package/esm/typings/{utils → src/utils}/markdown/createMarkdownChart.test.d.ts +0 -0
  269. /package/esm/typings/{utils → src/utils}/markdown/createMarkdownTable.d.ts +0 -0
  270. /package/esm/typings/{utils → src/utils}/markdown/createMarkdownTable.test.d.ts +0 -0
  271. /package/esm/typings/{utils → src/utils}/markdown/escapeMarkdownBlock.d.ts +0 -0
  272. /package/esm/typings/{utils → src/utils}/markdown/escapeMarkdownBlock.test.d.ts +0 -0
  273. /package/esm/typings/{utils → src/utils}/markdown/extractAllBlocksFromMarkdown.d.ts +0 -0
  274. /package/esm/typings/{utils → src/utils}/markdown/extractAllBlocksFromMarkdown.test.d.ts +0 -0
  275. /package/esm/typings/{utils → src/utils}/markdown/extractAllListItemsFromMarkdown.d.ts +0 -0
  276. /package/esm/typings/{utils → src/utils}/markdown/extractAllListItemsFromMarkdown.test.d.ts +0 -0
  277. /package/esm/typings/{utils → src/utils}/markdown/extractOneBlockFromMarkdown.d.ts +0 -0
  278. /package/esm/typings/{utils → src/utils}/markdown/extractOneBlockFromMarkdown.test.d.ts +0 -0
  279. /package/esm/typings/{utils → src/utils}/markdown/prettifyMarkdown.d.ts +0 -0
  280. /package/esm/typings/{utils → src/utils}/markdown/prettifyMarkdown.test.d.ts +0 -0
  281. /package/esm/typings/{utils → src/utils}/markdown/removeContentComments.d.ts +0 -0
  282. /package/esm/typings/{utils → src/utils}/markdown/removeContentComments.test.d.ts +0 -0
  283. /package/esm/typings/{utils → src/utils}/markdown/removeMarkdownFormatting.d.ts +0 -0
  284. /package/esm/typings/{utils → src/utils}/markdown/removeMarkdownFormatting.test.d.ts +0 -0
  285. /package/esm/typings/{utils → src/utils}/markdown-json/MarkdownStructure.d.ts +0 -0
  286. /package/esm/typings/{utils → src/utils}/markdown-json/countMarkdownStructureDeepness.d.ts +0 -0
  287. /package/esm/typings/{utils → src/utils}/markdown-json/countMarkdownStructureDeepness.test.d.ts +0 -0
  288. /package/esm/typings/{utils → src/utils}/markdown-json/markdownToMarkdownStructure.d.ts +0 -0
  289. /package/esm/typings/{utils → src/utils}/markdown-json/markdownToMarkdownStructure.test.d.ts +0 -0
  290. /package/esm/typings/{utils → src/utils}/normalization/DIACRITIC_VARIANTS_LETTERS.d.ts +0 -0
  291. /package/esm/typings/{utils → src/utils}/normalization/IKeywords.d.ts +0 -0
  292. /package/esm/typings/{utils → src/utils}/normalization/capitalize.d.ts +0 -0
  293. /package/esm/typings/{utils → src/utils}/normalization/capitalize.test.d.ts +0 -0
  294. /package/esm/typings/{utils → src/utils}/normalization/decapitalize.d.ts +0 -0
  295. /package/esm/typings/{utils → src/utils}/normalization/decapitalize.test.d.ts +0 -0
  296. /package/esm/typings/{utils → src/utils}/normalization/isValidKeyword.d.ts +0 -0
  297. /package/esm/typings/{utils → src/utils}/normalization/isValidKeyword.test.d.ts +0 -0
  298. /package/esm/typings/{utils → src/utils}/normalization/nameToUriPart.d.ts +0 -0
  299. /package/esm/typings/{utils → src/utils}/normalization/nameToUriPart.test.d.ts +0 -0
  300. /package/esm/typings/{utils → src/utils}/normalization/nameToUriParts.d.ts +0 -0
  301. /package/esm/typings/{utils → src/utils}/normalization/nameToUriParts.test.d.ts +0 -0
  302. /package/esm/typings/{utils → src/utils}/normalization/normalize-to-kebab-case.d.ts +0 -0
  303. /package/esm/typings/{utils → src/utils}/normalization/normalize-to-kebab-case.test.d.ts +0 -0
  304. /package/esm/typings/{utils → src/utils}/normalization/normalizeTo_PascalCase.d.ts +0 -0
  305. /package/esm/typings/{utils → src/utils}/normalization/normalizeTo_PascalCase.test.d.ts +0 -0
  306. /package/esm/typings/{utils → src/utils}/normalization/normalizeTo_SCREAMING_CASE.d.ts +0 -0
  307. /package/esm/typings/{utils → src/utils}/normalization/normalizeTo_SCREAMING_CASE.test.d.ts +0 -0
  308. /package/esm/typings/{utils → src/utils}/normalization/normalizeTo_camelCase.d.ts +0 -0
  309. /package/esm/typings/{utils → src/utils}/normalization/normalizeTo_camelCase.test.d.ts +0 -0
  310. /package/esm/typings/{utils → src/utils}/normalization/normalizeTo_snake_case.d.ts +0 -0
  311. /package/esm/typings/{utils → src/utils}/normalization/normalizeTo_snake_case.test.d.ts +0 -0
  312. /package/esm/typings/{utils → src/utils}/normalization/normalizeWhitespaces.d.ts +0 -0
  313. /package/esm/typings/{utils → src/utils}/normalization/normalizeWhitespaces.test.d.ts +0 -0
  314. /package/esm/typings/{utils → src/utils}/normalization/parseKeywords.d.ts +0 -0
  315. /package/esm/typings/{utils → src/utils}/normalization/parseKeywords.test.d.ts +0 -0
  316. /package/esm/typings/{utils → src/utils}/normalization/parseKeywordsFromString.d.ts +0 -0
  317. /package/esm/typings/{utils → src/utils}/normalization/parseKeywordsFromString.test.d.ts +0 -0
  318. /package/esm/typings/{utils → src/utils}/normalization/removeDiacritics.d.ts +0 -0
  319. /package/esm/typings/{utils → src/utils}/normalization/removeDiacritics.test.d.ts +0 -0
  320. /package/esm/typings/{utils → src/utils}/normalization/searchKeywords.d.ts +0 -0
  321. /package/esm/typings/{utils → src/utils}/normalization/searchKeywords.test.d.ts +0 -0
  322. /package/esm/typings/{utils → src/utils}/postprocessing/extractBlock.d.ts +0 -0
  323. /package/esm/typings/{utils → src/utils}/removeEmojis.d.ts +0 -0
  324. /package/esm/typings/{utils → src/utils}/removeEmojis.test.d.ts +0 -0
  325. /package/esm/typings/{utils → src/utils}/removeQuotes.d.ts +0 -0
  326. /package/esm/typings/{utils → src/utils}/removeQuotes.test.d.ts +0 -0
  327. /package/esm/typings/{utils → src/utils}/sets/difference.d.ts +0 -0
  328. /package/esm/typings/{utils → src/utils}/sets/difference.test.d.ts +0 -0
  329. /package/esm/typings/{utils → src/utils}/sets/intersection.d.ts +0 -0
  330. /package/esm/typings/{utils → src/utils}/sets/intersection.test.d.ts +0 -0
  331. /package/esm/typings/{utils → src/utils}/sets/union.d.ts +0 -0
  332. /package/esm/typings/{utils → src/utils}/sets/union.test.d.ts +0 -0
  333. /package/esm/typings/{utils → src/utils}/trimCodeBlock.d.ts +0 -0
  334. /package/esm/typings/{utils → src/utils}/trimCodeBlock.test.d.ts +0 -0
  335. /package/esm/typings/{utils → src/utils}/trimEndOfCodeBlock.d.ts +0 -0
  336. /package/esm/typings/{utils → src/utils}/trimEndOfCodeBlock.test.d.ts +0 -0
  337. /package/esm/typings/{utils → src/utils}/unwrapResult.d.ts +0 -0
  338. /package/esm/typings/{utils → src/utils}/unwrapResult.test.d.ts +0 -0
  339. /package/esm/typings/{utils → src/utils}/validators/url/isValidUrl.d.ts +0 -0
  340. /package/esm/typings/{utils → src/utils}/validators/url/isValidUrl.test.d.ts +0 -0
  341. /package/esm/typings/{version.d.ts → src/version.d.ts} +0 -0
  342. /package/umd/typings/{_packages → src/_packages}/anthropic-claude.index.d.ts +0 -0
  343. /package/umd/typings/{_packages → src/_packages}/azure-openai.index.d.ts +0 -0
  344. /package/umd/typings/{_packages → src/_packages}/execute-javascript.index.d.ts +0 -0
  345. /package/umd/typings/{_packages → src/_packages}/fake-llm.index.d.ts +0 -0
  346. /package/umd/typings/{_packages → src/_packages}/langtail.index.d.ts +0 -0
  347. /package/umd/typings/{_packages → src/_packages}/openai.index.d.ts +0 -0
  348. /package/umd/typings/{_packages → src/_packages}/remote-client.index.d.ts +0 -0
  349. /package/umd/typings/{_packages → src/_packages}/remote-server.index.d.ts +0 -0
  350. /package/umd/typings/{_packages → src/_packages}/utils.index.d.ts +0 -0
  351. /package/umd/typings/{conversion → src/conversion}/prettify/PrettifyOptions.d.ts +0 -0
  352. /package/umd/typings/{conversion → src/conversion}/prettify/prettifyPromptbookString.d.ts +0 -0
  353. /package/umd/typings/{conversion → src/conversion}/prettify/renderPromptbookMermaid.d.ts +0 -0
  354. /package/umd/typings/{conversion → src/conversion}/promptbookJsonToString.d.ts +0 -0
  355. /package/umd/typings/{conversion → src/conversion}/promptbookStringToJson.test.d.ts +0 -0
  356. /package/{esm/typings/promptbook-library/constructors/createPromptbookLibraryFromPromise.test.d.ts → umd/typings/src/conversion/promptbookStringToJsonSync.test.d.ts} +0 -0
  357. /package/umd/typings/{conversion → src/conversion}/utils/extractParametersFromPromptTemplate.d.ts +0 -0
  358. /package/{esm/typings/promptbook-library/constructors/createPromptbookLibraryFromSources.test.d.ts → umd/typings/src/conversion/utils/extractParametersFromPromptTemplate.test.d.ts} +0 -0
  359. /package/umd/typings/{conversion → src/conversion}/utils/extractVariables.d.ts +0 -0
  360. /package/umd/typings/{conversion → src/conversion}/utils/extractVariables.test.d.ts +0 -0
  361. /package/umd/typings/{conversion → src/conversion}/utils/parseCommand.d.ts +0 -0
  362. /package/umd/typings/{conversion → src/conversion}/utils/parseCommand.test.d.ts +0 -0
  363. /package/umd/typings/{conversion → src/conversion}/utils/parseNumber.d.ts +0 -0
  364. /package/umd/typings/{conversion → src/conversion}/utils/parseNumber.test.d.ts +0 -0
  365. /package/umd/typings/{conversion → src/conversion}/utils/renameParameter.d.ts +0 -0
  366. /package/umd/typings/{conversion → src/conversion}/utils/renameParameter.test.d.ts +0 -0
  367. /package/umd/typings/{conversion → src/conversion}/utils/titleToName.d.ts +0 -0
  368. /package/umd/typings/{conversion → src/conversion}/utils/titleToName.test.d.ts +0 -0
  369. /package/umd/typings/{conversion → src/conversion}/validation/_importPromptbook.d.ts +0 -0
  370. /package/umd/typings/{conversion → src/conversion}/validation/promptbookStringToJson-syntaxErrors.test.d.ts +0 -0
  371. /package/umd/typings/{conversion/validation/validatePromptbookJson-logicErrors.test.d.ts → src/conversion/validation/validatePromptbook-logicErrors.test.d.ts} +0 -0
  372. /package/umd/typings/{conversion/validation/validatePromptbookJson.test.d.ts → src/conversion/validation/validatePromptbook.test.d.ts} +0 -0
  373. /package/umd/typings/{errors → src/errors}/PromptbookExecutionError.d.ts +0 -0
  374. /package/umd/typings/{errors → src/errors}/PromptbookLibraryError.d.ts +0 -0
  375. /package/umd/typings/{errors → src/errors}/PromptbookLogicError.d.ts +0 -0
  376. /package/umd/typings/{errors → src/errors}/PromptbookNotFoundError.d.ts +0 -0
  377. /package/umd/typings/{errors → src/errors}/PromptbookReferenceError.d.ts +0 -0
  378. /package/umd/typings/{errors → src/errors}/PromptbookSyntaxError.d.ts +0 -0
  379. /package/umd/typings/{errors → src/errors}/TemplateError.d.ts +0 -0
  380. /package/umd/typings/{errors → src/errors}/UnexpectedError.d.ts +0 -0
  381. /package/umd/typings/{errors → src/errors}/_ExpectError.d.ts +0 -0
  382. /package/umd/typings/{execution → src/execution}/CommonExecutionToolsOptions.d.ts +0 -0
  383. /package/umd/typings/{execution → src/execution}/ExecutionTools.d.ts +0 -0
  384. /package/umd/typings/{execution → src/execution}/PromptbookExecutor.d.ts +0 -0
  385. /package/umd/typings/{execution → src/execution}/ScriptExecutionTools.d.ts +0 -0
  386. /package/umd/typings/{execution → src/execution}/UserInterfaceTools.d.ts +0 -0
  387. /package/umd/typings/{execution → src/execution}/addPromptResultUsage.test.d.ts +0 -0
  388. /package/umd/typings/{execution → src/execution}/assertsExecutionSuccessful.d.ts +0 -0
  389. /package/umd/typings/{execution → src/execution}/createPromptbookExecutor.d.ts +0 -0
  390. /package/umd/typings/{execution → src/execution}/translation/automatic-translate/automatic-translators/AutomaticTranslator.d.ts +0 -0
  391. /package/umd/typings/{execution → src/execution}/translation/automatic-translate/automatic-translators/DebugAutomaticTranslator.d.ts +0 -0
  392. /package/umd/typings/{execution → src/execution}/translation/automatic-translate/automatic-translators/FakeAutomaticTranslator.d.ts +0 -0
  393. /package/umd/typings/{execution → src/execution}/translation/automatic-translate/automatic-translators/LindatAutomaticTranslator.d.ts +0 -0
  394. /package/umd/typings/{execution → src/execution}/translation/automatic-translate/automatic-translators/TranslatorOptions.d.ts +0 -0
  395. /package/umd/typings/{execution → src/execution}/translation/automatic-translate/automatic-translators/utils/extractMultiplicatedOccurrence.d.ts +0 -0
  396. /package/umd/typings/{execution → src/execution}/translation/automatic-translate/automatic-translators/utils/extractMultiplicatedOccurrence.test.d.ts +0 -0
  397. /package/umd/typings/{execution → src/execution}/translation/automatic-translate/translateMessages.d.ts +0 -0
  398. /package/umd/typings/{execution → src/execution}/utils/addUsage.d.ts +0 -0
  399. /package/umd/typings/{execution → src/execution}/utils/addUsage.test.d.ts +0 -0
  400. /package/umd/typings/{execution → src/execution}/utils/checkExpectations.d.ts +0 -0
  401. /package/umd/typings/{execution → src/execution}/utils/checkExpectations.test.d.ts +0 -0
  402. /package/umd/typings/{execution → src/execution}/utils/computeUsageCounts.d.ts +0 -0
  403. /package/umd/typings/{execution → src/execution}/utils/forEachAsync.d.ts +0 -0
  404. /package/umd/typings/{execution → src/execution}/utils/replaceParameters.d.ts +0 -0
  405. /package/umd/typings/{execution → src/execution}/utils/replaceParameters.test.d.ts +0 -0
  406. /package/umd/typings/{execution → src/execution}/utils/uncertainNumber.d.ts +0 -0
  407. /package/umd/typings/{execution → src/execution}/utils/usageToWorktime.d.ts +0 -0
  408. /package/umd/typings/{execution → src/execution}/utils/usageToWorktime.test.d.ts +0 -0
  409. /package/umd/typings/{expectations → src/expectations}/drafts/isDomainNameFree.d.ts +0 -0
  410. /package/umd/typings/{expectations → src/expectations}/drafts/isGithubNameFree.d.ts +0 -0
  411. /package/umd/typings/{formats → src/formats}/_common/FormatDefinition.d.ts +0 -0
  412. /package/umd/typings/{formats → src/formats}/csv/ListFormatDefinition.d.ts +0 -0
  413. /package/umd/typings/{formats → src/formats}/index.d.ts +0 -0
  414. /package/umd/typings/{formats → src/formats}/json/JsonFormatDefinition.d.ts +0 -0
  415. /package/umd/typings/{formats → src/formats}/json/utils/isValidJsonString.d.ts +0 -0
  416. /package/umd/typings/{formats → src/formats}/json/utils/isValidJsonString.test.d.ts +0 -0
  417. /package/umd/typings/{formats → src/formats}/list/ListFormatDefinition.d.ts +0 -0
  418. /package/umd/typings/{formats → src/formats}/xml/XmlFormatDefinition.d.ts +0 -0
  419. /package/umd/typings/{knowledge → src/knowledge}/dialogs/callback/CallbackInterfaceTools.d.ts +0 -0
  420. /package/umd/typings/{knowledge → src/knowledge}/dialogs/callback/CallbackInterfaceToolsOptions.d.ts +0 -0
  421. /package/umd/typings/{knowledge → src/knowledge}/dialogs/simple-prompt/SimplePromptInterfaceTools.d.ts +0 -0
  422. /package/umd/typings/{knowledge → src/knowledge}/dialogs/user-interface-execution-tools.test.d.ts +0 -0
  423. /package/umd/typings/{knowledge → src/knowledge}/prepare-knowledge/markdown/playground/markdown-knowledge-playground.d.ts +0 -0
  424. /package/umd/typings/{knowledge → src/knowledge}/prepare-knowledge/markdown/prepareKnowledgeFromMarkdown.test.d.ts +0 -0
  425. /package/umd/typings/{knowledge → src/knowledge}/prepare-knowledge/pdf/prepareKnowledgeFromPdf.d.ts +0 -0
  426. /package/umd/typings/{knowledge → src/knowledge}/prepare-knowledge/pdf/prepareKnowledgeFromPdf.test.d.ts +0 -0
  427. /package/umd/typings/{promptbook-library → src/library}/PromptbookLibrary.d.ts +0 -0
  428. /package/umd/typings/{promptbook-library/constructors/createPromptbookLibraryFromDirectory.test.d.ts → src/library/constructors/createLibraryFromDirectory.test.d.ts} +0 -0
  429. /package/umd/typings/{promptbook-library/constructors/createPromptbookLibraryFromPromise.test.d.ts → src/library/constructors/createLibraryFromJson.test.d.ts} +0 -0
  430. /package/umd/typings/{promptbook-library/constructors/createPromptbookLibraryFromSources.test.d.ts → src/library/constructors/createLibraryFromPromise.test.d.ts} +0 -0
  431. /package/umd/typings/{promptbook-library → src/library}/constructors/justTestFsImport.d.ts +0 -0
  432. /package/umd/typings/{scripting/_test/custom-function-async.test.ts.test.d.ts → src/library/libraryToJson.test.d.ts} +0 -0
  433. /package/umd/typings/{llm-providers → src/llm-providers}/anthropic-claude/AnthropicClaudeExecutionToolsOptions.d.ts +0 -0
  434. /package/umd/typings/{llm-providers → src/llm-providers}/anthropic-claude/playground/playground.d.ts +0 -0
  435. /package/umd/typings/{llm-providers → src/llm-providers}/azure-openai/AzureOpenAiExecutionTools.d.ts +0 -0
  436. /package/umd/typings/{llm-providers → src/llm-providers}/azure-openai/AzureOpenAiExecutionToolsOptions.d.ts +0 -0
  437. /package/umd/typings/{llm-providers → src/llm-providers}/azure-openai/playground/playground.d.ts +0 -0
  438. /package/umd/typings/{llm-providers → src/llm-providers}/langtail/LangtailExecutionTools.d.ts +0 -0
  439. /package/umd/typings/{llm-providers → src/llm-providers}/langtail/LangtailExecutionToolsOptions.d.ts +0 -0
  440. /package/umd/typings/{llm-providers → src/llm-providers}/langtail/playground/playground.d.ts +0 -0
  441. /package/umd/typings/{llm-providers → src/llm-providers}/mocked/MockedEchoLlmExecutionTools.d.ts +0 -0
  442. /package/umd/typings/{llm-providers → src/llm-providers}/mocked/MockedFackedLlmExecutionTools.d.ts +0 -0
  443. /package/umd/typings/{llm-providers → src/llm-providers}/mocked/fakeTextToExpectations.d.ts +0 -0
  444. /package/umd/typings/{scripting/_test/custom-function-missing.test.d.ts → src/llm-providers/mocked/fakeTextToExpectations.test.d.ts} +0 -0
  445. /package/umd/typings/{scripting/_test/custom-function-with-dependencies.test.d.ts → src/llm-providers/mocked/faked-completion.test.d.ts} +0 -0
  446. /package/umd/typings/{llm-providers → src/llm-providers}/mocked/joker.test.d.ts +0 -0
  447. /package/umd/typings/{llm-providers → src/llm-providers}/mocked/mocked-chat.test.d.ts +0 -0
  448. /package/umd/typings/{llm-providers → src/llm-providers}/mocked/mocked-completion.test.d.ts +0 -0
  449. /package/umd/typings/{llm-providers → src/llm-providers}/multiple/MultipleLlmExecutionTools.d.ts +0 -0
  450. /package/umd/typings/{llm-providers → src/llm-providers}/multiple/MultipleLlmExecutionToolsOptions.d.ts +0 -0
  451. /package/umd/typings/{llm-providers → src/llm-providers}/multiple/playground/playground.d.ts +0 -0
  452. /package/umd/typings/{llm-providers → src/llm-providers}/openai/OpenAiExecutionToolsOptions.d.ts +0 -0
  453. /package/umd/typings/{llm-providers → src/llm-providers}/openai/computeUsage.d.ts +0 -0
  454. /package/umd/typings/{scripting/_test/custom-function.test.d.ts → src/llm-providers/openai/computeUsage.test.d.ts} +0 -0
  455. /package/umd/typings/{llm-providers → src/llm-providers}/openai/openai-models.d.ts +0 -0
  456. /package/umd/typings/{llm-providers → src/llm-providers}/openai/playground/playground.d.ts +0 -0
  457. /package/umd/typings/{llm-providers → src/llm-providers}/remote/RemoteLlmExecutionTools.d.ts +0 -0
  458. /package/umd/typings/{llm-providers → src/llm-providers}/remote/RemoteLlmExecutionToolsOptions.d.ts +0 -0
  459. /package/umd/typings/{llm-providers → src/llm-providers}/remote/interfaces/Promptbook_Server_Error.d.ts +0 -0
  460. /package/umd/typings/{llm-providers → src/llm-providers}/remote/interfaces/Promptbook_Server_Progress.d.ts +0 -0
  461. /package/umd/typings/{llm-providers → src/llm-providers}/remote/interfaces/Promptbook_Server_Request.d.ts +0 -0
  462. /package/umd/typings/{llm-providers → src/llm-providers}/remote/interfaces/Promptbook_Server_Response.d.ts +0 -0
  463. /package/umd/typings/{scripting/_test/postprocessing.test.d.ts → src/scripting/_test/custom-function-async.test.ts.test.d.ts} +0 -0
  464. /package/umd/typings/{scripting/_test/script-execution-errors.test.d.ts → src/scripting/_test/custom-function-missing.test.d.ts} +0 -0
  465. /package/umd/typings/{scripting/_test/script-execution-tools.test.d.ts → src/scripting/_test/custom-function-with-dependencies.test.d.ts} +0 -0
  466. /package/umd/typings/{types/execution-report/countWorkingDuration.test.d.ts → src/scripting/_test/custom-function.test.d.ts} +0 -0
  467. /package/umd/typings/{utils/expectation-counters/countCharacters.test.d.ts → src/scripting/_test/postprocessing.test.d.ts} +0 -0
  468. /package/umd/typings/{utils/expectation-counters/countLines.test.d.ts → src/scripting/_test/script-execution-errors.test.d.ts} +0 -0
  469. /package/umd/typings/{utils/expectation-counters/countPages.test.d.ts → src/scripting/_test/script-execution-tools.test.d.ts} +0 -0
  470. /package/umd/typings/{scripting → src/scripting}/javascript/JavascriptEvalExecutionTools.d.ts +0 -0
  471. /package/umd/typings/{scripting → src/scripting}/javascript/JavascriptEvalExecutionTools.test.d.ts +0 -0
  472. /package/umd/typings/{scripting → src/scripting}/javascript/JavascriptExecutionTools.d.ts +0 -0
  473. /package/umd/typings/{scripting → src/scripting}/javascript/JavascriptExecutionToolsOptions.d.ts +0 -0
  474. /package/umd/typings/{scripting → src/scripting}/javascript/utils/preserve.d.ts +0 -0
  475. /package/umd/typings/{scripting → src/scripting}/javascript/utils/unknownToString.d.ts +0 -0
  476. /package/umd/typings/{scripting → src/scripting}/python/PythonExecutionTools.d.ts +0 -0
  477. /package/umd/typings/{scripting → src/scripting}/typescript/TypescriptExecutionTools.d.ts +0 -0
  478. /package/umd/typings/{types → src/types}/Command.d.ts +0 -0
  479. /package/umd/typings/{types → src/types}/ExecutionTypes.d.ts +0 -0
  480. /package/umd/typings/{types → src/types}/Parameters.d.ts +0 -0
  481. /package/umd/typings/{types → src/types}/Prompt.d.ts +0 -0
  482. /package/umd/typings/{types → src/types}/PromptbookJson/PromptTemplateJson.d.ts +0 -0
  483. /package/umd/typings/{types → src/types}/PromptbookJson/PromptTemplateParameterJson.d.ts +0 -0
  484. /package/umd/typings/{types → src/types}/PromptbookJson/PromptbookJson.d.ts +0 -0
  485. /package/umd/typings/{types → src/types}/PromptbookString.d.ts +0 -0
  486. /package/umd/typings/{types → src/types}/ScriptLanguage.d.ts +0 -0
  487. /package/umd/typings/{types → src/types}/TaskProgress.d.ts +0 -0
  488. /package/umd/typings/{types → src/types}/execution-report/ExecutionReportJson.d.ts +0 -0
  489. /package/umd/typings/{types → src/types}/execution-report/ExecutionReportString.d.ts +0 -0
  490. /package/umd/typings/{types → src/types}/execution-report/ExecutionReportStringOptions.d.ts +0 -0
  491. /package/umd/typings/{types → src/types}/execution-report/config.d.ts +0 -0
  492. /package/umd/typings/{types → src/types}/execution-report/countWorkingDuration.d.ts +0 -0
  493. /package/umd/typings/{utils/expectation-counters/countParagraphs.test.d.ts → src/types/execution-report/countWorkingDuration.test.d.ts} +0 -0
  494. /package/umd/typings/{types → src/types}/execution-report/executionReportJsonToString.d.ts +0 -0
  495. /package/umd/typings/{types → src/types}/typeAliasEmoji.d.ts +0 -0
  496. /package/umd/typings/{types → src/types}/typeAliases.d.ts +0 -0
  497. /package/umd/typings/{utils → src/utils}/FromtoItems.d.ts +0 -0
  498. /package/umd/typings/{utils → src/utils}/emojis.d.ts +0 -0
  499. /package/umd/typings/{utils → src/utils}/expectation-counters/countCharacters.d.ts +0 -0
  500. /package/umd/typings/{utils/expectation-counters/countSentences.test.d.ts → src/utils/expectation-counters/countCharacters.test.d.ts} +0 -0
  501. /package/umd/typings/{utils → src/utils}/expectation-counters/countLines.d.ts +0 -0
  502. /package/umd/typings/{utils/expectation-counters/countWords.test.d.ts → src/utils/expectation-counters/countLines.test.d.ts} +0 -0
  503. /package/umd/typings/{utils → src/utils}/expectation-counters/countPages.d.ts +0 -0
  504. /package/umd/typings/{utils/extractParameters.test.d.ts → src/utils/expectation-counters/countPages.test.d.ts} +0 -0
  505. /package/umd/typings/{utils → src/utils}/expectation-counters/countParagraphs.d.ts +0 -0
  506. /package/umd/typings/{utils/formatNumber.test.d.ts → src/utils/expectation-counters/countParagraphs.test.d.ts} +0 -0
  507. /package/umd/typings/{utils → src/utils}/expectation-counters/countSentences.d.ts +0 -0
  508. /package/umd/typings/{utils/markdown-json/countMarkdownStructureDeepness.test.d.ts → src/utils/expectation-counters/countSentences.test.d.ts} +0 -0
  509. /package/umd/typings/{utils → src/utils}/expectation-counters/countWords.d.ts +0 -0
  510. /package/umd/typings/{utils/markdown-json/markdownToMarkdownStructure.test.d.ts → src/utils/expectation-counters/countWords.test.d.ts} +0 -0
  511. /package/umd/typings/{utils → src/utils}/expectation-counters/index.d.ts +0 -0
  512. /package/umd/typings/{utils → src/utils}/extractParameters.d.ts +0 -0
  513. /package/umd/typings/{utils/markdown/addAutoGeneratedSection.test.d.ts → src/utils/extractParameters.test.d.ts} +0 -0
  514. /package/umd/typings/{utils → src/utils}/formatNumber.d.ts +0 -0
  515. /package/umd/typings/{utils/markdown/createMarkdownChart.test.d.ts → src/utils/formatNumber.test.d.ts} +0 -0
  516. /package/umd/typings/{utils → src/utils}/getCurrentIsoDate.d.ts +0 -0
  517. /package/umd/typings/{utils → src/utils}/isRunningInWhatever.d.ts +0 -0
  518. /package/umd/typings/{utils → src/utils}/just.d.ts +0 -0
  519. /package/umd/typings/{utils → src/utils}/markdown/addAutoGeneratedSection.d.ts +0 -0
  520. /package/umd/typings/{utils/markdown/extractAllBlocksFromMarkdown.test.d.ts → src/utils/markdown/addAutoGeneratedSection.test.d.ts} +0 -0
  521. /package/umd/typings/{utils → src/utils}/markdown/createMarkdownChart.d.ts +0 -0
  522. /package/umd/typings/{utils/markdown/extractAllListItemsFromMarkdown.test.d.ts → src/utils/markdown/createMarkdownChart.test.d.ts} +0 -0
  523. /package/umd/typings/{utils → src/utils}/markdown/createMarkdownTable.d.ts +0 -0
  524. /package/umd/typings/{utils/markdown/extractOneBlockFromMarkdown.test.d.ts → src/utils/markdown/createMarkdownTable.test.d.ts} +0 -0
  525. /package/umd/typings/{utils → src/utils}/markdown/escapeMarkdownBlock.d.ts +0 -0
  526. /package/umd/typings/{utils/markdown/prettifyMarkdown.test.d.ts → src/utils/markdown/escapeMarkdownBlock.test.d.ts} +0 -0
  527. /package/umd/typings/{utils → src/utils}/markdown/extractAllBlocksFromMarkdown.d.ts +0 -0
  528. /package/umd/typings/{utils/markdown/removeContentComments.test.d.ts → src/utils/markdown/extractAllBlocksFromMarkdown.test.d.ts} +0 -0
  529. /package/umd/typings/{utils → src/utils}/markdown/extractAllListItemsFromMarkdown.d.ts +0 -0
  530. /package/umd/typings/{utils/markdown/removeMarkdownFormatting.test.d.ts → src/utils/markdown/extractAllListItemsFromMarkdown.test.d.ts} +0 -0
  531. /package/umd/typings/{utils → src/utils}/markdown/extractOneBlockFromMarkdown.d.ts +0 -0
  532. /package/umd/typings/{utils/normalization/capitalize.test.d.ts → src/utils/markdown/extractOneBlockFromMarkdown.test.d.ts} +0 -0
  533. /package/umd/typings/{utils → src/utils}/markdown/prettifyMarkdown.d.ts +0 -0
  534. /package/umd/typings/{utils/normalization/decapitalize.test.d.ts → src/utils/markdown/prettifyMarkdown.test.d.ts} +0 -0
  535. /package/umd/typings/{utils → src/utils}/markdown/removeContentComments.d.ts +0 -0
  536. /package/umd/typings/{utils/normalization/isValidKeyword.test.d.ts → src/utils/markdown/removeContentComments.test.d.ts} +0 -0
  537. /package/umd/typings/{utils → src/utils}/markdown/removeMarkdownFormatting.d.ts +0 -0
  538. /package/umd/typings/{utils/normalization/nameToUriPart.test.d.ts → src/utils/markdown/removeMarkdownFormatting.test.d.ts} +0 -0
  539. /package/umd/typings/{utils → src/utils}/markdown-json/MarkdownStructure.d.ts +0 -0
  540. /package/umd/typings/{utils → src/utils}/markdown-json/countMarkdownStructureDeepness.d.ts +0 -0
  541. /package/umd/typings/{utils/markdown/createMarkdownTable.test.d.ts → src/utils/markdown-json/countMarkdownStructureDeepness.test.d.ts} +0 -0
  542. /package/umd/typings/{utils → src/utils}/markdown-json/markdownToMarkdownStructure.d.ts +0 -0
  543. /package/umd/typings/{utils/markdown/escapeMarkdownBlock.test.d.ts → src/utils/markdown-json/markdownToMarkdownStructure.test.d.ts} +0 -0
  544. /package/umd/typings/{utils → src/utils}/normalization/DIACRITIC_VARIANTS_LETTERS.d.ts +0 -0
  545. /package/umd/typings/{utils → src/utils}/normalization/IKeywords.d.ts +0 -0
  546. /package/umd/typings/{utils → src/utils}/normalization/capitalize.d.ts +0 -0
  547. /package/umd/typings/{utils/normalization/nameToUriParts.test.d.ts → src/utils/normalization/capitalize.test.d.ts} +0 -0
  548. /package/umd/typings/{utils → src/utils}/normalization/decapitalize.d.ts +0 -0
  549. /package/umd/typings/{utils/normalization/normalize-to-kebab-case.test.d.ts → src/utils/normalization/decapitalize.test.d.ts} +0 -0
  550. /package/umd/typings/{utils → src/utils}/normalization/isValidKeyword.d.ts +0 -0
  551. /package/umd/typings/{utils/normalization/normalizeTo_PascalCase.test.d.ts → src/utils/normalization/isValidKeyword.test.d.ts} +0 -0
  552. /package/umd/typings/{utils → src/utils}/normalization/nameToUriPart.d.ts +0 -0
  553. /package/umd/typings/{utils/normalization/normalizeTo_SCREAMING_CASE.test.d.ts → src/utils/normalization/nameToUriPart.test.d.ts} +0 -0
  554. /package/umd/typings/{utils → src/utils}/normalization/nameToUriParts.d.ts +0 -0
  555. /package/umd/typings/{utils/normalization/normalizeTo_camelCase.test.d.ts → src/utils/normalization/nameToUriParts.test.d.ts} +0 -0
  556. /package/umd/typings/{utils → src/utils}/normalization/normalize-to-kebab-case.d.ts +0 -0
  557. /package/umd/typings/{utils/normalization/normalizeTo_snake_case.test.d.ts → src/utils/normalization/normalize-to-kebab-case.test.d.ts} +0 -0
  558. /package/umd/typings/{utils → src/utils}/normalization/normalizeTo_PascalCase.d.ts +0 -0
  559. /package/umd/typings/{utils/normalization/normalizeWhitespaces.test.d.ts → src/utils/normalization/normalizeTo_PascalCase.test.d.ts} +0 -0
  560. /package/umd/typings/{utils → src/utils}/normalization/normalizeTo_SCREAMING_CASE.d.ts +0 -0
  561. /package/umd/typings/{utils/normalization/parseKeywords.test.d.ts → src/utils/normalization/normalizeTo_SCREAMING_CASE.test.d.ts} +0 -0
  562. /package/umd/typings/{utils → src/utils}/normalization/normalizeTo_camelCase.d.ts +0 -0
  563. /package/umd/typings/{utils/normalization/parseKeywordsFromString.test.d.ts → src/utils/normalization/normalizeTo_camelCase.test.d.ts} +0 -0
  564. /package/umd/typings/{utils → src/utils}/normalization/normalizeTo_snake_case.d.ts +0 -0
  565. /package/umd/typings/{utils/normalization/removeDiacritics.test.d.ts → src/utils/normalization/normalizeTo_snake_case.test.d.ts} +0 -0
  566. /package/umd/typings/{utils → src/utils}/normalization/normalizeWhitespaces.d.ts +0 -0
  567. /package/umd/typings/{utils/normalization/searchKeywords.test.d.ts → src/utils/normalization/normalizeWhitespaces.test.d.ts} +0 -0
  568. /package/umd/typings/{utils → src/utils}/normalization/parseKeywords.d.ts +0 -0
  569. /package/umd/typings/{utils/removeEmojis.test.d.ts → src/utils/normalization/parseKeywords.test.d.ts} +0 -0
  570. /package/umd/typings/{utils → src/utils}/normalization/parseKeywordsFromString.d.ts +0 -0
  571. /package/umd/typings/{utils/removeQuotes.test.d.ts → src/utils/normalization/parseKeywordsFromString.test.d.ts} +0 -0
  572. /package/umd/typings/{utils → src/utils}/normalization/removeDiacritics.d.ts +0 -0
  573. /package/umd/typings/{utils/sets/difference.test.d.ts → src/utils/normalization/removeDiacritics.test.d.ts} +0 -0
  574. /package/umd/typings/{utils → src/utils}/normalization/searchKeywords.d.ts +0 -0
  575. /package/umd/typings/{utils/sets/intersection.test.d.ts → src/utils/normalization/searchKeywords.test.d.ts} +0 -0
  576. /package/umd/typings/{utils → src/utils}/postprocessing/extractBlock.d.ts +0 -0
  577. /package/umd/typings/{utils → src/utils}/removeEmojis.d.ts +0 -0
  578. /package/umd/typings/{utils/sets/union.test.d.ts → src/utils/removeEmojis.test.d.ts} +0 -0
  579. /package/umd/typings/{utils → src/utils}/removeQuotes.d.ts +0 -0
  580. /package/umd/typings/{utils/trimCodeBlock.test.d.ts → src/utils/removeQuotes.test.d.ts} +0 -0
  581. /package/umd/typings/{utils → src/utils}/sets/difference.d.ts +0 -0
  582. /package/umd/typings/{utils/trimEndOfCodeBlock.test.d.ts → src/utils/sets/difference.test.d.ts} +0 -0
  583. /package/umd/typings/{utils → src/utils}/sets/intersection.d.ts +0 -0
  584. /package/umd/typings/{utils/unwrapResult.test.d.ts → src/utils/sets/intersection.test.d.ts} +0 -0
  585. /package/umd/typings/{utils → src/utils}/sets/union.d.ts +0 -0
  586. /package/umd/typings/{utils/validators/url/isValidUrl.test.d.ts → src/utils/sets/union.test.d.ts} +0 -0
  587. /package/umd/typings/{utils → src/utils}/trimCodeBlock.d.ts +0 -0
  588. /package/umd/typings/{utils → src/utils}/trimEndOfCodeBlock.d.ts +0 -0
  589. /package/umd/typings/{utils → src/utils}/unwrapResult.d.ts +0 -0
  590. /package/umd/typings/{utils → src/utils}/validators/url/isValidUrl.d.ts +0 -0
  591. /package/umd/typings/{version.d.ts → src/version.d.ts} +0 -0
package/umd/index.umd.js CHANGED
@@ -1,11 +1,12 @@
1
1
  (function (global, factory) {
2
- typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('fs/promises'), require('path'), require('spacetrim'), require('prettier'), require('prettier/parser-html')) :
3
- typeof define === 'function' && define.amd ? define(['exports', 'fs/promises', 'path', 'spacetrim', 'prettier', 'prettier/parser-html'], factory) :
4
- (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global["promptbook-node"] = {}, global.promises, global.path, global.spaceTrim, global.prettier, global.parserHtml));
5
- })(this, (function (exports, promises, path, spaceTrim, prettier, parserHtml) { 'use strict';
2
+ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('colors'), require('fs/promises'), require('path'), require('spacetrim'), require('prettier'), require('prettier/parser-html')) :
3
+ typeof define === 'function' && define.amd ? define(['exports', 'colors', 'fs/promises', 'path', 'spacetrim', 'prettier', 'prettier/parser-html'], factory) :
4
+ (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global["promptbook-node"] = {}, global.colors, global.promises, global.path, global.spaceTrim, global.prettier, global.parserHtml));
5
+ })(this, (function (exports, colors, promises, path, spaceTrim, prettier, parserHtml) { 'use strict';
6
6
 
7
7
  function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
8
8
 
9
+ var colors__default = /*#__PURE__*/_interopDefaultLegacy(colors);
9
10
  var spaceTrim__default = /*#__PURE__*/_interopDefaultLegacy(spaceTrim);
10
11
  var parserHtml__default = /*#__PURE__*/_interopDefaultLegacy(parserHtml);
11
12
 
@@ -129,18 +130,15 @@
129
130
  }
130
131
 
131
132
  /**
132
- * This error indicates that the promptbook in a markdown format cannot be parsed into a valid promptbook object
133
+ * The maximum number of iterations for a loops
133
134
  */
134
- var PromptbookSyntaxError = /** @class */ (function (_super) {
135
- __extends(PromptbookSyntaxError, _super);
136
- function PromptbookSyntaxError(message) {
137
- var _this = _super.call(this, message) || this;
138
- _this.name = 'PromptbookSyntaxError';
139
- Object.setPrototypeOf(_this, PromptbookSyntaxError.prototype);
140
- return _this;
141
- }
142
- return PromptbookSyntaxError;
143
- }(Error));
135
+ var LOOP_LIMIT = 1000;
136
+ /**
137
+ * The name of the builded promptbook library made by CLI `promptbook make` and for lookup in `createLibraryFromDirectory`
138
+ */
139
+ var PROMPTBOOK_MAKED_BASE_FILENAME = "index";
140
+
141
+ var promptbookLibrary = [{title:"Prepare Keywords",promptbookUrl:"https://promptbook.studio/promptbook/prepare-keywords.ptbk.md",promptbookVersion:"0.59.0-36",parameters:[{name:"content",description:"The content",isInput:true,isOutput:false},{name:"keywords",description:"Keywords separated by comma",isInput:false,isOutput:true}],promptTemplates:[{name:"knowledge",title:"Knowledge",dependentParameterNames:["content"],executionType:"PROMPT_TEMPLATE",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> {content}",resultingParameterName:"keywords"}],knowledge:[]},{title:"Prepare Knowledge from Markdown",promptbookUrl:"https://promptbook.studio/promptbook/prepare-knowledge-from-markdown.ptbk.md",promptbookVersion:"0.59.0-36",parameters:[{name:"content",description:"Markdown document content",isInput:true,isOutput:false},{name:"knowledge",description:"The knowledge JSON object",isInput:false,isOutput:true}],promptTemplates:[{name:"knowledge",title:"Knowledge",dependentParameterNames:["content"],executionType:"PROMPT_TEMPLATE",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> {content}",resultingParameterName:"knowledge"}],knowledge:[]}];
144
142
 
145
143
  /**
146
144
  * This error indicates errors during the execution of the promptbook
@@ -181,11 +179,6 @@
181
179
  * TODO: [🧠] Can this return type be better typed than void
182
180
  */
183
181
 
184
- /**
185
- * The maximum number of iterations for a loops
186
- */
187
- var LOOP_LIMIT = 1000;
188
-
189
182
  /**
190
183
  * This error indicates that the promptbook object has valid syntax but contains logical errors (like circular dependencies)
191
184
  */
@@ -200,6 +193,20 @@
200
193
  return PromptbookLogicError;
201
194
  }(Error));
202
195
 
196
+ /**
197
+ * This error indicates that the promptbook in a markdown format cannot be parsed into a valid promptbook object
198
+ */
199
+ var PromptbookSyntaxError = /** @class */ (function (_super) {
200
+ __extends(PromptbookSyntaxError, _super);
201
+ function PromptbookSyntaxError(message) {
202
+ var _this = _super.call(this, message) || this;
203
+ _this.name = 'PromptbookSyntaxError';
204
+ Object.setPrototypeOf(_this, PromptbookSyntaxError.prototype);
205
+ return _this;
206
+ }
207
+ return PromptbookSyntaxError;
208
+ }(Error));
209
+
203
210
  /**
204
211
  * This error type indicates that the error should not happen and its last check before crashing with some other error
205
212
  */
@@ -253,7 +260,7 @@
253
260
  * @returns the same promptbook if it is logically valid
254
261
  * @throws {PromptbookLogicError} on logical error in the promptbook
255
262
  */
256
- function validatePromptbookJson(promptbook) {
263
+ function validatePromptbook(promptbook) {
257
264
  // TODO: [🧠] Maybe test if promptbook is a promise and make specific error case for that
258
265
  var e_1, _a, e_2, _b, e_3, _c, e_4, _d;
259
266
  if (promptbook.promptbookUrl !== undefined) {
@@ -317,8 +324,7 @@
317
324
  throw new PromptbookLogicError("Parameter {".concat(template.resultingParameterName, "} is defined multiple times"));
318
325
  }
319
326
  definedParameters.add(template.resultingParameterName);
320
- if (template.executionType === 'PROMPT_TEMPLATE' &&
321
- (template.modelRequirements.modelVariant === undefined)) {
327
+ if (template.executionType === 'PROMPT_TEMPLATE' && template.modelRequirements.modelVariant === undefined) {
322
328
  throw new PromptbookLogicError(spaceTrim.spaceTrim("\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`\n\n ")));
323
329
  }
324
330
  if (template.jokers && template.jokers.length > 0) {
@@ -388,7 +394,7 @@
388
394
  var loopLimit = LOOP_LIMIT;
389
395
  var _loop_2 = function () {
390
396
  if (loopLimit-- < 0) {
391
- throw new UnexpectedError('Loop limit reached during detection of circular dependencies in `validatePromptbookJson`');
397
+ throw new UnexpectedError('Loop limit reached during detection of circular dependencies in `validatePromptbook`');
392
398
  }
393
399
  var currentlyResovedTemplates = unresovedTemplates.filter(function (template) {
394
400
  return template.dependentParameterNames.every(function (name) { return resovedParameters.includes(name); });
@@ -423,7 +429,7 @@
423
429
  * > * It checks:
424
430
  * > * - it has a valid structure
425
431
  * > * - ...
426
- * > ex port function validatePromptbookJson(promptbook: unknown): asserts promptbook is PromptbookJson {
432
+ * > ex port function validatePromptbook(promptbook: unknown): asserts promptbook is PromptbookJson {
427
433
  */
428
434
 
429
435
  /**
@@ -465,7 +471,7 @@
465
471
  /**
466
472
  * The version of the Promptbook library
467
473
  */
468
- var PROMPTBOOK_VERSION = '0.59.0-7';
474
+ var PROMPTBOOK_VERSION = '0.59.0-36';
469
475
 
470
476
  /**
471
477
  * Function `addUsage` will add multiple usages into one
@@ -1006,7 +1012,7 @@
1006
1012
  var _this = this;
1007
1013
  var promptbook = options.promptbook, tools = options.tools, _a = options.settings, settings = _a === void 0 ? {} : _a;
1008
1014
  var _b = settings.maxExecutionAttempts, maxExecutionAttempts = _b === void 0 ? 3 : _b;
1009
- validatePromptbookJson(promptbook);
1015
+ validatePromptbook(promptbook);
1010
1016
  var promptbookExecutor = function (inputParameters, onProgress) { return __awaiter(_this, void 0, void 0, function () {
1011
1017
  function executeSingleTemplate(currentTemplate) {
1012
1018
  return __awaiter(this, void 0, void 0, function () {
@@ -1437,7 +1443,7 @@
1437
1443
  return template.dependentParameterNames.every(function (name) { return resovedParameters_1.includes(name); });
1438
1444
  });
1439
1445
  if (!(!currentTemplate && resolving_1.length === 0)) return [3 /*break*/, 1];
1440
- throw new UnexpectedError(spaceTrim.spaceTrim("\n Can not resolve some parameters\n\n Note: This should be catched during validatePromptbookJson\n "));
1446
+ throw new UnexpectedError(spaceTrim.spaceTrim("\n Can not resolve some parameters\n\n Note: This should be catched during validatePromptbook\n "));
1441
1447
  case 1:
1442
1448
  if (!!currentTemplate) return [3 /*break*/, 3];
1443
1449
  /* [5] */ return [4 /*yield*/, Promise.race(resolving_1)];
@@ -1798,6 +1804,7 @@
1798
1804
  * Library of promptbooks that groups together promptbooks for an application.
1799
1805
  * This implementation is a very thin wrapper around the Array / Map of promptbooks.
1800
1806
  *
1807
+ * @private use `createLibraryFromJson` instead
1801
1808
  * @see https://github.com/webgptorg/promptbook#promptbook-library
1802
1809
  */
1803
1810
  var SimplePromptbookLibrary = /** @class */ (function () {
@@ -1806,8 +1813,9 @@
1806
1813
  *
1807
1814
  * @param promptbooks !!!
1808
1815
  *
1816
+ * @private Use instead `createLibraryFromJson`
1809
1817
  * Note: During the construction logic of all promptbooks are validated
1810
- * Note: It is not recommended to use this constructor directly, use `createPromptbookLibraryFromSources` *(or other variant)* instead
1818
+ * Note: It is not recommended to use this constructor directly, use `createLibraryFromJson` *(or other variant)* instead
1811
1819
  */
1812
1820
  function SimplePromptbookLibrary() {
1813
1821
  var e_1, _a;
@@ -1822,7 +1830,7 @@
1822
1830
  if (promptbook.promptbookUrl === undefined) {
1823
1831
  throw new PromptbookReferenceError(spaceTrim.spaceTrim("\n Promptbook with name \"".concat(promptbook.title, "\" does not have defined URL\n\n Note: Promptbooks without URLs are called anonymous promptbooks\n They can be used as standalone promptbooks, but they cannot be referenced by other promptbooks\n And also they cannot be used in the promptbook library\n\n ")));
1824
1832
  }
1825
- validatePromptbookJson(promptbook);
1833
+ validatePromptbook(promptbook);
1826
1834
  // Note: [🦄]
1827
1835
  if (this.library.has(promptbook.promptbookUrl) &&
1828
1836
  promptbookJsonToString(promptbook) !==
@@ -1876,68 +1884,19 @@
1876
1884
  /**
1877
1885
  * Creates PromptbookLibrary from array of PromptbookJson or PromptbookString
1878
1886
  *
1879
- * Note: You can combine `PromptbookString` (`.ptbk.md`) with `PromptbookJson` BUT it is not recommended
1887
+ * Note: Functions `libraryToJson` and `createLibraryFromJson` are complementary
1880
1888
  * Note: During the construction syntax and logic of all sources are validated
1881
1889
  *
1882
1890
  * @param promptbookSources
1883
1891
  * @returns PromptbookLibrary
1884
1892
  */
1885
- function createPromptbookLibraryFromSources() {
1886
- var promptbookSources = [];
1893
+ function createLibraryFromJson() {
1894
+ var promptbooks = [];
1887
1895
  for (var _i = 0; _i < arguments.length; _i++) {
1888
- promptbookSources[_i] = arguments[_i];
1896
+ promptbooks[_i] = arguments[_i];
1889
1897
  }
1890
- return __awaiter(this, void 0, void 0, function () {
1891
- var promptbooks, promptbookSources_1, promptbookSources_1_1, source, promptbook, e_1_1;
1892
- var e_1, _a;
1893
- return __generator(this, function (_b) {
1894
- switch (_b.label) {
1895
- case 0:
1896
- promptbooks = new Array();
1897
- _b.label = 1;
1898
- case 1:
1899
- _b.trys.push([1, 8, 9, 10]);
1900
- promptbookSources_1 = __values(promptbookSources), promptbookSources_1_1 = promptbookSources_1.next();
1901
- _b.label = 2;
1902
- case 2:
1903
- if (!!promptbookSources_1_1.done) return [3 /*break*/, 7];
1904
- source = promptbookSources_1_1.value;
1905
- promptbook = void 0;
1906
- if (!(typeof source === 'string')) return [3 /*break*/, 4];
1907
- return [4 /*yield*/, promptbookStringToJson(source)];
1908
- case 3:
1909
- // Note: When directly creating from string, no need to validate the source
1910
- // The validation is performed always before execution
1911
- promptbook = _b.sent();
1912
- return [3 /*break*/, 5];
1913
- case 4:
1914
- promptbook = source;
1915
- _b.label = 5;
1916
- case 5:
1917
- promptbooks.push(promptbook);
1918
- _b.label = 6;
1919
- case 6:
1920
- promptbookSources_1_1 = promptbookSources_1.next();
1921
- return [3 /*break*/, 2];
1922
- case 7: return [3 /*break*/, 10];
1923
- case 8:
1924
- e_1_1 = _b.sent();
1925
- e_1 = { error: e_1_1 };
1926
- return [3 /*break*/, 10];
1927
- case 9:
1928
- try {
1929
- if (promptbookSources_1_1 && !promptbookSources_1_1.done && (_a = promptbookSources_1.return)) _a.call(promptbookSources_1);
1930
- }
1931
- finally { if (e_1) throw e_1.error; }
1932
- return [7 /*endfinally*/];
1933
- case 10: return [2 /*return*/, new (SimplePromptbookLibrary.bind.apply(SimplePromptbookLibrary, __spreadArray([void 0], __read(promptbooks), false)))()];
1934
- }
1935
- });
1936
- });
1898
+ return new (SimplePromptbookLibrary.bind.apply(SimplePromptbookLibrary, __spreadArray([void 0], __read(promptbooks), false)))();
1937
1899
  }
1938
- /**
1939
- * TODO: !!!! [🧠] Library precompilation and do not mix markdown and json promptbooks
1940
- */
1941
1900
 
1942
1901
  /* tslint:disable */
1943
1902
  function normalizeToKebabCase(sentence) {
@@ -1996,85 +1955,100 @@
1996
1955
 
1997
1956
  function prepareKnowledgeFromMarkdown(options) {
1998
1957
  return __awaiter(this, void 0, void 0, function () {
1999
- var content, llmTools, library, promptbook, executor, result, outputParameters, knowledgeRaw, knowledgeTextPieces, knowledge;
1958
+ var content, llmTools, _a, isVerbose, library, prepareKnowledgeFromMarkdownPromptbook, prepareKnowledgeFromMarkdownExecutor, prepareKeywordsPromptbook, prepareKeywordsExecutor, result, outputParameters, knowledgeRaw, knowledgeTextPieces, knowledge;
2000
1959
  var _this = this;
2001
- return __generator(this, function (_a) {
2002
- switch (_a.label) {
1960
+ return __generator(this, function (_b) {
1961
+ switch (_b.label) {
2003
1962
  case 0:
2004
- content = options.content, llmTools = options.llmTools;
2005
- return [4 /*yield*/, createPromptbookLibraryFromSources(
2006
- /* !!!! ...(promptbookLibrary as Array<PromptbookJson>)*/ {
2007
- title: 'Prepare Knowledge from Markdown',
2008
- promptbookUrl: 'https://promptbook.studio/promptbook/prepare-knowledge-from-markdown.ptbk.md',
2009
- promptbookVersion: '0.59.0-5',
2010
- parameters: [
2011
- { name: 'content', description: 'Markdown document content', isInput: true, isOutput: false },
2012
- { name: 'knowledge', description: 'The knowledge JSON object', isInput: false, isOutput: true },
2013
- ],
2014
- promptTemplates: [
2015
- {
2016
- name: 'knowledge',
2017
- title: 'Knowledge',
2018
- dependentParameterNames: ['content'],
2019
- executionType: 'PROMPT_TEMPLATE',
2020
- modelRequirements: { modelVariant: 'CHAT', modelName: 'claude-3-opus-20240229' },
2021
- 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> {content}',
2022
- resultingParameterName: 'knowledge',
2023
- },
2024
- ],
2025
- knowledge: [],
2026
- })];
1963
+ content = options.content, llmTools = options.llmTools, _a = options.isVerbose, isVerbose = _a === void 0 ? false : _a;
1964
+ library = createLibraryFromJson.apply(void 0, __spreadArray([], __read(promptbookLibrary), false));
1965
+ return [4 /*yield*/, library.getPromptbookByUrl('https://promptbook.studio/promptbook/prepare-knowledge-from-markdown.ptbk.md')];
2027
1966
  case 1:
2028
- library = _a.sent();
2029
- promptbook = library.getPromptbookByUrl('https://promptbook.studio/promptbook/prepare-knowledge-from-markdown.ptbk.md');
2030
- executor = createPromptbookExecutor({
2031
- promptbook: promptbook,
1967
+ prepareKnowledgeFromMarkdownPromptbook = _b.sent();
1968
+ prepareKnowledgeFromMarkdownExecutor = createPromptbookExecutor({
1969
+ promptbook: prepareKnowledgeFromMarkdownPromptbook,
2032
1970
  tools: {
2033
1971
  llm: llmTools,
2034
1972
  script: [
2035
- /* <- TODO: Allow to just not define script tools */
1973
+ /* <- TODO: Allow to just keep script undefined */
2036
1974
  ],
2037
1975
  },
2038
1976
  });
2039
- return [4 /*yield*/, executor({ content: content })];
1977
+ return [4 /*yield*/, library.getPromptbookByUrl('https://promptbook.studio/promptbook/prepare-keywords.ptbk.md')];
2040
1978
  case 2:
2041
- result = _a.sent();
1979
+ prepareKeywordsPromptbook = _b.sent();
1980
+ prepareKeywordsExecutor = createPromptbookExecutor({
1981
+ promptbook: prepareKeywordsPromptbook,
1982
+ tools: {
1983
+ llm: llmTools,
1984
+ script: [
1985
+ /* <- TODO: Allow to just keep script undefined */
1986
+ ],
1987
+ },
1988
+ });
1989
+ return [4 /*yield*/, prepareKnowledgeFromMarkdownExecutor({ content: content })];
1990
+ case 3:
1991
+ result = _b.sent();
2042
1992
  assertsExecutionSuccessful(result);
2043
1993
  outputParameters = result.outputParameters;
2044
1994
  knowledgeRaw = outputParameters.knowledge;
2045
1995
  knowledgeTextPieces = (knowledgeRaw || '').split('\n---\n');
1996
+ if (isVerbose) {
1997
+ console.info('knowledgeTextPieces:', knowledgeTextPieces);
1998
+ }
2046
1999
  return [4 /*yield*/, Promise.all(knowledgeTextPieces.map(function (knowledgeTextPiece, i) { return __awaiter(_this, void 0, void 0, function () {
2047
- var name, title, content, keywords, index, sources;
2048
- return __generator(this, function (_a) {
2049
- name = "piece-".concat(i);
2050
- title = spaceTrim__default["default"](knowledgeTextPiece.substring(0, 100));
2051
- content = spaceTrim__default["default"](knowledgeTextPiece);
2052
- keywords = [];
2053
- index = [];
2054
- sources = [];
2055
- try {
2056
- // TODO: !!!! Summarize name and title from the content
2057
- title = spaceTrim__default["default"](knowledgeTextPiece.substring(0, 30));
2058
- name = normalizeToKebabCase(title);
2059
- // TODO: !!!! Extract keywords via prompt
2060
- // TODO: !!!! Index through LLM model
2061
- // TODO: [🖖] !!!! Make system for sources and identification of sources
2062
- }
2063
- catch (error) {
2064
- console.error(error);
2000
+ var name, title, content, keywords, index, sources, result_1, _a, outputParameters_1, keywordsRaw, error_1;
2001
+ return __generator(this, function (_b) {
2002
+ switch (_b.label) {
2003
+ case 0:
2004
+ name = "piece-".concat(i);
2005
+ title = spaceTrim__default["default"](knowledgeTextPiece.substring(0, 100));
2006
+ content = spaceTrim__default["default"](knowledgeTextPiece);
2007
+ keywords = [];
2008
+ index = [];
2009
+ sources = [];
2010
+ _b.label = 1;
2011
+ case 1:
2012
+ _b.trys.push([1, 3, , 4]);
2013
+ // TODO: !!!! Summarize name and title from the content
2014
+ title = spaceTrim__default["default"](knowledgeTextPiece.substring(0, 30));
2015
+ name = normalizeToKebabCase(title);
2016
+ return [4 /*yield*/, prepareKeywordsExecutor({ content: content })];
2017
+ case 2:
2018
+ result_1 = _b.sent();
2019
+ _a = result_1.outputParameters, outputParameters_1 = _a === void 0 ? {} : _a;
2020
+ keywordsRaw = outputParameters_1.keywords;
2021
+ keywords = (keywordsRaw || '')
2022
+ .split(',')
2023
+ .map(function (keyword) { return keyword.trim(); })
2024
+ .filter(function (keyword) { return keyword !== ''; });
2025
+ if (isVerbose) {
2026
+ console.info("Keywords for \"".concat(title, "\":"), keywords);
2027
+ }
2028
+ // ---
2029
+ // TODO: !!!! Index through LLM model
2030
+ index.push({
2031
+ modelName: 'fake-model',
2032
+ position: new Array(25).fill(0).map(function () { return Math.random() * 2 - 1; }),
2033
+ });
2034
+ return [3 /*break*/, 4];
2035
+ case 3:
2036
+ error_1 = _b.sent();
2037
+ console.error(error_1);
2038
+ return [3 /*break*/, 4];
2039
+ case 4: return [2 /*return*/, {
2040
+ name: name,
2041
+ title: title,
2042
+ content: content,
2043
+ keywords: keywords,
2044
+ index: index,
2045
+ sources: sources,
2046
+ }];
2065
2047
  }
2066
- return [2 /*return*/, {
2067
- name: name,
2068
- title: title,
2069
- content: content,
2070
- keywords: keywords,
2071
- index: index,
2072
- sources: sources,
2073
- }];
2074
2048
  });
2075
2049
  }); }))];
2076
- case 3:
2077
- knowledge = _a.sent();
2050
+ case 4:
2051
+ knowledge = _b.sent();
2078
2052
  return [2 /*return*/, knowledge];
2079
2053
  }
2080
2054
  });
@@ -2923,9 +2897,279 @@
2923
2897
  return value;
2924
2898
  }
2925
2899
 
2900
+ /**
2901
+ * Compile promptbook from string (markdown) format to JSON format synchronously
2902
+ *
2903
+ * Note: There are two similar functions:
2904
+ * - `promptbookStringToJson` **(preferred)** - which propperly compiles the promptbook and use embedding for external knowledge
2905
+ * - `promptbookStringToJsonSync` - use only if you need to compile promptbook synchronously and it contains NO external knowledge
2906
+ *
2907
+ * @param promptbookString {Promptbook} in string markdown format (.ptbk.md)
2908
+ * @param options - Options and tools for the compilation
2909
+ * @returns {Promptbook} compiled in JSON format (.ptbk.json)
2910
+ * @throws {PromptbookSyntaxError} if the promptbook string is not valid
2911
+ *
2912
+ * Note: This function does not validate logic of the pipeline only the syntax
2913
+ * Note: This function acts as compilation process
2914
+ */
2915
+ function promptbookStringToJsonSync(promptbookString) {
2916
+ var e_1, _a, e_2, _b;
2917
+ var promptbookJson = {
2918
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
2919
+ title: undefined /* <- Note: Putting here placeholder to keep `title` on top at final JSON */,
2920
+ promptbookUrl: undefined /* <- Note: Putting here placeholder to keep `promptbookUrl` on top at final JSON */,
2921
+ promptbookVersion: PROMPTBOOK_VERSION,
2922
+ description: undefined /* <- Note: Putting here placeholder to keep `description` on top at final JSON */,
2923
+ parameters: [],
2924
+ promptTemplates: [],
2925
+ knowledge: [],
2926
+ };
2927
+ // =============================================================
2928
+ // Note: 1️⃣ Normalization of the PROMPTBOOK string
2929
+ promptbookString = removeContentComments(promptbookString);
2930
+ promptbookString = promptbookString.replaceAll(/`\{(?<parameterName>[a-z0-9_]+)\}`/gi, '{$<parameterName>}');
2931
+ promptbookString = promptbookString.replaceAll(/`->\s+\{(?<parameterName>[a-z0-9_]+)\}`/gi, '-> {$<parameterName>}');
2932
+ // =============================================================
2933
+ ///Note: 2️⃣ Function for adding parameters
2934
+ var addParam = function (parameterCommand) {
2935
+ var parameterName = parameterCommand.parameterName, parameterDescription = parameterCommand.parameterDescription, isInput = parameterCommand.isInput, isOutput = parameterCommand.isOutput;
2936
+ var existingParameter = promptbookJson.parameters.find(function (parameter) { return parameter.name === parameterName; });
2937
+ if (existingParameter &&
2938
+ existingParameter.description &&
2939
+ existingParameter.description !== parameterDescription &&
2940
+ parameterDescription) {
2941
+ throw new PromptbookSyntaxError(spaceTrim.spaceTrim(function (block) { return "\n Parameter {".concat(parameterName, "} is defined multiple times with different description.\n\n First definition:\n ").concat(block(existingParameter.description || '[undefined]'), "\n\n Second definition:\n ").concat(block(parameterDescription || '[undefined]'), "\n "); }));
2942
+ }
2943
+ if (existingParameter) {
2944
+ if (parameterDescription) {
2945
+ existingParameter.description = parameterDescription;
2946
+ }
2947
+ }
2948
+ else {
2949
+ promptbookJson.parameters.push({
2950
+ name: parameterName,
2951
+ description: parameterDescription || undefined,
2952
+ isInput: isInput,
2953
+ isOutput: isOutput,
2954
+ });
2955
+ }
2956
+ };
2957
+ // =============================================================
2958
+ // Note: 3️⃣ Parse the dynamic part - the template pipeline
2959
+ var markdownStructure = markdownToMarkdownStructure(promptbookString);
2960
+ var markdownStructureDeepness = countMarkdownStructureDeepness(markdownStructure);
2961
+ if (markdownStructureDeepness !== 2) {
2962
+ throw new PromptbookSyntaxError(spaceTrim.spaceTrim("\n Invalid markdown structure.\n The markdown must have exactly 2 levels of headings (one top-level section and one section for each template).\n Now it has ".concat(markdownStructureDeepness, " levels of headings.\n ")));
2963
+ }
2964
+ promptbookJson.title = markdownStructure.title;
2965
+ // TODO: [1] DRY description
2966
+ var description = markdownStructure.content;
2967
+ // Note: Remove codeblocks
2968
+ description = description.split(/^```.*^```/gms).join('');
2969
+ //Note: Remove lists and return statement
2970
+ description = description.split(/^(?:(?:-)|(?:\d\))|(?:`?->))\s+.*$/gm).join('');
2971
+ description = spaceTrim.spaceTrim(description);
2972
+ if (description === '') {
2973
+ description = undefined;
2974
+ }
2975
+ promptbookJson.description = description;
2976
+ var defaultModelRequirements = {};
2977
+ var listItems = extractAllListItemsFromMarkdown(markdownStructure.content);
2978
+ try {
2979
+ for (var listItems_1 = __values(listItems), listItems_1_1 = listItems_1.next(); !listItems_1_1.done; listItems_1_1 = listItems_1.next()) {
2980
+ var listItem = listItems_1_1.value;
2981
+ var command = parseCommand(listItem);
2982
+ switch (command.type) {
2983
+ case 'PROMPTBOOK_URL':
2984
+ promptbookJson.promptbookUrl = command.promptbookUrl.href;
2985
+ break;
2986
+ case 'PROMPTBOOK_VERSION':
2987
+ promptbookJson.promptbookVersion = command.promptbookVersion;
2988
+ break;
2989
+ case 'MODEL':
2990
+ defaultModelRequirements[command.key] = command.value;
2991
+ break;
2992
+ case 'PARAMETER':
2993
+ addParam(command);
2994
+ break;
2995
+ default:
2996
+ throw new PromptbookSyntaxError("Command ".concat(command.type, " is not allowed in the head of the promptbook ONLY at the prompt template block"));
2997
+ }
2998
+ }
2999
+ }
3000
+ catch (e_1_1) { e_1 = { error: e_1_1 }; }
3001
+ finally {
3002
+ try {
3003
+ if (listItems_1_1 && !listItems_1_1.done && (_a = listItems_1.return)) _a.call(listItems_1);
3004
+ }
3005
+ finally { if (e_1) throw e_1.error; }
3006
+ }
3007
+ var _loop_1 = function (section) {
3008
+ var e_3, _e;
3009
+ // TODO: Parse prompt template description (the content out of the codeblock and lists)
3010
+ var templateModelRequirements = __assign({}, defaultModelRequirements);
3011
+ var listItems_3 = extractAllListItemsFromMarkdown(section.content);
3012
+ var dependentParameterNames = new Set();
3013
+ var executionType = 'PROMPT_TEMPLATE';
3014
+ var jokers = [];
3015
+ var postprocessing = [];
3016
+ var expectAmount = {};
3017
+ var expectFormat = undefined;
3018
+ var isExecutionTypeChanged = false;
3019
+ try {
3020
+ for (var listItems_2 = (e_3 = void 0, __values(listItems_3)), listItems_2_1 = listItems_2.next(); !listItems_2_1.done; listItems_2_1 = listItems_2.next()) {
3021
+ var listItem = listItems_2_1.value;
3022
+ var command = parseCommand(listItem);
3023
+ switch (command.type) {
3024
+ case 'JOKER':
3025
+ jokers.push(command.parameterName);
3026
+ dependentParameterNames.add(command.parameterName);
3027
+ break;
3028
+ case 'EXECUTE':
3029
+ if (isExecutionTypeChanged) {
3030
+ throw new PromptbookSyntaxError('Execution type is already defined in the prompt template. It can be defined only once.');
3031
+ }
3032
+ executionType = command.executionType;
3033
+ isExecutionTypeChanged = true;
3034
+ break;
3035
+ case 'MODEL':
3036
+ templateModelRequirements[command.key] = command.value;
3037
+ break;
3038
+ case 'PARAMETER':
3039
+ // Note: This is just for detecting resulitng parameter name
3040
+ addParam(command);
3041
+ break;
3042
+ case 'POSTPROCESS':
3043
+ postprocessing.push(command.functionName);
3044
+ break;
3045
+ case 'EXPECT_AMOUNT':
3046
+ // eslint-disable-next-line no-case-declarations
3047
+ var unit = command.unit.toLowerCase();
3048
+ expectAmount[unit] = expectAmount[unit] || {};
3049
+ if (command.sign === 'MINIMUM' || command.sign === 'EXACTLY') {
3050
+ if (expectAmount[unit].min !== undefined) {
3051
+ throw new PromptbookSyntaxError("Already defined minumum ".concat(expectAmount[unit].min, " ").concat(command.unit.toLowerCase(), ", now trying to redefine it to ").concat(command.amount));
3052
+ }
3053
+ expectAmount[unit].min = command.amount;
3054
+ } /* not else */
3055
+ if (command.sign === 'MAXIMUM' || command.sign === 'EXACTLY') {
3056
+ if (expectAmount[unit].max !== undefined) {
3057
+ throw new PromptbookSyntaxError("Already defined maximum ".concat(expectAmount[unit].max, " ").concat(command.unit.toLowerCase(), ", now trying to redefine it to ").concat(command.amount));
3058
+ }
3059
+ expectAmount[unit].max = command.amount;
3060
+ }
3061
+ break;
3062
+ case 'EXPECT_FORMAT':
3063
+ if (expectFormat !== undefined && command.format !== expectFormat) {
3064
+ throw new PromptbookSyntaxError("Expect format is already defined to \"".concat(expectFormat, "\". Now you try to redefine it by \"").concat(command.format, "\"."));
3065
+ }
3066
+ expectFormat = command.format;
3067
+ break;
3068
+ default:
3069
+ throw new PromptbookSyntaxError("Command ".concat(command.type, " is not allowed in the block of the prompt template ONLY at the head of the promptbook"));
3070
+ }
3071
+ }
3072
+ }
3073
+ catch (e_3_1) { e_3 = { error: e_3_1 }; }
3074
+ finally {
3075
+ try {
3076
+ if (listItems_2_1 && !listItems_2_1.done && (_e = listItems_2.return)) _e.call(listItems_2);
3077
+ }
3078
+ finally { if (e_3) throw e_3.error; }
3079
+ }
3080
+ var _f = extractOneBlockFromMarkdown(section.content), language = _f.language, content = _f.content;
3081
+ if (executionType === 'SCRIPT') {
3082
+ if (!language) {
3083
+ throw new PromptbookSyntaxError('You must specify the language of the script in the prompt template');
3084
+ }
3085
+ else if (!SUPPORTED_SCRIPT_LANGUAGES.includes(language)) {
3086
+ throw new PromptbookSyntaxError(spaceTrim.spaceTrim(function (block) { return "\n Script language ".concat(language, " is not supported.\n\n Supported languages are:\n ").concat(block(SUPPORTED_SCRIPT_LANGUAGES.join(', ')), "\n\n "); }));
3087
+ }
3088
+ }
3089
+ var lastLine = section.content.split('\n').pop();
3090
+ var match = /^->\s*\{(?<resultingParamName>[a-z0-9_]+)\}/im.exec(lastLine);
3091
+ if (!match || match.groups === undefined || match.groups.resultingParamName === undefined) {
3092
+ throw new PromptbookSyntaxError(spaceTrim.spaceTrim(function (block) { return "\n Invalid template - each section must end with \"-> {...}\"\n\n Invalid section:\n ".concat(block(
3093
+ // TODO: Show code of invalid sections each time + DRY
3094
+ section.content
3095
+ .split('\n')
3096
+ .map(function (line) { return "> ".concat(line); })
3097
+ .join('\n')), "\n "); }));
3098
+ }
3099
+ var resultingParameterName = match.groups.resultingParamName;
3100
+ // TODO: [1] DRY description
3101
+ var description_1 = section.content;
3102
+ // Note: Remove codeblocks
3103
+ description_1 = description_1.split(/^```.*^```/gms).join('');
3104
+ //Note: Remove lists and return statement
3105
+ description_1 = description_1.split(/^(?:(?:-)|(?:\d\))|(?:`?->))\s+.*$/gm).join('');
3106
+ description_1 = spaceTrim.spaceTrim(description_1);
3107
+ if (description_1 === '') {
3108
+ description_1 = undefined;
3109
+ }
3110
+ if (Object.keys(jokers).length === 0) {
3111
+ jokers = undefined;
3112
+ }
3113
+ if (Object.keys(expectAmount).length === 0) {
3114
+ expectAmount = undefined;
3115
+ }
3116
+ if (Object.keys(postprocessing).length === 0) {
3117
+ postprocessing = undefined;
3118
+ }
3119
+ dependentParameterNames = union(dependentParameterNames, extractParametersFromPromptTemplate(__assign(__assign({}, section), { description: description_1, executionType: executionType, content: content })));
3120
+ if (templateModelRequirements.modelVariant === undefined) {
3121
+ templateModelRequirements.modelVariant = 'CHAT';
3122
+ }
3123
+ var template = {
3124
+ name: titleToName(section.title),
3125
+ title: section.title,
3126
+ description: description_1,
3127
+ dependentParameterNames: Array.from(dependentParameterNames),
3128
+ executionType: executionType,
3129
+ jokers: jokers,
3130
+ postprocessing: postprocessing,
3131
+ expectations: expectAmount,
3132
+ expectFormat: expectFormat,
3133
+ modelRequirements: templateModelRequirements,
3134
+ contentLanguage: executionType === 'SCRIPT' ? language : undefined,
3135
+ content: content,
3136
+ resultingParameterName: resultingParameterName,
3137
+ };
3138
+ if (executionType !== 'PROMPT_TEMPLATE') {
3139
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
3140
+ delete template.modelRequirements;
3141
+ }
3142
+ promptbookJson.promptTemplates.push(template);
3143
+ };
3144
+ try {
3145
+ for (var _c = __values(markdownStructure.sections), _d = _c.next(); !_d.done; _d = _c.next()) {
3146
+ var section = _d.value;
3147
+ _loop_1(section);
3148
+ }
3149
+ }
3150
+ catch (e_2_1) { e_2 = { error: e_2_1 }; }
3151
+ finally {
3152
+ try {
3153
+ if (_d && !_d.done && (_b = _c.return)) _b.call(_c);
3154
+ }
3155
+ finally { if (e_2) throw e_2.error; }
3156
+ }
3157
+ // =============================================================
3158
+ return promptbookJson;
3159
+ }
3160
+ /**
3161
+ * TODO: Report here line/column of error
3162
+ * TODO: Use spaceTrim more effectively
3163
+ * TODO: [🧠] Parameter flags - isInput, isOutput, isInternal
3164
+ */
3165
+
2926
3166
  /**
2927
3167
  * Compile promptbook from string (markdown) format to JSON format
2928
3168
  *
3169
+ * Note: There are two similar functions:
3170
+ * - `promptbookStringToJson` **(preferred)** - which propperly compiles the promptbook and use embedding for external knowledge
3171
+ * - `promptbookStringToJsonSync` - use only if you need to compile promptbook synchronously and it contains NO external knowledge
3172
+ *
2929
3173
  * @param promptbookString {Promptbook} in string markdown format (.ptbk.md)
2930
3174
  * @param options - Options and tools for the compilation
2931
3175
  * @returns {Promptbook} compiled in JSON format (.ptbk.json)
@@ -2937,262 +3181,29 @@
2937
3181
  function promptbookStringToJson(promptbookString, options) {
2938
3182
  if (options === void 0) { options = {}; }
2939
3183
  return __awaiter(this, void 0, void 0, function () {
2940
- var llmTools, promptbookJson, knowledge, addParam, markdownStructure, markdownStructureDeepness, description, defaultModelRequirements, listItems, listItems_1, listItems_1_1, listItem, command, _loop_1, _a, _b, section;
2941
- var e_1, _c, e_2, _d;
2942
- return __generator(this, function (_e) {
2943
- switch (_e.label) {
3184
+ var llmTools, knowledge, promptbookJson;
3185
+ return __generator(this, function (_a) {
3186
+ switch (_a.label) {
2944
3187
  case 0:
2945
3188
  llmTools = options.llmTools;
2946
- promptbookJson = {
2947
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
2948
- title: undefined /* <- Note: Putting here placeholder to keep `title` on top at final JSON */,
2949
- promptbookUrl: undefined /* <- Note: Putting here placeholder to keep `promptbookUrl` on top at final JSON */,
2950
- promptbookVersion: PROMPTBOOK_VERSION,
2951
- description: undefined /* <- Note: Putting here placeholder to keep `description` on top at final JSON */,
2952
- parameters: [],
2953
- promptTemplates: [],
2954
- knowledge: [],
2955
- };
2956
3189
  if (!llmTools) return [3 /*break*/, 2];
2957
3190
  return [4 /*yield*/, prepareKnowledgeFromMarkdown({
2958
3191
  content: 'Roses are red, violets are blue, programmers use Promptbook, users too',
2959
3192
  llmTools: llmTools,
2960
3193
  })];
2961
3194
  case 1:
2962
- knowledge = _e.sent();
3195
+ knowledge = _a.sent();
2963
3196
  console.info('!!!! knowledge', knowledge);
2964
- _e.label = 2;
3197
+ _a.label = 2;
2965
3198
  case 2:
2966
- // =============================================================
2967
- // Note: 1️⃣ Normalization of the PROMPTBOOK string
2968
- promptbookString = removeContentComments(promptbookString);
2969
- promptbookString = promptbookString.replaceAll(/`\{(?<parameterName>[a-z0-9_]+)\}`/gi, '{$<parameterName>}');
2970
- promptbookString = promptbookString.replaceAll(/`->\s+\{(?<parameterName>[a-z0-9_]+)\}`/gi, '-> {$<parameterName>}');
2971
- addParam = function (parameterCommand) {
2972
- var parameterName = parameterCommand.parameterName, parameterDescription = parameterCommand.parameterDescription, isInput = parameterCommand.isInput, isOutput = parameterCommand.isOutput;
2973
- var existingParameter = promptbookJson.parameters.find(function (parameter) { return parameter.name === parameterName; });
2974
- if (existingParameter &&
2975
- existingParameter.description &&
2976
- existingParameter.description !== parameterDescription &&
2977
- parameterDescription) {
2978
- throw new PromptbookSyntaxError(spaceTrim.spaceTrim(function (block) { return "\n Parameter {".concat(parameterName, "} is defined multiple times with different description.\n\n First definition:\n ").concat(block(existingParameter.description || '[undefined]'), "\n\n Second definition:\n ").concat(block(parameterDescription || '[undefined]'), "\n "); }));
2979
- }
2980
- if (existingParameter) {
2981
- if (parameterDescription) {
2982
- existingParameter.description = parameterDescription;
2983
- }
2984
- }
2985
- else {
2986
- promptbookJson.parameters.push({
2987
- name: parameterName,
2988
- description: parameterDescription || undefined,
2989
- isInput: isInput,
2990
- isOutput: isOutput,
2991
- });
2992
- }
2993
- };
2994
- markdownStructure = markdownToMarkdownStructure(promptbookString);
2995
- markdownStructureDeepness = countMarkdownStructureDeepness(markdownStructure);
2996
- if (markdownStructureDeepness !== 2) {
2997
- throw new PromptbookSyntaxError(spaceTrim.spaceTrim("\n Invalid markdown structure.\n The markdown must have exactly 2 levels of headings (one top-level section and one section for each template).\n Now it has ".concat(markdownStructureDeepness, " levels of headings.\n ")));
2998
- }
2999
- promptbookJson.title = markdownStructure.title;
3000
- description = markdownStructure.content;
3001
- // Note: Remove codeblocks
3002
- description = description.split(/^```.*^```/gms).join('');
3003
- //Note: Remove lists and return statement
3004
- description = description.split(/^(?:(?:-)|(?:\d\))|(?:`?->))\s+.*$/gm).join('');
3005
- description = spaceTrim.spaceTrim(description);
3006
- if (description === '') {
3007
- description = undefined;
3008
- }
3009
- promptbookJson.description = description;
3010
- defaultModelRequirements = {};
3011
- listItems = extractAllListItemsFromMarkdown(markdownStructure.content);
3012
- try {
3013
- for (listItems_1 = __values(listItems), listItems_1_1 = listItems_1.next(); !listItems_1_1.done; listItems_1_1 = listItems_1.next()) {
3014
- listItem = listItems_1_1.value;
3015
- command = parseCommand(listItem);
3016
- switch (command.type) {
3017
- case 'PROMPTBOOK_URL':
3018
- promptbookJson.promptbookUrl = command.promptbookUrl.href;
3019
- break;
3020
- case 'PROMPTBOOK_VERSION':
3021
- promptbookJson.promptbookVersion = command.promptbookVersion;
3022
- break;
3023
- case 'MODEL':
3024
- defaultModelRequirements[command.key] = command.value;
3025
- break;
3026
- case 'PARAMETER':
3027
- addParam(command);
3028
- break;
3029
- default:
3030
- throw new PromptbookSyntaxError("Command ".concat(command.type, " is not allowed in the head of the promptbook ONLY at the prompt template block"));
3031
- }
3032
- }
3033
- }
3034
- catch (e_1_1) { e_1 = { error: e_1_1 }; }
3035
- finally {
3036
- try {
3037
- if (listItems_1_1 && !listItems_1_1.done && (_c = listItems_1.return)) _c.call(listItems_1);
3038
- }
3039
- finally { if (e_1) throw e_1.error; }
3040
- }
3041
- _loop_1 = function (section) {
3042
- var e_3, _f;
3043
- // TODO: Parse prompt template description (the content out of the codeblock and lists)
3044
- var templateModelRequirements = __assign({}, defaultModelRequirements);
3045
- var listItems_3 = extractAllListItemsFromMarkdown(section.content);
3046
- var dependentParameterNames = new Set();
3047
- var executionType = 'PROMPT_TEMPLATE';
3048
- var jokers = [];
3049
- var postprocessing = [];
3050
- var expectAmount = {};
3051
- var expectFormat = undefined;
3052
- var isExecutionTypeChanged = false;
3053
- try {
3054
- for (var listItems_2 = (e_3 = void 0, __values(listItems_3)), listItems_2_1 = listItems_2.next(); !listItems_2_1.done; listItems_2_1 = listItems_2.next()) {
3055
- var listItem = listItems_2_1.value;
3056
- var command = parseCommand(listItem);
3057
- switch (command.type) {
3058
- case 'JOKER':
3059
- jokers.push(command.parameterName);
3060
- dependentParameterNames.add(command.parameterName);
3061
- break;
3062
- case 'EXECUTE':
3063
- if (isExecutionTypeChanged) {
3064
- throw new PromptbookSyntaxError('Execution type is already defined in the prompt template. It can be defined only once.');
3065
- }
3066
- executionType = command.executionType;
3067
- isExecutionTypeChanged = true;
3068
- break;
3069
- case 'MODEL':
3070
- templateModelRequirements[command.key] = command.value;
3071
- break;
3072
- case 'PARAMETER':
3073
- // Note: This is just for detecting resulitng parameter name
3074
- addParam(command);
3075
- break;
3076
- case 'POSTPROCESS':
3077
- postprocessing.push(command.functionName);
3078
- break;
3079
- case 'EXPECT_AMOUNT':
3080
- // eslint-disable-next-line no-case-declarations
3081
- var unit = command.unit.toLowerCase();
3082
- expectAmount[unit] = expectAmount[unit] || {};
3083
- if (command.sign === 'MINIMUM' || command.sign === 'EXACTLY') {
3084
- if (expectAmount[unit].min !== undefined) {
3085
- throw new PromptbookSyntaxError("Already defined minumum ".concat(expectAmount[unit].min, " ").concat(command.unit.toLowerCase(), ", now trying to redefine it to ").concat(command.amount));
3086
- }
3087
- expectAmount[unit].min = command.amount;
3088
- } /* not else */
3089
- if (command.sign === 'MAXIMUM' || command.sign === 'EXACTLY') {
3090
- if (expectAmount[unit].max !== undefined) {
3091
- throw new PromptbookSyntaxError("Already defined maximum ".concat(expectAmount[unit].max, " ").concat(command.unit.toLowerCase(), ", now trying to redefine it to ").concat(command.amount));
3092
- }
3093
- expectAmount[unit].max = command.amount;
3094
- }
3095
- break;
3096
- case 'EXPECT_FORMAT':
3097
- if (expectFormat !== undefined && command.format !== expectFormat) {
3098
- throw new PromptbookSyntaxError("Expect format is already defined to \"".concat(expectFormat, "\". Now you try to redefine it by \"").concat(command.format, "\"."));
3099
- }
3100
- expectFormat = command.format;
3101
- break;
3102
- default:
3103
- throw new PromptbookSyntaxError("Command ".concat(command.type, " is not allowed in the block of the prompt template ONLY at the head of the promptbook"));
3104
- }
3105
- }
3106
- }
3107
- catch (e_3_1) { e_3 = { error: e_3_1 }; }
3108
- finally {
3109
- try {
3110
- if (listItems_2_1 && !listItems_2_1.done && (_f = listItems_2.return)) _f.call(listItems_2);
3111
- }
3112
- finally { if (e_3) throw e_3.error; }
3113
- }
3114
- var _g = extractOneBlockFromMarkdown(section.content), language = _g.language, content = _g.content;
3115
- if (executionType === 'SCRIPT') {
3116
- if (!language) {
3117
- throw new PromptbookSyntaxError('You must specify the language of the script in the prompt template');
3118
- }
3119
- else if (!SUPPORTED_SCRIPT_LANGUAGES.includes(language)) {
3120
- throw new PromptbookSyntaxError(spaceTrim.spaceTrim(function (block) { return "\n Script language ".concat(language, " is not supported.\n\n Supported languages are:\n ").concat(block(SUPPORTED_SCRIPT_LANGUAGES.join(', ')), "\n\n "); }));
3121
- }
3122
- }
3123
- var lastLine = section.content.split('\n').pop();
3124
- var match = /^->\s*\{(?<resultingParamName>[a-z0-9_]+)\}/im.exec(lastLine);
3125
- if (!match || match.groups === undefined || match.groups.resultingParamName === undefined) {
3126
- throw new PromptbookSyntaxError(spaceTrim.spaceTrim(function (block) { return "\n Invalid template - each section must end with \"-> {...}\"\n\n Invalid section:\n ".concat(block(
3127
- // TODO: Show code of invalid sections each time + DRY
3128
- section.content
3129
- .split('\n')
3130
- .map(function (line) { return "> ".concat(line); })
3131
- .join('\n')), "\n "); }));
3132
- }
3133
- var resultingParameterName = match.groups.resultingParamName;
3134
- // TODO: [1] DRY description
3135
- var description_1 = section.content;
3136
- // Note: Remove codeblocks
3137
- description_1 = description_1.split(/^```.*^```/gms).join('');
3138
- //Note: Remove lists and return statement
3139
- description_1 = description_1.split(/^(?:(?:-)|(?:\d\))|(?:`?->))\s+.*$/gm).join('');
3140
- description_1 = spaceTrim.spaceTrim(description_1);
3141
- if (description_1 === '') {
3142
- description_1 = undefined;
3143
- }
3144
- if (Object.keys(jokers).length === 0) {
3145
- jokers = undefined;
3146
- }
3147
- if (Object.keys(expectAmount).length === 0) {
3148
- expectAmount = undefined;
3149
- }
3150
- if (Object.keys(postprocessing).length === 0) {
3151
- postprocessing = undefined;
3152
- }
3153
- dependentParameterNames = union(dependentParameterNames, extractParametersFromPromptTemplate(__assign(__assign({}, section), { description: description_1, executionType: executionType, content: content })));
3154
- if (templateModelRequirements.modelVariant === undefined) {
3155
- templateModelRequirements.modelVariant = 'CHAT';
3156
- }
3157
- promptbookJson.promptTemplates.push({
3158
- name: titleToName(section.title),
3159
- title: section.title,
3160
- description: description_1,
3161
- dependentParameterNames: Array.from(dependentParameterNames),
3162
- executionType: executionType,
3163
- jokers: jokers,
3164
- postprocessing: postprocessing,
3165
- expectations: expectAmount,
3166
- expectFormat: expectFormat,
3167
- modelRequirements: templateModelRequirements,
3168
- contentLanguage: executionType === 'SCRIPT' ? language : undefined,
3169
- content: content,
3170
- resultingParameterName: resultingParameterName,
3171
- });
3172
- };
3173
- try {
3174
- for (_a = __values(markdownStructure.sections), _b = _a.next(); !_b.done; _b = _a.next()) {
3175
- section = _b.value;
3176
- _loop_1(section);
3177
- }
3178
- }
3179
- catch (e_2_1) { e_2 = { error: e_2_1 }; }
3180
- finally {
3181
- try {
3182
- if (_b && !_b.done && (_d = _a.return)) _d.call(_a);
3183
- }
3184
- finally { if (e_2) throw e_2.error; }
3185
- }
3186
- // =============================================================
3199
+ promptbookJson = promptbookStringToJsonSync(promptbookString);
3187
3200
  return [2 /*return*/, promptbookJson];
3188
3201
  }
3189
3202
  });
3190
3203
  });
3191
3204
  }
3192
3205
  /**
3193
- * TODO: Report here line/column of error
3194
- * TODO: Use spaceTrim more effectively
3195
- * TODO: [🧠] Parameter flags - isInput, isOutput, isInternal
3206
+ * TODO: [🏏] Leverage the batch API and build queues @see https://platform.openai.com/docs/guides/batch
3196
3207
  */
3197
3208
 
3198
3209
  /**
@@ -3229,19 +3240,19 @@
3229
3240
  * - Factory function that returns Promise of array of PromptbookJson or PromptbookString
3230
3241
  *
3231
3242
  * Note: This is useful as internal tool for other constructor functions like
3232
- * `createPromptbookLibraryFromUrl` or `createPromptbookLibraryFromDirectory`
3243
+ * `createLibraryFromUrl` or `createLibraryFromDirectory`
3233
3244
  * Consider using those functions instead of this one
3234
3245
  *
3235
3246
  * Note: The function does NOT return promise it returns the library directly which waits for the sources to be resolved
3236
3247
  * when error occurs in given promise or factory function, it is thrown during `listPromptbooks` or `getPromptbookByUrl` call
3237
3248
  *
3238
- * Note: Consider using `createPromptbookLibraryFromDirectory` or `createPromptbookLibraryFromUrl`
3249
+ * Note: Consider using `createLibraryFromDirectory` or `createLibraryFromUrl`
3239
3250
  *
3240
3251
  * @param promptbookSourcesPromiseOrFactory
3241
3252
  * @returns PromptbookLibrary
3242
3253
  * @deprecated Do not use, it will became internal tool for other constructor functions
3243
3254
  */
3244
- function createPromptbookLibraryFromPromise(promptbookSourcesPromiseOrFactory) {
3255
+ function createLibraryFromPromise(promptbookSourcesPromiseOrFactory) {
3245
3256
  var library;
3246
3257
  function forSources() {
3247
3258
  return __awaiter(this, void 0, void 0, function () {
@@ -3256,9 +3267,7 @@
3256
3267
  return [4 /*yield*/, promptbookSourcesPromiseOrFactory];
3257
3268
  case 1:
3258
3269
  promptbookSources = _a.sent();
3259
- return [4 /*yield*/, createPromptbookLibraryFromSources.apply(void 0, __spreadArray([], __read(promptbookSources), false))];
3260
- case 2:
3261
- library = _a.sent();
3270
+ library = createLibraryFromJson.apply(void 0, __spreadArray([], __read(promptbookSources), false));
3262
3271
  return [2 /*return*/];
3263
3272
  }
3264
3273
  });
@@ -3306,9 +3315,6 @@
3306
3315
  isResponsibleForPrompt: isResponsibleForPrompt,
3307
3316
  };
3308
3317
  }
3309
- /**
3310
- * TODO: !!!! [🧠] Library precompilation and do not mix markdown and json promptbooks
3311
- */
3312
3318
 
3313
3319
  /**
3314
3320
  * Constructs Promptbook from given directory
@@ -3319,32 +3325,42 @@
3319
3325
  * @param options - Misc options for the library
3320
3326
  * @returns PromptbookLibrary
3321
3327
  */
3322
- function createPromptbookLibraryFromDirectory(path, options) {
3328
+ function createLibraryFromDirectory(path$1, options) {
3323
3329
  return __awaiter(this, void 0, void 0, function () {
3324
- var _a, _b, isRecursive, _c, isVerbose, _d, isLazyLoaded, _e, isCrashOnError, library;
3330
+ var makedLibraryFilePath, makedLibraryFileExists, _a, _b, isRecursive, _c, isVerbose, _d, isLazyLoaded, _e, isCrashOnError, library;
3325
3331
  var _this = this;
3326
3332
  return __generator(this, function (_f) {
3327
3333
  switch (_f.label) {
3328
3334
  case 0:
3329
3335
  if (!isRunningInNode()) {
3330
- throw new Error('Function `createPromptbookLibraryFromDirectory` can only be run in Node.js environment because it reads the file system.');
3336
+ throw new Error('Function `createLibraryFromDirectory` can only be run in Node.js environment because it reads the file system.');
3337
+ }
3338
+ makedLibraryFilePath = path.join(path$1, "".concat(PROMPTBOOK_MAKED_BASE_FILENAME, ".json"));
3339
+ return [4 /*yield*/, promises.access(makedLibraryFilePath, promises.constants.R_OK)
3340
+ .then(function () { return true; })
3341
+ .catch(function () { return false; })];
3342
+ case 1:
3343
+ makedLibraryFileExists = _f.sent();
3344
+ if (!makedLibraryFileExists) {
3345
+ console.info(colors__default["default"].yellow("Tip: Prebuild your promptbook library (file with supposed prebuild ".concat(makedLibraryFilePath, " not found) with CLI util \"promptbook make\" to speed up the library creation.")));
3346
+ }
3347
+ else {
3348
+ colors__default["default"].green("(In future, not implemented yet) Using your prebuild promptbook library ".concat(makedLibraryFilePath));
3349
+ // TODO: !! Implement;
3331
3350
  }
3332
3351
  _a = options || {}, _b = _a.isRecursive, isRecursive = _b === void 0 ? true : _b, _c = _a.isVerbose, isVerbose = _c === void 0 ? false : _c, _d = _a.isLazyLoaded, isLazyLoaded = _d === void 0 ? false : _d, _e = _a.isCrashOnError, isCrashOnError = _e === void 0 ? true : _e;
3333
- library = createPromptbookLibraryFromPromise(function () { return __awaiter(_this, void 0, void 0, function () {
3352
+ library = createLibraryFromPromise(function () { return __awaiter(_this, void 0, void 0, function () {
3334
3353
  var fileNames, promptbooks, _loop_1, fileNames_1, fileNames_1_1, fileName, e_1_1;
3335
3354
  var e_1, _a;
3336
3355
  return __generator(this, function (_b) {
3337
3356
  switch (_b.label) {
3338
3357
  case 0:
3339
3358
  if (isVerbose) {
3340
- console.info("Creating promptbook library from path ".concat(path));
3359
+ console.info("Creating promptbook library from path ".concat(path$1.split('\\').join('/')));
3341
3360
  }
3342
- return [4 /*yield*/, listAllFiles(path, isRecursive)];
3361
+ return [4 /*yield*/, listAllFiles(path$1, isRecursive)];
3343
3362
  case 1:
3344
3363
  fileNames = _b.sent();
3345
- if (isVerbose) {
3346
- console.info('createPromptbookLibraryFromDirectory', { path: path, isRecursive: isRecursive, fileNames: fileNames });
3347
- }
3348
3364
  promptbooks = [];
3349
3365
  _loop_1 = function (fileName) {
3350
3366
  var promptbook, promptbookString, _c, _d, error_1, wrappedErrorMessage;
@@ -3364,7 +3380,7 @@
3364
3380
  case 3:
3365
3381
  if (!fileName.endsWith('.ptbk.json')) return [3 /*break*/, 5];
3366
3382
  if (isVerbose) {
3367
- console.info("Loading ".concat(fileName));
3383
+ console.info("Loading ".concat(fileName.split('\\').join('/')));
3368
3384
  }
3369
3385
  _d = (_c = JSON).parse;
3370
3386
  return [4 /*yield*/, promises.readFile(fileName, 'utf8')];
@@ -3374,7 +3390,7 @@
3374
3390
  return [3 /*break*/, 6];
3375
3391
  case 5:
3376
3392
  if (isVerbose) {
3377
- console.info("Skipping file ".concat(fileName));
3393
+ console.info("Skipping file ".concat(fileName.split('\\').join('/')));
3378
3394
  }
3379
3395
  _e.label = 6;
3380
3396
  case 6:
@@ -3382,17 +3398,17 @@
3382
3398
  if (promptbook !== null) {
3383
3399
  if (!promptbook.promptbookUrl) {
3384
3400
  if (isVerbose) {
3385
- console.info("Not loading ".concat(fileName, " - missing URL"));
3401
+ console.info("Not loading ".concat(fileName.split('\\').join('/'), " - missing URL"));
3386
3402
  }
3387
3403
  }
3388
3404
  else {
3389
3405
  if (isVerbose) {
3390
- console.info("Loading ".concat(fileName));
3406
+ console.info("Loading ".concat(fileName.split('\\').join('/')));
3391
3407
  }
3392
3408
  if (!isCrashOnError) {
3393
3409
  // Note: Validate promptbook to check if it is logically correct to not crash on invalid promptbooks
3394
3410
  // But be handled in current try-catch block
3395
- validatePromptbookJson(promptbook);
3411
+ validatePromptbook(promptbook);
3396
3412
  }
3397
3413
  // Note: [🦄] Promptbook with same url uniqueness will be checked automatically in SimplePromptbookLibrary
3398
3414
  promptbooks.push(promptbook);
@@ -3444,12 +3460,12 @@
3444
3460
  }
3445
3461
  });
3446
3462
  }); });
3447
- if (!(isLazyLoaded === false)) return [3 /*break*/, 2];
3463
+ if (!(isLazyLoaded === false)) return [3 /*break*/, 3];
3448
3464
  return [4 /*yield*/, library.listPromptbooks()];
3449
- case 1:
3465
+ case 2:
3450
3466
  _f.sent();
3451
- _f.label = 2;
3452
- case 2: return [2 /*return*/, library];
3467
+ _f.label = 3;
3468
+ case 3: return [2 /*return*/, library];
3453
3469
  }
3454
3470
  });
3455
3471
  });
@@ -3460,7 +3476,7 @@
3460
3476
  * @param path
3461
3477
  * @param isRecursive
3462
3478
  * @returns List of all files in the directory
3463
- * @private internal function for `createPromptbookLibraryFromDirectory`
3479
+ * @private internal function for `createLibraryFromDirectory`
3464
3480
  */
3465
3481
  function listAllFiles(path$1, isRecursive) {
3466
3482
  return __awaiter(this, void 0, void 0, function () {
@@ -3518,7 +3534,7 @@
3518
3534
  */
3519
3535
 
3520
3536
  exports.PROMPTBOOK_VERSION = PROMPTBOOK_VERSION;
3521
- exports.createPromptbookLibraryFromDirectory = createPromptbookLibraryFromDirectory;
3537
+ exports.createLibraryFromDirectory = createLibraryFromDirectory;
3522
3538
 
3523
3539
  Object.defineProperty(exports, '__esModule', { value: true });
3524
3540