@promptbook/markdown-utils 0.75.0-0 → 0.75.0-2

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 (158) hide show
  1. package/README.md +1 -0
  2. package/esm/index.es.js +276 -236
  3. package/esm/index.es.js.map +1 -1
  4. package/esm/typings/promptbook-collection/index.d.ts +6 -6
  5. package/esm/typings/src/_packages/core.index.d.ts +29 -19
  6. package/esm/typings/src/_packages/types.index.d.ts +58 -50
  7. package/esm/typings/src/_packages/utils.index.d.ts +4 -4
  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 +2 -2
  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/SECTION/SectionType.d.ts +13 -0
  28. package/esm/typings/src/commands/{TEMPLATE/templateCommandParser.d.ts → SECTION/sectionCommandParser.d.ts} +6 -6
  29. package/esm/typings/src/commands/_common/types/Command.d.ts +1 -1
  30. package/esm/typings/src/commands/_common/types/CommandParser.d.ts +17 -17
  31. package/esm/typings/src/commands/_common/types/CommandUsagePlaces.d.ts +1 -1
  32. package/esm/typings/src/commands/index.d.ts +4 -1
  33. package/esm/typings/src/config.d.ts +3 -1
  34. package/esm/typings/src/conversion/pipelineJsonToString.d.ts +2 -2
  35. package/esm/typings/src/conversion/pipelineStringToJson.d.ts +2 -2
  36. package/esm/typings/src/conversion/pipelineStringToJsonSync.d.ts +3 -3
  37. package/esm/typings/src/conversion/prettify/prettifyPipelineString.d.ts +1 -1
  38. package/esm/typings/src/conversion/prettify/renderPipelineMermaidOptions.d.ts +3 -3
  39. package/esm/typings/src/conversion/utils/{extractParameterNamesFromTemplate.d.ts → extractParameterNamesFromTask.d.ts} +2 -2
  40. package/esm/typings/src/conversion/utils/renameParameter.d.ts +1 -1
  41. package/esm/typings/src/conversion/validation/_importPipeline.d.ts +3 -2
  42. package/esm/typings/src/conversion/validation/validatePipeline.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/createPipelineExecutor/{$OngoingTemplateResult.d.ts → $OngoingTaskResult.d.ts} +1 -1
  47. package/esm/typings/src/execution/createPipelineExecutor/00-CreatePipelineExecutorOptions.d.ts +1 -1
  48. package/esm/typings/src/execution/createPipelineExecutor/10-executePipeline.d.ts +1 -1
  49. package/esm/typings/src/execution/createPipelineExecutor/{20-executeTemplate.d.ts → 20-executeTask.d.ts} +7 -7
  50. package/esm/typings/src/execution/createPipelineExecutor/40-executeAttempts.d.ts +5 -5
  51. package/esm/typings/src/execution/createPipelineExecutor/filterJustOutputParameters.d.ts +1 -1
  52. package/esm/typings/src/execution/createPipelineExecutor/{getContextForTemplate.d.ts → getContextForTask.d.ts} +2 -2
  53. package/esm/typings/src/execution/createPipelineExecutor/{getExamplesForTemplate.d.ts → getExamplesForTask.d.ts} +2 -2
  54. package/esm/typings/src/execution/createPipelineExecutor/getKnowledgeForTask.d.ts +27 -0
  55. package/esm/typings/src/execution/createPipelineExecutor/getReservedParametersForTask.d.ts +30 -0
  56. package/esm/typings/src/{types → execution}/execution-report/ExecutionPromptReportJson.d.ts +2 -2
  57. package/esm/typings/src/{types → execution}/execution-report/ExecutionReportJson.d.ts +4 -4
  58. package/esm/typings/src/{types → execution}/execution-report/ExecutionReportStringOptions.d.ts +1 -1
  59. package/esm/typings/src/execution/utils/checkExpectations.d.ts +1 -1
  60. package/esm/typings/src/execution/utils/usage-constants.d.ts +3 -0
  61. package/esm/typings/src/formats/index.d.ts +3 -0
  62. package/esm/typings/src/formfactors/_boilerplate/BoilerplateFormfactorDefinition.d.ts +14 -0
  63. package/esm/typings/src/formfactors/_common/AbstractFormfactorDefinition.d.ts +9 -1
  64. package/esm/typings/src/formfactors/_common/FormfactorDefinition.d.ts +4 -1
  65. package/esm/typings/src/formfactors/chatbot/ChatbotFormfactorDefinition.d.ts +15 -0
  66. package/esm/typings/src/formfactors/generic/GenericFormfactorDefinition.d.ts +5 -1
  67. package/esm/typings/src/formfactors/index.d.ts +39 -3
  68. package/esm/typings/src/formfactors/matcher/MatcherFormfactorDefinition.d.ts +14 -0
  69. package/esm/typings/src/formfactors/sheets/SheetsFormfactorDefinition.d.ts +14 -0
  70. package/esm/typings/src/formfactors/translator/TranslatorFormfactorDefinition.d.ts +14 -0
  71. package/esm/typings/src/llm-providers/anthropic-claude/anthropic-claude-models.d.ts +1 -0
  72. package/esm/typings/src/llm-providers/anthropic-claude/register-configuration.d.ts +3 -0
  73. package/esm/typings/src/llm-providers/anthropic-claude/register-constructor.d.ts +1 -0
  74. package/esm/typings/src/llm-providers/azure-openai/register-configuration.d.ts +3 -0
  75. package/esm/typings/src/llm-providers/azure-openai/register-constructor.d.ts +1 -0
  76. package/esm/typings/src/llm-providers/mocked/$fakeTextToExpectations.d.ts +1 -1
  77. package/esm/typings/src/llm-providers/openai/openai-models.d.ts +1 -0
  78. package/esm/typings/src/llm-providers/openai/register-configuration.d.ts +3 -0
  79. package/esm/typings/src/llm-providers/openai/register-constructor.d.ts +1 -0
  80. package/esm/typings/src/personas/preparePersona.d.ts +1 -1
  81. package/esm/typings/src/pipeline/{pipeline-interface → PipelineInterface}/PipelineInterface.d.ts +5 -2
  82. package/esm/typings/src/pipeline/PipelineInterface/constants.d.ts +14 -0
  83. package/esm/typings/src/pipeline/{pipeline-interface → PipelineInterface}/getPipelineInterface.d.ts +3 -1
  84. package/esm/typings/src/pipeline/{pipeline-interface → PipelineInterface}/isPipelineImplementingInterface.d.ts +5 -1
  85. package/esm/typings/src/pipeline/{pipeline-interface → PipelineInterface}/isPipelineInterfacesEqual.d.ts +2 -0
  86. package/esm/typings/src/pipeline/PipelineJson/DialogTaskJson.d.ts +13 -0
  87. package/esm/typings/src/{types → pipeline}/PipelineJson/Expectations.d.ts +2 -2
  88. package/esm/typings/src/{types → pipeline}/PipelineJson/KnowledgePieceJson.d.ts +7 -6
  89. package/esm/typings/src/{types → pipeline}/PipelineJson/KnowledgeSourceJson.d.ts +3 -3
  90. package/esm/typings/src/pipeline/PipelineJson/ParameterJson.d.ts +96 -0
  91. package/esm/typings/src/{types → pipeline}/PipelineJson/PersonaJson.d.ts +4 -4
  92. package/esm/typings/src/{types → pipeline}/PipelineJson/PipelineJson.d.ts +10 -10
  93. package/esm/typings/src/{types → pipeline}/PipelineJson/PreparationJson.d.ts +1 -1
  94. package/esm/typings/src/{types/PipelineJson/PromptTemplateJson.d.ts → pipeline/PipelineJson/PromptTaskJson.d.ts} +8 -8
  95. package/esm/typings/src/pipeline/PipelineJson/ScriptTaskJson.d.ts +20 -0
  96. package/esm/typings/src/pipeline/PipelineJson/SimpleTaskJson.d.ts +13 -0
  97. package/esm/typings/src/pipeline/PipelineJson/TaskJson.d.ts +11 -0
  98. package/esm/typings/src/{types/PipelineJson/TemplateJsonCommon.d.ts → pipeline/PipelineJson/TaskJsonCommon.d.ts} +13 -13
  99. package/esm/typings/src/{types → pipeline}/PipelineString.d.ts +1 -1
  100. package/esm/typings/src/prepare/isPipelinePrepared.d.ts +2 -2
  101. package/esm/typings/src/prepare/preparePipeline.d.ts +1 -1
  102. package/esm/typings/src/prepare/{prepareTemplates.d.ts → prepareTasks.d.ts} +7 -7
  103. package/esm/typings/src/prepare/unpreparePipeline.d.ts +1 -1
  104. package/esm/typings/src/scrapers/_common/Scraper.d.ts +1 -1
  105. package/esm/typings/src/scrapers/_common/prepareKnowledgePieces.d.ts +2 -2
  106. package/esm/typings/src/scrapers/_common/utils/makeKnowledgeSourceHandler.d.ts +1 -1
  107. package/esm/typings/src/scrapers/document/DocumentScraper.d.ts +1 -1
  108. package/esm/typings/src/scrapers/document/register-constructor.d.ts +1 -0
  109. package/esm/typings/src/scrapers/document/register-metadata.d.ts +3 -0
  110. package/esm/typings/src/scrapers/document-legacy/LegacyDocumentScraper.d.ts +1 -1
  111. package/esm/typings/src/scrapers/document-legacy/register-constructor.d.ts +1 -0
  112. package/esm/typings/src/scrapers/document-legacy/register-metadata.d.ts +3 -0
  113. package/esm/typings/src/scrapers/markdown/MarkdownScraper.d.ts +1 -1
  114. package/esm/typings/src/scrapers/markdown/register-constructor.d.ts +1 -0
  115. package/esm/typings/src/scrapers/markdown/register-metadata.d.ts +3 -0
  116. package/esm/typings/src/scrapers/pdf/PdfScraper.d.ts +1 -1
  117. package/esm/typings/src/scrapers/pdf/register-constructor.d.ts +1 -0
  118. package/esm/typings/src/scrapers/pdf/register-metadata.d.ts +3 -0
  119. package/esm/typings/src/scrapers/website/WebsiteScraper.d.ts +1 -1
  120. package/esm/typings/src/scrapers/website/register-constructor.d.ts +1 -0
  121. package/esm/typings/src/scrapers/website/register-metadata.d.ts +3 -0
  122. package/esm/typings/src/scripting/javascript/postprocessing-functions.d.ts +1 -0
  123. package/esm/typings/src/types/Prompt.d.ts +1 -1
  124. package/esm/typings/src/types/TaskProgress.d.ts +2 -2
  125. package/esm/typings/src/types/typeAliasEmoji.d.ts +3 -0
  126. package/esm/typings/src/types/typeAliases.d.ts +1 -0
  127. package/esm/typings/src/utils/emojis.d.ts +1 -0
  128. package/esm/typings/src/utils/expectation-counters/{config.d.ts → constants.d.ts} +4 -0
  129. package/esm/typings/src/utils/expectation-counters/countCharacters.d.ts +1 -1
  130. package/esm/typings/src/utils/expectation-counters/countLines.d.ts +1 -1
  131. package/esm/typings/src/utils/expectation-counters/countPages.d.ts +1 -1
  132. package/esm/typings/src/utils/expectation-counters/countParagraphs.d.ts +1 -1
  133. package/esm/typings/src/utils/expectation-counters/countSentences.d.ts +1 -1
  134. package/esm/typings/src/utils/expectation-counters/countWords.d.ts +1 -1
  135. package/esm/typings/src/utils/expectation-counters/index.d.ts +3 -2
  136. package/esm/typings/src/utils/normalization/normalize-to-kebab-case.d.ts +3 -0
  137. package/esm/typings/src/utils/parameters/extractParameterNames.d.ts +2 -2
  138. package/esm/typings/src/utils/serialization/clonePipeline.d.ts +1 -1
  139. package/esm/typings/src/version.d.ts +2 -1
  140. package/package.json +4 -3
  141. package/umd/index.umd.js +276 -236
  142. package/umd/index.umd.js.map +1 -1
  143. package/esm/typings/src/commands/TEMPLATE/TemplateCommand.d.ts +0 -11
  144. package/esm/typings/src/commands/TEMPLATE/TemplateTypes.d.ts +0 -15
  145. package/esm/typings/src/execution/createPipelineExecutor/getKnowledgeForTemplate.d.ts +0 -27
  146. package/esm/typings/src/execution/createPipelineExecutor/getReservedParametersForTemplate.d.ts +0 -30
  147. package/esm/typings/src/formfactors/chat/ChatFormfactorDefinition.d.ts +0 -10
  148. package/esm/typings/src/types/PipelineJson/DialogTemplateJson.d.ts +0 -13
  149. package/esm/typings/src/types/PipelineJson/ParameterJson.d.ts +0 -39
  150. package/esm/typings/src/types/PipelineJson/ScriptTemplateJson.d.ts +0 -20
  151. package/esm/typings/src/types/PipelineJson/SimpleTemplateJson.d.ts +0 -13
  152. package/esm/typings/src/types/PipelineJson/TemplateJson.d.ts +0 -11
  153. /package/esm/typings/src/commands/{TEMPLATE/templateCommand.test.d.ts → SECTION/sectionCommand.test.d.ts} +0 -0
  154. /package/esm/typings/src/conversion/utils/{extractParameterNamesFromTemplate.test.d.ts → extractParameterNamesFromTask.test.d.ts} +0 -0
  155. /package/esm/typings/src/{types → execution}/execution-report/ExecutionReportString.d.ts +0 -0
  156. /package/esm/typings/src/{types → execution}/execution-report/countWorkingDuration.d.ts +0 -0
  157. /package/esm/typings/src/{types → execution}/execution-report/countWorkingDuration.test.d.ts +0 -0
  158. /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.74.0-13';
