@promptbook/markdown-utils 0.75.0-1 → 0.75.0-4

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 (167) hide show
  1. package/README.md +28 -17
  2. package/esm/index.es.js +266 -250
  3. package/esm/index.es.js.map +1 -1
  4. package/esm/typings/{promptbook-collection → books}/index.d.ts +6 -6
  5. package/esm/typings/src/_packages/core.index.d.ts +28 -20
  6. package/esm/typings/src/_packages/types.index.d.ts +62 -52
  7. package/esm/typings/src/_packages/utils.index.d.ts +2 -2
  8. package/esm/typings/src/cli/cli-commands/about.d.ts +1 -0
  9. package/esm/typings/src/cli/cli-commands/hello.d.ts +1 -0
  10. package/esm/typings/src/cli/cli-commands/make.d.ts +1 -0
  11. package/esm/typings/src/cli/cli-commands/prettify.d.ts +1 -0
  12. package/esm/typings/src/cli/cli-commands/run.d.ts +1 -0
  13. package/esm/typings/src/cli/cli-commands/test-command.d.ts +1 -0
  14. package/esm/typings/src/cli/main.d.ts +1 -0
  15. package/esm/typings/src/collection/PipelineCollection.d.ts +1 -1
  16. package/esm/typings/src/collection/SimplePipelineCollection.d.ts +1 -1
  17. package/esm/typings/src/collection/collectionToJson.d.ts +1 -1
  18. package/esm/typings/src/collection/constructors/createCollectionFromJson.d.ts +1 -1
  19. package/esm/typings/src/collection/constructors/createCollectionFromPromise.d.ts +1 -1
  20. package/esm/typings/src/commands/EXPECT/ExpectCommand.d.ts +3 -3
  21. package/esm/typings/src/commands/EXPECT/expectCommandParser.d.ts +2 -2
  22. package/esm/typings/src/commands/FOREACH/foreachCommandParser.d.ts +2 -2
  23. package/esm/typings/src/commands/FORMAT/formatCommandParser.d.ts +2 -2
  24. package/esm/typings/src/commands/JOKER/jokerCommandParser.d.ts +2 -2
  25. package/esm/typings/src/commands/POSTPROCESS/postprocessCommandParser.d.ts +2 -2
  26. package/esm/typings/src/commands/SECTION/SectionCommand.d.ts +11 -0
  27. package/esm/typings/src/commands/{TEMPLATE/templateCommandParser.d.ts → SECTION/sectionCommandParser.d.ts} +6 -6
  28. package/esm/typings/src/commands/_common/types/Command.d.ts +1 -1
  29. package/esm/typings/src/commands/_common/types/CommandParser.d.ts +17 -19
  30. package/esm/typings/src/commands/_common/types/CommandUsagePlaces.d.ts +1 -1
  31. package/esm/typings/src/commands/index.d.ts +4 -1
  32. package/esm/typings/src/config.d.ts +11 -3
  33. package/esm/typings/src/conversion/pipelineJsonToString.d.ts +3 -3
  34. package/esm/typings/src/conversion/pipelineStringToJson.d.ts +2 -2
  35. package/esm/typings/src/conversion/pipelineStringToJsonSync.d.ts +3 -3
  36. package/esm/typings/src/conversion/prettify/prettifyPipelineString.d.ts +1 -1
  37. package/esm/typings/src/conversion/prettify/renderPipelineMermaidOptions.d.ts +4 -4
  38. package/esm/typings/src/conversion/utils/extractParameterNamesFromTask.d.ts +15 -0
  39. package/esm/typings/src/conversion/utils/renameParameter.d.ts +3 -3
  40. package/esm/typings/src/conversion/validation/_importPipeline.d.ts +3 -2
  41. package/esm/typings/src/conversion/validation/validatePipeline.d.ts +1 -1
  42. package/esm/typings/src/dialogs/simple-prompt/SimplePromptInterfaceTools.d.ts +1 -1
  43. package/esm/typings/src/errors/index.d.ts +3 -0
  44. package/esm/typings/src/execution/PipelineExecutorResult.d.ts +2 -2
  45. package/esm/typings/src/execution/PromptResultUsage.d.ts +1 -1
  46. package/esm/typings/src/execution/ScriptExecutionTools.d.ts +1 -1
  47. package/esm/typings/src/execution/createPipelineExecutor/{$OngoingTemplateResult.d.ts → $OngoingTaskResult.d.ts} +1 -1
  48. package/esm/typings/src/execution/createPipelineExecutor/00-CreatePipelineExecutorOptions.d.ts +1 -1
  49. package/esm/typings/src/execution/createPipelineExecutor/10-executePipeline.d.ts +1 -1
  50. package/esm/typings/src/execution/createPipelineExecutor/{20-executeTemplate.d.ts → 20-executeTask.d.ts} +7 -7
  51. package/esm/typings/src/execution/createPipelineExecutor/40-executeAttempts.d.ts +5 -5
  52. package/esm/typings/src/execution/createPipelineExecutor/filterJustOutputParameters.d.ts +1 -1
  53. package/esm/typings/src/execution/createPipelineExecutor/{getContextForTemplate.d.ts → getContextForTask.d.ts} +2 -2
  54. package/esm/typings/src/execution/createPipelineExecutor/{getExamplesForTemplate.d.ts → getExamplesForTask.d.ts} +2 -2
  55. package/esm/typings/src/execution/createPipelineExecutor/getKnowledgeForTask.d.ts +27 -0
  56. package/esm/typings/src/execution/createPipelineExecutor/getReservedParametersForTask.d.ts +30 -0
  57. package/esm/typings/src/{types → execution}/execution-report/ExecutionPromptReportJson.d.ts +2 -2
  58. package/esm/typings/src/{types → execution}/execution-report/ExecutionReportJson.d.ts +4 -4
  59. package/esm/typings/src/{types → execution}/execution-report/ExecutionReportStringOptions.d.ts +1 -1
  60. package/esm/typings/src/execution/utils/checkExpectations.d.ts +1 -1
  61. package/esm/typings/src/execution/utils/usage-constants.d.ts +3 -0
  62. package/esm/typings/src/formats/index.d.ts +3 -0
  63. package/esm/typings/src/formfactors/_boilerplate/BoilerplateFormfactorDefinition.d.ts +2 -2
  64. package/esm/typings/src/formfactors/_common/AbstractFormfactorDefinition.d.ts +7 -1
  65. package/esm/typings/src/formfactors/_common/FormfactorDefinition.d.ts +3 -0
  66. package/esm/typings/src/formfactors/chatbot/ChatbotFormfactorDefinition.d.ts +45 -0
  67. package/esm/typings/src/formfactors/generator/GeneratorFormfactorDefinition.d.ts +14 -0
  68. package/esm/typings/src/formfactors/generic/GenericFormfactorDefinition.d.ts +3 -3
  69. package/esm/typings/src/formfactors/index.d.ts +85 -12
  70. package/esm/typings/src/formfactors/matcher/MatcherFormfactorDefinition.d.ts +14 -0
  71. package/esm/typings/src/formfactors/sheets/SheetsFormfactorDefinition.d.ts +13 -3
  72. package/esm/typings/src/formfactors/translator/TranslatorFormfactorDefinition.d.ts +13 -3
  73. package/esm/typings/src/llm-providers/anthropic-claude/anthropic-claude-models.d.ts +1 -0
  74. package/esm/typings/src/llm-providers/anthropic-claude/register-configuration.d.ts +3 -0
  75. package/esm/typings/src/llm-providers/anthropic-claude/register-constructor.d.ts +1 -0
  76. package/esm/typings/src/llm-providers/azure-openai/register-configuration.d.ts +3 -0
  77. package/esm/typings/src/llm-providers/azure-openai/register-constructor.d.ts +1 -0
  78. package/esm/typings/src/llm-providers/mocked/$fakeTextToExpectations.d.ts +1 -1
  79. package/esm/typings/src/llm-providers/openai/openai-models.d.ts +1 -0
  80. package/esm/typings/src/llm-providers/openai/register-configuration.d.ts +3 -0
  81. package/esm/typings/src/llm-providers/openai/register-constructor.d.ts +1 -0
  82. package/esm/typings/src/personas/preparePersona.d.ts +1 -1
  83. package/esm/typings/src/pipeline/PipelineInterface/PipelineInterface.d.ts +26 -0
  84. package/esm/typings/src/pipeline/PipelineInterface/constants.d.ts +14 -0
  85. package/esm/typings/src/pipeline/{pipeline-interface → PipelineInterface}/getPipelineInterface.d.ts +3 -1
  86. package/esm/typings/src/pipeline/{pipeline-interface → PipelineInterface}/isPipelineImplementingInterface.d.ts +5 -1
  87. package/esm/typings/src/pipeline/{pipeline-interface → PipelineInterface}/isPipelineInterfacesEqual.d.ts +2 -0
  88. package/esm/typings/src/{types/PipelineJson/TemplateJsonCommon.d.ts → pipeline/PipelineJson/CommonTaskJson.d.ts} +24 -24
  89. package/esm/typings/src/pipeline/PipelineJson/DialogTaskJson.d.ts +13 -0
  90. package/esm/typings/src/{types → pipeline}/PipelineJson/Expectations.d.ts +2 -2
  91. package/esm/typings/src/{types → pipeline}/PipelineJson/KnowledgePieceJson.d.ts +7 -6
  92. package/esm/typings/src/{types → pipeline}/PipelineJson/KnowledgeSourceJson.d.ts +3 -3
  93. package/esm/typings/src/pipeline/PipelineJson/ParameterJson.d.ts +98 -0
  94. package/esm/typings/src/{types → pipeline}/PipelineJson/PersonaJson.d.ts +5 -5
  95. package/esm/typings/src/{types → pipeline}/PipelineJson/PipelineJson.d.ts +11 -11
  96. package/esm/typings/src/{types → pipeline}/PipelineJson/PreparationJson.d.ts +1 -1
  97. package/esm/typings/src/{types/PipelineJson/PromptTemplateJson.d.ts → pipeline/PipelineJson/PromptTaskJson.d.ts} +8 -8
  98. package/esm/typings/src/pipeline/PipelineJson/ScriptTaskJson.d.ts +20 -0
  99. package/esm/typings/src/pipeline/PipelineJson/SimpleTaskJson.d.ts +13 -0
  100. package/esm/typings/src/pipeline/PipelineJson/TaskJson.d.ts +11 -0
  101. package/esm/typings/src/{types → pipeline}/PipelineString.d.ts +1 -1
  102. package/esm/typings/src/prepare/isPipelinePrepared.d.ts +3 -3
  103. package/esm/typings/src/prepare/preparePipeline.d.ts +1 -1
  104. package/esm/typings/src/prepare/prepareTasks.d.ts +32 -0
  105. package/esm/typings/src/prepare/unpreparePipeline.d.ts +1 -1
  106. package/esm/typings/src/scrapers/_common/Scraper.d.ts +1 -1
  107. package/esm/typings/src/scrapers/_common/prepareKnowledgePieces.d.ts +2 -2
  108. package/esm/typings/src/scrapers/_common/utils/makeKnowledgeSourceHandler.d.ts +1 -1
  109. package/esm/typings/src/scrapers/document/DocumentScraper.d.ts +1 -1
  110. package/esm/typings/src/scrapers/document/register-constructor.d.ts +1 -0
  111. package/esm/typings/src/scrapers/document/register-metadata.d.ts +3 -0
  112. package/esm/typings/src/scrapers/document-legacy/LegacyDocumentScraper.d.ts +1 -1
  113. package/esm/typings/src/scrapers/document-legacy/register-constructor.d.ts +1 -0
  114. package/esm/typings/src/scrapers/document-legacy/register-metadata.d.ts +3 -0
  115. package/esm/typings/src/scrapers/markdown/MarkdownScraper.d.ts +1 -1
  116. package/esm/typings/src/scrapers/markdown/register-constructor.d.ts +1 -0
  117. package/esm/typings/src/scrapers/markdown/register-metadata.d.ts +3 -0
  118. package/esm/typings/src/scrapers/pdf/PdfScraper.d.ts +1 -1
  119. package/esm/typings/src/scrapers/pdf/register-constructor.d.ts +1 -0
  120. package/esm/typings/src/scrapers/pdf/register-metadata.d.ts +3 -0
  121. package/esm/typings/src/scrapers/website/WebsiteScraper.d.ts +1 -1
  122. package/esm/typings/src/scrapers/website/register-constructor.d.ts +1 -0
  123. package/esm/typings/src/scrapers/website/register-metadata.d.ts +3 -0
  124. package/esm/typings/src/scripting/javascript/postprocessing-functions.d.ts +1 -0
  125. package/esm/typings/src/types/Prompt.d.ts +4 -4
  126. package/esm/typings/src/types/SectionType.d.ts +21 -0
  127. package/esm/typings/src/types/TaskProgress.d.ts +2 -2
  128. package/esm/typings/src/types/TaskType.d.ts +15 -0
  129. package/esm/typings/src/types/typeAliasEmoji.d.ts +3 -0
  130. package/esm/typings/src/types/typeAliases.d.ts +2 -1
  131. package/esm/typings/src/utils/emojis.d.ts +1 -0
  132. package/esm/typings/src/utils/expectation-counters/constants.d.ts +1 -0
  133. package/esm/typings/src/utils/expectation-counters/countCharacters.d.ts +1 -1
  134. package/esm/typings/src/utils/expectation-counters/countLines.d.ts +1 -1
  135. package/esm/typings/src/utils/expectation-counters/countPages.d.ts +1 -1
  136. package/esm/typings/src/utils/expectation-counters/countParagraphs.d.ts +1 -1
  137. package/esm/typings/src/utils/expectation-counters/countSentences.d.ts +1 -1
  138. package/esm/typings/src/utils/expectation-counters/countWords.d.ts +1 -1
  139. package/esm/typings/src/utils/expectation-counters/index.d.ts +3 -2
  140. package/esm/typings/src/utils/normalization/normalize-to-kebab-case.d.ts +3 -0
  141. package/esm/typings/src/utils/organization/TODO_remove_as.d.ts +6 -0
  142. package/esm/typings/src/utils/parameters/extractParameterNames.d.ts +2 -2
  143. package/esm/typings/src/utils/serialization/clonePipeline.d.ts +1 -1
  144. package/esm/typings/src/version.d.ts +2 -1
  145. package/package.json +4 -3
  146. package/umd/index.umd.js +266 -250
  147. package/umd/index.umd.js.map +1 -1
  148. package/esm/typings/src/commands/TEMPLATE/TemplateCommand.d.ts +0 -11
  149. package/esm/typings/src/commands/TEMPLATE/TemplateTypes.d.ts +0 -15
  150. package/esm/typings/src/conversion/utils/extractParameterNamesFromTemplate.d.ts +0 -15
  151. package/esm/typings/src/execution/createPipelineExecutor/getKnowledgeForTemplate.d.ts +0 -27
  152. package/esm/typings/src/execution/createPipelineExecutor/getReservedParametersForTemplate.d.ts +0 -30
  153. package/esm/typings/src/formfactors/chat/ChatFormfactorDefinition.d.ts +0 -15
  154. package/esm/typings/src/pipeline/pipeline-interface/PipelineInterface.d.ts +0 -22
  155. package/esm/typings/src/pipeline/pipeline-interface/constants.d.ts +0 -9
  156. package/esm/typings/src/prepare/prepareTemplates.d.ts +0 -32
  157. package/esm/typings/src/types/PipelineJson/DialogTemplateJson.d.ts +0 -13
  158. package/esm/typings/src/types/PipelineJson/ParameterJson.d.ts +0 -39
  159. package/esm/typings/src/types/PipelineJson/ScriptTemplateJson.d.ts +0 -20
  160. package/esm/typings/src/types/PipelineJson/SimpleTemplateJson.d.ts +0 -13
  161. package/esm/typings/src/types/PipelineJson/TemplateJson.d.ts +0 -11
  162. /package/esm/typings/src/commands/{TEMPLATE/templateCommand.test.d.ts → SECTION/sectionCommand.test.d.ts} +0 -0
  163. /package/esm/typings/src/conversion/utils/{extractParameterNamesFromTemplate.test.d.ts → extractParameterNamesFromTask.test.d.ts} +0 -0
  164. /package/esm/typings/src/{types → execution}/execution-report/ExecutionReportString.d.ts +0 -0
  165. /package/esm/typings/src/{types → execution}/execution-report/countWorkingDuration.d.ts +0 -0
  166. /package/esm/typings/src/{types → execution}/execution-report/countWorkingDuration.test.d.ts +0 -0
  167. /package/esm/typings/src/{types → execution}/execution-report/executionReportJsonToString.d.ts +0 -0