23
+ var PROMPTBOOK_ENGINE_VERSION = '0.75.0-1';
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
  /*! *****************************************************************************
@@ -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:"./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}],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:"./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}],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:"./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}],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:"./promptbook-collection/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';
@@ -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 template = tasks_1_1.value;
455
456
  var
456
457
  /* Note: Not using:> name, */
457
458
  title_1 = template.title, description_1 = template.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 = template.jokerParameterNames, taskType = template.taskType, content = template.content, postprocessing = template.postprocessingFunctionNames, expectations = template.expectations, format = template.format, resultingParameterName = template.resultingParameterName;
460
461
  pipelineString += '\n\n';
461
462
  pipelineString += "## ".concat(title_1);
462
463
  if (description_1) {
@@ -465,7 +466,7 @@ function pipelineJsonToString(pipelineJson) {
465
466
  }
466
467
  var commands_1 = [];
467
468
  var contentLanguage = 'text';
468
- if (templateType === 'PROMPT_TEMPLATE') {
469
+ if (taskType === 'PROMPT_TASK') {
469
470
  var modelRequirements = template.modelRequirements;
470
471
  var _l = modelRequirements || {}, modelName = _l.modelName, modelVariant = _l.modelVariant;
471
472
  commands_1.push("EXECUTE PROMPT TEMPLATE");
@@ -476,11 +477,11 @@ function pipelineJsonToString(pipelineJson) {
476
477
  commands_1.push("MODEL NAME `".concat(modelName, "`"));
477
478
  }
478
479
  }
479
- else if (templateType === 'SIMPLE_TEMPLATE') {
480
+ else if (taskType === 'SIMPLE_TASK') {
480
481
  commands_1.push("SIMPLE TEMPLATE");
481
482
  // Note: Nothing special here
482
483
  }
483
- else if (templateType === 'SCRIPT_TEMPLATE') {
484
+ else if (taskType === 'SCRIPT_TASK') {
484
485
  commands_1.push("SCRIPT TEMPLATE");
485
486
  if (template.contentLanguage) {
486
487
  contentLanguage = template.contentLanguage;
@@ -489,7 +490,7 @@ function pipelineJsonToString(pipelineJson) {
489
490
  contentLanguage = '';
490
491
  }
491
492
  }
492
- else if (templateType === 'DIALOG_TEMPLATE') {
493
+ else if (taskType === 'DIALOG_TASK') {
493
494
  commands_1.push("DIALOG TEMPLATE");
494
495
  // Note: Nothing special here
495
496
  } // <- }else if([🅱]
@@ -571,7 +572,7 @@ function pipelineJsonToString(pipelineJson) {
571
572
  catch (e_3_1) { e_3 = { error: e_3_1 }; }
572
573
  finally {
573
574
  try {
574
- if (templates_1_1 && !templates_1_1.done && (_c = templates_1.return)) _c.call(templates_1);
575
+ if (tasks_1_1 && !tasks_1_1.done && (_c = tasks_1.return)) _c.call(tasks_1);
575
576
  }
576
577
  finally { if (e_3) throw e_3.error; }
577
578
  }
@@ -910,6 +911,8 @@ var IS_PIPELINE_LOGIC_VALIDATED = just(
910
911
  // Note: In normal situations, we check the pipeline logic:
911
912
  true);
912
913
  /**
914
+ * TODO: Extract `constants.ts` from `config.ts`
915
+ * Note: [💞] Ignore a discrepancy between file name and entity name
913
916
  * TODO: [🧠][🧜‍♂️] Maybe join remoteUrl and path into single value
914
917
  */
915
918
 
@@ -1146,24 +1149,23 @@ function validatePipelineCore(pipeline) {
1146
1149
  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 "); }));
1147
1150
  }
1148
1151
  // TODO: [🧠] Maybe do here some propper JSON-schema / ZOD checking
1149
- if (!Array.isArray(pipeline.templates)) {
1152
+ if (!Array.isArray(pipeline.tasks)) {
1150
1153
  // TODO: [🧠] what is the correct error tp throw - maybe PromptbookSchemaError
1151
- 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 "); }));
1154
+ 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 "); }));
1152
1155
  }
1153
1156
  var _loop_1 = function (parameter) {
1154
1157
  if (parameter.isInput && parameter.isOutput) {
1155
- throw new PipelineLogicError(spaceTrim$1(function (block) { return "\n\n Parameter {".concat(parameter.name, "} can not be both input and output\n\n ").concat(block(pipelineIdentification), "\n "); }));
1158
+ throw new PipelineLogicError(spaceTrim$1(function (block) { return "\n\n Parameter `{".concat(parameter.name, "}` can not be both input and output\n\n ").concat(block(pipelineIdentification), "\n "); }));
1156
1159
  }
1157
1160
  // Note: Testing that parameter is either intermediate or output BUT not created and unused
1158
1161
  if (!parameter.isInput &&
1159
1162
  !parameter.isOutput &&
1160
- !pipeline.templates.some(function (template) { return template.dependentParameterNames.includes(parameter.name); })) {
1161
- 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
+ !pipeline.tasks.some(function (task) { return task.dependentParameterNames.includes(parameter.name); })) {
1164
+ 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 "); }));
1162
1165
  }
1163
- // Note: Testing that parameter is either input or result of some template
1164
- if (!parameter.isInput &&
1165
- !pipeline.templates.some(function (template) { return template.resultingParameterName === parameter.name; })) {
1166
- 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 "); }));
1166
+ // Note: Testing that parameter is either input or result of some task
1167
+ if (!parameter.isInput && !pipeline.tasks.some(function (task) { return task.resultingParameterName === parameter.name; })) {
1168
+ 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 "); }));
1167
1169
  }
1168
1170
  };
1169
1171
  try {
@@ -1180,7 +1182,7 @@ function validatePipelineCore(pipeline) {
1180
1182
  }
1181
1183
  finally { if (e_1) throw e_1.error; }
1182
1184
  }
1183
- // Note: All input parameters are defined - so that they can be used as result of some template
1185
+ // Note: All input parameters are defined - so that they can be used as result of some task
1184
1186
  var definedParameters = new Set(pipeline.parameters.filter(function (_a) {
1185
1187
  var isInput = _a.isInput;
1186
1188
  return isInput;
@@ -1188,27 +1190,27 @@ function validatePipelineCore(pipeline) {
1188
1190
  var name = _a.name;
1189
1191
  return name;
1190
1192
  }));
1191
- var _loop_2 = function (template) {
1193
+ var _loop_2 = function (task) {
1192
1194
  var e_4, _h, e_5, _j;
1193
- if (definedParameters.has(template.resultingParameterName)) {
1194
- throw new PipelineLogicError(spaceTrim$1(function (block) { return "\n Parameter {".concat(template.resultingParameterName, "} is defined multiple times\n\n ").concat(block(pipelineIdentification), "\n "); }));
1195
+ if (definedParameters.has(task.resultingParameterName)) {
1196
+ throw new PipelineLogicError(spaceTrim$1(function (block) { return "\n Parameter `{".concat(task.resultingParameterName, "}` is defined multiple times\n\n ").concat(block(pipelineIdentification), "\n "); }));
1195
1197
  }
1196
- if (RESERVED_PARAMETER_NAMES.includes(template.resultingParameterName)) {
1197
- 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 "); }));
1198
+ if (RESERVED_PARAMETER_NAMES.includes(task.resultingParameterName)) {
1199
+ 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 "); }));
1198
1200
  }
1199
- definedParameters.add(template.resultingParameterName);
1200
- if (template.jokerParameterNames && template.jokerParameterNames.length > 0) {
1201
- if (!template.format &&
1202
- !template.expectations /* <- TODO: Require at least 1 -> min <- expectation to use jokers */) {
1203
- 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 "); }));
1201
+ definedParameters.add(task.resultingParameterName);
1202
+ if (task.jokerParameterNames && task.jokerParameterNames.length > 0) {
1203
+ if (!task.format &&
1204
+ !task.expectations /* <- TODO: Require at least 1 -> min <- expectation to use jokers */) {
1205
+ 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 "); }));
1204
1206
  }
1205
1207
  var _loop_4 = function (joker) {
1206
- if (!template.dependentParameterNames.includes(joker)) {
1207
- 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 "); }));
1208
+ if (!task.dependentParameterNames.includes(joker)) {
1209
+ 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 "); }));
1208
1210
  }
1209
1211
  };
1210
1212
  try {
1211
- for (var _k = (e_4 = void 0, __values(template.jokerParameterNames)), _l = _k.next(); !_l.done; _l = _k.next()) {
1213
+ for (var _k = (e_4 = void 0, __values(task.jokerParameterNames)), _l = _k.next(); !_l.done; _l = _k.next()) {
1212
1214
  var joker = _l.value;
1213
1215
  _loop_4(joker);
1214
1216
  }
@@ -1221,7 +1223,7 @@ function validatePipelineCore(pipeline) {
1221
1223
  finally { if (e_4) throw e_4.error; }
1222
1224
  }
1223
1225
  }
1224
- if (template.expectations) {
1226
+ if (task.expectations) {
1225
1227
  var _loop_5 = function (unit, min, max) {
1226
1228
  if (min !== undefined && max !== undefined && min > max) {
1227
1229
  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 "); }));
@@ -1234,7 +1236,7 @@ function validatePipelineCore(pipeline) {
1234
1236
  }
1235
1237
  };
1236
1238
  try {
1237
- for (var _m = (e_5 = void 0, __values(Object.entries(template.expectations))), _o = _m.next(); !_o.done; _o = _m.next()) {
1239
+ for (var _m = (e_5 = void 0, __values(Object.entries(task.expectations))), _o = _m.next(); !_o.done; _o = _m.next()) {
1238
1240
  var _p = __read(_o.value, 2), unit = _p[0], _q = _p[1], min = _q.min, max = _q.max;
1239
1241
  _loop_5(unit, min, max);
1240
1242
  }
@@ -1249,10 +1251,10 @@ function validatePipelineCore(pipeline) {
1249
1251
  }
1250
1252
  };
1251
1253
  try {
1252
- // Note: Checking each template individually
1253
- for (var _f = __values(pipeline.templates), _g = _f.next(); !_g.done; _g = _f.next()) {
1254
- var template = _g.value;
1255
- _loop_2(template);
1254
+ // Note: Checking each task individually
1255
+ for (var _f = __values(pipeline.tasks), _g = _f.next(); !_g.done; _g = _f.next()) {
1256
+ var task = _g.value;
1257
+ _loop_2(task);
1256
1258
  }
1257
1259
  }
1258
1260
  catch (e_2_1) { e_2 = { error: e_2_1 }; }
@@ -1286,37 +1288,48 @@ function validatePipelineCore(pipeline) {
1286
1288
  }
1287
1289
  finally { if (e_3) throw e_3.error; }
1288
1290
  }
1289
- var unresovedTemplates = __spreadArray([], __read(pipeline.templates), false);
1291
+ var unresovedTemplates = __spreadArray([], __read(pipeline.tasks), false);
1290
1292
  var loopLimit = LOOP_LIMIT;
1291
1293
  var _loop_3 = function () {
1292
1294
  if (loopLimit-- < 0) {
1293
1295
  // Note: Really UnexpectedError not LimitReachedError - this should not happen and be caught below
1294
1296
  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 "); }));
1295
1297
  }
1296
- var currentlyResovedTemplates = unresovedTemplates.filter(function (template) {
1297
- return template.dependentParameterNames.every(function (name) { return resovedParameters.includes(name); });
1298
+ var currentlyResovedTemplates = unresovedTemplates.filter(function (task) {
1299
+ return task.dependentParameterNames.every(function (name) { return resovedParameters.includes(name); });
1298
1300
  });
1299
1301
  if (currentlyResovedTemplates.length === 0) {
1300
1302
  throw new PipelineLogicError(
1301
1303
  // TODO: [🐎] DRY
1302
- 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
1304
+ 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
1303
1305
  .map(function (_a) {
1304
1306
  var resultingParameterName = _a.resultingParameterName, dependentParameterNames = _a.dependentParameterNames;
1305
- return "- Parameter {".concat(resultingParameterName, "} which depends on ").concat(dependentParameterNames
1306
- .map(function (dependentParameterName) { return "{".concat(dependentParameterName, "}"); })
1307
+ return "- Parameter `{".concat(resultingParameterName, "}` which depends on ").concat(dependentParameterNames
1308
+ .map(function (dependentParameterName) { return "`{".concat(dependentParameterName, "}`"); })
1307
1309
  .join(' and '));
1308
1310
  })
1309
- .join('\n')), "\n\n Resolved:\n ").concat(block(resovedParameters.map(function (name) { return "- Parameter {".concat(name, "}"); }).join('\n')), "\n\n\n "); }));
1311
+ .join('\n')), "\n\n **Resolved:**\n ").concat(block(resovedParameters
1312
+ .filter(function (name) {
1313
+ return !RESERVED_PARAMETER_NAMES.includes(name);
1314
+ })
1315
+ .map(function (name) { return "- Parameter `{".concat(name, "}`"); })
1316
+ .join('\n')), "\n\n\n **Reserved (which are available):**\n ").concat(block(resovedParameters
1317
+ .filter(function (name) {
1318
+ return RESERVED_PARAMETER_NAMES.includes(name);
1319
+ })
1320
+ .map(function (name) { return "- Parameter `{".concat(name, "}`"); })
1321
+ .join('\n')), "\n\n\n "); }));
1310
1322
  }
1311
1323
  resovedParameters = __spreadArray(__spreadArray([], __read(resovedParameters), false), __read(currentlyResovedTemplates.map(function (_a) {
1312
1324
  var resultingParameterName = _a.resultingParameterName;
1313
1325
  return resultingParameterName;
1314
1326
  })), false);
1315
- unresovedTemplates = unresovedTemplates.filter(function (template) { return !currentlyResovedTemplates.includes(template); });
1327
+ unresovedTemplates = unresovedTemplates.filter(function (task) { return !currentlyResovedTemplates.includes(task); });
1316
1328
  };
1317
1329
  while (unresovedTemplates.length > 0) {
1318
1330
  _loop_3();
1319
1331
  }
1332
+ // TODO: !!!!!! Test that pipeline interface implements declared formfactor interface
1320
1333
  }
1321
1334
  /**
1322
1335
  * TODO: !! [🧞‍♀️] Do not allow joker + foreach
@@ -1373,9 +1386,9 @@ var PipelineUrlError = /** @class */ (function (_super) {
1373
1386
  }(Error));
1374
1387
 
1375
1388
  /**
1376
- * Parses the template and returns the list of all parameter names
1389
+ * Parses the task and returns the list of all parameter names
1377
1390
  *
1378
- * @param template the template with parameters in {curly} braces
1391
+ * @param template the task with parameters in {curly} braces
1379
1392
  * @returns the list of parameter names
1380
1393
  * @public exported from `@promptbook/utils`
1381
1394
  */
@@ -1406,10 +1419,10 @@ function extractParameterNames(template) {
1406
1419
  * @public exported from `@promptbook/core`
1407
1420
  */
1408
1421
  function unpreparePipeline(pipeline) {
1409
- var personas = pipeline.personas, knowledgeSources = pipeline.knowledgeSources, templates = pipeline.templates;
1422
+ var personas = pipeline.personas, knowledgeSources = pipeline.knowledgeSources, tasks = pipeline.tasks;
1410
1423
  personas = personas.map(function (persona) { return (__assign(__assign({}, persona), { modelRequirements: undefined, preparationIds: undefined })); });
1411
1424
  knowledgeSources = knowledgeSources.map(function (knowledgeSource) { return (__assign(__assign({}, knowledgeSource), { preparationIds: undefined })); });
1412
- templates = templates.map(function (template) {
1425
+ tasks = tasks.map(function (template) {
1413
1426
  var dependentParameterNames = template.dependentParameterNames;
1414
1427
  var parameterNames = extractParameterNames(template.preparedContent || '');
1415
1428
  dependentParameterNames = dependentParameterNames.filter(function (dependentParameterName) { return !parameterNames.has(dependentParameterName); });
@@ -1417,7 +1430,7 @@ function unpreparePipeline(pipeline) {
1417
1430
  delete templateUnprepared.preparedContent;
1418
1431
  return templateUnprepared;
1419
1432
  });
1420
- return $asDeeplyFrozenSerializableJson('Unprepared PipelineJson', __assign(__assign({}, pipeline), { templates: templates, knowledgeSources: knowledgeSources, knowledgePieces: [], personas: personas, preparations: [] }));
1433
+ return $asDeeplyFrozenSerializableJson('Unprepared PipelineJson', __assign(__assign({}, pipeline), { tasks: tasks, knowledgeSources: knowledgeSources, knowledgePieces: [], personas: personas, preparations: [] }));
1421
1434
  }
1422
1435
  /**
1423
1436
  * TODO: [🧿] Maybe do same process with same granularity and subfinctions as `preparePipeline`
@@ -1849,6 +1862,9 @@ function normalizeToKebabCase(text) {
1849
1862
  normalizedName = normalizedName.replace(/-$/, '');
1850
1863
  return normalizedName;
1851
1864
  }
1865
+ /**
1866
+ * Note: [💞] Ignore a discrepancy between file name and entity name
1867
+ */
1852
1868
 
1853
1869
  /**
1854
1870
  * Removes emojis from a string and fix whitespaces
@@ -2050,6 +2066,9 @@ var ERRORS = {
2050
2066
  UnexpectedError: UnexpectedError,
2051
2067
  // TODO: [🪑]> VersionMismatchError,
2052
2068
  };
2069
+ /**
2070
+ * Note: [💞] Ignore a discrepancy between file name and entity name
2071
+ */
2053
2072
 
2054
2073
  /**
2055
2074
  * Deserializes the error object
@@ -2111,8 +2130,8 @@ function isPipelinePrepared(pipeline) {
2111
2130
  return false;
2112
2131
  }
2113
2132
  /*
2114
- TODO: [🧠][🍫] `templates` can not be determined if they are fully prepared SO ignoring them
2115
- > if (!pipeline.templates.every(({ preparedContent }) => preparedContent === undefined)) {
2133
+ TODO: [🧠][🍫] `tasks` can not be determined if they are fully prepared SO ignoring them
2134
+ > if (!pipeline.tasks.every(({ preparedContent }) => preparedContent === undefined)) {
2116
2135
  > return false;
2117
2136
  > }
2118
2137
  */
@@ -2125,7 +2144,7 @@ function isPipelinePrepared(pipeline) {
2125
2144
  * TODO: [🧿] Maybe do same process with same granularity and subfinctions as `preparePipeline`
2126
2145
  * - [🏍] ? Is context in each template
2127
2146
  * - [♨] Are examples prepared
2128
- * - [♨] Are templates prepared
2147
+ * - [♨] Are tasks prepared
2129
2148
  */
2130
2149
 
2131
2150
  /**
@@ -2273,6 +2292,9 @@ $deepFreeze({
2273
2292
  pagesCount: { value: 0, isUncertain: true },
2274
2293
  },
2275
2294
  });
2295
+ /**
2296
+ * Note: [💞] Ignore a discrepancy between file name and entity name
2297
+ */
2276
2298
 
2277
2299
  /**
2278
2300
  * @@@
@@ -2672,8 +2694,8 @@ var MultipleLlmExecutionTools = /** @class */ (function () {
2672
2694
  else if (errors.length > 1) {
2673
2695
  throw new PipelineExecutionError(
2674
2696
  // TODO: Tell which execution tools failed like
2675
- // 1) OpenAI throw PipelineExecutionError: Parameter {knowledge} is not defined
2676
- // 2) AnthropicClaude throw PipelineExecutionError: Parameter {knowledge} is not defined
2697
+ // 1) OpenAI throw PipelineExecutionError: Parameter `{knowledge}` is not defined
2698
+ // 2) AnthropicClaude throw PipelineExecutionError: Parameter `{knowledge}` is not defined
2677
2699
  // 3) ...
2678
2700
  spaceTrim(function (block) { return "\n All execution tools failed:\n\n ".concat(block(errors
2679
2701
  .map(function (error, i) { return "".concat(i + 1, ") **").concat(error.name || 'Error', ":** ").concat(error.message); })
@@ -3459,7 +3481,7 @@ TODO: [🧊] This is how it can look in future
3459
3481
  */
3460
3482
  function clonePipeline(pipeline) {
3461
3483
  // Note: Not using spread operator (...) because @@@
3462
- 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;
3484
+ 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;
3463
3485
  return {
3464
3486
  pipelineUrl: pipelineUrl,
3465
3487
  sourceFile: sourceFile,
@@ -3468,7 +3490,7 @@ function clonePipeline(pipeline) {
3468
3490
  description: description,
3469
3491
  formfactorName: formfactorName,
3470
3492
  parameters: parameters,
3471
- templates: templates,
3493
+ tasks: tasks,
3472
3494
  knowledgeSources: knowledgeSources,
3473
3495
  knowledgePieces: knowledgePieces,
3474
3496
  personas: personas,
@@ -3484,17 +3506,17 @@ function clonePipeline(pipeline) {
3484
3506
  *
3485
3507
  * @public exported from `@promptbook/core`
3486
3508
  */
3487
- function prepareTemplates(pipeline, tools, options) {
3509
+ function prepareTasks(pipeline, tools, options) {
3488
3510
  return __awaiter(this, void 0, void 0, function () {
3489
- var _a, maxParallelCount, templates, knowledgePiecesCount, templatesPrepared;
3511
+ var _a, maxParallelCount, tasks, knowledgePiecesCount, tasksPrepared;
3490
3512
  var _this = this;
3491
3513
  return __generator(this, function (_b) {
3492
3514
  switch (_b.label) {
3493
3515
  case 0:
3494
3516
  _a = options.maxParallelCount, maxParallelCount = _a === void 0 ? DEFAULT_MAX_PARALLEL_COUNT : _a;
3495
- templates = pipeline.templates, pipeline.parameters, knowledgePiecesCount = pipeline.knowledgePiecesCount;
3496
- templatesPrepared = new Array(templates.length);
3497
- 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 () {
3517
+ tasks = pipeline.tasks, pipeline.parameters, knowledgePiecesCount = pipeline.knowledgePiecesCount;
3518
+ tasksPrepared = new Array(tasks.length);
3519
+ return [4 /*yield*/, forEachAsync(tasks, { maxParallelCount: maxParallelCount /* <- TODO: [🪂] When there are subtasks, this maximul limit can be broken */ }, function (template, index) { return __awaiter(_this, void 0, void 0, function () {
3498
3520
  var dependentParameterNames, preparedContent, preparedTemplate;
3499
3521
  return __generator(this, function (_a) {
3500
3522
  dependentParameterNames = template.dependentParameterNames;
@@ -3507,13 +3529,13 @@ function prepareTemplates(pipeline, tools, options) {
3507
3529
  ], false);
3508
3530
  }
3509
3531
  preparedTemplate = __assign(__assign({}, template), { dependentParameterNames: dependentParameterNames, preparedContent: preparedContent });
3510
- templatesPrepared[index] = preparedTemplate;
3532
+ tasksPrepared[index] = preparedTemplate;
3511
3533
  return [2 /*return*/];
3512
3534
  });
3513
3535
  }); })];
3514
3536
  case 1:
3515
3537
  _b.sent();
3516
- return [2 /*return*/, { templatesPrepared: templatesPrepared }];
3538
+ return [2 /*return*/, { tasksPrepared: tasksPrepared }];
3517
3539
  }
3518
3540
  });
3519
3541
  });
@@ -3521,7 +3543,7 @@ function prepareTemplates(pipeline, tools, options) {
3521
3543
  /**
3522
3544
  * TODO: [🧠] Add context to each template (if missing)
3523
3545
  * TODO: [🧠] What is better name `prepareTemplate` or `prepareTemplateAndParameters`
3524
- * TODO: [♨][main] !!! Prepare index the examples and maybe templates
3546
+ * TODO: [♨][main] !!! Prepare index the examples and maybe tasks
3525
3547
  * TODO: Write tests for `preparePipeline`
3526
3548
  * TODO: [🏏] Leverage the batch API and build queues @see https://platform.openai.com/docs/guides/batch
3527
3549
  * TODO: [🧊] In future one preparation can take data from previous preparation and save tokens and time
@@ -3538,12 +3560,12 @@ function prepareTemplates(pipeline, tools, options) {
3538
3560
  */
3539
3561
  function preparePipeline(pipeline, tools, options) {
3540
3562
  return __awaiter(this, void 0, void 0, function () {
3541
- var rootDirname, _a, maxParallelCount, _b, isVerbose, parameters, templates,
3563
+ var rootDirname, _a, maxParallelCount, _b, isVerbose, parameters, tasks,
3542
3564
  /*
3543
3565
  <- TODO: [🧠][🪑] `promptbookVersion` */
3544
3566
  knowledgeSources /*
3545
3567
  <- TODO: [🧊] `knowledgePieces` */, personas /*
3546
- <- TODO: [🧊] `preparations` */, _llms, llmTools, llmToolsWithUsage, currentPreparation, preparations, preparedPersonas, knowledgeSourcesPrepared, partialknowledgePiecesPrepared, knowledgePiecesPrepared, templatesPrepared /* TODO: parameters: parametersPrepared*/;
3568
+ <- TODO: [🧊] `preparations` */, _llms, llmTools, llmToolsWithUsage, currentPreparation, preparations, preparedPersonas, knowledgeSourcesPrepared, partialknowledgePiecesPrepared, knowledgePiecesPrepared, tasksPrepared /* TODO: parameters: parametersPrepared*/;
3547
3569
  var _this = this;
3548
3570
  return __generator(this, function (_c) {
3549
3571
  switch (_c.label) {
@@ -3552,7 +3574,7 @@ function preparePipeline(pipeline, tools, options) {
3552
3574
  return [2 /*return*/, pipeline];
3553
3575
  }
3554
3576
  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;
3555
- parameters = pipeline.parameters, templates = pipeline.templates, knowledgeSources = pipeline.knowledgeSources, personas = pipeline.personas;
3577
+ parameters = pipeline.parameters, tasks = pipeline.tasks, knowledgeSources = pipeline.knowledgeSources, personas = pipeline.personas;
3556
3578
  if (tools === undefined || tools.llm === undefined) {
3557
3579
  throw new MissingToolsError('LLM tools are required for preparing the pipeline');
3558
3580
  }
@@ -3595,9 +3617,9 @@ function preparePipeline(pipeline, tools, options) {
3595
3617
  case 2:
3596
3618
  partialknowledgePiecesPrepared = _c.sent();
3597
3619
  knowledgePiecesPrepared = partialknowledgePiecesPrepared.map(function (piece) { return (__assign(__assign({}, piece), { preparationIds: [/* TODO: [🧊] -> */ currentPreparation.id] })); });
3598
- return [4 /*yield*/, prepareTemplates({
3620
+ return [4 /*yield*/, prepareTasks({
3599
3621
  parameters: parameters,
3600
- templates: templates,
3622
+ tasks: tasks,
3601
3623
  knowledgePiecesCount: knowledgePiecesPrepared.length,
3602
3624
  }, __assign(__assign({}, tools), { llm: llmToolsWithUsage }), {
3603
3625
  rootDirname: rootDirname,
@@ -3605,12 +3627,12 @@ function preparePipeline(pipeline, tools, options) {
3605
3627
  isVerbose: isVerbose,
3606
3628
  })];
3607
3629
  case 3:
3608
- templatesPrepared = (_c.sent()).templatesPrepared;
3630
+ tasksPrepared = (_c.sent()).tasksPrepared;
3609
3631
  // ----- /Templates preparation -----
3610
3632
  // Note: Count total usage
3611
3633
  currentPreparation.usage = llmToolsWithUsage.getTotalUsage();
3612
- return [2 /*return*/, $asDeeplyFrozenSerializableJson('Prepared PipelineJson', __assign(__assign({}, clonePipeline(pipeline)), { templates: __spreadArray([], __read(templatesPrepared), false),
3613
- // <- TODO: [🪓] Here should be no need for spreading new array, just ` templates: templatesPrepared`
3634
+ return [2 /*return*/, $asDeeplyFrozenSerializableJson('Prepared PipelineJson', __assign(__assign({}, clonePipeline(pipeline)), { tasks: __spreadArray([], __read(tasksPrepared), false),
3635
+ // <- TODO: [🪓] Here should be no need for spreading new array, just ` tasks: tasksPrepared`
3614
3636
  knowledgeSources: knowledgeSourcesPrepared, knowledgePieces: knowledgePiecesPrepared, personas: preparedPersonas, preparations: __spreadArray([], __read(preparations), false) }))];
3615
3637
  }
3616
3638
  });
@@ -3682,9 +3704,9 @@ function extractVariables(script) {
3682
3704
  * @throws {ParseError} if the script is invalid
3683
3705
  * @public exported from `@promptbook/utils`
3684
3706
  */
3685
- function extractParameterNamesFromTemplate(template) {
3707
+ function extractParameterNamesFromTask(template) {
3686
3708
  var e_1, _a, e_2, _b, e_3, _c, e_4, _d;
3687
- var title = template.title, description = template.description, templateType = template.templateType, content = template.content, preparedContent = template.preparedContent, jokerParameterNames = template.jokerParameterNames, foreach = template.foreach;
3709
+ var title = template.title, description = template.description, taskType = template.taskType, content = template.content, preparedContent = template.preparedContent, jokerParameterNames = template.jokerParameterNames, foreach = template.foreach;
3688
3710
  var parameterNames = new Set();
3689
3711
  try {
3690
3712
  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()) {
@@ -3699,7 +3721,7 @@ function extractParameterNamesFromTemplate(template) {
3699
3721
  }
3700
3722
  finally { if (e_1) throw e_1.error; }
3701
3723
  }
3702
- if (templateType === 'SCRIPT_TEMPLATE') {
3724
+ if (taskType === 'SCRIPT_TASK') {
3703
3725
  try {
3704
3726
  for (var _g = __values(extractVariables(content)), _h = _g.next(); !_h.done; _h = _g.next()) {
3705
3727
  var parameterName = _h.value;
@@ -4109,6 +4131,9 @@ var FORMAT_DEFINITIONS = [
4109
4131
  TextFormatDefinition,
4110
4132
  CsvFormatDefinition,
4111
4133
  ];
4134
+ /**
4135
+ * Note: [💞] Ignore a discrepancy between file name and entity name
4136
+ */
4112
4137
 
4113
4138
  /**
4114
4139
  * Maps available parameters to expected parameters
@@ -4194,11 +4219,11 @@ function replaceParameters(template, parameters) {
4194
4219
  for (var _b = __values(Object.entries(parameters)), _c = _b.next(); !_c.done; _c = _b.next()) {
4195
4220
  var _d = __read(_c.value, 2), parameterName = _d[0], parameterValue = _d[1];
4196
4221
  if (parameterValue === RESERVED_PARAMETER_MISSING_VALUE) {
4197
- throw new UnexpectedError("Parameter {".concat(parameterName, "} has missing value"));
4222
+ throw new UnexpectedError("Parameter `{".concat(parameterName, "}` has missing value"));
4198
4223
  }
4199
4224
  else if (parameterValue === RESERVED_PARAMETER_RESTRICTED) {
4200
4225
  // TODO: [🍵]
4201
- throw new UnexpectedError("Parameter {".concat(parameterName, "} is restricted to use"));
4226
+ throw new UnexpectedError("Parameter `{".concat(parameterName, "}` is restricted to use"));
4202
4227
  }
4203
4228
  }
4204
4229
  }
@@ -4209,7 +4234,7 @@ function replaceParameters(template, parameters) {
4209
4234
  }
4210
4235
  finally { if (e_1) throw e_1.error; }
4211
4236
  }
4212
- var replacedTemplate = template;
4237
+ var replacedTemplates = template;
4213
4238
  var match;
4214
4239
  var loopLimit = LOOP_LIMIT;
4215
4240
  var _loop_1 = function () {
@@ -4225,11 +4250,11 @@ function replaceParameters(template, parameters) {
4225
4250
  throw new PipelineExecutionError('Parameter is already opened or not closed');
4226
4251
  }
4227
4252
  if (parameters[parameterName] === undefined) {
4228
- throw new PipelineExecutionError("Parameter {".concat(parameterName, "} is not defined"));
4253
+ throw new PipelineExecutionError("Parameter `{".concat(parameterName, "}` is not defined"));
4229
4254
  }
4230
4255
  var parameterValue = parameters[parameterName];
4231
4256
  if (parameterValue === undefined) {
4232
- throw new PipelineExecutionError("Parameter {".concat(parameterName, "} is not defined"));
4257
+ throw new PipelineExecutionError("Parameter `{".concat(parameterName, "}` is not defined"));
4233
4258
  }
4234
4259
  parameterValue = parameterValue.toString();
4235
4260
  if (parameterValue.includes('\n') && /^\s*\W{0,3}\s*$/.test(precol)) {
@@ -4238,24 +4263,24 @@ function replaceParameters(template, parameters) {
4238
4263
  .map(function (line, index) { return (index === 0 ? line : "".concat(precol).concat(line)); })
4239
4264
  .join('\n');
4240
4265
  }
4241
- replacedTemplate =
4242
- replacedTemplate.substring(0, match.index + precol.length) +
4266
+ replacedTemplates =
4267
+ replacedTemplates.substring(0, match.index + precol.length) +
4243
4268
  parameterValue +
4244
- replacedTemplate.substring(match.index + precol.length + parameterName.length + 2);
4269
+ replacedTemplates.substring(match.index + precol.length + parameterName.length + 2);
4245
4270
  };
4246
4271
  while ((match = /^(?<precol>.*){(?<parameterName>\w+)}(.*)/m /* <- Not global */
4247
- .exec(replacedTemplate))) {
4272
+ .exec(replacedTemplates))) {
4248
4273
  _loop_1();
4249
4274
  }
4250
4275
  // [💫] Check if there are parameters that are not closed properly
4251
- if (/{\w+$/.test(replacedTemplate)) {
4276
+ if (/{\w+$/.test(replacedTemplates)) {
4252
4277
  throw new PipelineExecutionError('Parameter is not closed');
4253
4278
  }
4254
4279
  // [💫] Check if there are parameters that are not opened properly
4255
- if (/^\w+}/.test(replacedTemplate)) {
4280
+ if (/^\w+}/.test(replacedTemplates)) {
4256
4281
  throw new PipelineExecutionError('Parameter is not opened');
4257
4282
  }
4258
- return replacedTemplate;
4283
+ return replacedTemplates;
4259
4284
  }
4260
4285
 
4261
4286
  /**
@@ -4285,6 +4310,10 @@ var CHARACTERS_PER_STANDARD_LINE = 63;
4285
4310
  * @public exported from `@promptbook/utils`
4286
4311
  */
4287
4312
  var LINES_PER_STANDARD_PAGE = 44;
4313
+ /**
4314
+ * TODO: [🧠] Should be this `constants.ts` or `config.ts`?
4315
+ * Note: [💞] Ignore a discrepancy between file name and entity name
4316
+ */
4288
4317
 
4289
4318
  /**
4290
4319
  * Counts number of lines in the text
@@ -4363,6 +4392,7 @@ var CountUtils = {
4363
4392
  };
4364
4393
  /**
4365
4394
  * TODO: [🧠][🤠] This should be probbably as part of `TextFormatDefinition`
4395
+ * Note: [💞] Ignore a discrepancy between file name and entity name
4366
4396
  */
4367
4397
 
4368
4398
  /**
@@ -4411,12 +4441,12 @@ function checkExpectations(expectations, value) {
4411
4441
  */
4412
4442
  function executeAttempts(options) {
4413
4443
  return __awaiter(this, void 0, void 0, function () {
4414
- var jokerParameterNames, priority, maxAttempts, preparedContent, parameters, template, preparedPipeline, tools, $executionReport, pipelineIdentification, maxExecutionAttempts, $ongoingTemplateResult, _llms, llmTools, _loop_1, attempt, state_1;
4444
+ var jokerParameterNames, priority, maxAttempts, preparedContent, parameters, task, preparedPipeline, tools, $executionReport, pipelineIdentification, maxExecutionAttempts, $ongoingTaskResult, _llms, llmTools, _loop_1, attempt, state_1;
4415
4445
  return __generator(this, function (_a) {
4416
4446
  switch (_a.label) {
4417
4447
  case 0:
4418
- 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;
4419
- $ongoingTemplateResult = {
4448
+ 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;
4449
+ $ongoingTaskResult = {
4420
4450
  $result: null,
4421
4451
  $resultString: null,
4422
4452
  $expectError: null,
@@ -4436,52 +4466,51 @@ function executeAttempts(options) {
4436
4466
  if (isJokerAttempt && !jokerParameterName) {
4437
4467
  throw new UnexpectedError(spaceTrim$1(function (block) { return "\n Joker not found in attempt ".concat(attempt, "\n\n ").concat(block(pipelineIdentification), "\n "); }));
4438
4468
  }
4439
- $ongoingTemplateResult.$result = null;
4440
- $ongoingTemplateResult.$resultString = null;
4441
- $ongoingTemplateResult.$expectError = null;
4469
+ $ongoingTaskResult.$result = null;
4470
+ $ongoingTaskResult.$resultString = null;
4471
+ $ongoingTaskResult.$expectError = null;
4442
4472
  if (isJokerAttempt) {
4443
4473
  if (parameters[jokerParameterName] === undefined) {
4444
4474
  throw new PipelineExecutionError(spaceTrim$1(function (block) { return "\n Joker parameter {".concat(jokerParameterName, "} not defined\n\n ").concat(block(pipelineIdentification), "\n "); }));
4445
4475
  // <- TODO: This is maybe `PipelineLogicError` which should be detected in `validatePipeline` and here just thrown as `UnexpectedError`
4446
4476
  }
4447
4477
  else {
4448
- $ongoingTemplateResult.$resultString = parameters[jokerParameterName];
4478
+ $ongoingTaskResult.$resultString = parameters[jokerParameterName];
4449
4479
  }
4450
4480
  }
4451
4481
  _t.label = 1;
4452
4482
  case 1:
4453
4483
  _t.trys.push([1, 43, 44, 45]);
4454
4484
  if (!!isJokerAttempt) return [3 /*break*/, 25];
4455
- _b = template.templateType;
4485
+ _b = task.taskType;
4456
4486
  switch (_b) {
4457
- case 'SIMPLE_TEMPLATE': return [3 /*break*/, 2];
4458
- case 'PROMPT_TEMPLATE': return [3 /*break*/, 3];
4459
- case 'SCRIPT_TEMPLATE': return [3 /*break*/, 11];
4460
- case 'DIALOG_TEMPLATE': return [3 /*break*/, 22];
4487
+ case 'SIMPLE_TASK': return [3 /*break*/, 2];
4488
+ case 'PROMPT_TASK': return [3 /*break*/, 3];
4489
+ case 'SCRIPT_TASK': return [3 /*break*/, 11];
4490
+ case 'DIALOG_TASK': return [3 /*break*/, 22];
4461
4491
  }
4462
4492
  return [3 /*break*/, 24];
4463
4493
  case 2:
4464
- $ongoingTemplateResult.$resultString = replaceParameters(preparedContent, parameters);
4494
+ $ongoingTaskResult.$resultString = replaceParameters(preparedContent, parameters);
4465
4495
  return [3 /*break*/, 25];
4466
4496
  case 3:
4467
- modelRequirements = __assign(__assign({ modelVariant: 'CHAT' }, (preparedPipeline.defaultModelRequirements || {})), (template.modelRequirements || {}));
4468
- $ongoingTemplateResult.$prompt = {
4469
- title: template.title,
4497
+ modelRequirements = __assign(__assign({ modelVariant: 'CHAT' }, (preparedPipeline.defaultModelRequirements || {})), (task.modelRequirements || {}));
4498
+ $ongoingTaskResult.$prompt = {
4499
+ title: task.title,
4470
4500
  pipelineUrl: "".concat(preparedPipeline.pipelineUrl
4471
4501
  ? preparedPipeline.pipelineUrl
4472
- : 'anonymous' /* <- TODO: [🧠] How to deal with anonymous pipelines, do here some auto-url like SHA-256 based ad-hoc identifier? */, "#").concat(template.name
4473
- // <- TODO: Here should be maybe also subformat index to distinguish between same template with different subformat values
4502
+ : 'anonymous' /* <- TODO: [🧠] How to deal with anonymous pipelines, do here some auto-url like SHA-256 based ad-hoc identifier? */, "#").concat(task.name
4503
+ // <- TODO: Here should be maybe also subformat index to distinguish between same task with different subformat values
4474
4504
  ),
4475
4505
  parameters: parameters,
4476
4506
  content: preparedContent,
4477
4507
  modelRequirements: modelRequirements,
4478
4508
  expectations: __assign(__assign({}, (preparedPipeline.personas.find(function (_a) {
4479
4509
  var name = _a.name;
4480
- return name === template.personaName;
4481
- }) ||
4482
- {})), template.expectations),
4483
- format: template.format,
4484
- postprocessingFunctionNames: template.postprocessingFunctionNames,
4510
+ return name === task.personaName;
4511
+ }) || {})), task.expectations),
4512
+ format: task.format,
4513
+ postprocessingFunctionNames: task.postprocessingFunctionNames,
4485
4514
  }; // <- TODO: Not very good type guard
4486
4515
  _c = modelRequirements.modelVariant;
4487
4516
  switch (_c) {
@@ -4491,36 +4520,35 @@ function executeAttempts(options) {
4491
4520
  }
4492
4521
  return [3 /*break*/, 9];
4493
4522
  case 4:
4494
- _d = $ongoingTemplateResult;
4523
+ _d = $ongoingTaskResult;
4495
4524
  return [4 /*yield*/, llmTools.callChatModel(
4496
4525
  // <- TODO: [🧁] Check that `callChatModel` is defined
4497
- $deepFreeze($ongoingTemplateResult.$prompt))];
4526
+ $deepFreeze($ongoingTaskResult.$prompt))];
4498
4527
  case 5:
4499
4528
  _d.$chatResult = _t.sent();
4500
4529
  // TODO: [🍬] Destroy chatThread
4501
- $ongoingTemplateResult.$result = $ongoingTemplateResult.$chatResult;
4502
- $ongoingTemplateResult.$resultString = $ongoingTemplateResult.$chatResult.content;
4530
+ $ongoingTaskResult.$result = $ongoingTaskResult.$chatResult;
4531
+ $ongoingTaskResult.$resultString = $ongoingTaskResult.$chatResult.content;
4503
4532
  return [3 /*break*/, 10];
4504
4533
  case 6:
4505
- _e = $ongoingTemplateResult;
4534
+ _e = $ongoingTaskResult;
4506
4535
  return [4 /*yield*/, llmTools.callCompletionModel(
4507
4536
  // <- TODO: [🧁] Check that `callCompletionModel` is defined
4508
- $deepFreeze($ongoingTemplateResult.$prompt))];
4537
+ $deepFreeze($ongoingTaskResult.$prompt))];
4509
4538
  case 7:
4510
4539
  _e.$completionResult = _t.sent();
4511
- $ongoingTemplateResult.$result = $ongoingTemplateResult.$completionResult;
4512
- $ongoingTemplateResult.$resultString =
4513
- $ongoingTemplateResult.$completionResult.content;
4540
+ $ongoingTaskResult.$result = $ongoingTaskResult.$completionResult;
4541
+ $ongoingTaskResult.$resultString = $ongoingTaskResult.$completionResult.content;
4514
4542
  return [3 /*break*/, 10];
4515
4543
  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 "); }));
4516
- 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 "); }));
4544
+ 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 "); }));
4517
4545
  case 10: return [3 /*break*/, 25];
4518
4546
  case 11:
4519
4547
  if (arrayableToArray(tools.script).length === 0) {
4520
4548
  throw new PipelineExecutionError(spaceTrim$1(function (block) { return "\n No script execution tools are available\n\n ".concat(block(pipelineIdentification), "\n "); }));
4521
4549
  }
4522
- if (!template.contentLanguage) {
4523
- 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 "); }));
4550
+ if (!task.contentLanguage) {
4551
+ 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 "); }));
4524
4552
  }
4525
4553
  _t.label = 12;
4526
4554
  case 12:
@@ -4533,9 +4561,9 @@ function executeAttempts(options) {
4533
4561
  _t.label = 14;
4534
4562
  case 14:
4535
4563
  _t.trys.push([14, 16, , 17]);
4536
- _h = $ongoingTemplateResult;
4564
+ _h = $ongoingTaskResult;
4537
4565
  return [4 /*yield*/, scriptTools.execute($deepFreeze({
4538
- scriptLanguage: template.contentLanguage,
4566
+ scriptLanguage: task.contentLanguage,
4539
4567
  script: preparedContent,
4540
4568
  parameters: parameters,
4541
4569
  }))];
@@ -4550,7 +4578,7 @@ function executeAttempts(options) {
4550
4578
  if (error_1 instanceof UnexpectedError) {
4551
4579
  throw error_1;
4552
4580
  }
4553
- $ongoingTemplateResult.$scriptPipelineExecutionErrors.push(error_1);
4581
+ $ongoingTaskResult.$scriptPipelineExecutionErrors.push(error_1);
4554
4582
  return [3 /*break*/, 17];
4555
4583
  case 17:
4556
4584
  _g = _f.next();
@@ -4567,14 +4595,14 @@ function executeAttempts(options) {
4567
4595
  finally { if (e_1) throw e_1.error; }
4568
4596
  return [7 /*endfinally*/];
4569
4597
  case 21:
4570
- if ($ongoingTemplateResult.$resultString !== null) {
4598
+ if ($ongoingTaskResult.$resultString !== null) {
4571
4599
  return [3 /*break*/, 25];
4572
4600
  }
4573
- if ($ongoingTemplateResult.$scriptPipelineExecutionErrors.length === 1) {
4574
- throw $ongoingTemplateResult.$scriptPipelineExecutionErrors[0];
4601
+ if ($ongoingTaskResult.$scriptPipelineExecutionErrors.length === 1) {
4602
+ throw $ongoingTaskResult.$scriptPipelineExecutionErrors[0];
4575
4603
  }
4576
4604
  else {
4577
- 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
4605
+ 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
4578
4606
  .map(function (error) { return '- ' + error.message; })
4579
4607
  .join('\n\n')), "\n "); }));
4580
4608
  }
@@ -4582,27 +4610,27 @@ function executeAttempts(options) {
4582
4610
  if (tools.userInterface === undefined) {
4583
4611
  throw new PipelineExecutionError(spaceTrim$1(function (block) { return "\n User interface tools are not available\n\n ".concat(block(pipelineIdentification), "\n "); }));
4584
4612
  }
4585
- // TODO: [🌹] When making next attempt for `DIALOG TEMPLATE`, preserve the previous user input
4586
- _j = $ongoingTemplateResult;
4613
+ // TODO: [🌹] When making next attempt for `DIALOG TASK`, preserve the previous user input
4614
+ _j = $ongoingTaskResult;
4587
4615
  return [4 /*yield*/, tools.userInterface.promptDialog($deepFreeze({
4588
- promptTitle: template.title,
4589
- promptMessage: replaceParameters(template.description || '', parameters),
4616
+ promptTitle: task.title,
4617
+ promptMessage: replaceParameters(task.description || '', parameters),
4590
4618
  defaultValue: replaceParameters(preparedContent, parameters),
4591
4619
  // TODO: [🧠] !! Figure out how to define placeholder in .book.md file
4592
4620
  placeholder: undefined,
4593
4621
  priority: priority,
4594
4622
  }))];
4595
4623
  case 23:
4596
- // TODO: [🌹] When making next attempt for `DIALOG TEMPLATE`, preserve the previous user input
4624
+ // TODO: [🌹] When making next attempt for `DIALOG TASK`, preserve the previous user input
4597
4625
  _j.$resultString = _t.sent();
4598
4626
  return [3 /*break*/, 25];
4599
- case 24: throw new PipelineExecutionError(spaceTrim$1(function (block) { return "\n Unknown execution type \"".concat(template.templateType, "\"\n\n ").concat(block(pipelineIdentification), "\n "); }));
4627
+ case 24: throw new PipelineExecutionError(spaceTrim$1(function (block) { return "\n Unknown execution type \"".concat(task.taskType, "\"\n\n ").concat(block(pipelineIdentification), "\n "); }));
4600
4628
  case 25:
4601
- if (!(!isJokerAttempt && template.postprocessingFunctionNames)) return [3 /*break*/, 42];
4629
+ if (!(!isJokerAttempt && task.postprocessingFunctionNames)) return [3 /*break*/, 42];
4602
4630
  _t.label = 26;
4603
4631
  case 26:
4604
4632
  _t.trys.push([26, 40, 41, 42]);
4605
- _k = (e_3 = void 0, __values(template.postprocessingFunctionNames)), _l = _k.next();
4633
+ _k = (e_3 = void 0, __values(task.postprocessingFunctionNames)), _l = _k.next();
4606
4634
  _t.label = 27;
4607
4635
  case 27:
4608
4636
  if (!!_l.done) return [3 /*break*/, 39];
@@ -4619,13 +4647,13 @@ function executeAttempts(options) {
4619
4647
  _t.label = 30;
4620
4648
  case 30:
4621
4649
  _t.trys.push([30, 32, , 33]);
4622
- _p = $ongoingTemplateResult;
4650
+ _p = $ongoingTaskResult;
4623
4651
  return [4 /*yield*/, scriptTools.execute({
4624
4652
  scriptLanguage: "javascript" /* <- TODO: Try it in each languages; In future allow postprocessing with arbitrary combination of languages to combine */,
4625
4653
  script: "".concat(functionName, "(resultString)"),
4626
4654
  parameters: {
4627
- resultString: $ongoingTemplateResult.$resultString || '',
4628
- // Note: No ...parametersForTemplate, because working with result only
4655
+ resultString: $ongoingTaskResult.$resultString || '',
4656
+ // Note: No ...parametersForTask, because working with result only
4629
4657
  },
4630
4658
  })];
4631
4659
  case 31:
@@ -4641,7 +4669,7 @@ function executeAttempts(options) {
4641
4669
  throw error_2;
4642
4670
  }
4643
4671
  postprocessingError = error_2;
4644
- $ongoingTemplateResult.$scriptPipelineExecutionErrors.push(error_2);
4672
+ $ongoingTaskResult.$scriptPipelineExecutionErrors.push(error_2);
4645
4673
  return [3 /*break*/, 33];
4646
4674
  case 33:
4647
4675
  _o = _m.next();
@@ -4678,12 +4706,12 @@ function executeAttempts(options) {
4678
4706
  return [7 /*endfinally*/];
4679
4707
  case 42:
4680
4708
  // TODO: [💝] Unite object for expecting amount and format
4681
- if (template.format) {
4682
- if (template.format === 'JSON') {
4683
- if (!isValidJsonString($ongoingTemplateResult.$resultString || '')) {
4709
+ if (task.format) {
4710
+ if (task.format === 'JSON') {
4711
+ if (!isValidJsonString($ongoingTaskResult.$resultString || '')) {
4684
4712
  // TODO: [🏢] Do more universally via `FormatDefinition`
4685
4713
  try {
4686
- $ongoingTemplateResult.$resultString = extractJsonBlock($ongoingTemplateResult.$resultString || '');
4714
+ $ongoingTaskResult.$resultString = extractJsonBlock($ongoingTaskResult.$resultString || '');
4687
4715
  }
4688
4716
  catch (error) {
4689
4717
  throw new ExpectError(spaceTrim$1(function (block) { return "\n Expected valid JSON string\n\n ".concat(block(
@@ -4692,12 +4720,12 @@ function executeAttempts(options) {
4692
4720
  }
4693
4721
  }
4694
4722
  else {
4695
- throw new UnexpectedError(spaceTrim$1(function (block) { return "\n Unknown format \"".concat(template.format, "\"\n\n ").concat(block(pipelineIdentification), "\n "); }));
4723
+ throw new UnexpectedError(spaceTrim$1(function (block) { return "\n Unknown format \"".concat(task.format, "\"\n\n ").concat(block(pipelineIdentification), "\n "); }));
4696
4724
  }
4697
4725
  }
4698
4726
  // TODO: [💝] Unite object for expecting amount and format
4699
- if (template.expectations) {
4700
- checkExpectations(template.expectations, $ongoingTemplateResult.$resultString || '');
4727
+ if (task.expectations) {
4728
+ checkExpectations(task.expectations, $ongoingTaskResult.$resultString || '');
4701
4729
  }
4702
4730
  return [2 /*return*/, "break-attempts"];
4703
4731
  case 43:
@@ -4705,38 +4733,38 @@ function executeAttempts(options) {
4705
4733
  if (!(error_3 instanceof ExpectError)) {
4706
4734
  throw error_3;
4707
4735
  }
4708
- $ongoingTemplateResult.$expectError = error_3;
4736
+ $ongoingTaskResult.$expectError = error_3;
4709
4737
  return [3 /*break*/, 45];
4710
4738
  case 44:
4711
4739
  if (!isJokerAttempt &&
4712
- template.templateType === 'PROMPT_TEMPLATE' &&
4713
- $ongoingTemplateResult.$prompt
4740
+ task.taskType === 'PROMPT_TASK' &&
4741
+ $ongoingTaskResult.$prompt
4714
4742
  // <- Note: [2] When some expected parameter is not defined, error will occur in replaceParameters
4715
4743
  // In that case we don’t want to make a report about it because it’s not a llm execution error
4716
4744
  ) {
4717
- // TODO: [🧠] Maybe put other templateTypes into report
4745
+ // TODO: [🧠] Maybe put other taskTypes into report
4718
4746
  $executionReport.promptExecutions.push({
4719
- prompt: __assign({}, $ongoingTemplateResult.$prompt),
4720
- result: $ongoingTemplateResult.$result || undefined,
4721
- error: $ongoingTemplateResult.$expectError === null
4747
+ prompt: __assign({}, $ongoingTaskResult.$prompt),
4748
+ result: $ongoingTaskResult.$result || undefined,
4749
+ error: $ongoingTaskResult.$expectError === null
4722
4750
  ? undefined
4723
- : serializeError($ongoingTemplateResult.$expectError),
4751
+ : serializeError($ongoingTaskResult.$expectError),
4724
4752
  });
4725
4753
  }
4726
4754
  return [7 /*endfinally*/];
4727
4755
  case 45:
4728
- if ($ongoingTemplateResult.$expectError !== null && attempt === maxAttempts - 1) {
4756
+ if ($ongoingTaskResult.$expectError !== null && attempt === maxAttempts - 1) {
4729
4757
  throw new PipelineExecutionError(spaceTrim$1(function (block) {
4730
4758
  var _a, _b, _c;
4731
- 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) || '')
4759
+ 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) || '')
4732
4760
  .split('\n')
4733
4761
  .map(function (line) { return "> ".concat(line); })
4734
- .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) || '')
4762
+ .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) || '')
4735
4763
  .split('\n')
4736
4764
  .map(function (line) { return "> ".concat(line); })
4737
- .join('\n')), "\n\n Last result:\n ").concat(block($ongoingTemplateResult.$resultString === null
4765
+ .join('\n')), "\n\n Last result:\n ").concat(block($ongoingTaskResult.$resultString === null
4738
4766
  ? 'null'
4739
- : $ongoingTemplateResult.$resultString
4767
+ : $ongoingTaskResult.$resultString
4740
4768
  .split('\n')
4741
4769
  .map(function (line) { return "> ".concat(line); })
4742
4770
  .join('\n')), "\n ---\n ");
@@ -4761,10 +4789,10 @@ function executeAttempts(options) {
4761
4789
  attempt++;
4762
4790
  return [3 /*break*/, 1];
4763
4791
  case 4:
4764
- if ($ongoingTemplateResult.$resultString === null) {
4792
+ if ($ongoingTaskResult.$resultString === null) {
4765
4793
  throw new UnexpectedError(spaceTrim$1(function (block) { return "\n Something went wrong and prompt result is null\n\n ".concat(block(pipelineIdentification), "\n "); }));
4766
4794
  }
4767
- return [2 /*return*/, $ongoingTemplateResult.$resultString];
4795
+ return [2 /*return*/, $ongoingTaskResult.$resultString];
4768
4796
  }
4769
4797
  });
4770
4798
  });
@@ -4780,36 +4808,36 @@ function executeAttempts(options) {
4780
4808
  */
4781
4809
  function executeFormatSubvalues(options) {
4782
4810
  return __awaiter(this, void 0, void 0, function () {
4783
- var template, jokerParameterNames, parameters, priority, csvSettings, pipelineIdentification, parameterValue, formatDefinition, subvalueDefinition, formatSettings, resultString;
4811
+ var task, jokerParameterNames, parameters, priority, csvSettings, pipelineIdentification, parameterValue, formatDefinition, subvalueDefinition, formatSettings, resultString;
4784
4812
  var _this = this;
4785
4813
  return __generator(this, function (_a) {
4786
4814
  switch (_a.label) {
4787
4815
  case 0:
4788
- template = options.template, jokerParameterNames = options.jokerParameterNames, parameters = options.parameters, priority = options.priority, csvSettings = options.csvSettings, pipelineIdentification = options.pipelineIdentification;
4789
- if (template.foreach === undefined) {
4816
+ task = options.task, jokerParameterNames = options.jokerParameterNames, parameters = options.parameters, priority = options.priority, csvSettings = options.csvSettings, pipelineIdentification = options.pipelineIdentification;
4817
+ if (task.foreach === undefined) {
4790
4818
  return [2 /*return*/, /* not await */ executeAttempts(options)];
4791
4819
  }
4792
4820
  if (jokerParameterNames.length !== 0) {
4793
4821
  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 "); }));
4794
4822
  }
4795
- parameterValue = parameters[template.foreach.parameterName] || '';
4823
+ parameterValue = parameters[task.foreach.parameterName] || '';
4796
4824
  formatDefinition = FORMAT_DEFINITIONS.find(function (formatDefinition) {
4797
- return __spreadArray([formatDefinition.formatName], __read((formatDefinition.aliases || [])), false).includes(template.foreach.formatName);
4825
+ return __spreadArray([formatDefinition.formatName], __read((formatDefinition.aliases || [])), false).includes(task.foreach.formatName);
4798
4826
  });
4799
4827
  if (formatDefinition === undefined) {
4800
4828
  throw new UnexpectedError(
4801
4829
  // <- TODO: [🧠][🧐] Should be formats fixed per promptbook version or behave as plugins (=> change UnexpectedError)
4802
- 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; })
4830
+ 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; })
4803
4831
  .map(function (formatName) { return "- ".concat(formatName); })
4804
4832
  .join('\n')), "\n\n [\u26F7] This should never happen because format name should be validated during parsing\n\n ").concat(block(pipelineIdentification), "\n "); }));
4805
4833
  }
4806
4834
  subvalueDefinition = formatDefinition.subvalueDefinitions.find(function (subvalueDefinition) {
4807
- return __spreadArray([subvalueDefinition.subvalueName], __read((subvalueDefinition.aliases || [])), false).includes(template.foreach.subformatName);
4835
+ return __spreadArray([subvalueDefinition.subvalueName], __read((subvalueDefinition.aliases || [])), false).includes(task.foreach.subformatName);
4808
4836
  });
4809
4837
  if (subvalueDefinition === undefined) {
4810
4838
  throw new UnexpectedError(
4811
4839
  // <- TODO: [🧠][🧐] Should be formats fixed per promptbook version or behave as plugins (=> change UnexpectedError)
4812
- 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
4840
+ 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
4813
4841
  .map(function (subvalueDefinition) { return subvalueDefinition.subvalueName; })
4814
4842
  .map(function (subvalueName) { return "- ".concat(subvalueName); })
4815
4843
  .join('\n')), "\n\n [\u26F7] This should never happen because subformat name should be validated during parsing\n\n ").concat(block(pipelineIdentification), "\n "); }));
@@ -4818,7 +4846,7 @@ function executeFormatSubvalues(options) {
4818
4846
  formatSettings = csvSettings;
4819
4847
  // <- TODO: [🤹‍♂️] More universal, make simmilar pattern for other formats for example \n vs \r\n in text
4820
4848
  }
4821
- return [4 /*yield*/, subvalueDefinition.mapValues(parameterValue, template.foreach.outputSubparameterName, formatSettings, function (subparameters, index) { return __awaiter(_this, void 0, void 0, function () {
4849
+ return [4 /*yield*/, subvalueDefinition.mapValues(parameterValue, task.foreach.outputSubparameterName, formatSettings, function (subparameters, index) { return __awaiter(_this, void 0, void 0, function () {
4822
4850
  var mappedParameters, allSubparameters, subresultString;
4823
4851
  return __generator(this, function (_a) {
4824
4852
  switch (_a.label) {
@@ -4827,7 +4855,7 @@ function executeFormatSubvalues(options) {
4827
4855
  // TODO: When done [🐚] Report progress also for each subvalue here
4828
4856
  try {
4829
4857
  mappedParameters = mapAvailableToExpectedParameters({
4830
- expectedParameters: Object.fromEntries(template.foreach.inputSubparameterNames.map(function (subparameterName) { return [subparameterName, null]; })),
4858
+ expectedParameters: Object.fromEntries(task.foreach.inputSubparameterNames.map(function (subparameterName) { return [subparameterName, null]; })),
4831
4859
  availableParameters: subparameters,
4832
4860
  });
4833
4861
  }
@@ -4860,7 +4888,7 @@ function executeFormatSubvalues(options) {
4860
4888
  *
4861
4889
  * @private internal utility of `createPipelineExecutor`
4862
4890
  */
4863
- function getContextForTemplate(template) {
4891
+ function getContextForTask(task) {
4864
4892
  return __awaiter(this, void 0, void 0, function () {
4865
4893
  return __generator(this, function (_a) {
4866
4894
  return [2 /*return*/, RESERVED_PARAMETER_MISSING_VALUE /* <- TODO: [🏍] Implement */];
@@ -4873,15 +4901,10 @@ function getContextForTemplate(template) {
4873
4901
  *
4874
4902
  * @private internal utility of `createPipelineExecutor`
4875
4903
  */
4876
- function getKnowledgeForTemplate(options) {
4904
+ function getExamplesForTask(task) {
4877
4905
  return __awaiter(this, void 0, void 0, function () {
4878
- var preparedPipeline;
4879
4906
  return __generator(this, function (_a) {
4880
- preparedPipeline = options.preparedPipeline, options.template;
4881
- return [2 /*return*/, preparedPipeline.knowledgePieces.map(function (_a) {
4882
- var content = _a.content;
4883
- return "- ".concat(content);
4884
- }).join('\n')];
4907
+ return [2 /*return*/, RESERVED_PARAMETER_MISSING_VALUE /* <- TODO: [♨] Implement */];
4885
4908
  });
4886
4909
  });
4887
4910
  }
@@ -4891,10 +4914,15 @@ function getKnowledgeForTemplate(options) {
4891
4914
  *
4892
4915
  * @private internal utility of `createPipelineExecutor`
4893
4916
  */
4894
- function getExamplesForTemplate(template) {
4917
+ function getKnowledgeForTask(options) {
4895
4918
  return __awaiter(this, void 0, void 0, function () {
4919
+ var preparedPipeline;
4896
4920
  return __generator(this, function (_a) {
4897
- return [2 /*return*/, RESERVED_PARAMETER_MISSING_VALUE /* <- TODO: [♨] Implement */];
4921
+ preparedPipeline = options.preparedPipeline, options.task;
4922
+ return [2 /*return*/, preparedPipeline.knowledgePieces.map(function (_a) {
4923
+ var content = _a.content;
4924
+ return "- ".concat(content);
4925
+ }).join('\n')];
4898
4926
  });
4899
4927
  });
4900
4928
  }
@@ -4904,21 +4932,21 @@ function getExamplesForTemplate(template) {
4904
4932
  *
4905
4933
  * @private internal utility of `createPipelineExecutor`
4906
4934
  */
4907
- function getReservedParametersForTemplate(options) {
4935
+ function getReservedParametersForTask(options) {
4908
4936
  return __awaiter(this, void 0, void 0, function () {
4909
- var preparedPipeline, template, pipelineIdentification, context, knowledge, examples, currentDate, modelName, reservedParameters, _loop_1, RESERVED_PARAMETER_NAMES_1, RESERVED_PARAMETER_NAMES_1_1, parameterName;
4937
+ var preparedPipeline, task, pipelineIdentification, context, knowledge, examples, currentDate, modelName, reservedParameters, _loop_1, RESERVED_PARAMETER_NAMES_1, RESERVED_PARAMETER_NAMES_1_1, parameterName;
4910
4938
  var e_1, _a;
4911
4939
  return __generator(this, function (_b) {
4912
4940
  switch (_b.label) {
4913
4941
  case 0:
4914
- preparedPipeline = options.preparedPipeline, template = options.template, pipelineIdentification = options.pipelineIdentification;
4915
- return [4 /*yield*/, getContextForTemplate()];
4942
+ preparedPipeline = options.preparedPipeline, task = options.task, pipelineIdentification = options.pipelineIdentification;
4943
+ return [4 /*yield*/, getContextForTask()];
4916
4944
  case 1:
4917
4945
  context = _b.sent();
4918
- return [4 /*yield*/, getKnowledgeForTemplate({ preparedPipeline: preparedPipeline, template: template })];
4946
+ return [4 /*yield*/, getKnowledgeForTask({ preparedPipeline: preparedPipeline, task: task })];
4919
4947
  case 2:
4920
4948
  knowledge = _b.sent();
4921
- return [4 /*yield*/, getExamplesForTemplate()];
4949
+ return [4 /*yield*/, getExamplesForTask()];
4922
4950
  case 3:
4923
4951
  examples = _b.sent();
4924
4952
  currentDate = new Date().toISOString();
@@ -4961,31 +4989,31 @@ function getReservedParametersForTemplate(options) {
4961
4989
  *
4962
4990
  * @private internal utility of `createPipelineExecutor`
4963
4991
  */
4964
- function executeTemplate(options) {
4992
+ function executeTask(options) {
4965
4993
  return __awaiter(this, void 0, void 0, function () {
4966
- 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;
4994
+ 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;
4967
4995
  var e_1, _g, _h;
4968
4996
  return __generator(this, function (_j) {
4969
4997
  switch (_j.label) {
4970
4998
  case 0:
4971
- 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;
4972
- name = "pipeline-executor-frame-".concat(currentTemplate.name);
4973
- title = currentTemplate.title;
4974
- priority = preparedPipeline.templates.length - preparedPipeline.templates.indexOf(currentTemplate);
4999
+ 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;
5000
+ name = "pipeline-executor-frame-".concat(currentTask.name);
5001
+ title = currentTask.title;
5002
+ priority = preparedPipeline.tasks.length - preparedPipeline.tasks.indexOf(currentTask);
4975
5003
  return [4 /*yield*/, onProgress({
4976
5004
  name: name,
4977
5005
  title: title,
4978
5006
  isStarted: false,
4979
5007
  isDone: false,
4980
- templateType: currentTemplate.templateType,
4981
- parameterName: currentTemplate.resultingParameterName,
5008
+ taskType: currentTask.taskType,
5009
+ parameterName: currentTask.resultingParameterName,
4982
5010
  parameterValue: null,
4983
5011
  // <- [🍸]
4984
5012
  })];
4985
5013
  case 1:
4986
5014
  _j.sent();
4987
- usedParameterNames = extractParameterNamesFromTemplate(currentTemplate);
4988
- dependentParameterNames = new Set(currentTemplate.dependentParameterNames);
5015
+ usedParameterNames = extractParameterNamesFromTask(currentTask);
5016
+ dependentParameterNames = new Set(currentTask.dependentParameterNames);
4989
5017
  // TODO: [👩🏾‍🤝‍👩🏻] Use here `mapAvailableToExpectedParameters`
4990
5018
  if (union(difference(usedParameterNames, dependentParameterNames), difference(dependentParameterNames, usedParameterNames)).size !== 0) {
4991
5019
  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)
@@ -4996,9 +5024,9 @@ function executeTemplate(options) {
4996
5024
  }
4997
5025
  _c = (_b = Object).freeze;
4998
5026
  _d = [{}];
4999
- return [4 /*yield*/, getReservedParametersForTemplate({
5027
+ return [4 /*yield*/, getReservedParametersForTask({
5000
5028
  preparedPipeline: preparedPipeline,
5001
- template: currentTemplate,
5029
+ task: currentTask,
5002
5030
  pipelineIdentification: pipelineIdentification,
5003
5031
  })];
5004
5032
  case 2:
@@ -5016,11 +5044,11 @@ function executeTemplate(options) {
5016
5044
  else if (!definedParameterNames.has(parameterName) && usedParameterNames.has(parameterName)) {
5017
5045
  // Houston, we have a problem
5018
5046
  // Note: Checking part is also done in `validatePipeline`, but it’s good to doublecheck
5019
- 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 "); }));
5047
+ 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 "); }));
5020
5048
  }
5021
5049
  };
5022
5050
  try {
5023
- // Note: [2] Check that all used parameters are defined and removing unused parameters for this template
5051
+ // Note: [2] Check that all used parameters are defined and removing unused parameters for this task
5024
5052
  // TODO: [👩🏾‍🤝‍👩🏻] Use here `mapAvailableToExpectedParameters`
5025
5053
  for (_e = __values(Array.from(union(definedParameterNames, usedParameterNames, dependentParameterNames))), _f = _e.next(); !_f.done; _f = _e.next()) {
5026
5054
  parameterName = _f.value;
@@ -5036,18 +5064,16 @@ function executeTemplate(options) {
5036
5064
  }
5037
5065
  // 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
5038
5066
  Object.freeze(parameters);
5039
- maxAttempts = currentTemplate.templateType === 'DIALOG_TEMPLATE' ? Infinity : maxExecutionAttempts;
5040
- jokerParameterNames = currentTemplate.jokerParameterNames || [];
5041
- preparedContent = (currentTemplate.preparedContent || '{content}')
5042
- .split('{content}')
5043
- .join(currentTemplate.content);
5067
+ maxAttempts = currentTask.taskType === 'DIALOG_TASK' ? Infinity : maxExecutionAttempts;
5068
+ jokerParameterNames = currentTask.jokerParameterNames || [];
5069
+ preparedContent = (currentTask.preparedContent || '{content}').split('{content}').join(currentTask.content);
5044
5070
  return [4 /*yield*/, executeFormatSubvalues({
5045
5071
  jokerParameterNames: jokerParameterNames,
5046
5072
  priority: priority,
5047
5073
  maxAttempts: maxAttempts,
5048
5074
  preparedContent: preparedContent,
5049
5075
  parameters: parameters,
5050
- template: currentTemplate,
5076
+ task: currentTask,
5051
5077
  preparedPipeline: preparedPipeline,
5052
5078
  tools: tools,
5053
5079
  $executionReport: $executionReport,
@@ -5060,15 +5086,15 @@ function executeTemplate(options) {
5060
5086
  title: title,
5061
5087
  isStarted: true,
5062
5088
  isDone: true,
5063
- templateType: currentTemplate.templateType,
5064
- parameterName: currentTemplate.resultingParameterName,
5089
+ taskType: currentTask.taskType,
5090
+ parameterName: currentTask.resultingParameterName,
5065
5091
  parameterValue: resultString,
5066
5092
  // <- [🍸]
5067
5093
  })];
5068
5094
  case 4:
5069
5095
  _j.sent();
5070
5096
  return [2 /*return*/, Object.freeze((_h = {},
5071
- _h[currentTemplate.resultingParameterName] =
5097
+ _h[currentTask.resultingParameterName] =
5072
5098
  // <- Note: [👩‍👩‍👧] No need to detect parameter collision here because pipeline checks logic consistency during construction
5073
5099
  resultString,
5074
5100
  _h))];
@@ -5095,7 +5121,7 @@ function filterJustOutputParameters(options) {
5095
5121
  var _loop_1 = function (parameter) {
5096
5122
  if (parametersToPass[parameter.name] === undefined) {
5097
5123
  // [4]
5098
- $warnings.push(new PipelineExecutionError(spaceTrim$1(function (block) { return "\n Parameter {".concat(parameter.name, "} should be an output parameter, but it was not generated during pipeline execution\n\n ").concat(block(pipelineIdentification), "\n "); })));
5124
+ $warnings.push(new PipelineExecutionError(spaceTrim$1(function (block) { return "\n Parameter `{".concat(parameter.name, "}` should be an output parameter, but it was not generated during pipeline execution\n\n ").concat(block(pipelineIdentification), "\n "); })));
5099
5125
  return "continue";
5100
5126
  }
5101
5127
  outputParameters[parameter.name] = parametersToPass[parameter.name] || '';
@@ -5130,7 +5156,7 @@ function filterJustOutputParameters(options) {
5130
5156
  */
5131
5157
  function executePipeline(options) {
5132
5158
  return __awaiter(this, void 0, void 0, function () {
5133
- 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;
5159
+ 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;
5134
5160
  var e_1, _f, e_2, _g;
5135
5161
  return __generator(this, function (_h) {
5136
5162
  switch (_h.label) {
@@ -5182,7 +5208,7 @@ function executePipeline(options) {
5182
5208
  case 6: return [2 /*return*/, $asDeeplyFrozenSerializableJson("Unuccessful PipelineExecutorResult (with missing parameter {".concat(parameter.name, "}) PipelineExecutorResult"), {
5183
5209
  isSuccessful: false,
5184
5210
  errors: __spreadArray([
5185
- new PipelineExecutionError("Parameter {".concat(parameter.name, "} is required as an input parameter"))
5211
+ new PipelineExecutionError("Parameter `{".concat(parameter.name, "}` is required as an input parameter"))
5186
5212
  ], __read(errors), false).map(serializeError),
5187
5213
  warnings: [],
5188
5214
  executionReport: executionReport,
@@ -5230,7 +5256,7 @@ function executePipeline(options) {
5230
5256
  case 3: return [2 /*return*/, { value: $asDeeplyFrozenSerializableJson(spaceTrim$1(function (block) { return "\n Unuccessful PipelineExecutorResult (with extra parameter {".concat(parameter.name, "}) PipelineExecutorResult\n\n ").concat(block(pipelineIdentification), "\n "); }), {
5231
5257
  isSuccessful: false,
5232
5258
  errors: __spreadArray([
5233
- new PipelineExecutionError(spaceTrim$1(function (block) { return "\n Parameter {".concat(parameter.name, "} is passed as input parameter but it is not input\n\n ").concat(block(pipelineIdentification), "\n "); }))
5259
+ new PipelineExecutionError(spaceTrim$1(function (block) { return "\n Parameter `{".concat(parameter.name, "}` is passed as input parameter but it is not input\n\n ").concat(block(pipelineIdentification), "\n "); }))
5234
5260
  ], __read(errors), false).map(serializeError),
5235
5261
  warnings: warnings.map(serializeError),
5236
5262
  executionReport: executionReport,
@@ -5284,11 +5310,11 @@ function executePipeline(options) {
5284
5310
  var name = _a.name;
5285
5311
  return name;
5286
5312
  });
5287
- unresovedTemplates_1 = __spreadArray([], __read(preparedPipeline.templates), false);
5313
+ unresovedTasks_1 = __spreadArray([], __read(preparedPipeline.tasks), false);
5288
5314
  resolving_1 = [];
5289
5315
  loopLimit = LOOP_LIMIT;
5290
5316
  _loop_2 = function () {
5291
- var currentTemplate, work_1;
5317
+ var currentTask, work_1;
5292
5318
  return __generator(this, function (_k) {
5293
5319
  switch (_k.label) {
5294
5320
  case 0:
@@ -5296,31 +5322,41 @@ function executePipeline(options) {
5296
5322
  // Note: Really UnexpectedError not LimitReachedError - this should be catched during validatePipeline
5297
5323
  throw new UnexpectedError(spaceTrim$1(function (block) { return "\n Loop limit reached during resolving parameters pipeline execution\n\n ".concat(block(pipelineIdentification), "\n "); }));
5298
5324
  }
5299
- currentTemplate = unresovedTemplates_1.find(function (template) {
5300
- return template.dependentParameterNames.every(function (name) {
5325
+ currentTask = unresovedTasks_1.find(function (task) {
5326
+ return task.dependentParameterNames.every(function (name) {
5301
5327
  return __spreadArray(__spreadArray([], __read(resovedParameterNames_1), false), __read(RESERVED_PARAMETER_NAMES), false).includes(name);
5302
5328
  });
5303
5329
  });
5304
- if (!(!currentTemplate && resolving_1.length === 0)) return [3 /*break*/, 1];
5330
+ if (!(!currentTask && resolving_1.length === 0)) return [3 /*break*/, 1];
5305
5331
  throw new UnexpectedError(
5306
5332
  // TODO: [🐎] DRY
5307
- 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
5333
+ 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
5308
5334
  .map(function (_a) {
5309
5335
  var resultingParameterName = _a.resultingParameterName, dependentParameterNames = _a.dependentParameterNames;
5310
- return "- Parameter {".concat(resultingParameterName, "} which depends on ").concat(dependentParameterNames
5311
- .map(function (dependentParameterName) { return "{".concat(dependentParameterName, "}"); })
5336
+ return "- Parameter `{".concat(resultingParameterName, "}` which depends on ").concat(dependentParameterNames
5337
+ .map(function (dependentParameterName) { return "`{".concat(dependentParameterName, "}`"); })
5312
5338
  .join(' and '));
5313
5339
  })
5314
- .join('\n')), "\n\n Resolved:\n ").concat(block(resovedParameterNames_1.map(function (name) { return "- Parameter {".concat(name, "}"); }).join('\n')), "\n\n Note: This should be catched in `validatePipeline`\n "); }));
5340
+ .join('\n')), "\n\n **Resolved:**\n ").concat(block(resovedParameterNames_1
5341
+ .filter(function (name) {
5342
+ return !RESERVED_PARAMETER_NAMES.includes(name);
5343
+ })
5344
+ .map(function (name) { return "- Parameter `{".concat(name, "}`"); })
5345
+ .join('\n')), "\n\n **Reserved (which are available):**\n ").concat(block(resovedParameterNames_1
5346
+ .filter(function (name) {
5347
+ return RESERVED_PARAMETER_NAMES.includes(name);
5348
+ })
5349
+ .map(function (name) { return "- Parameter `{".concat(name, "}`"); })
5350
+ .join('\n')), "\n\n *Note: This should be catched in `validatePipeline`*\n "); }));
5315
5351
  case 1:
5316
- if (!!currentTemplate) return [3 /*break*/, 3];
5352
+ if (!!currentTask) return [3 /*break*/, 3];
5317
5353
  /* [🤹‍♂️] */ return [4 /*yield*/, Promise.race(resolving_1)];
5318
5354
  case 2:
5319
5355
  /* [🤹‍♂️] */ _k.sent();
5320
5356
  return [3 /*break*/, 4];
5321
5357
  case 3:
5322
- unresovedTemplates_1 = unresovedTemplates_1.filter(function (template) { return template !== currentTemplate; });
5323
- work_1 = executeTemplate(__assign(__assign({}, options), { currentTemplate: currentTemplate, preparedPipeline: preparedPipeline, parametersToPass: parametersToPass, tools: tools, onProgress: function (progress) {
5358
+ unresovedTasks_1 = unresovedTasks_1.filter(function (task) { return task !== currentTask; });
5359
+ work_1 = executeTask(__assign(__assign({}, options), { currentTask: currentTask, preparedPipeline: preparedPipeline, parametersToPass: parametersToPass, tools: tools, onProgress: function (progress) {
5324
5360
  if (isReturned) {
5325
5361
  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)
5326
5362
  .split('\n')
@@ -5330,16 +5366,16 @@ function executePipeline(options) {
5330
5366
  if (onProgress) {
5331
5367
  onProgress(progress);
5332
5368
  }
5333
- }, $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 "); }) }))
5369
+ }, $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 "); }) }))
5334
5370
  .then(function (newParametersToPass) {
5335
5371
  parametersToPass = __assign(__assign({}, newParametersToPass), parametersToPass);
5336
- resovedParameterNames_1 = __spreadArray(__spreadArray([], __read(resovedParameterNames_1), false), [currentTemplate.resultingParameterName], false);
5372
+ resovedParameterNames_1 = __spreadArray(__spreadArray([], __read(resovedParameterNames_1), false), [currentTask.resultingParameterName], false);
5337
5373
  })
5338
5374
  .then(function () {
5339
5375
  resolving_1 = resolving_1.filter(function (w) { return w !== work_1; });
5340
5376
  });
5341
5377
  // <- Note: Errors are catched here [3]
5342
- // 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
5378
+ // 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
5343
5379
  resolving_1.push(work_1);
5344
5380
  _k.label = 4;
5345
5381
  case 4: return [2 /*return*/];
@@ -5348,7 +5384,7 @@ function executePipeline(options) {
5348
5384
  };
5349
5385
  _h.label = 21;
5350
5386
  case 21:
5351
- if (!(unresovedTemplates_1.length > 0)) return [3 /*break*/, 23];
5387
+ if (!(unresovedTasks_1.length > 0)) return [3 /*break*/, 23];
5352
5388
  return [5 /*yield**/, _loop_2()];
5353
5389
  case 22:
5354
5390
  _h.sent();
@@ -5506,6 +5542,9 @@ var markdownScraperMetadata = $deepFreeze({
5506
5542
  * @public exported from `@promptbook/cli`
5507
5543
  */
5508
5544
  $scrapersMetadataRegister.register(markdownScraperMetadata);
5545
+ /**
5546
+ * Note: [💞] Ignore a discrepancy between file name and entity name
5547
+ */
5509
5548
 
5510
5549
  /**
5511
5550
  * Scraper for markdown files
@@ -5700,6 +5739,7 @@ var createMarkdownScraper = Object.assign(function (tools, options) {
5700
5739
  var _MarkdownScraperRegistration = $scrapersRegister.register(createMarkdownScraper);
5701
5740
  /**
5702
5741
  * TODO: [🎶] Naming "constructor" vs "creator" vs "factory"
5742
+ * Note: [💞] Ignore a discrepancy between file name and entity name
5703
5743
  */
5704
5744
 
5705
5745
  /**