package/esm/index.es.js CHANGED
@@ -20,9 +20,10 @@ var BOOK_LANGUAGE_VERSION = '1.0.0';
20
20
  *
21
21
  * @see https://github.com/webgptorg/promptbook
22
22
  */
23
- var PROMPTBOOK_ENGINE_VERSION = '0.75.0-0';
23
+ var PROMPTBOOK_ENGINE_VERSION = '0.75.0-3';
24
24
  /**
25
25
  * TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
26
+ * Note: [💞] Ignore a discrepancy between file name and entity name
26
27
  */
27
28
 
28
29
  /*! *****************************************************************************
@@ -268,7 +269,7 @@ function extractAllBlocksFromMarkdown(markdown) {
268
269
  function extractOneBlockFromMarkdown(markdown) {
269
270
  var codeBlocks = extractAllBlocksFromMarkdown(markdown);
270
271
  if (codeBlocks.length !== 1) {
271
- throw new ParseError(spaceTrim(function (block) { return "\n There should be exactly 1 code block in template, found ".concat(codeBlocks.length, " code blocks\n\n ").concat(block(codeBlocks.map(function (block, i) { return "Block ".concat(i + 1, ":\n").concat(block.content); }).join('\n\n\n')), "\n "); }));
272
+ throw new ParseError(spaceTrim(function (block) { return "\n There should be exactly 1 code block in task section, found ".concat(codeBlocks.length, " code blocks\n\n ").concat(block(codeBlocks.map(function (block, i) { return "Block ".concat(i + 1, ":\n").concat(block.content); }).join('\n\n\n')), "\n "); }));
272
273
  }
273
274
  return codeBlocks[0];
274
275
  }
@@ -355,7 +356,7 @@ function extractJsonBlock(markdown) {
355
356
  * TODO: [🏢] Make this logic part of `JsonFormatDefinition` or `isValidJsonString`
356
357
  */
357
358
 
358
- var PipelineCollection = [{title:"Prepare Knowledge from Markdown",pipelineUrl:"https://promptbook.studio/promptbook/prepare-knowledge-from-markdown.book.md",formfactorName:"GENERIC",parameters:[{name:"knowledgeContent",description:"Markdown document content",isInput:true,isOutput:false},{name:"knowledgePieces",description:"The knowledge JSON object",isInput:false,isOutput:true}],templates:[{templateType:"PROMPT_TEMPLATE",name:"knowledge",title:"Knowledge",content:"You are experienced data researcher, extract the important knowledge from the document.\n\n# Rules\n\n- Make pieces of information concise, clear, and easy to understand\n- One piece of information should be approximately 1 paragraph\n- Divide the paragraphs by markdown horizontal lines ---\n- Omit irrelevant information\n- Group redundant information\n- Write just extracted information, nothing else\n\n# The document\n\nTake information from this document:\n\n> {knowledgeContent}",resultingParameterName:"knowledgePieces",dependentParameterNames:["knowledgeContent"]}],knowledgeSources:[],knowledgePieces:[],personas:[],preparations:[],sourceFile:"./promptbook-collection/prepare-knowledge-from-markdown.book.md"},{title:"Prepare Keywords",pipelineUrl:"https://promptbook.studio/promptbook/prepare-knowledge-keywords.book.md",formfactorName:"GENERIC",parameters:[{name:"knowledgePieceContent",description:"The content",isInput:true,isOutput:false},{name:"keywords",description:"Keywords separated by comma",isInput:false,isOutput:true}],templates:[{templateType:"PROMPT_TEMPLATE",name:"knowledge",title:"Knowledge",content:"You are experienced data researcher, detect the important keywords in the document.\n\n# Rules\n\n- Write just keywords separated by comma\n\n# The document\n\nTake information from this document:\n\n> {knowledgePieceContent}",resultingParameterName:"keywords",dependentParameterNames:["knowledgePieceContent"]}],knowledgeSources:[],knowledgePieces:[],personas:[],preparations:[],sourceFile:"./promptbook-collection/prepare-knowledge-keywords.book.md"},{title:"Prepare Title",pipelineUrl:"https://promptbook.studio/promptbook/prepare-knowledge-title.book.md",formfactorName:"GENERIC",parameters:[{name:"knowledgePieceContent",description:"The content",isInput:true,isOutput:false},{name:"title",description:"The title of the document",isInput:false,isOutput:true}],templates:[{templateType:"PROMPT_TEMPLATE",name:"knowledge",title:"Knowledge",content:"You are experienced content creator, write best title for the document.\n\n# Rules\n\n- Write just title, nothing else\n- Title should be concise and clear\n- Write maximum 5 words for the title\n\n# The document\n\n> {knowledgePieceContent}",resultingParameterName:"title",expectations:{words:{min:1,max:8}},dependentParameterNames:["knowledgePieceContent"]}],knowledgeSources:[],knowledgePieces:[],personas:[],preparations:[],sourceFile:"./promptbook-collection/prepare-knowledge-title.book.md"},{title:"Prepare Keywords",pipelineUrl:"https://promptbook.studio/promptbook/prepare-persona.book.md",formfactorName:"GENERIC",parameters:[{name:"availableModelNames",description:"List of available model names separated by comma (,)",isInput:true,isOutput:false},{name:"personaDescription",description:"Description of the persona",isInput:true,isOutput:false},{name:"modelRequirements",description:"Specific requirements for the model",isInput:false,isOutput:true}],templates:[{templateType:"PROMPT_TEMPLATE",name:"make-model-requirements",title:"Make modelRequirements",content:"You are experienced AI engineer, you need to create virtual assistant.\nWrite\n\n## Example\n\n```json\n{\n\"modelName\": \"gpt-4o\",\n\"systemMessage\": \"You are experienced AI engineer and helpfull assistant.\",\n\"temperature\": 0.7\n}\n```\n\n## Instructions\n\n- Your output format is JSON object\n- Write just the JSON object, no other text should be present\n- It contains the following keys:\n - `modelName`: The name of the model to use\n - `systemMessage`: The system message to provide context to the model\n - `temperature`: The sampling temperature to use\n\n### Key `modelName`\n\nPick from the following models:\n\n- {availableModelNames}\n\n### Key `systemMessage`\n\nThe system message is used to communicate instructions or provide context to the model at the beginning of a conversation. It is displayed in a different format compared to user messages, helping the model understand its role in the conversation. The system message typically guides the model's behavior, sets the tone, or specifies desired output from the model. By utilizing the system message effectively, users can steer the model towards generating more accurate and relevant responses.\n\nFor example:\n\n> You are an experienced AI engineer and helpful assistant.\n\n> You are a friendly and knowledgeable chatbot.\n\n### Key `temperature`\n\nThe sampling temperature, between 0 and 1. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic. If set to 0, the model will use log probability to automatically increase the temperature until certain thresholds are hit.\n\nYou can pick a value between 0 and 2. For example:\n\n- `0.1`: Low temperature, extremely conservative and deterministic\n- `0.5`: Medium temperature, balanced between conservative and creative\n- `1.0`: High temperature, creative and bit random\n- `1.5`: Very high temperature, extremely creative and often chaotic and unpredictable\n- `2.0`: Maximum temperature, completely random and unpredictable, for some extreme creative use cases\n\n# The assistant\n\nTake this description of the persona:\n\n> {personaDescription}",resultingParameterName:"modelRequirements",format:"JSON",dependentParameterNames:["availableModelNames","personaDescription"]}],knowledgeSources:[],knowledgePieces:[],personas:[],preparations:[],sourceFile:"./promptbook-collection/prepare-persona.book.md"}];
359
+ var PipelineCollection = [{title:"Prepare Knowledge from Markdown",pipelineUrl:"https://promptbook.studio/promptbook/prepare-knowledge-from-markdown.book.md",formfactorName:"GENERIC",parameters:[{name:"knowledgeContent",description:"Markdown document content",isInput:true,isOutput:false},{name:"knowledgePieces",description:"The knowledge JSON object",isInput:false,isOutput:true}],tasks:[{taskType:"PROMPT_TASK",name:"knowledge",title:"Knowledge",content:"You are experienced data researcher, extract the important knowledge from the document.\n\n# Rules\n\n- Make pieces of information concise, clear, and easy to understand\n- One piece of information should be approximately 1 paragraph\n- Divide the paragraphs by markdown horizontal lines ---\n- Omit irrelevant information\n- Group redundant information\n- Write just extracted information, nothing else\n\n# The document\n\nTake information from this document:\n\n> {knowledgeContent}",resultingParameterName:"knowledgePieces",dependentParameterNames:["knowledgeContent"]}],knowledgeSources:[],knowledgePieces:[],personas:[],preparations:[],sourceFile:"./books/prepare-knowledge-from-markdown.book.md"},{title:"Prepare Keywords",pipelineUrl:"https://promptbook.studio/promptbook/prepare-knowledge-keywords.book.md",formfactorName:"GENERIC",parameters:[{name:"knowledgePieceContent",description:"The content",isInput:true,isOutput:false},{name:"keywords",description:"Keywords separated by comma",isInput:false,isOutput:true}],tasks:[{taskType:"PROMPT_TASK",name:"knowledge",title:"Knowledge",content:"You are experienced data researcher, detect the important keywords in the document.\n\n# Rules\n\n- Write just keywords separated by comma\n\n# The document\n\nTake information from this document:\n\n> {knowledgePieceContent}",resultingParameterName:"keywords",dependentParameterNames:["knowledgePieceContent"]}],knowledgeSources:[],knowledgePieces:[],personas:[],preparations:[],sourceFile:"./books/prepare-knowledge-keywords.book.md"},{title:"Prepare Title",pipelineUrl:"https://promptbook.studio/promptbook/prepare-knowledge-title.book.md",formfactorName:"GENERIC",parameters:[{name:"knowledgePieceContent",description:"The content",isInput:true,isOutput:false},{name:"title",description:"The title of the document",isInput:false,isOutput:true}],tasks:[{taskType:"PROMPT_TASK",name:"knowledge",title:"Knowledge",content:"You are experienced content creator, write best title for the document.\n\n# Rules\n\n- Write just title, nothing else\n- Title should be concise and clear\n- Write maximum 5 words for the title\n\n# The document\n\n> {knowledgePieceContent}",resultingParameterName:"title",expectations:{words:{min:1,max:8}},dependentParameterNames:["knowledgePieceContent"]}],knowledgeSources:[],knowledgePieces:[],personas:[],preparations:[],sourceFile:"./books/prepare-knowledge-title.book.md"},{title:"Prepare Keywords",pipelineUrl:"https://promptbook.studio/promptbook/prepare-persona.book.md",formfactorName:"GENERIC",parameters:[{name:"availableModelNames",description:"List of available model names separated by comma (,)",isInput:true,isOutput:false},{name:"personaDescription",description:"Description of the persona",isInput:true,isOutput:false},{name:"modelRequirements",description:"Specific requirements for the model",isInput:false,isOutput:true}],tasks:[{taskType:"PROMPT_TASK",name:"make-model-requirements",title:"Make modelRequirements",content:"You are experienced AI engineer, you need to create virtual assistant.\nWrite\n\n## Example\n\n```json\n{\n\"modelName\": \"gpt-4o\",\n\"systemMessage\": \"You are experienced AI engineer and helpfull assistant.\",\n\"temperature\": 0.7\n}\n```\n\n## Instructions\n\n- Your output format is JSON object\n- Write just the JSON object, no other text should be present\n- It contains the following keys:\n - `modelName`: The name of the model to use\n - `systemMessage`: The system message to provide context to the model\n - `temperature`: The sampling temperature to use\n\n### Key `modelName`\n\nPick from the following models:\n\n- {availableModelNames}\n\n### Key `systemMessage`\n\nThe system message is used to communicate instructions or provide context to the model at the beginning of a conversation. It is displayed in a different format compared to user messages, helping the model understand its role in the conversation. The system message typically guides the model's behavior, sets the tone, or specifies desired output from the model. By utilizing the system message effectively, users can steer the model towards generating more accurate and relevant responses.\n\nFor example:\n\n> You are an experienced AI engineer and helpful assistant.\n\n> You are a friendly and knowledgeable chatbot.\n\n### Key `temperature`\n\nThe sampling temperature, between 0 and 1. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic. If set to 0, the model will use log probability to automatically increase the temperature until certain thresholds are hit.\n\nYou can pick a value between 0 and 2. For example:\n\n- `0.1`: Low temperature, extremely conservative and deterministic\n- `0.5`: Medium temperature, balanced between conservative and creative\n- `1.0`: High temperature, creative and bit random\n- `1.5`: Very high temperature, extremely creative and often chaotic and unpredictable\n- `2.0`: Maximum temperature, completely random and unpredictable, for some extreme creative use cases\n\n# The assistant\n\nTake this description of the persona:\n\n> {personaDescription}",resultingParameterName:"modelRequirements",format:"JSON",dependentParameterNames:["availableModelNames","personaDescription"]}],knowledgeSources:[],knowledgePieces:[],personas:[],preparations:[],sourceFile:"./books/prepare-persona.book.md"}];
359
360
 
360
361
  /**
361
362
  * Prettify the html code
@@ -400,7 +401,7 @@ function prettifyMarkdown(content) {
400
401
  */
401
402
  function pipelineJsonToString(pipelineJson) {
402
403
  var e_1, _a, e_2, _b, e_3, _c, e_4, _d, e_5, _e, e_6, _f;
403
- var title = pipelineJson.title, pipelineUrl = pipelineJson.pipelineUrl, bookVersion = pipelineJson.bookVersion, description = pipelineJson.description, parameters = pipelineJson.parameters, templates = pipelineJson.templates;
404
+ var title = pipelineJson.title, pipelineUrl = pipelineJson.pipelineUrl, bookVersion = pipelineJson.bookVersion, description = pipelineJson.description, parameters = pipelineJson.parameters, tasks = pipelineJson.tasks;
404
405
  var pipelineString = "# ".concat(title);
405
406
  if (description) {
406
407
  pipelineString += '\n\n';
@@ -421,7 +422,7 @@ function pipelineJsonToString(pipelineJson) {
421
422
  return isInput;
422
423
  })), _h = _g.next(); !_h.done; _h = _g.next()) {
423
424
  var parameter = _h.value;
424
- commands.push("INPUT PARAMETER ".concat(templateParameterJsonToString(parameter)));
425
+ commands.push("INPUT PARAMETER ".concat(taskParameterJsonToString(parameter)));
425
426
  }
426
427
  }
427
428
  catch (e_1_1) { e_1 = { error: e_1_1 }; }
@@ -437,7 +438,7 @@ function pipelineJsonToString(pipelineJson) {
437
438
  return isOutput;
438
439
  })), _k = _j.next(); !_k.done; _k = _j.next()) {
439
440
  var parameter = _k.value;
440
- commands.push("OUTPUT PARAMETER ".concat(templateParameterJsonToString(parameter)));
441
+ commands.push("OUTPUT PARAMETER ".concat(taskParameterJsonToString(parameter)));
441
442
  }
442
443
  }
443
444
  catch (e_2_1) { e_2 = { error: e_2_1 }; }
@@ -450,13 +451,13 @@ function pipelineJsonToString(pipelineJson) {
450
451
  pipelineString += '\n\n';
451
452
  pipelineString += commands.map(function (command) { return "- ".concat(command); }).join('\n');
452
453
  try {
453
- for (var templates_1 = __values(templates), templates_1_1 = templates_1.next(); !templates_1_1.done; templates_1_1 = templates_1.next()) {
454
- var template = templates_1_1.value;
454
+ for (var tasks_1 = __values(tasks), tasks_1_1 = tasks_1.next(); !tasks_1_1.done; tasks_1_1 = tasks_1.next()) {
455
+ var task = tasks_1_1.value;
455
456
  var
456
457
  /* Note: Not using:> name, */
457
- title_1 = template.title, description_1 = template.description,
458
+ title_1 = task.title, description_1 = task.description,
458
459
  /* Note: dependentParameterNames, */
459
- jokers = template.jokerParameterNames, templateType = template.templateType, content = template.content, postprocessing = template.postprocessingFunctionNames, expectations = template.expectations, format = template.format, resultingParameterName = template.resultingParameterName;
460
+ jokers = task.jokerParameterNames, taskType = task.taskType, content = task.content, postprocessing = task.postprocessingFunctionNames, expectations = task.expectations, format = task.format, resultingParameterName = task.resultingParameterName;
460
461
  pipelineString += '\n\n';
461
462
  pipelineString += "## ".concat(title_1);
462
463
  if (description_1) {
@@ -465,10 +466,11 @@ function pipelineJsonToString(pipelineJson) {
465
466
  }
466
467
  var commands_1 = [];
467
468
  var contentLanguage = 'text';
468
- if (templateType === 'PROMPT_TEMPLATE') {
469
- var modelRequirements = template.modelRequirements;
469
+ if (taskType === 'PROMPT_TASK') {
470
+ var modelRequirements = task.modelRequirements;
470
471
  var _l = modelRequirements || {}, modelName = _l.modelName, modelVariant = _l.modelVariant;
471
- commands_1.push("EXECUTE PROMPT TEMPLATE");
472
+ // Note: Do nothing, it is default
473
+ // commands.push(`PROMPT`);
472
474
  if (modelVariant) {
473
475
  commands_1.push("MODEL VARIANT ".concat(capitalize(modelVariant)));
474
476
  }
@@ -476,21 +478,21 @@ function pipelineJsonToString(pipelineJson) {
476
478
  commands_1.push("MODEL NAME `".concat(modelName, "`"));
477
479
  }
478
480
  }
479
- else if (templateType === 'SIMPLE_TEMPLATE') {
481
+ else if (taskType === 'SIMPLE_TASK') {
480
482
  commands_1.push("SIMPLE TEMPLATE");
481
483
  // Note: Nothing special here
482
484
  }
483
- else if (templateType === 'SCRIPT_TEMPLATE') {
484
- commands_1.push("SCRIPT TEMPLATE");
485
- if (template.contentLanguage) {
486
- contentLanguage = template.contentLanguage;
485
+ else if (taskType === 'SCRIPT_TASK') {
486
+ commands_1.push("SCRIPT");
487
+ if (task.contentLanguage) {
488
+ contentLanguage = task.contentLanguage;
487
489
  }
488
490
  else {
489
491
  contentLanguage = '';
490
492
  }
491
493
  }
492
- else if (templateType === 'DIALOG_TEMPLATE') {
493
- commands_1.push("DIALOG TEMPLATE");
494
+ else if (taskType === 'DIALOG_TASK') {
495
+ commands_1.push("DIALOG");
494
496
  // Note: Nothing special here
495
497
  } // <- }else if([🅱]
496
498
  if (jokers) {
@@ -565,13 +567,13 @@ function pipelineJsonToString(pipelineJson) {
565
567
  pipelineString += '\n';
566
568
  pipelineString += '```';
567
569
  pipelineString += '\n\n';
568
- pipelineString += "`-> {".concat(resultingParameterName, "}`"); // <- TODO: [main] !!! If the parameter here has description, add it and use templateParameterJsonToString
570
+ pipelineString += "`-> {".concat(resultingParameterName, "}`"); // <- TODO: [main] !!! If the parameter here has description, add it and use taskParameterJsonToString
569
571
  }
570
572
  }
571
573
  catch (e_3_1) { e_3 = { error: e_3_1 }; }
572
574
  finally {
573
575
  try {
574
- if (templates_1_1 && !templates_1_1.done && (_c = templates_1.return)) _c.call(templates_1);
576
+ if (tasks_1_1 && !tasks_1_1.done && (_c = tasks_1.return)) _c.call(tasks_1);
575
577
  }
576
578
  finally { if (e_3) throw e_3.error; }
577
579
  }
@@ -580,8 +582,8 @@ function pipelineJsonToString(pipelineJson) {
580
582
  /**
581
583
  * @private internal utility of `pipelineJsonToString`
582
584
  */
583
- function templateParameterJsonToString(templateParameterJson) {
584
- var name = templateParameterJson.name, description = templateParameterJson.description;
585
+ function taskParameterJsonToString(taskParameterJson) {
586
+ var name = taskParameterJson.name, description = taskParameterJson.description;
585
587
  var parameterString = "{".concat(name, "}");
586
588
  if (description) {
587
589
  parameterString = "".concat(parameterString, " ").concat(description);
@@ -589,7 +591,7 @@ function templateParameterJsonToString(templateParameterJson) {
589
591
  return parameterString;
590
592
  }
591
593
  /**
592
- * TODO: [🛋] Implement new features and commands into `pipelineJsonToString` + `templateParameterJsonToString` , use `stringifyCommand`
594
+ * TODO: [🛋] Implement new features and commands into `pipelineJsonToString` + `taskParameterJsonToString` , use `stringifyCommand`
593
595
  * TODO: [🧠] Is there a way to auto-detect missing features in pipelineJsonToString
594
596
  * TODO: [🏛] Maybe make some markdown builder
595
597
  * TODO: [🏛] Escape all
@@ -911,6 +913,7 @@ var IS_PIPELINE_LOGIC_VALIDATED = just(
911
913
  true);
912
914
  /**
913
915
  * TODO: Extract `constants.ts` from `config.ts`
916
+ * Note: [💞] Ignore a discrepancy between file name and entity name
914
917
  * TODO: [🧠][🧜‍♂️] Maybe join remoteUrl and path into single value
915
918
  */
916
919
 
@@ -1147,9 +1150,9 @@ function validatePipelineCore(pipeline) {
1147
1150
  throw new ParseError(spaceTrim$1(function (block) { return "\n Pipeline is valid JSON but with wrong structure\n\n `PipelineJson.parameters` expected to be an array, but got ".concat(typeof pipeline.parameters, "\n\n ").concat(block(pipelineIdentification), "\n "); }));
1148
1151
  }
1149
1152
  // TODO: [🧠] Maybe do here some propper JSON-schema / ZOD checking
1150
- if (!Array.isArray(pipeline.templates)) {
1153
+ if (!Array.isArray(pipeline.tasks)) {
1151
1154
  // TODO: [🧠] what is the correct error tp throw - maybe PromptbookSchemaError
1152
- throw new ParseError(spaceTrim$1(function (block) { return "\n Pipeline is valid JSON but with wrong structure\n\n `PipelineJson.templates` expected to be an array, but got ".concat(typeof pipeline.templates, "\n\n ").concat(block(pipelineIdentification), "\n "); }));
1155
+ throw new ParseError(spaceTrim$1(function (block) { return "\n Pipeline is valid JSON but with wrong structure\n\n `PipelineJson.tasks` expected to be an array, but got ".concat(typeof pipeline.tasks, "\n\n ").concat(block(pipelineIdentification), "\n "); }));
1153
1156
  }
1154
1157
  var _loop_1 = function (parameter) {
1155
1158
  if (parameter.isInput && parameter.isOutput) {
@@ -1158,13 +1161,12 @@ function validatePipelineCore(pipeline) {
1158
1161
  // Note: Testing that parameter is either intermediate or output BUT not created and unused
1159
1162
  if (!parameter.isInput &&
1160
1163
  !parameter.isOutput &&
1161
- !pipeline.templates.some(function (template) { return template.dependentParameterNames.includes(parameter.name); })) {
1164
+ !pipeline.tasks.some(function (task) { return task.dependentParameterNames.includes(parameter.name); })) {
1162
1165
  throw new PipelineLogicError(spaceTrim$1(function (block) { return "\n Parameter `{".concat(parameter.name, "}` is created but not used\n\n You can declare {").concat(parameter.name, "} as output parameter by adding in the header:\n - OUTPUT PARAMETER `{").concat(parameter.name, "}` ").concat(parameter.description || '', "\n\n ").concat(block(pipelineIdentification), "\n\n "); }));
1163
1166
  }
1164
- // Note: Testing that parameter is either input or result of some template
1165
- if (!parameter.isInput &&
1166
- !pipeline.templates.some(function (template) { return template.resultingParameterName === parameter.name; })) {
1167
- throw new PipelineLogicError(spaceTrim$1(function (block) { return "\n Parameter `{".concat(parameter.name, "}` is declared but not defined\n\n You can do one of these:\n 1) Remove declaration of `{").concat(parameter.name, "}`\n 2) Add template that results in `-> {").concat(parameter.name, "}`\n\n ").concat(block(pipelineIdentification), "\n "); }));
1167
+ // Note: Testing that parameter is either input or result of some task
1168
+ if (!parameter.isInput && !pipeline.tasks.some(function (task) { return task.resultingParameterName === parameter.name; })) {
1169
+ throw new PipelineLogicError(spaceTrim$1(function (block) { return "\n Parameter `{".concat(parameter.name, "}` is declared but not defined\n\n You can do one of these:\n 1) Remove declaration of `{").concat(parameter.name, "}`\n 2) Add task that results in `-> {").concat(parameter.name, "}`\n\n ").concat(block(pipelineIdentification), "\n "); }));
1168
1170
  }
1169
1171
  };
1170
1172
  try {
@@ -1181,7 +1183,7 @@ function validatePipelineCore(pipeline) {
1181
1183
  }
1182
1184
  finally { if (e_1) throw e_1.error; }
1183
1185
  }
1184
- // Note: All input parameters are defined - so that they can be used as result of some template
1186
+ // Note: All input parameters are defined - so that they can be used as result of some task
1185
1187
  var definedParameters = new Set(pipeline.parameters.filter(function (_a) {
1186
1188
  var isInput = _a.isInput;
1187
1189
  return isInput;
@@ -1189,27 +1191,27 @@ function validatePipelineCore(pipeline) {
1189
1191
  var name = _a.name;
1190
1192
  return name;
1191
1193
  }));
1192
- var _loop_2 = function (template) {
1194
+ var _loop_2 = function (task) {
1193
1195
  var e_4, _h, e_5, _j;
1194
- if (definedParameters.has(template.resultingParameterName)) {
1195
- throw new PipelineLogicError(spaceTrim$1(function (block) { return "\n Parameter `{".concat(template.resultingParameterName, "}` is defined multiple times\n\n ").concat(block(pipelineIdentification), "\n "); }));
1196
+ if (definedParameters.has(task.resultingParameterName)) {
1197
+ throw new PipelineLogicError(spaceTrim$1(function (block) { return "\n Parameter `{".concat(task.resultingParameterName, "}` is defined multiple times\n\n ").concat(block(pipelineIdentification), "\n "); }));
1196
1198
  }
1197
- if (RESERVED_PARAMETER_NAMES.includes(template.resultingParameterName)) {
1198
- throw new PipelineLogicError(spaceTrim$1(function (block) { return "\n Parameter name {".concat(template.resultingParameterName, "} is reserved, please use different name\n\n ").concat(block(pipelineIdentification), "\n "); }));
1199
+ if (RESERVED_PARAMETER_NAMES.includes(task.resultingParameterName)) {
1200
+ throw new PipelineLogicError(spaceTrim$1(function (block) { return "\n Parameter name {".concat(task.resultingParameterName, "} is reserved, please use different name\n\n ").concat(block(pipelineIdentification), "\n "); }));
1199
1201
  }
1200
- definedParameters.add(template.resultingParameterName);
1201
- if (template.jokerParameterNames && template.jokerParameterNames.length > 0) {
1202
- if (!template.format &&
1203
- !template.expectations /* <- TODO: Require at least 1 -> min <- expectation to use jokers */) {
1204
- throw new PipelineLogicError(spaceTrim$1(function (block) { return "\n Joker parameters are used for {".concat(template.resultingParameterName, "} but no expectations are defined\n\n ").concat(block(pipelineIdentification), "\n "); }));
1202
+ definedParameters.add(task.resultingParameterName);
1203
+ if (task.jokerParameterNames && task.jokerParameterNames.length > 0) {
1204
+ if (!task.format &&
1205
+ !task.expectations /* <- TODO: Require at least 1 -> min <- expectation to use jokers */) {
1206
+ throw new PipelineLogicError(spaceTrim$1(function (block) { return "\n Joker parameters are used for {".concat(task.resultingParameterName, "} but no expectations are defined\n\n ").concat(block(pipelineIdentification), "\n "); }));
1205
1207
  }
1206
1208
  var _loop_4 = function (joker) {
1207
- if (!template.dependentParameterNames.includes(joker)) {
1208
- throw new PipelineLogicError(spaceTrim$1(function (block) { return "\n Parameter `{".concat(joker, "}` is used for {").concat(template.resultingParameterName, "} as joker but not in `dependentParameterNames`\n\n ").concat(block(pipelineIdentification), "\n "); }));
1209
+ if (!task.dependentParameterNames.includes(joker)) {
1210
+ throw new PipelineLogicError(spaceTrim$1(function (block) { return "\n Parameter `{".concat(joker, "}` is used for {").concat(task.resultingParameterName, "} as joker but not in `dependentParameterNames`\n\n ").concat(block(pipelineIdentification), "\n "); }));
1209
1211
  }
1210
1212
  };
1211
1213
  try {
1212
- for (var _k = (e_4 = void 0, __values(template.jokerParameterNames)), _l = _k.next(); !_l.done; _l = _k.next()) {
1214
+ for (var _k = (e_4 = void 0, __values(task.jokerParameterNames)), _l = _k.next(); !_l.done; _l = _k.next()) {
1213
1215
  var joker = _l.value;
1214
1216
  _loop_4(joker);
1215
1217
  }
@@ -1222,7 +1224,7 @@ function validatePipelineCore(pipeline) {
1222
1224
  finally { if (e_4) throw e_4.error; }
1223
1225
  }
1224
1226
  }
1225
- if (template.expectations) {
1227
+ if (task.expectations) {
1226
1228
  var _loop_5 = function (unit, min, max) {
1227
1229
  if (min !== undefined && max !== undefined && min > max) {
1228
1230
  throw new PipelineLogicError(spaceTrim$1(function (block) { return "\n Min expectation (=".concat(min, ") of ").concat(unit, " is higher than max expectation (=").concat(max, ")\n\n ").concat(block(pipelineIdentification), "\n "); }));
@@ -1235,7 +1237,7 @@ function validatePipelineCore(pipeline) {
1235
1237
  }
1236
1238
  };
1237
1239
  try {
1238
- for (var _m = (e_5 = void 0, __values(Object.entries(template.expectations))), _o = _m.next(); !_o.done; _o = _m.next()) {
1240
+ for (var _m = (e_5 = void 0, __values(Object.entries(task.expectations))), _o = _m.next(); !_o.done; _o = _m.next()) {
1239
1241
  var _p = __read(_o.value, 2), unit = _p[0], _q = _p[1], min = _q.min, max = _q.max;
1240
1242
  _loop_5(unit, min, max);
1241
1243
  }
@@ -1250,10 +1252,10 @@ function validatePipelineCore(pipeline) {
1250
1252
  }
1251
1253
  };
1252
1254
  try {
1253
- // Note: Checking each template individually
1254
- for (var _f = __values(pipeline.templates), _g = _f.next(); !_g.done; _g = _f.next()) {
1255
- var template = _g.value;
1256
- _loop_2(template);
1255
+ // Note: Checking each task individually
1256
+ for (var _f = __values(pipeline.tasks), _g = _f.next(); !_g.done; _g = _f.next()) {
1257
+ var task = _g.value;
1258
+ _loop_2(task);
1257
1259
  }
1258
1260
  }
1259
1261
  catch (e_2_1) { e_2 = { error: e_2_1 }; }
@@ -1287,20 +1289,20 @@ function validatePipelineCore(pipeline) {
1287
1289
  }
1288
1290
  finally { if (e_3) throw e_3.error; }
1289
1291
  }
1290
- var unresovedTemplates = __spreadArray([], __read(pipeline.templates), false);
1292
+ var unresovedTasks = __spreadArray([], __read(pipeline.tasks), false);
1291
1293
  var loopLimit = LOOP_LIMIT;
1292
1294
  var _loop_3 = function () {
1293
1295
  if (loopLimit-- < 0) {
1294
1296
  // Note: Really UnexpectedError not LimitReachedError - this should not happen and be caught below
1295
1297
  throw new UnexpectedError(spaceTrim$1(function (block) { return "\n Loop limit reached during detection of circular dependencies in `validatePipeline`\n\n ".concat(block(pipelineIdentification), "\n "); }));
1296
1298
  }
1297
- var currentlyResovedTemplates = unresovedTemplates.filter(function (template) {
1298
- return template.dependentParameterNames.every(function (name) { return resovedParameters.includes(name); });
1299
+ var currentlyResovedTasks = unresovedTasks.filter(function (task) {
1300
+ return task.dependentParameterNames.every(function (name) { return resovedParameters.includes(name); });
1299
1301
  });
1300
- if (currentlyResovedTemplates.length === 0) {
1302
+ if (currentlyResovedTasks.length === 0) {
1301
1303
  throw new PipelineLogicError(
1302
1304
  // TODO: [🐎] DRY
1303
- spaceTrim$1(function (block) { return "\n\n Can not resolve some parameters:\n Either you are using a parameter that is not defined, or there are some circular dependencies.\n\n ".concat(block(pipelineIdentification), "\n\n **Can not resolve:**\n ").concat(block(unresovedTemplates
1305
+ spaceTrim$1(function (block) { return "\n\n Can not resolve some parameters:\n Either you are using a parameter that is not defined, or there are some circular dependencies.\n\n ".concat(block(pipelineIdentification), "\n\n **Can not resolve:**\n ").concat(block(unresovedTasks
1304
1306
  .map(function (_a) {
1305
1307
  var resultingParameterName = _a.resultingParameterName, dependentParameterNames = _a.dependentParameterNames;
1306
1308
  return "- Parameter `{".concat(resultingParameterName, "}` which depends on ").concat(dependentParameterNames
@@ -1319,13 +1321,13 @@ function validatePipelineCore(pipeline) {
1319
1321
  .map(function (name) { return "- Parameter `{".concat(name, "}`"); })
1320
1322
  .join('\n')), "\n\n\n "); }));
1321
1323
  }
1322
- resovedParameters = __spreadArray(__spreadArray([], __read(resovedParameters), false), __read(currentlyResovedTemplates.map(function (_a) {
1324
+ resovedParameters = __spreadArray(__spreadArray([], __read(resovedParameters), false), __read(currentlyResovedTasks.map(function (_a) {
1323
1325
  var resultingParameterName = _a.resultingParameterName;
1324
1326
  return resultingParameterName;
1325
1327
  })), false);
1326
- unresovedTemplates = unresovedTemplates.filter(function (template) { return !currentlyResovedTemplates.includes(template); });
1328
+ unresovedTasks = unresovedTasks.filter(function (task) { return !currentlyResovedTasks.includes(task); });
1327
1329
  };
1328
- while (unresovedTemplates.length > 0) {
1330
+ while (unresovedTasks.length > 0) {
1329
1331
  _loop_3();
1330
1332
  }
1331
1333
  // TODO: !!!!!! Test that pipeline interface implements declared formfactor interface
@@ -1385,9 +1387,9 @@ var PipelineUrlError = /** @class */ (function (_super) {
1385
1387
  }(Error));
1386
1388
 
1387
1389
  /**
1388
- * Parses the template and returns the list of all parameter names
1390
+ * Parses the task and returns the list of all parameter names
1389
1391
  *
1390
- * @param template the template with parameters in {curly} braces
1392
+ * @param template the string template with parameters in {curly} braces
1391
1393
  * @returns the list of parameter names
1392
1394
  * @public exported from `@promptbook/utils`
1393
1395
  */
@@ -1418,18 +1420,18 @@ function extractParameterNames(template) {
1418
1420
  * @public exported from `@promptbook/core`
1419
1421
  */
1420
1422
  function unpreparePipeline(pipeline) {
1421
- var personas = pipeline.personas, knowledgeSources = pipeline.knowledgeSources, templates = pipeline.templates;
1423
+ var personas = pipeline.personas, knowledgeSources = pipeline.knowledgeSources, tasks = pipeline.tasks;
1422
1424
  personas = personas.map(function (persona) { return (__assign(__assign({}, persona), { modelRequirements: undefined, preparationIds: undefined })); });
1423
1425
  knowledgeSources = knowledgeSources.map(function (knowledgeSource) { return (__assign(__assign({}, knowledgeSource), { preparationIds: undefined })); });
1424
- templates = templates.map(function (template) {
1425
- var dependentParameterNames = template.dependentParameterNames;
1426
- var parameterNames = extractParameterNames(template.preparedContent || '');
1426
+ tasks = tasks.map(function (task) {
1427
+ var dependentParameterNames = task.dependentParameterNames;
1428
+ var parameterNames = extractParameterNames(task.preparedContent || '');
1427
1429
  dependentParameterNames = dependentParameterNames.filter(function (dependentParameterName) { return !parameterNames.has(dependentParameterName); });
1428
- var templateUnprepared = __assign(__assign({}, template), { dependentParameterNames: dependentParameterNames });
1429
- delete templateUnprepared.preparedContent;
1430
- return templateUnprepared;
1430
+ var taskUnprepared = __assign(__assign({}, task), { dependentParameterNames: dependentParameterNames });
1431
+ delete taskUnprepared.preparedContent;
1432
+ return taskUnprepared;
1431
1433
  });
1432
- return $asDeeplyFrozenSerializableJson('Unprepared PipelineJson', __assign(__assign({}, pipeline), { templates: templates, knowledgeSources: knowledgeSources, knowledgePieces: [], personas: personas, preparations: [] }));
1434
+ return $asDeeplyFrozenSerializableJson('Unprepared PipelineJson', __assign(__assign({}, pipeline), { tasks: tasks, knowledgeSources: knowledgeSources, knowledgePieces: [], personas: personas, preparations: [] }));
1433
1435
  }
1434
1436
  /**
1435
1437
  * TODO: [🧿] Maybe do same process with same granularity and subfinctions as `preparePipeline`
@@ -1861,6 +1863,9 @@ function normalizeToKebabCase(text) {
1861
1863
  normalizedName = normalizedName.replace(/-$/, '');
1862
1864
  return normalizedName;
1863
1865
  }
1866
+ /**
1867
+ * Note: [💞] Ignore a discrepancy between file name and entity name
1868
+ */
1864
1869
 
1865
1870
  /**
1866
1871
  * Removes emojis from a string and fix whitespaces
@@ -2062,6 +2067,9 @@ var ERRORS = {
2062
2067
  UnexpectedError: UnexpectedError,
2063
2068
  // TODO: [🪑]> VersionMismatchError,
2064
2069
  };
2070
+ /**
2071
+ * Note: [💞] Ignore a discrepancy between file name and entity name
2072
+ */
2065
2073
 
2066
2074
  /**
2067
2075
  * Deserializes the error object
@@ -2123,8 +2131,8 @@ function isPipelinePrepared(pipeline) {
2123
2131
  return false;
2124
2132
  }
2125
2133
  /*
2126
- TODO: [🧠][🍫] `templates` can not be determined if they are fully prepared SO ignoring them
2127
- > if (!pipeline.templates.every(({ preparedContent }) => preparedContent === undefined)) {
2134
+ TODO: [🧠][🍫] `tasks` can not be determined if they are fully prepared SO ignoring them
2135
+ > if (!pipeline.tasks.every(({ preparedContent }) => preparedContent === undefined)) {
2128
2136
  > return false;
2129
2137
  > }
2130
2138
  */
@@ -2135,9 +2143,9 @@ function isPipelinePrepared(pipeline) {
2135
2143
  * TODO: [🐠] Maybe base this on `makeValidator`
2136
2144
  * TODO: [🧊] Pipeline can be partially prepared, this should return true ONLY if fully prepared
2137
2145
  * TODO: [🧿] Maybe do same process with same granularity and subfinctions as `preparePipeline`
2138
- * - [🏍] ? Is context in each template
2146
+ * - [🏍] ? Is context in each task
2139
2147
  * - [♨] Are examples prepared
2140
- * - [♨] Are templates prepared
2148
+ * - [♨] Are tasks prepared
2141
2149
  */
2142
2150
 
2143
2151
  /**
@@ -2285,6 +2293,9 @@ $deepFreeze({
2285
2293
  pagesCount: { value: 0, isUncertain: true },
2286
2294
  },
2287
2295
  });
2296
+ /**
2297
+ * Note: [💞] Ignore a discrepancy between file name and entity name
2298
+ */
2288
2299
 
2289
2300
  /**
2290
2301
  * @@@
@@ -3471,7 +3482,7 @@ TODO: [🧊] This is how it can look in future
3471
3482
  */
3472
3483
  function clonePipeline(pipeline) {
3473
3484
  // Note: Not using spread operator (...) because @@@
3474
- var pipelineUrl = pipeline.pipelineUrl, sourceFile = pipeline.sourceFile, title = pipeline.title, bookVersion = pipeline.bookVersion, description = pipeline.description, formfactorName = pipeline.formfactorName, parameters = pipeline.parameters, templates = pipeline.templates, knowledgeSources = pipeline.knowledgeSources, knowledgePieces = pipeline.knowledgePieces, personas = pipeline.personas, preparations = pipeline.preparations;
3485
+ var pipelineUrl = pipeline.pipelineUrl, sourceFile = pipeline.sourceFile, title = pipeline.title, bookVersion = pipeline.bookVersion, description = pipeline.description, formfactorName = pipeline.formfactorName, parameters = pipeline.parameters, tasks = pipeline.tasks, knowledgeSources = pipeline.knowledgeSources, knowledgePieces = pipeline.knowledgePieces, personas = pipeline.personas, preparations = pipeline.preparations;
3475
3486
  return {
3476
3487
  pipelineUrl: pipelineUrl,
3477
3488
  sourceFile: sourceFile,
@@ -3480,7 +3491,7 @@ function clonePipeline(pipeline) {
3480
3491
  description: description,
3481
3492
  formfactorName: formfactorName,
3482
3493
  parameters: parameters,
3483
- templates: templates,
3494
+ tasks: tasks,
3484
3495
  knowledgeSources: knowledgeSources,
3485
3496
  knowledgePieces: knowledgePieces,
3486
3497
  personas: personas,
@@ -3496,20 +3507,20 @@ function clonePipeline(pipeline) {
3496
3507
  *
3497
3508
  * @public exported from `@promptbook/core`
3498
3509
  */
3499
- function prepareTemplates(pipeline, tools, options) {
3510
+ function prepareTasks(pipeline, tools, options) {
3500
3511
  return __awaiter(this, void 0, void 0, function () {
3501
- var _a, maxParallelCount, templates, knowledgePiecesCount, templatesPrepared;
3512
+ var _a, maxParallelCount, tasks, knowledgePiecesCount, tasksPrepared;
3502
3513
  var _this = this;
3503
3514
  return __generator(this, function (_b) {
3504
3515
  switch (_b.label) {
3505
3516
  case 0:
3506
3517
  _a = options.maxParallelCount, maxParallelCount = _a === void 0 ? DEFAULT_MAX_PARALLEL_COUNT : _a;
3507
- templates = pipeline.templates, pipeline.parameters, knowledgePiecesCount = pipeline.knowledgePiecesCount;
3508
- templatesPrepared = new Array(templates.length);
3509
- return [4 /*yield*/, forEachAsync(templates, { maxParallelCount: maxParallelCount /* <- TODO: [🪂] When there are subtasks, this maximul limit can be broken */ }, function (template, index) { return __awaiter(_this, void 0, void 0, function () {
3510
- var dependentParameterNames, preparedContent, preparedTemplate;
3518
+ tasks = pipeline.tasks, pipeline.parameters, knowledgePiecesCount = pipeline.knowledgePiecesCount;
3519
+ tasksPrepared = new Array(tasks.length);
3520
+ return [4 /*yield*/, forEachAsync(tasks, { maxParallelCount: maxParallelCount /* <- TODO: [🪂] When there are subtasks, this maximul limit can be broken */ }, function (task, index) { return __awaiter(_this, void 0, void 0, function () {
3521
+ var dependentParameterNames, preparedContent, preparedTask;
3511
3522
  return __generator(this, function (_a) {
3512
- dependentParameterNames = template.dependentParameterNames;
3523
+ dependentParameterNames = task.dependentParameterNames;
3513
3524
  preparedContent = undefined;
3514
3525
  if (knowledgePiecesCount > 0 && !dependentParameterNames.includes('knowledge')) {
3515
3526
  preparedContent = spaceTrim$1("\n {content}\n\n ## Knowledge\n\n {knowledge}\n ");
@@ -3518,22 +3529,22 @@ function prepareTemplates(pipeline, tools, options) {
3518
3529
  'knowledge',
3519
3530
  ], false);
3520
3531
  }
3521
- preparedTemplate = __assign(__assign({}, template), { dependentParameterNames: dependentParameterNames, preparedContent: preparedContent });
3522
- templatesPrepared[index] = preparedTemplate;
3532
+ preparedTask = __assign(__assign({}, task), { dependentParameterNames: dependentParameterNames, preparedContent: preparedContent });
3533
+ tasksPrepared[index] = preparedTask;
3523
3534
  return [2 /*return*/];
3524
3535
  });
3525
3536
  }); })];
3526
3537
  case 1:
3527
3538
  _b.sent();
3528
- return [2 /*return*/, { templatesPrepared: templatesPrepared }];
3539
+ return [2 /*return*/, { tasksPrepared: tasksPrepared }];
3529
3540
  }
3530
3541
  });
3531
3542
  });
3532
3543
  }
3533
3544
  /**
3534
- * TODO: [🧠] Add context to each template (if missing)
3535
- * TODO: [🧠] What is better name `prepareTemplate` or `prepareTemplateAndParameters`
3536
- * TODO: [♨][main] !!! Prepare index the examples and maybe templates
3545
+ * TODO: [🧠] Add context to each task (if missing)
3546
+ * TODO: [🧠] What is better name `prepareTask` or `prepareTaskAndParameters`
3547
+ * TODO: [♨][main] !!! Prepare index the examples and maybe tasks
3537
3548
  * TODO: Write tests for `preparePipeline`
3538
3549
  * TODO: [🏏] Leverage the batch API and build queues @see https://platform.openai.com/docs/guides/batch
3539
3550
  * TODO: [🧊] In future one preparation can take data from previous preparation and save tokens and time
@@ -3550,12 +3561,12 @@ function prepareTemplates(pipeline, tools, options) {
3550
3561
  */
3551
3562
  function preparePipeline(pipeline, tools, options) {
3552
3563
  return __awaiter(this, void 0, void 0, function () {
3553
- var rootDirname, _a, maxParallelCount, _b, isVerbose, parameters, templates,
3564
+ var rootDirname, _a, maxParallelCount, _b, isVerbose, parameters, tasks,
3554
3565
  /*
3555
3566
  <- TODO: [🧠][🪑] `promptbookVersion` */
3556
3567
  knowledgeSources /*
3557
3568
  <- TODO: [🧊] `knowledgePieces` */, personas /*
3558
- <- TODO: [🧊] `preparations` */, _llms, llmTools, llmToolsWithUsage, currentPreparation, preparations, preparedPersonas, knowledgeSourcesPrepared, partialknowledgePiecesPrepared, knowledgePiecesPrepared, templatesPrepared /* TODO: parameters: parametersPrepared*/;
3569
+ <- TODO: [🧊] `preparations` */, _llms, llmTools, llmToolsWithUsage, currentPreparation, preparations, preparedPersonas, knowledgeSourcesPrepared, partialknowledgePiecesPrepared, knowledgePiecesPrepared, tasksPrepared /* TODO: parameters: parametersPrepared*/;
3559
3570
  var _this = this;
3560
3571
  return __generator(this, function (_c) {
3561
3572
  switch (_c.label) {
@@ -3564,7 +3575,7 @@ function preparePipeline(pipeline, tools, options) {
3564
3575
  return [2 /*return*/, pipeline];
3565
3576
  }
3566
3577
  rootDirname = options.rootDirname, _a = options.maxParallelCount, maxParallelCount = _a === void 0 ? DEFAULT_MAX_PARALLEL_COUNT : _a, _b = options.isVerbose, isVerbose = _b === void 0 ? DEFAULT_IS_VERBOSE : _b;
3567
- parameters = pipeline.parameters, templates = pipeline.templates, knowledgeSources = pipeline.knowledgeSources, personas = pipeline.personas;
3578
+ parameters = pipeline.parameters, tasks = pipeline.tasks, knowledgeSources = pipeline.knowledgeSources, personas = pipeline.personas;
3568
3579
  if (tools === undefined || tools.llm === undefined) {
3569
3580
  throw new MissingToolsError('LLM tools are required for preparing the pipeline');
3570
3581
  }
@@ -3607,9 +3618,9 @@ function preparePipeline(pipeline, tools, options) {
3607
3618
  case 2:
3608
3619
  partialknowledgePiecesPrepared = _c.sent();
3609
3620
  knowledgePiecesPrepared = partialknowledgePiecesPrepared.map(function (piece) { return (__assign(__assign({}, piece), { preparationIds: [/* TODO: [🧊] -> */ currentPreparation.id] })); });
3610
- return [4 /*yield*/, prepareTemplates({
3621
+ return [4 /*yield*/, prepareTasks({
3611
3622
  parameters: parameters,
3612
- templates: templates,
3623
+ tasks: tasks,
3613
3624
  knowledgePiecesCount: knowledgePiecesPrepared.length,
3614
3625
  }, __assign(__assign({}, tools), { llm: llmToolsWithUsage }), {
3615
3626
  rootDirname: rootDirname,
@@ -3617,12 +3628,12 @@ function preparePipeline(pipeline, tools, options) {
3617
3628
  isVerbose: isVerbose,
3618
3629
  })];
3619
3630
  case 3:
3620
- templatesPrepared = (_c.sent()).templatesPrepared;
3621
- // ----- /Templates preparation -----
3631
+ tasksPrepared = (_c.sent()).tasksPrepared;
3632
+ // ----- /Tasks preparation -----
3622
3633
  // Note: Count total usage
3623
3634
  currentPreparation.usage = llmToolsWithUsage.getTotalUsage();
3624
- return [2 /*return*/, $asDeeplyFrozenSerializableJson('Prepared PipelineJson', __assign(__assign({}, clonePipeline(pipeline)), { templates: __spreadArray([], __read(templatesPrepared), false),
3625
- // <- TODO: [🪓] Here should be no need for spreading new array, just ` templates: templatesPrepared`
3635
+ return [2 /*return*/, $asDeeplyFrozenSerializableJson('Prepared PipelineJson', __assign(__assign({}, clonePipeline(pipeline)), { tasks: __spreadArray([], __read(tasksPrepared), false),
3636
+ // <- TODO: [🪓] Here should be no need for spreading new array, just ` tasks: tasksPrepared`
3626
3637
  knowledgeSources: knowledgeSourcesPrepared, knowledgePieces: knowledgePiecesPrepared, personas: preparedPersonas, preparations: __spreadArray([], __read(preparations), false) }))];
3627
3638
  }
3628
3639
  });
@@ -3687,16 +3698,16 @@ function extractVariables(script) {
3687
3698
  */
3688
3699
 
3689
3700
  /**
3690
- * Parses the template and returns the set of all used parameters
3701
+ * Parses the task and returns the set of all used parameters
3691
3702
  *
3692
- * @param template the template with used parameters
3703
+ * @param task the task with used parameters
3693
3704
  * @returns the set of parameter names
3694
3705
  * @throws {ParseError} if the script is invalid
3695
3706
  * @public exported from `@promptbook/utils`
3696
3707
  */
3697
- function extractParameterNamesFromTemplate(template) {
3708
+ function extractParameterNamesFromTask(task) {
3698
3709
  var e_1, _a, e_2, _b, e_3, _c, e_4, _d;
3699
- var title = template.title, description = template.description, templateType = template.templateType, content = template.content, preparedContent = template.preparedContent, jokerParameterNames = template.jokerParameterNames, foreach = template.foreach;
3710
+ var title = task.title, description = task.description, taskType = task.taskType, content = task.content, preparedContent = task.preparedContent, jokerParameterNames = task.jokerParameterNames, foreach = task.foreach;
3700
3711
  var parameterNames = new Set();
3701
3712
  try {
3702
3713
  for (var _e = __values(__spreadArray(__spreadArray(__spreadArray(__spreadArray([], __read(extractParameterNames(title)), false), __read(extractParameterNames(description || '')), false), __read(extractParameterNames(content)), false), __read(extractParameterNames(preparedContent || '')), false)), _f = _e.next(); !_f.done; _f = _e.next()) {
@@ -3711,7 +3722,7 @@ function extractParameterNamesFromTemplate(template) {
3711
3722
  }
3712
3723
  finally { if (e_1) throw e_1.error; }
3713
3724
  }
3714
- if (templateType === 'SCRIPT_TEMPLATE') {
3725
+ if (taskType === 'SCRIPT_TASK') {
3715
3726
  try {
3716
3727
  for (var _g = __values(extractVariables(content)), _h = _g.next(); !_h.done; _h = _g.next()) {
3717
3728
  var parameterName = _h.value;
@@ -4121,6 +4132,9 @@ var FORMAT_DEFINITIONS = [
4121
4132
  TextFormatDefinition,
4122
4133
  CsvFormatDefinition,
4123
4134
  ];
4135
+ /**
4136
+ * Note: [💞] Ignore a discrepancy between file name and entity name
4137
+ */
4124
4138
 
4125
4139
  /**
4126
4140
  * Maps available parameters to expected parameters
@@ -4221,7 +4235,7 @@ function replaceParameters(template, parameters) {
4221
4235
  }
4222
4236
  finally { if (e_1) throw e_1.error; }
4223
4237
  }
4224
- var replacedTemplate = template;
4238
+ var replacedTemplates = template;
4225
4239
  var match;
4226
4240
  var loopLimit = LOOP_LIMIT;
4227
4241
  var _loop_1 = function () {
@@ -4250,24 +4264,24 @@ function replaceParameters(template, parameters) {
4250
4264
  .map(function (line, index) { return (index === 0 ? line : "".concat(precol).concat(line)); })
4251
4265
  .join('\n');
4252
4266
  }
4253
- replacedTemplate =
4254
- replacedTemplate.substring(0, match.index + precol.length) +
4267
+ replacedTemplates =
4268
+ replacedTemplates.substring(0, match.index + precol.length) +
4255
4269
  parameterValue +
4256
- replacedTemplate.substring(match.index + precol.length + parameterName.length + 2);
4270
+ replacedTemplates.substring(match.index + precol.length + parameterName.length + 2);
4257
4271
  };
4258
4272
  while ((match = /^(?<precol>.*){(?<parameterName>\w+)}(.*)/m /* <- Not global */
4259
- .exec(replacedTemplate))) {
4273
+ .exec(replacedTemplates))) {
4260
4274
  _loop_1();
4261
4275
  }
4262
4276
  // [💫] Check if there are parameters that are not closed properly
4263
- if (/{\w+$/.test(replacedTemplate)) {
4277
+ if (/{\w+$/.test(replacedTemplates)) {
4264
4278
  throw new PipelineExecutionError('Parameter is not closed');
4265
4279
  }
4266
4280
  // [💫] Check if there are parameters that are not opened properly
4267
- if (/^\w+}/.test(replacedTemplate)) {
4281
+ if (/^\w+}/.test(replacedTemplates)) {
4268
4282
  throw new PipelineExecutionError('Parameter is not opened');
4269
4283
  }
4270
- return replacedTemplate;
4284
+ return replacedTemplates;
4271
4285
  }
4272
4286
 
4273
4287
  /**
@@ -4299,6 +4313,7 @@ var CHARACTERS_PER_STANDARD_LINE = 63;
4299
4313
  var LINES_PER_STANDARD_PAGE = 44;
4300
4314
  /**
4301
4315
  * TODO: [🧠] Should be this `constants.ts` or `config.ts`?
4316
+ * Note: [💞] Ignore a discrepancy between file name and entity name
4302
4317
  */
4303
4318
 
4304
4319
  /**
@@ -4378,6 +4393,7 @@ var CountUtils = {
4378
4393
  };
4379
4394
  /**
4380
4395
  * TODO: [🧠][🤠] This should be probbably as part of `TextFormatDefinition`
4396
+ * Note: [💞] Ignore a discrepancy between file name and entity name
4381
4397
  */
4382
4398
 
4383
4399
  /**
@@ -4426,12 +4442,12 @@ function checkExpectations(expectations, value) {
4426
4442
  */
4427
4443
  function executeAttempts(options) {
4428
4444
  return __awaiter(this, void 0, void 0, function () {
4429
- var jokerParameterNames, priority, maxAttempts, preparedContent, parameters, template, preparedPipeline, tools, $executionReport, pipelineIdentification, maxExecutionAttempts, $ongoingTemplateResult, _llms, llmTools, _loop_1, attempt, state_1;
4445
+ var jokerParameterNames, priority, maxAttempts, preparedContent, parameters, task, preparedPipeline, tools, $executionReport, pipelineIdentification, maxExecutionAttempts, $ongoingTaskResult, _llms, llmTools, _loop_1, attempt, state_1;
4430
4446
  return __generator(this, function (_a) {
4431
4447
  switch (_a.label) {
4432
4448
  case 0:
4433
- jokerParameterNames = options.jokerParameterNames, priority = options.priority, maxAttempts = options.maxAttempts, preparedContent = options.preparedContent, parameters = options.parameters, template = options.template, preparedPipeline = options.preparedPipeline, tools = options.tools, $executionReport = options.$executionReport, pipelineIdentification = options.pipelineIdentification, maxExecutionAttempts = options.maxExecutionAttempts;
4434
- $ongoingTemplateResult = {
4449
+ jokerParameterNames = options.jokerParameterNames, priority = options.priority, maxAttempts = options.maxAttempts, preparedContent = options.preparedContent, parameters = options.parameters, task = options.task, preparedPipeline = options.preparedPipeline, tools = options.tools, $executionReport = options.$executionReport, pipelineIdentification = options.pipelineIdentification, maxExecutionAttempts = options.maxExecutionAttempts;
4450
+ $ongoingTaskResult = {
4435
4451
  $result: null,
4436
4452
  $resultString: null,
4437
4453
  $expectError: null,
@@ -4451,52 +4467,51 @@ function executeAttempts(options) {
4451
4467
  if (isJokerAttempt && !jokerParameterName) {
4452
4468
  throw new UnexpectedError(spaceTrim$1(function (block) { return "\n Joker not found in attempt ".concat(attempt, "\n\n ").concat(block(pipelineIdentification), "\n "); }));
4453
4469
  }
4454
- $ongoingTemplateResult.$result = null;
4455
- $ongoingTemplateResult.$resultString = null;
4456
- $ongoingTemplateResult.$expectError = null;
4470
+ $ongoingTaskResult.$result = null;
4471
+ $ongoingTaskResult.$resultString = null;
4472
+ $ongoingTaskResult.$expectError = null;
4457
4473
  if (isJokerAttempt) {
4458
4474
  if (parameters[jokerParameterName] === undefined) {
4459
4475
  throw new PipelineExecutionError(spaceTrim$1(function (block) { return "\n Joker parameter {".concat(jokerParameterName, "} not defined\n\n ").concat(block(pipelineIdentification), "\n "); }));
4460
4476
  // <- TODO: This is maybe `PipelineLogicError` which should be detected in `validatePipeline` and here just thrown as `UnexpectedError`
4461
4477
  }
4462
4478
  else {
4463
- $ongoingTemplateResult.$resultString = parameters[jokerParameterName];
4479
+ $ongoingTaskResult.$resultString = parameters[jokerParameterName];
4464
4480
  }
4465
4481
  }
4466
4482
  _t.label = 1;
4467
4483
  case 1:
4468
4484
  _t.trys.push([1, 43, 44, 45]);
4469
4485
  if (!!isJokerAttempt) return [3 /*break*/, 25];
4470
- _b = template.templateType;
4486
+ _b = task.taskType;
4471
4487
  switch (_b) {
4472
- case 'SIMPLE_TEMPLATE': return [3 /*break*/, 2];
4473
- case 'PROMPT_TEMPLATE': return [3 /*break*/, 3];
4474
- case 'SCRIPT_TEMPLATE': return [3 /*break*/, 11];
4475
- case 'DIALOG_TEMPLATE': return [3 /*break*/, 22];
4488
+ case 'SIMPLE_TASK': return [3 /*break*/, 2];
4489
+ case 'PROMPT_TASK': return [3 /*break*/, 3];
4490
+ case 'SCRIPT_TASK': return [3 /*break*/, 11];
4491
+ case 'DIALOG_TASK': return [3 /*break*/, 22];
4476
4492
  }
4477
4493
  return [3 /*break*/, 24];
4478
4494
  case 2:
4479
- $ongoingTemplateResult.$resultString = replaceParameters(preparedContent, parameters);
4495
+ $ongoingTaskResult.$resultString = replaceParameters(preparedContent, parameters);
4480
4496
  return [3 /*break*/, 25];
4481
4497
  case 3:
4482
- modelRequirements = __assign(__assign({ modelVariant: 'CHAT' }, (preparedPipeline.defaultModelRequirements || {})), (template.modelRequirements || {}));
4483
- $ongoingTemplateResult.$prompt = {
4484
- title: template.title,
4498
+ modelRequirements = __assign(__assign({ modelVariant: 'CHAT' }, (preparedPipeline.defaultModelRequirements || {})), (task.modelRequirements || {}));
4499
+ $ongoingTaskResult.$prompt = {
4500
+ title: task.title,
4485
4501
  pipelineUrl: "".concat(preparedPipeline.pipelineUrl
4486
4502
  ? preparedPipeline.pipelineUrl
4487
- : 'anonymous' /* <- TODO: [🧠] How to deal with anonymous pipelines, do here some auto-url like SHA-256 based ad-hoc identifier? */, "#").concat(template.name
4488
- // <- TODO: Here should be maybe also subformat index to distinguish between same template with different subformat values
4503
+ : 'anonymous' /* <- TODO: [🧠] How to deal with anonymous pipelines, do here some auto-url like SHA-256 based ad-hoc identifier? */, "#").concat(task.name
4504
+ // <- TODO: Here should be maybe also subformat index to distinguish between same task with different subformat values
4489
4505
  ),
4490
4506
  parameters: parameters,
4491
4507
  content: preparedContent,
4492
4508
  modelRequirements: modelRequirements,
4493
4509
  expectations: __assign(__assign({}, (preparedPipeline.personas.find(function (_a) {
4494
4510
  var name = _a.name;
4495
- return name === template.personaName;
4496
- }) ||
4497
- {})), template.expectations),
4498
- format: template.format,
4499
- postprocessingFunctionNames: template.postprocessingFunctionNames,
4511
+ return name === task.personaName;
4512
+ }) || {})), task.expectations),
4513
+ format: task.format,
4514
+ postprocessingFunctionNames: task.postprocessingFunctionNames,
4500
4515
  }; // <- TODO: Not very good type guard
4501
4516
  _c = modelRequirements.modelVariant;
4502
4517
  switch (_c) {
@@ -4506,36 +4521,35 @@ function executeAttempts(options) {
4506
4521
  }
4507
4522
  return [3 /*break*/, 9];
4508
4523
  case 4:
4509
- _d = $ongoingTemplateResult;
4524
+ _d = $ongoingTaskResult;
4510
4525
  return [4 /*yield*/, llmTools.callChatModel(
4511
4526
  // <- TODO: [🧁] Check that `callChatModel` is defined
4512
- $deepFreeze($ongoingTemplateResult.$prompt))];
4527
+ $deepFreeze($ongoingTaskResult.$prompt))];
4513
4528
  case 5:
4514
4529
  _d.$chatResult = _t.sent();
4515
4530
  // TODO: [🍬] Destroy chatThread
4516
- $ongoingTemplateResult.$result = $ongoingTemplateResult.$chatResult;
4517
- $ongoingTemplateResult.$resultString = $ongoingTemplateResult.$chatResult.content;
4531
+ $ongoingTaskResult.$result = $ongoingTaskResult.$chatResult;
4532
+ $ongoingTaskResult.$resultString = $ongoingTaskResult.$chatResult.content;
4518
4533
  return [3 /*break*/, 10];
4519
4534
  case 6:
4520
- _e = $ongoingTemplateResult;
4535
+ _e = $ongoingTaskResult;
4521
4536
  return [4 /*yield*/, llmTools.callCompletionModel(
4522
4537
  // <- TODO: [🧁] Check that `callCompletionModel` is defined
4523
- $deepFreeze($ongoingTemplateResult.$prompt))];
4538
+ $deepFreeze($ongoingTaskResult.$prompt))];
4524
4539
  case 7:
4525
4540
  _e.$completionResult = _t.sent();
4526
- $ongoingTemplateResult.$result = $ongoingTemplateResult.$completionResult;
4527
- $ongoingTemplateResult.$resultString =
4528
- $ongoingTemplateResult.$completionResult.content;
4541
+ $ongoingTaskResult.$result = $ongoingTaskResult.$completionResult;
4542
+ $ongoingTaskResult.$resultString = $ongoingTaskResult.$completionResult.content;
4529
4543
  return [3 /*break*/, 10];
4530
4544
  case 8: throw new PipelineExecutionError(spaceTrim$1(function (block) { return "\n Embedding model can not be used in pipeline\n\n This should be catched during parsing\n\n ".concat(block(pipelineIdentification), "\n\n "); }));
4531
- case 9: throw new PipelineExecutionError(spaceTrim$1(function (block) { return "\n Unknown model variant \"".concat(template.modelRequirements.modelVariant, "\"\n\n ").concat(block(pipelineIdentification), "\n\n "); }));
4545
+ case 9: throw new PipelineExecutionError(spaceTrim$1(function (block) { return "\n Unknown model variant \"".concat(task.modelRequirements.modelVariant, "\"\n\n ").concat(block(pipelineIdentification), "\n\n "); }));
4532
4546
  case 10: return [3 /*break*/, 25];
4533
4547
  case 11:
4534
4548
  if (arrayableToArray(tools.script).length === 0) {
4535
4549
  throw new PipelineExecutionError(spaceTrim$1(function (block) { return "\n No script execution tools are available\n\n ".concat(block(pipelineIdentification), "\n "); }));
4536
4550
  }
4537
- if (!template.contentLanguage) {
4538
- throw new PipelineExecutionError(spaceTrim$1(function (block) { return "\n Script language is not defined for SCRIPT TEMPLATE \"".concat(template.name, "\"\n\n ").concat(block(pipelineIdentification), "\n "); }));
4551
+ if (!task.contentLanguage) {
4552
+ throw new PipelineExecutionError(spaceTrim$1(function (block) { return "\n Script language is not defined for SCRIPT TASK \"".concat(task.name, "\"\n\n ").concat(block(pipelineIdentification), "\n "); }));
4539
4553
  }
4540
4554
  _t.label = 12;
4541
4555
  case 12:
@@ -4548,9 +4562,9 @@ function executeAttempts(options) {
4548
4562
  _t.label = 14;
4549
4563
  case 14:
4550
4564
  _t.trys.push([14, 16, , 17]);
4551
- _h = $ongoingTemplateResult;
4565
+ _h = $ongoingTaskResult;
4552
4566
  return [4 /*yield*/, scriptTools.execute($deepFreeze({
4553
- scriptLanguage: template.contentLanguage,
4567
+ scriptLanguage: task.contentLanguage,
4554
4568
  script: preparedContent,
4555
4569
  parameters: parameters,
4556
4570
  }))];
@@ -4565,7 +4579,7 @@ function executeAttempts(options) {
4565
4579
  if (error_1 instanceof UnexpectedError) {
4566
4580
  throw error_1;
4567
4581
  }
4568
- $ongoingTemplateResult.$scriptPipelineExecutionErrors.push(error_1);
4582
+ $ongoingTaskResult.$scriptPipelineExecutionErrors.push(error_1);
4569
4583
  return [3 /*break*/, 17];
4570
4584
  case 17:
4571
4585
  _g = _f.next();
@@ -4582,14 +4596,14 @@ function executeAttempts(options) {
4582
4596
  finally { if (e_1) throw e_1.error; }
4583
4597
  return [7 /*endfinally*/];
4584
4598
  case 21:
4585
- if ($ongoingTemplateResult.$resultString !== null) {
4599
+ if ($ongoingTaskResult.$resultString !== null) {
4586
4600
  return [3 /*break*/, 25];
4587
4601
  }
4588
- if ($ongoingTemplateResult.$scriptPipelineExecutionErrors.length === 1) {
4589
- throw $ongoingTemplateResult.$scriptPipelineExecutionErrors[0];
4602
+ if ($ongoingTaskResult.$scriptPipelineExecutionErrors.length === 1) {
4603
+ throw $ongoingTaskResult.$scriptPipelineExecutionErrors[0];
4590
4604
  }
4591
4605
  else {
4592
- throw new PipelineExecutionError(spaceTrim$1(function (block) { return "\n Script execution failed ".concat($ongoingTemplateResult.$scriptPipelineExecutionErrors.length, "x\n\n ").concat(block(pipelineIdentification), "\n\n ").concat(block($ongoingTemplateResult.$scriptPipelineExecutionErrors
4606
+ throw new PipelineExecutionError(spaceTrim$1(function (block) { return "\n Script execution failed ".concat($ongoingTaskResult.$scriptPipelineExecutionErrors.length, "x\n\n ").concat(block(pipelineIdentification), "\n\n ").concat(block($ongoingTaskResult.$scriptPipelineExecutionErrors
4593
4607
  .map(function (error) { return '- ' + error.message; })
4594
4608
  .join('\n\n')), "\n "); }));
4595
4609
  }
@@ -4597,27 +4611,27 @@ function executeAttempts(options) {
4597
4611
  if (tools.userInterface === undefined) {
4598
4612
  throw new PipelineExecutionError(spaceTrim$1(function (block) { return "\n User interface tools are not available\n\n ".concat(block(pipelineIdentification), "\n "); }));
4599
4613
  }
4600
- // TODO: [🌹] When making next attempt for `DIALOG TEMPLATE`, preserve the previous user input
4601
- _j = $ongoingTemplateResult;
4614
+ // TODO: [🌹] When making next attempt for `DIALOG TASK`, preserve the previous user input
4615
+ _j = $ongoingTaskResult;
4602
4616
  return [4 /*yield*/, tools.userInterface.promptDialog($deepFreeze({
4603
- promptTitle: template.title,
4604
- promptMessage: replaceParameters(template.description || '', parameters),
4617
+ promptTitle: task.title,
4618
+ promptMessage: replaceParameters(task.description || '', parameters),
4605
4619
  defaultValue: replaceParameters(preparedContent, parameters),
4606
4620
  // TODO: [🧠] !! Figure out how to define placeholder in .book.md file
4607
4621
  placeholder: undefined,
4608
4622
  priority: priority,
4609
4623
  }))];
4610
4624
  case 23:
4611
- // TODO: [🌹] When making next attempt for `DIALOG TEMPLATE`, preserve the previous user input
4625
+ // TODO: [🌹] When making next attempt for `DIALOG TASK`, preserve the previous user input
4612
4626
  _j.$resultString = _t.sent();
4613
4627
  return [3 /*break*/, 25];
4614
- case 24: throw new PipelineExecutionError(spaceTrim$1(function (block) { return "\n Unknown execution type \"".concat(template.templateType, "\"\n\n ").concat(block(pipelineIdentification), "\n "); }));
4628
+ case 24: throw new PipelineExecutionError(spaceTrim$1(function (block) { return "\n Unknown execution type \"".concat(task.taskType, "\"\n\n ").concat(block(pipelineIdentification), "\n "); }));
4615
4629
  case 25:
4616
- if (!(!isJokerAttempt && template.postprocessingFunctionNames)) return [3 /*break*/, 42];
4630
+ if (!(!isJokerAttempt && task.postprocessingFunctionNames)) return [3 /*break*/, 42];
4617
4631
  _t.label = 26;
4618
4632
  case 26:
4619
4633
  _t.trys.push([26, 40, 41, 42]);
4620
- _k = (e_3 = void 0, __values(template.postprocessingFunctionNames)), _l = _k.next();
4634
+ _k = (e_3 = void 0, __values(task.postprocessingFunctionNames)), _l = _k.next();
4621
4635
  _t.label = 27;
4622
4636
  case 27:
4623
4637
  if (!!_l.done) return [3 /*break*/, 39];
@@ -4634,13 +4648,13 @@ function executeAttempts(options) {
4634
4648
  _t.label = 30;
4635
4649
  case 30:
4636
4650
  _t.trys.push([30, 32, , 33]);
4637
- _p = $ongoingTemplateResult;
4651
+ _p = $ongoingTaskResult;
4638
4652
  return [4 /*yield*/, scriptTools.execute({
4639
4653
  scriptLanguage: "javascript" /* <- TODO: Try it in each languages; In future allow postprocessing with arbitrary combination of languages to combine */,
4640
4654
  script: "".concat(functionName, "(resultString)"),
4641
4655
  parameters: {
4642
- resultString: $ongoingTemplateResult.$resultString || '',
4643
- // Note: No ...parametersForTemplate, because working with result only
4656
+ resultString: $ongoingTaskResult.$resultString || '',
4657
+ // Note: No ...parametersForTask, because working with result only
4644
4658
  },
4645
4659
  })];
4646
4660
  case 31:
@@ -4656,7 +4670,7 @@ function executeAttempts(options) {
4656
4670
  throw error_2;
4657
4671
  }
4658
4672
  postprocessingError = error_2;
4659
- $ongoingTemplateResult.$scriptPipelineExecutionErrors.push(error_2);
4673
+ $ongoingTaskResult.$scriptPipelineExecutionErrors.push(error_2);
4660
4674
  return [3 /*break*/, 33];
4661
4675
  case 33:
4662
4676
  _o = _m.next();
@@ -4693,12 +4707,12 @@ function executeAttempts(options) {
4693
4707
  return [7 /*endfinally*/];
4694
4708
  case 42:
4695
4709
  // TODO: [💝] Unite object for expecting amount and format
4696
- if (template.format) {
4697
- if (template.format === 'JSON') {
4698
- if (!isValidJsonString($ongoingTemplateResult.$resultString || '')) {
4710
+ if (task.format) {
4711
+ if (task.format === 'JSON') {
4712
+ if (!isValidJsonString($ongoingTaskResult.$resultString || '')) {
4699
4713
  // TODO: [🏢] Do more universally via `FormatDefinition`
4700
4714
  try {
4701
- $ongoingTemplateResult.$resultString = extractJsonBlock($ongoingTemplateResult.$resultString || '');
4715
+ $ongoingTaskResult.$resultString = extractJsonBlock($ongoingTaskResult.$resultString || '');
4702
4716
  }
4703
4717
  catch (error) {
4704
4718
  throw new ExpectError(spaceTrim$1(function (block) { return "\n Expected valid JSON string\n\n ".concat(block(
@@ -4707,12 +4721,12 @@ function executeAttempts(options) {
4707
4721
  }
4708
4722
  }
4709
4723
  else {
4710
- throw new UnexpectedError(spaceTrim$1(function (block) { return "\n Unknown format \"".concat(template.format, "\"\n\n ").concat(block(pipelineIdentification), "\n "); }));
4724
+ throw new UnexpectedError(spaceTrim$1(function (block) { return "\n Unknown format \"".concat(task.format, "\"\n\n ").concat(block(pipelineIdentification), "\n "); }));
4711
4725
  }
4712
4726
  }
4713
4727
  // TODO: [💝] Unite object for expecting amount and format
4714
- if (template.expectations) {
4715
- checkExpectations(template.expectations, $ongoingTemplateResult.$resultString || '');
4728
+ if (task.expectations) {
4729
+ checkExpectations(task.expectations, $ongoingTaskResult.$resultString || '');
4716
4730
  }
4717
4731
  return [2 /*return*/, "break-attempts"];
4718
4732
  case 43:
@@ -4720,38 +4734,38 @@ function executeAttempts(options) {
4720
4734
  if (!(error_3 instanceof ExpectError)) {
4721
4735
  throw error_3;
4722
4736
  }
4723
- $ongoingTemplateResult.$expectError = error_3;
4737
+ $ongoingTaskResult.$expectError = error_3;
4724
4738
  return [3 /*break*/, 45];
4725
4739
  case 44:
4726
4740
  if (!isJokerAttempt &&
4727
- template.templateType === 'PROMPT_TEMPLATE' &&
4728
- $ongoingTemplateResult.$prompt
4741
+ task.taskType === 'PROMPT_TASK' &&
4742
+ $ongoingTaskResult.$prompt
4729
4743
  // <- Note: [2] When some expected parameter is not defined, error will occur in replaceParameters
4730
4744
  // In that case we don’t want to make a report about it because it’s not a llm execution error
4731
4745
  ) {
4732
- // TODO: [🧠] Maybe put other templateTypes into report
4746
+ // TODO: [🧠] Maybe put other taskTypes into report
4733
4747
  $executionReport.promptExecutions.push({
4734
- prompt: __assign({}, $ongoingTemplateResult.$prompt),
4735
- result: $ongoingTemplateResult.$result || undefined,
4736
- error: $ongoingTemplateResult.$expectError === null
4748
+ prompt: __assign({}, $ongoingTaskResult.$prompt),
4749
+ result: $ongoingTaskResult.$result || undefined,
4750
+ error: $ongoingTaskResult.$expectError === null
4737
4751
  ? undefined
4738
- : serializeError($ongoingTemplateResult.$expectError),
4752
+ : serializeError($ongoingTaskResult.$expectError),
4739
4753
  });
4740
4754
  }
4741
4755
  return [7 /*endfinally*/];
4742
4756
  case 45:
4743
- if ($ongoingTemplateResult.$expectError !== null && attempt === maxAttempts - 1) {
4757
+ if ($ongoingTaskResult.$expectError !== null && attempt === maxAttempts - 1) {
4744
4758
  throw new PipelineExecutionError(spaceTrim$1(function (block) {
4745
4759
  var _a, _b, _c;
4746
- return "\n LLM execution failed ".concat(maxExecutionAttempts, "x\n\n ").concat(block(pipelineIdentification), "\n\n ---\n The Prompt:\n ").concat(block((((_a = $ongoingTemplateResult.$prompt) === null || _a === void 0 ? void 0 : _a.content) || '')
4760
+ return "\n LLM execution failed ".concat(maxExecutionAttempts, "x\n\n ").concat(block(pipelineIdentification), "\n\n ---\n The Prompt:\n ").concat(block((((_a = $ongoingTaskResult.$prompt) === null || _a === void 0 ? void 0 : _a.content) || '')
4747
4761
  .split('\n')
4748
4762
  .map(function (line) { return "> ".concat(line); })
4749
- .join('\n')), "\n\n Last error ").concat(((_b = $ongoingTemplateResult.$expectError) === null || _b === void 0 ? void 0 : _b.name) || '', ":\n ").concat(block((((_c = $ongoingTemplateResult.$expectError) === null || _c === void 0 ? void 0 : _c.message) || '')
4763
+ .join('\n')), "\n\n Last error ").concat(((_b = $ongoingTaskResult.$expectError) === null || _b === void 0 ? void 0 : _b.name) || '', ":\n ").concat(block((((_c = $ongoingTaskResult.$expectError) === null || _c === void 0 ? void 0 : _c.message) || '')
4750
4764
  .split('\n')
4751
4765
  .map(function (line) { return "> ".concat(line); })
4752
- .join('\n')), "\n\n Last result:\n ").concat(block($ongoingTemplateResult.$resultString === null
4766
+ .join('\n')), "\n\n Last result:\n ").concat(block($ongoingTaskResult.$resultString === null
4753
4767
  ? 'null'
4754
- : $ongoingTemplateResult.$resultString
4768
+ : $ongoingTaskResult.$resultString
4755
4769
  .split('\n')
4756
4770
  .map(function (line) { return "> ".concat(line); })
4757
4771
  .join('\n')), "\n ---\n ");
@@ -4776,10 +4790,10 @@ function executeAttempts(options) {
4776
4790
  attempt++;
4777
4791
  return [3 /*break*/, 1];
4778
4792
  case 4:
4779
- if ($ongoingTemplateResult.$resultString === null) {
4793
+ if ($ongoingTaskResult.$resultString === null) {
4780
4794
  throw new UnexpectedError(spaceTrim$1(function (block) { return "\n Something went wrong and prompt result is null\n\n ".concat(block(pipelineIdentification), "\n "); }));
4781
4795
  }
4782
- return [2 /*return*/, $ongoingTemplateResult.$resultString];
4796
+ return [2 /*return*/, $ongoingTaskResult.$resultString];
4783
4797
  }
4784
4798
  });
4785
4799
  });
@@ -4795,36 +4809,36 @@ function executeAttempts(options) {
4795
4809
  */
4796
4810
  function executeFormatSubvalues(options) {
4797
4811
  return __awaiter(this, void 0, void 0, function () {
4798
- var template, jokerParameterNames, parameters, priority, csvSettings, pipelineIdentification, parameterValue, formatDefinition, subvalueDefinition, formatSettings, resultString;
4812
+ var task, jokerParameterNames, parameters, priority, csvSettings, pipelineIdentification, parameterValue, formatDefinition, subvalueDefinition, formatSettings, resultString;
4799
4813
  var _this = this;
4800
4814
  return __generator(this, function (_a) {
4801
4815
  switch (_a.label) {
4802
4816
  case 0:
4803
- template = options.template, jokerParameterNames = options.jokerParameterNames, parameters = options.parameters, priority = options.priority, csvSettings = options.csvSettings, pipelineIdentification = options.pipelineIdentification;
4804
- if (template.foreach === undefined) {
4817
+ task = options.task, jokerParameterNames = options.jokerParameterNames, parameters = options.parameters, priority = options.priority, csvSettings = options.csvSettings, pipelineIdentification = options.pipelineIdentification;
4818
+ if (task.foreach === undefined) {
4805
4819
  return [2 /*return*/, /* not await */ executeAttempts(options)];
4806
4820
  }
4807
4821
  if (jokerParameterNames.length !== 0) {
4808
4822
  throw new UnexpectedError(spaceTrim(function (block) { return "\n JOKER parameters are not supported together with FOREACH command\n\n [\uD83E\uDDDE\u200D\u2640\uFE0F] This should be prevented in `validatePipeline`\n\n ".concat(block(pipelineIdentification), "\n "); }));
4809
4823
  }
4810
- parameterValue = parameters[template.foreach.parameterName] || '';
4824
+ parameterValue = parameters[task.foreach.parameterName] || '';
4811
4825
  formatDefinition = FORMAT_DEFINITIONS.find(function (formatDefinition) {
4812
- return __spreadArray([formatDefinition.formatName], __read((formatDefinition.aliases || [])), false).includes(template.foreach.formatName);
4826
+ return __spreadArray([formatDefinition.formatName], __read((formatDefinition.aliases || [])), false).includes(task.foreach.formatName);
4813
4827
  });
4814
4828
  if (formatDefinition === undefined) {
4815
4829
  throw new UnexpectedError(
4816
4830
  // <- TODO: [🧠][🧐] Should be formats fixed per promptbook version or behave as plugins (=> change UnexpectedError)
4817
- spaceTrim(function (block) { return "\n Unsupported format \"".concat(template.foreach.formatName, "\"\n\n Available formats:\n ").concat(block(FORMAT_DEFINITIONS.map(function (formatDefinition) { return formatDefinition.formatName; })
4831
+ spaceTrim(function (block) { return "\n Unsupported format \"".concat(task.foreach.formatName, "\"\n\n Available formats:\n ").concat(block(FORMAT_DEFINITIONS.map(function (formatDefinition) { return formatDefinition.formatName; })
4818
4832
  .map(function (formatName) { return "- ".concat(formatName); })
4819
4833
  .join('\n')), "\n\n [\u26F7] This should never happen because format name should be validated during parsing\n\n ").concat(block(pipelineIdentification), "\n "); }));
4820
4834
  }
4821
4835
  subvalueDefinition = formatDefinition.subvalueDefinitions.find(function (subvalueDefinition) {
4822
- return __spreadArray([subvalueDefinition.subvalueName], __read((subvalueDefinition.aliases || [])), false).includes(template.foreach.subformatName);
4836
+ return __spreadArray([subvalueDefinition.subvalueName], __read((subvalueDefinition.aliases || [])), false).includes(task.foreach.subformatName);
4823
4837
  });
4824
4838
  if (subvalueDefinition === undefined) {
4825
4839
  throw new UnexpectedError(
4826
4840
  // <- TODO: [🧠][🧐] Should be formats fixed per promptbook version or behave as plugins (=> change UnexpectedError)
4827
- spaceTrim(function (block) { return "\n Unsupported subformat name \"".concat(template.foreach.subformatName, "\" for format \"").concat(template.foreach.formatName, "\"\n\n Available subformat names for format \"").concat(formatDefinition.formatName, "\":\n ").concat(block(formatDefinition.subvalueDefinitions
4841
+ spaceTrim(function (block) { return "\n Unsupported subformat name \"".concat(task.foreach.subformatName, "\" for format \"").concat(task.foreach.formatName, "\"\n\n Available subformat names for format \"").concat(formatDefinition.formatName, "\":\n ").concat(block(formatDefinition.subvalueDefinitions
4828
4842
  .map(function (subvalueDefinition) { return subvalueDefinition.subvalueName; })
4829
4843
  .map(function (subvalueName) { return "- ".concat(subvalueName); })
4830
4844
  .join('\n')), "\n\n [\u26F7] This should never happen because subformat name should be validated during parsing\n\n ").concat(block(pipelineIdentification), "\n "); }));
@@ -4833,7 +4847,7 @@ function executeFormatSubvalues(options) {
4833
4847
  formatSettings = csvSettings;
4834
4848
  // <- TODO: [🤹‍♂️] More universal, make simmilar pattern for other formats for example \n vs \r\n in text
4835
4849
  }
4836
- return [4 /*yield*/, subvalueDefinition.mapValues(parameterValue, template.foreach.outputSubparameterName, formatSettings, function (subparameters, index) { return __awaiter(_this, void 0, void 0, function () {
4850
+ return [4 /*yield*/, subvalueDefinition.mapValues(parameterValue, task.foreach.outputSubparameterName, formatSettings, function (subparameters, index) { return __awaiter(_this, void 0, void 0, function () {
4837
4851
  var mappedParameters, allSubparameters, subresultString;
4838
4852
  return __generator(this, function (_a) {
4839
4853
  switch (_a.label) {
@@ -4842,7 +4856,7 @@ function executeFormatSubvalues(options) {
4842
4856
  // TODO: When done [🐚] Report progress also for each subvalue here
4843
4857
  try {
4844
4858
  mappedParameters = mapAvailableToExpectedParameters({
4845
- expectedParameters: Object.fromEntries(template.foreach.inputSubparameterNames.map(function (subparameterName) { return [subparameterName, null]; })),
4859
+ expectedParameters: Object.fromEntries(task.foreach.inputSubparameterNames.map(function (subparameterName) { return [subparameterName, null]; })),
4846
4860
  availableParameters: subparameters,
4847
4861
  });
4848
4862
  }
@@ -4875,7 +4889,7 @@ function executeFormatSubvalues(options) {
4875
4889
  *
4876
4890
  * @private internal utility of `createPipelineExecutor`
4877
4891
  */
4878
- function getContextForTemplate(template) {
4892
+ function getContextForTask(task) {
4879
4893
  return __awaiter(this, void 0, void 0, function () {
4880
4894
  return __generator(this, function (_a) {
4881
4895
  return [2 /*return*/, RESERVED_PARAMETER_MISSING_VALUE /* <- TODO: [🏍] Implement */];
@@ -4888,15 +4902,10 @@ function getContextForTemplate(template) {
4888
4902
  *
4889
4903
  * @private internal utility of `createPipelineExecutor`
4890
4904
  */
4891
- function getKnowledgeForTemplate(options) {
4905
+ function getExamplesForTask(task) {
4892
4906
  return __awaiter(this, void 0, void 0, function () {
4893
- var preparedPipeline;
4894
4907
  return __generator(this, function (_a) {
4895
- preparedPipeline = options.preparedPipeline, options.template;
4896
- return [2 /*return*/, preparedPipeline.knowledgePieces.map(function (_a) {
4897
- var content = _a.content;
4898
- return "- ".concat(content);
4899
- }).join('\n')];
4908
+ return [2 /*return*/, RESERVED_PARAMETER_MISSING_VALUE /* <- TODO: [♨] Implement */];
4900
4909
  });
4901
4910
  });
4902
4911
  }
@@ -4906,10 +4915,15 @@ function getKnowledgeForTemplate(options) {
4906
4915
  *
4907
4916
  * @private internal utility of `createPipelineExecutor`
4908
4917
  */
4909
- function getExamplesForTemplate(template) {
4918
+ function getKnowledgeForTask(options) {
4910
4919
  return __awaiter(this, void 0, void 0, function () {
4920
+ var preparedPipeline;
4911
4921
  return __generator(this, function (_a) {
4912
- return [2 /*return*/, RESERVED_PARAMETER_MISSING_VALUE /* <- TODO: [♨] Implement */];
4922
+ preparedPipeline = options.preparedPipeline, options.task;
4923
+ return [2 /*return*/, preparedPipeline.knowledgePieces.map(function (_a) {
4924
+ var content = _a.content;
4925
+ return "- ".concat(content);
4926
+ }).join('\n')];
4913
4927
  });
4914
4928
  });
4915
4929
  }
@@ -4919,21 +4933,21 @@ function getExamplesForTemplate(template) {
4919
4933
  *
4920
4934
  * @private internal utility of `createPipelineExecutor`
4921
4935
  */
4922
- function getReservedParametersForTemplate(options) {
4936
+ function getReservedParametersForTask(options) {
4923
4937
  return __awaiter(this, void 0, void 0, function () {
4924
- var preparedPipeline, template, pipelineIdentification, context, knowledge, examples, currentDate, modelName, reservedParameters, _loop_1, RESERVED_PARAMETER_NAMES_1, RESERVED_PARAMETER_NAMES_1_1, parameterName;
4938
+ var preparedPipeline, task, pipelineIdentification, context, knowledge, examples, currentDate, modelName, reservedParameters, _loop_1, RESERVED_PARAMETER_NAMES_1, RESERVED_PARAMETER_NAMES_1_1, parameterName;
4925
4939
  var e_1, _a;
4926
4940
  return __generator(this, function (_b) {
4927
4941
  switch (_b.label) {
4928
4942
  case 0:
4929
- preparedPipeline = options.preparedPipeline, template = options.template, pipelineIdentification = options.pipelineIdentification;
4930
- return [4 /*yield*/, getContextForTemplate()];
4943
+ preparedPipeline = options.preparedPipeline, task = options.task, pipelineIdentification = options.pipelineIdentification;
4944
+ return [4 /*yield*/, getContextForTask()];
4931
4945
  case 1:
4932
4946
  context = _b.sent();
4933
- return [4 /*yield*/, getKnowledgeForTemplate({ preparedPipeline: preparedPipeline, template: template })];
4947
+ return [4 /*yield*/, getKnowledgeForTask({ preparedPipeline: preparedPipeline, task: task })];
4934
4948
  case 2:
4935
4949
  knowledge = _b.sent();
4936
- return [4 /*yield*/, getExamplesForTemplate()];
4950
+ return [4 /*yield*/, getExamplesForTask()];
4937
4951
  case 3:
4938
4952
  examples = _b.sent();
4939
4953
  currentDate = new Date().toISOString();
@@ -4976,31 +4990,31 @@ function getReservedParametersForTemplate(options) {
4976
4990
  *
4977
4991
  * @private internal utility of `createPipelineExecutor`
4978
4992
  */
4979
- function executeTemplate(options) {
4993
+ function executeTask(options) {
4980
4994
  return __awaiter(this, void 0, void 0, function () {
4981
- var currentTemplate, preparedPipeline, parametersToPass, tools, onProgress, $executionReport, pipelineIdentification, _a, maxExecutionAttempts, name, title, priority, usedParameterNames, dependentParameterNames, definedParameters, _b, _c, _d, definedParameterNames, parameters, _loop_1, _e, _f, parameterName, maxAttempts, jokerParameterNames, preparedContent, resultString;
4995
+ var currentTask, preparedPipeline, parametersToPass, tools, onProgress, $executionReport, pipelineIdentification, _a, maxExecutionAttempts, name, title, priority, usedParameterNames, dependentParameterNames, definedParameters, _b, _c, _d, definedParameterNames, parameters, _loop_1, _e, _f, parameterName, maxAttempts, jokerParameterNames, preparedContent, resultString;
4982
4996
  var e_1, _g, _h;
4983
4997
  return __generator(this, function (_j) {
4984
4998
  switch (_j.label) {
4985
4999
  case 0:
4986
- currentTemplate = options.currentTemplate, preparedPipeline = options.preparedPipeline, parametersToPass = options.parametersToPass, tools = options.tools, onProgress = options.onProgress, $executionReport = options.$executionReport, pipelineIdentification = options.pipelineIdentification, _a = options.maxExecutionAttempts, maxExecutionAttempts = _a === void 0 ? DEFAULT_MAX_EXECUTION_ATTEMPTS : _a;
4987
- name = "pipeline-executor-frame-".concat(currentTemplate.name);
4988
- title = currentTemplate.title;
4989
- priority = preparedPipeline.templates.length - preparedPipeline.templates.indexOf(currentTemplate);
5000
+ currentTask = options.currentTask, preparedPipeline = options.preparedPipeline, parametersToPass = options.parametersToPass, tools = options.tools, onProgress = options.onProgress, $executionReport = options.$executionReport, pipelineIdentification = options.pipelineIdentification, _a = options.maxExecutionAttempts, maxExecutionAttempts = _a === void 0 ? DEFAULT_MAX_EXECUTION_ATTEMPTS : _a;
5001
+ name = "pipeline-executor-frame-".concat(currentTask.name);
5002
+ title = currentTask.title;
5003
+ priority = preparedPipeline.tasks.length - preparedPipeline.tasks.indexOf(currentTask);
4990
5004
  return [4 /*yield*/, onProgress({
4991
5005
  name: name,
4992
5006
  title: title,
4993
5007
  isStarted: false,
4994
5008
  isDone: false,
4995
- templateType: currentTemplate.templateType,
4996
- parameterName: currentTemplate.resultingParameterName,
5009
+ taskType: currentTask.taskType,
5010
+ parameterName: currentTask.resultingParameterName,
4997
5011
  parameterValue: null,
4998
5012
  // <- [🍸]
4999
5013
  })];
5000
5014
  case 1:
5001
5015
  _j.sent();
5002
- usedParameterNames = extractParameterNamesFromTemplate(currentTemplate);
5003
- dependentParameterNames = new Set(currentTemplate.dependentParameterNames);
5016
+ usedParameterNames = extractParameterNamesFromTask(currentTask);
5017
+ dependentParameterNames = new Set(currentTask.dependentParameterNames);
5004
5018
  // TODO: [👩🏾‍🤝‍👩🏻] Use here `mapAvailableToExpectedParameters`
5005
5019
  if (union(difference(usedParameterNames, dependentParameterNames), difference(dependentParameterNames, usedParameterNames)).size !== 0) {
5006
5020
  throw new UnexpectedError(spaceTrim$1(function (block) { return "\n Dependent parameters are not consistent with used parameters:\n\n Dependent parameters:\n ".concat(Array.from(dependentParameterNames)
@@ -5011,9 +5025,9 @@ function executeTemplate(options) {
5011
5025
  }
5012
5026
  _c = (_b = Object).freeze;
5013
5027
  _d = [{}];
5014
- return [4 /*yield*/, getReservedParametersForTemplate({
5028
+ return [4 /*yield*/, getReservedParametersForTask({
5015
5029
  preparedPipeline: preparedPipeline,
5016
- template: currentTemplate,
5030
+ task: currentTask,
5017
5031
  pipelineIdentification: pipelineIdentification,
5018
5032
  })];
5019
5033
  case 2:
@@ -5031,11 +5045,11 @@ function executeTemplate(options) {
5031
5045
  else if (!definedParameterNames.has(parameterName) && usedParameterNames.has(parameterName)) {
5032
5046
  // Houston, we have a problem
5033
5047
  // Note: Checking part is also done in `validatePipeline`, but it’s good to doublecheck
5034
- throw new UnexpectedError(spaceTrim$1(function (block) { return "\n Parameter `{".concat(parameterName, "}` is NOT defined\n BUT used in template \"").concat(currentTemplate.title || currentTemplate.name, "\"\n\n This should be catched in `validatePipeline`\n\n ").concat(block(pipelineIdentification), "\n\n "); }));
5048
+ throw new UnexpectedError(spaceTrim$1(function (block) { return "\n Parameter `{".concat(parameterName, "}` is NOT defined\n BUT used in task \"").concat(currentTask.title || currentTask.name, "\"\n\n This should be catched in `validatePipeline`\n\n ").concat(block(pipelineIdentification), "\n\n "); }));
5035
5049
  }
5036
5050
  };
5037
5051
  try {
5038
- // Note: [2] Check that all used parameters are defined and removing unused parameters for this template
5052
+ // Note: [2] Check that all used parameters are defined and removing unused parameters for this task
5039
5053
  // TODO: [👩🏾‍🤝‍👩🏻] Use here `mapAvailableToExpectedParameters`
5040
5054
  for (_e = __values(Array.from(union(definedParameterNames, usedParameterNames, dependentParameterNames))), _f = _e.next(); !_f.done; _f = _e.next()) {
5041
5055
  parameterName = _f.value;
@@ -5051,18 +5065,16 @@ function executeTemplate(options) {
5051
5065
  }
5052
5066
  // Note: [👨‍👨‍👧] Now we can freeze `parameters` because we are sure that all and only used parameters are defined and are not going to be changed
5053
5067
  Object.freeze(parameters);
5054
- maxAttempts = currentTemplate.templateType === 'DIALOG_TEMPLATE' ? Infinity : maxExecutionAttempts;
5055
- jokerParameterNames = currentTemplate.jokerParameterNames || [];
5056
- preparedContent = (currentTemplate.preparedContent || '{content}')
5057
- .split('{content}')
5058
- .join(currentTemplate.content);
5068
+ maxAttempts = currentTask.taskType === 'DIALOG_TASK' ? Infinity : maxExecutionAttempts;
5069
+ jokerParameterNames = currentTask.jokerParameterNames || [];
5070
+ preparedContent = (currentTask.preparedContent || '{content}').split('{content}').join(currentTask.content);
5059
5071
  return [4 /*yield*/, executeFormatSubvalues({
5060
5072
  jokerParameterNames: jokerParameterNames,
5061
5073
  priority: priority,
5062
5074
  maxAttempts: maxAttempts,
5063
5075
  preparedContent: preparedContent,
5064
5076
  parameters: parameters,
5065
- template: currentTemplate,
5077
+ task: currentTask,
5066
5078
  preparedPipeline: preparedPipeline,
5067
5079
  tools: tools,
5068
5080
  $executionReport: $executionReport,
@@ -5075,15 +5087,15 @@ function executeTemplate(options) {
5075
5087
  title: title,
5076
5088
  isStarted: true,
5077
5089
  isDone: true,
5078
- templateType: currentTemplate.templateType,
5079
- parameterName: currentTemplate.resultingParameterName,
5090
+ taskType: currentTask.taskType,
5091
+ parameterName: currentTask.resultingParameterName,
5080
5092
  parameterValue: resultString,
5081
5093
  // <- [🍸]
5082
5094
  })];
5083
5095
  case 4:
5084
5096
  _j.sent();
5085
5097
  return [2 /*return*/, Object.freeze((_h = {},
5086
- _h[currentTemplate.resultingParameterName] =
5098
+ _h[currentTask.resultingParameterName] =
5087
5099
  // <- Note: [👩‍👩‍👧] No need to detect parameter collision here because pipeline checks logic consistency during construction
5088
5100
  resultString,
5089
5101
  _h))];
@@ -5145,7 +5157,7 @@ function filterJustOutputParameters(options) {
5145
5157
  */
5146
5158
  function executePipeline(options) {
5147
5159
  return __awaiter(this, void 0, void 0, function () {
5148
- var inputParameters, tools, onProgress, pipeline, setPreparedPipeline, pipelineIdentification, maxParallelCount, rootDirname, _a, isVerbose, preparedPipeline, errors, warnings, executionReport, isReturned, _b, _c, parameter, e_1_1, _loop_1, _d, _e, parameterName, state_1, e_2_1, parametersToPass, resovedParameterNames_1, unresovedTemplates_1, resolving_1, loopLimit, _loop_2, error_1, usage_1, outputParameters_1, usage, outputParameters;
5160
+ var inputParameters, tools, onProgress, pipeline, setPreparedPipeline, pipelineIdentification, maxParallelCount, rootDirname, _a, isVerbose, preparedPipeline, errors, warnings, executionReport, isReturned, _b, _c, parameter, e_1_1, _loop_1, _d, _e, parameterName, state_1, e_2_1, parametersToPass, resovedParameterNames_1, unresovedTasks_1, resolving_1, loopLimit, _loop_2, error_1, usage_1, outputParameters_1, usage, outputParameters;
5149
5161
  var e_1, _f, e_2, _g;
5150
5162
  return __generator(this, function (_h) {
5151
5163
  switch (_h.label) {
@@ -5299,11 +5311,11 @@ function executePipeline(options) {
5299
5311
  var name = _a.name;
5300
5312
  return name;
5301
5313
  });
5302
- unresovedTemplates_1 = __spreadArray([], __read(preparedPipeline.templates), false);
5314
+ unresovedTasks_1 = __spreadArray([], __read(preparedPipeline.tasks), false);
5303
5315
  resolving_1 = [];
5304
5316
  loopLimit = LOOP_LIMIT;
5305
5317
  _loop_2 = function () {
5306
- var currentTemplate, work_1;
5318
+ var currentTask, work_1;
5307
5319
  return __generator(this, function (_k) {
5308
5320
  switch (_k.label) {
5309
5321
  case 0:
@@ -5311,15 +5323,15 @@ function executePipeline(options) {
5311
5323
  // Note: Really UnexpectedError not LimitReachedError - this should be catched during validatePipeline
5312
5324
  throw new UnexpectedError(spaceTrim$1(function (block) { return "\n Loop limit reached during resolving parameters pipeline execution\n\n ".concat(block(pipelineIdentification), "\n "); }));
5313
5325
  }
5314
- currentTemplate = unresovedTemplates_1.find(function (template) {
5315
- return template.dependentParameterNames.every(function (name) {
5326
+ currentTask = unresovedTasks_1.find(function (task) {
5327
+ return task.dependentParameterNames.every(function (name) {
5316
5328
  return __spreadArray(__spreadArray([], __read(resovedParameterNames_1), false), __read(RESERVED_PARAMETER_NAMES), false).includes(name);
5317
5329
  });
5318
5330
  });
5319
- if (!(!currentTemplate && resolving_1.length === 0)) return [3 /*break*/, 1];
5331
+ if (!(!currentTask && resolving_1.length === 0)) return [3 /*break*/, 1];
5320
5332
  throw new UnexpectedError(
5321
5333
  // TODO: [🐎] DRY
5322
- spaceTrim$1(function (block) { return "\n Can not resolve some parameters:\n\n ".concat(block(pipelineIdentification), "\n\n **Can not resolve:**\n ").concat(block(unresovedTemplates_1
5334
+ spaceTrim$1(function (block) { return "\n Can not resolve some parameters:\n\n ".concat(block(pipelineIdentification), "\n\n **Can not resolve:**\n ").concat(block(unresovedTasks_1
5323
5335
  .map(function (_a) {
5324
5336
  var resultingParameterName = _a.resultingParameterName, dependentParameterNames = _a.dependentParameterNames;
5325
5337
  return "- Parameter `{".concat(resultingParameterName, "}` which depends on ").concat(dependentParameterNames
@@ -5338,14 +5350,14 @@ function executePipeline(options) {
5338
5350
  .map(function (name) { return "- Parameter `{".concat(name, "}`"); })
5339
5351
  .join('\n')), "\n\n *Note: This should be catched in `validatePipeline`*\n "); }));
5340
5352
  case 1:
5341
- if (!!currentTemplate) return [3 /*break*/, 3];
5353
+ if (!!currentTask) return [3 /*break*/, 3];
5342
5354
  /* [🤹‍♂️] */ return [4 /*yield*/, Promise.race(resolving_1)];
5343
5355
  case 2:
5344
5356
  /* [🤹‍♂️] */ _k.sent();
5345
5357
  return [3 /*break*/, 4];
5346
5358
  case 3:
5347
- unresovedTemplates_1 = unresovedTemplates_1.filter(function (template) { return template !== currentTemplate; });
5348
- work_1 = executeTemplate(__assign(__assign({}, options), { currentTemplate: currentTemplate, preparedPipeline: preparedPipeline, parametersToPass: parametersToPass, tools: tools, onProgress: function (progress) {
5359
+ unresovedTasks_1 = unresovedTasks_1.filter(function (task) { return task !== currentTask; });
5360
+ work_1 = executeTask(__assign(__assign({}, options), { currentTask: currentTask, preparedPipeline: preparedPipeline, parametersToPass: parametersToPass, tools: tools, onProgress: function (progress) {
5349
5361
  if (isReturned) {
5350
5362
  throw new UnexpectedError(spaceTrim$1(function (block) { return "\n Can not call `onProgress` after pipeline execution is finished\n\n ".concat(block(pipelineIdentification), "\n\n ").concat(block(JSON.stringify(progress, null, 4)
5351
5363
  .split('\n')
@@ -5355,16 +5367,16 @@ function executePipeline(options) {
5355
5367
  if (onProgress) {
5356
5368
  onProgress(progress);
5357
5369
  }
5358
- }, $executionReport: executionReport, pipelineIdentification: spaceTrim$1(function (block) { return "\n ".concat(block(pipelineIdentification), "\n Template name: ").concat(currentTemplate.name, "\n Template title: ").concat(currentTemplate.title, "\n "); }) }))
5370
+ }, $executionReport: executionReport, pipelineIdentification: spaceTrim$1(function (block) { return "\n ".concat(block(pipelineIdentification), "\n Task name: ").concat(currentTask.name, "\n Task title: ").concat(currentTask.title, "\n "); }) }))
5359
5371
  .then(function (newParametersToPass) {
5360
5372
  parametersToPass = __assign(__assign({}, newParametersToPass), parametersToPass);
5361
- resovedParameterNames_1 = __spreadArray(__spreadArray([], __read(resovedParameterNames_1), false), [currentTemplate.resultingParameterName], false);
5373
+ resovedParameterNames_1 = __spreadArray(__spreadArray([], __read(resovedParameterNames_1), false), [currentTask.resultingParameterName], false);
5362
5374
  })
5363
5375
  .then(function () {
5364
5376
  resolving_1 = resolving_1.filter(function (w) { return w !== work_1; });
5365
5377
  });
5366
5378
  // <- Note: Errors are catched here [3]
5367
- // TODO: BUT if in multiple templates are errors, only the first one is catched so maybe we should catch errors here and save them to errors array here
5379
+ // TODO: BUT if in multiple tasks are errors, only the first one is catched so maybe we should catch errors here and save them to errors array here
5368
5380
  resolving_1.push(work_1);
5369
5381
  _k.label = 4;
5370
5382
  case 4: return [2 /*return*/];
@@ -5373,7 +5385,7 @@ function executePipeline(options) {
5373
5385
  };
5374
5386
  _h.label = 21;
5375
5387
  case 21:
5376
- if (!(unresovedTemplates_1.length > 0)) return [3 /*break*/, 23];
5388
+ if (!(unresovedTasks_1.length > 0)) return [3 /*break*/, 23];
5377
5389
  return [5 /*yield**/, _loop_2()];
5378
5390
  case 22:
5379
5391
  _h.sent();
@@ -5531,6 +5543,9 @@ var markdownScraperMetadata = $deepFreeze({
5531
5543
  * @public exported from `@promptbook/cli`
5532
5544
  */
5533
5545
  $scrapersMetadataRegister.register(markdownScraperMetadata);
5546
+ /**
5547
+ * Note: [💞] Ignore a discrepancy between file name and entity name
5548
+ */
5534
5549
 
5535
5550
  /**
5536
5551
  * Scraper for markdown files
@@ -5725,6 +5740,7 @@ var createMarkdownScraper = Object.assign(function (tools, options) {
5725
5740
  var _MarkdownScraperRegistration = $scrapersRegister.register(createMarkdownScraper);
5726
5741
  /**
5727
5742
  * TODO: [🎶] Naming "constructor" vs "creator" vs "factory"
5743
+ * Note: [💞] Ignore a discrepancy between file name and entity name
5728
5744
  */
5729
5745
 
5730
5746
  /**