@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/umd/index.umd.js CHANGED
@@ -22,9 +22,10 @@
22
22
  *
23
23
  * @see https://github.com/webgptorg/promptbook
24
24
  */
25
- var PROMPTBOOK_ENGINE_VERSION = '0.74.0-13';
25
+ var PROMPTBOOK_ENGINE_VERSION = '0.75.0-1';
26
26
  /**
27
27
  * TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
28
+ * Note: [💞] Ignore a discrepancy between file name and entity name
28
29
  */
29
30
 
30
31
  /*! *****************************************************************************
@@ -357,7 +358,7 @@
357
358
  * TODO: [🏢] Make this logic part of `JsonFormatDefinition` or `isValidJsonString`
358
359
  */
359
360
 
360
- 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"}];
361
+ 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"}];
361
362
 
362
363
  /**
363
364
  * Prettify the html code
@@ -402,7 +403,7 @@
402
403
  */
403
404
  function pipelineJsonToString(pipelineJson) {
404
405
  var e_1, _a, e_2, _b, e_3, _c, e_4, _d, e_5, _e, e_6, _f;
405
- var title = pipelineJson.title, pipelineUrl = pipelineJson.pipelineUrl, bookVersion = pipelineJson.bookVersion, description = pipelineJson.description, parameters = pipelineJson.parameters, templates = pipelineJson.templates;
406
+ var title = pipelineJson.title, pipelineUrl = pipelineJson.pipelineUrl, bookVersion = pipelineJson.bookVersion, description = pipelineJson.description, parameters = pipelineJson.parameters, tasks = pipelineJson.tasks;
406
407
  var pipelineString = "# ".concat(title);
407
408
  if (description) {
408
409
  pipelineString += '\n\n';
@@ -452,13 +453,13 @@
452
453
  pipelineString += '\n\n';
453
454
  pipelineString += commands.map(function (command) { return "- ".concat(command); }).join('\n');
454
455
  try {
455
- for (var templates_1 = __values(templates), templates_1_1 = templates_1.next(); !templates_1_1.done; templates_1_1 = templates_1.next()) {
456
- var template = templates_1_1.value;
456
+ for (var tasks_1 = __values(tasks), tasks_1_1 = tasks_1.next(); !tasks_1_1.done; tasks_1_1 = tasks_1.next()) {
457
+ var template = tasks_1_1.value;
457
458
  var
458
459
  /* Note: Not using:> name, */
459
460
  title_1 = template.title, description_1 = template.description,
460
461
  /* Note: dependentParameterNames, */
461
- jokers = template.jokerParameterNames, templateType = template.templateType, content = template.content, postprocessing = template.postprocessingFunctionNames, expectations = template.expectations, format = template.format, resultingParameterName = template.resultingParameterName;
462
+ jokers = template.jokerParameterNames, taskType = template.taskType, content = template.content, postprocessing = template.postprocessingFunctionNames, expectations = template.expectations, format = template.format, resultingParameterName = template.resultingParameterName;
462
463
  pipelineString += '\n\n';
463
464
  pipelineString += "## ".concat(title_1);
464
465
  if (description_1) {
@@ -467,7 +468,7 @@
467
468
  }
468
469
  var commands_1 = [];
469
470
  var contentLanguage = 'text';
470
- if (templateType === 'PROMPT_TEMPLATE') {
471
+ if (taskType === 'PROMPT_TASK') {
471
472
  var modelRequirements = template.modelRequirements;
472
473
  var _l = modelRequirements || {}, modelName = _l.modelName, modelVariant = _l.modelVariant;
473
474
  commands_1.push("EXECUTE PROMPT TEMPLATE");
@@ -478,11 +479,11 @@
478
479
  commands_1.push("MODEL NAME `".concat(modelName, "`"));
479
480
  }
480
481
  }
481
- else if (templateType === 'SIMPLE_TEMPLATE') {
482
+ else if (taskType === 'SIMPLE_TASK') {
482
483
  commands_1.push("SIMPLE TEMPLATE");
483
484
  // Note: Nothing special here
484
485
  }
485
- else if (templateType === 'SCRIPT_TEMPLATE') {
486
+ else if (taskType === 'SCRIPT_TASK') {
486
487
  commands_1.push("SCRIPT TEMPLATE");
487
488
  if (template.contentLanguage) {
488
489
  contentLanguage = template.contentLanguage;
@@ -491,7 +492,7 @@
491
492
  contentLanguage = '';
492
493
  }
493
494
  }
494
- else if (templateType === 'DIALOG_TEMPLATE') {
495
+ else if (taskType === 'DIALOG_TASK') {
495
496
  commands_1.push("DIALOG TEMPLATE");
496
497
  // Note: Nothing special here
497
498
  } // <- }else if([🅱]
@@ -573,7 +574,7 @@
573
574
  catch (e_3_1) { e_3 = { error: e_3_1 }; }
574
575
  finally {
575
576
  try {
576
- if (templates_1_1 && !templates_1_1.done && (_c = templates_1.return)) _c.call(templates_1);
577
+ if (tasks_1_1 && !tasks_1_1.done && (_c = tasks_1.return)) _c.call(tasks_1);
577
578
  }
578
579
  finally { if (e_3) throw e_3.error; }
579
580
  }
@@ -912,6 +913,8 @@
912
913
  // Note: In normal situations, we check the pipeline logic:
913
914
  true);
914
915
  /**
916
+ * TODO: Extract `constants.ts` from `config.ts`
917
+ * Note: [💞] Ignore a discrepancy between file name and entity name
915
918
  * TODO: [🧠][🧜‍♂️] Maybe join remoteUrl and path into single value
916
919
  */
917
920
 
@@ -1148,24 +1151,23 @@
1148
1151
  throw new ParseError(spaceTrim.spaceTrim(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 "); }));
1149
1152
  }
1150
1153
  // TODO: [🧠] Maybe do here some propper JSON-schema / ZOD checking
1151
- if (!Array.isArray(pipeline.templates)) {
1154
+ if (!Array.isArray(pipeline.tasks)) {
1152
1155
  // TODO: [🧠] what is the correct error tp throw - maybe PromptbookSchemaError
1153
- throw new ParseError(spaceTrim.spaceTrim(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 "); }));
1156
+ throw new ParseError(spaceTrim.spaceTrim(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 "); }));
1154
1157
  }
1155
1158
  var _loop_1 = function (parameter) {
1156
1159
  if (parameter.isInput && parameter.isOutput) {
1157
- throw new PipelineLogicError(spaceTrim.spaceTrim(function (block) { return "\n\n Parameter {".concat(parameter.name, "} can not be both input and output\n\n ").concat(block(pipelineIdentification), "\n "); }));
1160
+ throw new PipelineLogicError(spaceTrim.spaceTrim(function (block) { return "\n\n Parameter `{".concat(parameter.name, "}` can not be both input and output\n\n ").concat(block(pipelineIdentification), "\n "); }));
1158
1161
  }
1159
1162
  // Note: Testing that parameter is either intermediate or output BUT not created and unused
1160
1163
  if (!parameter.isInput &&
1161
1164
  !parameter.isOutput &&
1162
- !pipeline.templates.some(function (template) { return template.dependentParameterNames.includes(parameter.name); })) {
1163
- throw new PipelineLogicError(spaceTrim.spaceTrim(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 "); }));
1165
+ !pipeline.tasks.some(function (task) { return task.dependentParameterNames.includes(parameter.name); })) {
1166
+ throw new PipelineLogicError(spaceTrim.spaceTrim(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 "); }));
1164
1167
  }
1165
- // Note: Testing that parameter is either input or result of some template
1166
- if (!parameter.isInput &&
1167
- !pipeline.templates.some(function (template) { return template.resultingParameterName === parameter.name; })) {
1168
- throw new PipelineLogicError(spaceTrim.spaceTrim(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 "); }));
1168
+ // Note: Testing that parameter is either input or result of some task
1169
+ if (!parameter.isInput && !pipeline.tasks.some(function (task) { return task.resultingParameterName === parameter.name; })) {
1170
+ throw new PipelineLogicError(spaceTrim.spaceTrim(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 "); }));
1169
1171
  }
1170
1172
  };
1171
1173
  try {
@@ -1182,7 +1184,7 @@
1182
1184
  }
1183
1185
  finally { if (e_1) throw e_1.error; }
1184
1186
  }
1185
- // Note: All input parameters are defined - so that they can be used as result of some template
1187
+ // Note: All input parameters are defined - so that they can be used as result of some task
1186
1188
  var definedParameters = new Set(pipeline.parameters.filter(function (_a) {
1187
1189
  var isInput = _a.isInput;
1188
1190
  return isInput;
@@ -1190,27 +1192,27 @@
1190
1192
  var name = _a.name;
1191
1193
  return name;
1192
1194
  }));
1193
- var _loop_2 = function (template) {
1195
+ var _loop_2 = function (task) {
1194
1196
  var e_4, _h, e_5, _j;
1195
- if (definedParameters.has(template.resultingParameterName)) {
1196
- throw new PipelineLogicError(spaceTrim.spaceTrim(function (block) { return "\n Parameter {".concat(template.resultingParameterName, "} is defined multiple times\n\n ").concat(block(pipelineIdentification), "\n "); }));
1197
+ if (definedParameters.has(task.resultingParameterName)) {
1198
+ throw new PipelineLogicError(spaceTrim.spaceTrim(function (block) { return "\n Parameter `{".concat(task.resultingParameterName, "}` is defined multiple times\n\n ").concat(block(pipelineIdentification), "\n "); }));
1197
1199
  }
1198
- if (RESERVED_PARAMETER_NAMES.includes(template.resultingParameterName)) {
1199
- throw new PipelineLogicError(spaceTrim.spaceTrim(function (block) { return "\n Parameter name {".concat(template.resultingParameterName, "} is reserved, please use different name\n\n ").concat(block(pipelineIdentification), "\n "); }));
1200
+ if (RESERVED_PARAMETER_NAMES.includes(task.resultingParameterName)) {
1201
+ throw new PipelineLogicError(spaceTrim.spaceTrim(function (block) { return "\n Parameter name {".concat(task.resultingParameterName, "} is reserved, please use different name\n\n ").concat(block(pipelineIdentification), "\n "); }));
1200
1202
  }
1201
- definedParameters.add(template.resultingParameterName);
1202
- if (template.jokerParameterNames && template.jokerParameterNames.length > 0) {
1203
- if (!template.format &&
1204
- !template.expectations /* <- TODO: Require at least 1 -> min <- expectation to use jokers */) {
1205
- throw new PipelineLogicError(spaceTrim.spaceTrim(function (block) { return "\n Joker parameters are used for {".concat(template.resultingParameterName, "} but no expectations are defined\n\n ").concat(block(pipelineIdentification), "\n "); }));
1203
+ definedParameters.add(task.resultingParameterName);
1204
+ if (task.jokerParameterNames && task.jokerParameterNames.length > 0) {
1205
+ if (!task.format &&
1206
+ !task.expectations /* <- TODO: Require at least 1 -> min <- expectation to use jokers */) {
1207
+ throw new PipelineLogicError(spaceTrim.spaceTrim(function (block) { return "\n Joker parameters are used for {".concat(task.resultingParameterName, "} but no expectations are defined\n\n ").concat(block(pipelineIdentification), "\n "); }));
1206
1208
  }
1207
1209
  var _loop_4 = function (joker) {
1208
- if (!template.dependentParameterNames.includes(joker)) {
1209
- throw new PipelineLogicError(spaceTrim.spaceTrim(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 "); }));
1210
+ if (!task.dependentParameterNames.includes(joker)) {
1211
+ throw new PipelineLogicError(spaceTrim.spaceTrim(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 "); }));
1210
1212
  }
1211
1213
  };
1212
1214
  try {
1213
- for (var _k = (e_4 = void 0, __values(template.jokerParameterNames)), _l = _k.next(); !_l.done; _l = _k.next()) {
1215
+ for (var _k = (e_4 = void 0, __values(task.jokerParameterNames)), _l = _k.next(); !_l.done; _l = _k.next()) {
1214
1216
  var joker = _l.value;
1215
1217
  _loop_4(joker);
1216
1218
  }
@@ -1223,7 +1225,7 @@
1223
1225
  finally { if (e_4) throw e_4.error; }
1224
1226
  }
1225
1227
  }
1226
- if (template.expectations) {
1228
+ if (task.expectations) {
1227
1229
  var _loop_5 = function (unit, min, max) {
1228
1230
  if (min !== undefined && max !== undefined && min > max) {
1229
1231
  throw new PipelineLogicError(spaceTrim.spaceTrim(function (block) { return "\n Min expectation (=".concat(min, ") of ").concat(unit, " is higher than max expectation (=").concat(max, ")\n\n ").concat(block(pipelineIdentification), "\n "); }));
@@ -1236,7 +1238,7 @@
1236
1238
  }
1237
1239
  };
1238
1240
  try {
1239
- for (var _m = (e_5 = void 0, __values(Object.entries(template.expectations))), _o = _m.next(); !_o.done; _o = _m.next()) {
1241
+ for (var _m = (e_5 = void 0, __values(Object.entries(task.expectations))), _o = _m.next(); !_o.done; _o = _m.next()) {
1240
1242
  var _p = __read(_o.value, 2), unit = _p[0], _q = _p[1], min = _q.min, max = _q.max;
1241
1243
  _loop_5(unit, min, max);
1242
1244
  }
@@ -1251,10 +1253,10 @@
1251
1253
  }
1252
1254
  };
1253
1255
  try {
1254
- // Note: Checking each template individually
1255
- for (var _f = __values(pipeline.templates), _g = _f.next(); !_g.done; _g = _f.next()) {
1256
- var template = _g.value;
1257
- _loop_2(template);
1256
+ // Note: Checking each task individually
1257
+ for (var _f = __values(pipeline.tasks), _g = _f.next(); !_g.done; _g = _f.next()) {
1258
+ var task = _g.value;
1259
+ _loop_2(task);
1258
1260
  }
1259
1261
  }
1260
1262
  catch (e_2_1) { e_2 = { error: e_2_1 }; }
@@ -1288,37 +1290,48 @@
1288
1290
  }
1289
1291
  finally { if (e_3) throw e_3.error; }
1290
1292
  }
1291
- var unresovedTemplates = __spreadArray([], __read(pipeline.templates), false);
1293
+ var unresovedTemplates = __spreadArray([], __read(pipeline.tasks), false);
1292
1294
  var loopLimit = LOOP_LIMIT;
1293
1295
  var _loop_3 = function () {
1294
1296
  if (loopLimit-- < 0) {
1295
1297
  // Note: Really UnexpectedError not LimitReachedError - this should not happen and be caught below
1296
1298
  throw new UnexpectedError(spaceTrim.spaceTrim(function (block) { return "\n Loop limit reached during detection of circular dependencies in `validatePipeline`\n\n ".concat(block(pipelineIdentification), "\n "); }));
1297
1299
  }
1298
- var currentlyResovedTemplates = unresovedTemplates.filter(function (template) {
1299
- return template.dependentParameterNames.every(function (name) { return resovedParameters.includes(name); });
1300
+ var currentlyResovedTemplates = unresovedTemplates.filter(function (task) {
1301
+ return task.dependentParameterNames.every(function (name) { return resovedParameters.includes(name); });
1300
1302
  });
1301
1303
  if (currentlyResovedTemplates.length === 0) {
1302
1304
  throw new PipelineLogicError(
1303
1305
  // TODO: [🐎] DRY
1304
- spaceTrim.spaceTrim(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
1306
+ spaceTrim.spaceTrim(function (block) { return "\n\n Can not resolve some parameters:\n Either you are using a parameter that is not defined, or there are some circular dependencies.\n\n ".concat(block(pipelineIdentification), "\n\n **Can not resolve:**\n ").concat(block(unresovedTemplates
1305
1307
  .map(function (_a) {
1306
1308
  var resultingParameterName = _a.resultingParameterName, dependentParameterNames = _a.dependentParameterNames;
1307
- return "- Parameter {".concat(resultingParameterName, "} which depends on ").concat(dependentParameterNames
1308
- .map(function (dependentParameterName) { return "{".concat(dependentParameterName, "}"); })
1309
+ return "- Parameter `{".concat(resultingParameterName, "}` which depends on ").concat(dependentParameterNames
1310
+ .map(function (dependentParameterName) { return "`{".concat(dependentParameterName, "}`"); })
1309
1311
  .join(' and '));
1310
1312
  })
1311
- .join('\n')), "\n\n Resolved:\n ").concat(block(resovedParameters.map(function (name) { return "- Parameter {".concat(name, "}"); }).join('\n')), "\n\n\n "); }));
1313
+ .join('\n')), "\n\n **Resolved:**\n ").concat(block(resovedParameters
1314
+ .filter(function (name) {
1315
+ return !RESERVED_PARAMETER_NAMES.includes(name);
1316
+ })
1317
+ .map(function (name) { return "- Parameter `{".concat(name, "}`"); })
1318
+ .join('\n')), "\n\n\n **Reserved (which are available):**\n ").concat(block(resovedParameters
1319
+ .filter(function (name) {
1320
+ return RESERVED_PARAMETER_NAMES.includes(name);
1321
+ })
1322
+ .map(function (name) { return "- Parameter `{".concat(name, "}`"); })
1323
+ .join('\n')), "\n\n\n "); }));
1312
1324
  }
1313
1325
  resovedParameters = __spreadArray(__spreadArray([], __read(resovedParameters), false), __read(currentlyResovedTemplates.map(function (_a) {
1314
1326
  var resultingParameterName = _a.resultingParameterName;
1315
1327
  return resultingParameterName;
1316
1328
  })), false);
1317
- unresovedTemplates = unresovedTemplates.filter(function (template) { return !currentlyResovedTemplates.includes(template); });
1329
+ unresovedTemplates = unresovedTemplates.filter(function (task) { return !currentlyResovedTemplates.includes(task); });
1318
1330
  };
1319
1331
  while (unresovedTemplates.length > 0) {
1320
1332
  _loop_3();
1321
1333
  }
1334
+ // TODO: !!!!!! Test that pipeline interface implements declared formfactor interface
1322
1335
  }
1323
1336
  /**
1324
1337
  * TODO: !! [🧞‍♀️] Do not allow joker + foreach
@@ -1375,9 +1388,9 @@
1375
1388
  }(Error));
1376
1389
 
1377
1390
  /**
1378
- * Parses the template and returns the list of all parameter names
1391
+ * Parses the task and returns the list of all parameter names
1379
1392
  *
1380
- * @param template the template with parameters in {curly} braces
1393
+ * @param template the task with parameters in {curly} braces
1381
1394
  * @returns the list of parameter names
1382
1395
  * @public exported from `@promptbook/utils`
1383
1396
  */
@@ -1408,10 +1421,10 @@
1408
1421
  * @public exported from `@promptbook/core`
1409
1422
  */
1410
1423
  function unpreparePipeline(pipeline) {
1411
- var personas = pipeline.personas, knowledgeSources = pipeline.knowledgeSources, templates = pipeline.templates;
1424
+ var personas = pipeline.personas, knowledgeSources = pipeline.knowledgeSources, tasks = pipeline.tasks;
1412
1425
  personas = personas.map(function (persona) { return (__assign(__assign({}, persona), { modelRequirements: undefined, preparationIds: undefined })); });
1413
1426
  knowledgeSources = knowledgeSources.map(function (knowledgeSource) { return (__assign(__assign({}, knowledgeSource), { preparationIds: undefined })); });
1414
- templates = templates.map(function (template) {
1427
+ tasks = tasks.map(function (template) {
1415
1428
  var dependentParameterNames = template.dependentParameterNames;
1416
1429
  var parameterNames = extractParameterNames(template.preparedContent || '');
1417
1430
  dependentParameterNames = dependentParameterNames.filter(function (dependentParameterName) { return !parameterNames.has(dependentParameterName); });
@@ -1419,7 +1432,7 @@
1419
1432
  delete templateUnprepared.preparedContent;
1420
1433
  return templateUnprepared;
1421
1434
  });
1422
- return $asDeeplyFrozenSerializableJson('Unprepared PipelineJson', __assign(__assign({}, pipeline), { templates: templates, knowledgeSources: knowledgeSources, knowledgePieces: [], personas: personas, preparations: [] }));
1435
+ return $asDeeplyFrozenSerializableJson('Unprepared PipelineJson', __assign(__assign({}, pipeline), { tasks: tasks, knowledgeSources: knowledgeSources, knowledgePieces: [], personas: personas, preparations: [] }));
1423
1436
  }
1424
1437
  /**
1425
1438
  * TODO: [🧿] Maybe do same process with same granularity and subfinctions as `preparePipeline`
@@ -1851,6 +1864,9 @@
1851
1864
  normalizedName = normalizedName.replace(/-$/, '');
1852
1865
  return normalizedName;
1853
1866
  }
1867
+ /**
1868
+ * Note: [💞] Ignore a discrepancy between file name and entity name
1869
+ */
1854
1870
 
1855
1871
  /**
1856
1872
  * Removes emojis from a string and fix whitespaces
@@ -2052,6 +2068,9 @@
2052
2068
  UnexpectedError: UnexpectedError,
2053
2069
  // TODO: [🪑]> VersionMismatchError,
2054
2070
  };
2071
+ /**
2072
+ * Note: [💞] Ignore a discrepancy between file name and entity name
2073
+ */
2055
2074
 
2056
2075
  /**
2057
2076
  * Deserializes the error object
@@ -2113,8 +2132,8 @@
2113
2132
  return false;
2114
2133
  }
2115
2134
  /*
2116
- TODO: [🧠][🍫] `templates` can not be determined if they are fully prepared SO ignoring them
2117
- > if (!pipeline.templates.every(({ preparedContent }) => preparedContent === undefined)) {
2135
+ TODO: [🧠][🍫] `tasks` can not be determined if they are fully prepared SO ignoring them
2136
+ > if (!pipeline.tasks.every(({ preparedContent }) => preparedContent === undefined)) {
2118
2137
  > return false;
2119
2138
  > }
2120
2139
  */
@@ -2127,7 +2146,7 @@
2127
2146
  * TODO: [🧿] Maybe do same process with same granularity and subfinctions as `preparePipeline`
2128
2147
  * - [🏍] ? Is context in each template
2129
2148
  * - [♨] Are examples prepared
2130
- * - [♨] Are templates prepared
2149
+ * - [♨] Are tasks prepared
2131
2150
  */
2132
2151
 
2133
2152
  /**
@@ -2275,6 +2294,9 @@
2275
2294
  pagesCount: { value: 0, isUncertain: true },
2276
2295
  },
2277
2296
  });
2297
+ /**
2298
+ * Note: [💞] Ignore a discrepancy between file name and entity name
2299
+ */
2278
2300
 
2279
2301
  /**
2280
2302
  * @@@
@@ -2674,8 +2696,8 @@
2674
2696
  else if (errors.length > 1) {
2675
2697
  throw new PipelineExecutionError(
2676
2698
  // TODO: Tell which execution tools failed like
2677
- // 1) OpenAI throw PipelineExecutionError: Parameter {knowledge} is not defined
2678
- // 2) AnthropicClaude throw PipelineExecutionError: Parameter {knowledge} is not defined
2699
+ // 1) OpenAI throw PipelineExecutionError: Parameter `{knowledge}` is not defined
2700
+ // 2) AnthropicClaude throw PipelineExecutionError: Parameter `{knowledge}` is not defined
2679
2701
  // 3) ...
2680
2702
  spaceTrim__default["default"](function (block) { return "\n All execution tools failed:\n\n ".concat(block(errors
2681
2703
  .map(function (error, i) { return "".concat(i + 1, ") **").concat(error.name || 'Error', ":** ").concat(error.message); })
@@ -3461,7 +3483,7 @@
3461
3483
  */
3462
3484
  function clonePipeline(pipeline) {
3463
3485
  // Note: Not using spread operator (...) because @@@
3464
- 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;
3486
+ 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;
3465
3487
  return {
3466
3488
  pipelineUrl: pipelineUrl,
3467
3489
  sourceFile: sourceFile,
@@ -3470,7 +3492,7 @@
3470
3492
  description: description,
3471
3493
  formfactorName: formfactorName,
3472
3494
  parameters: parameters,
3473
- templates: templates,
3495
+ tasks: tasks,
3474
3496
  knowledgeSources: knowledgeSources,
3475
3497
  knowledgePieces: knowledgePieces,
3476
3498
  personas: personas,
@@ -3486,17 +3508,17 @@
3486
3508
  *
3487
3509
  * @public exported from `@promptbook/core`
3488
3510
  */
3489
- function prepareTemplates(pipeline, tools, options) {
3511
+ function prepareTasks(pipeline, tools, options) {
3490
3512
  return __awaiter(this, void 0, void 0, function () {
3491
- var _a, maxParallelCount, templates, knowledgePiecesCount, templatesPrepared;
3513
+ var _a, maxParallelCount, tasks, knowledgePiecesCount, tasksPrepared;
3492
3514
  var _this = this;
3493
3515
  return __generator(this, function (_b) {
3494
3516
  switch (_b.label) {
3495
3517
  case 0:
3496
3518
  _a = options.maxParallelCount, maxParallelCount = _a === void 0 ? DEFAULT_MAX_PARALLEL_COUNT : _a;
3497
- templates = pipeline.templates, pipeline.parameters, knowledgePiecesCount = pipeline.knowledgePiecesCount;
3498
- templatesPrepared = new Array(templates.length);
3499
- 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 () {
3519
+ tasks = pipeline.tasks, pipeline.parameters, knowledgePiecesCount = pipeline.knowledgePiecesCount;
3520
+ tasksPrepared = new Array(tasks.length);
3521
+ 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 () {
3500
3522
  var dependentParameterNames, preparedContent, preparedTemplate;
3501
3523
  return __generator(this, function (_a) {
3502
3524
  dependentParameterNames = template.dependentParameterNames;
@@ -3509,13 +3531,13 @@
3509
3531
  ], false);
3510
3532
  }
3511
3533
  preparedTemplate = __assign(__assign({}, template), { dependentParameterNames: dependentParameterNames, preparedContent: preparedContent });
3512
- templatesPrepared[index] = preparedTemplate;
3534
+ tasksPrepared[index] = preparedTemplate;
3513
3535
  return [2 /*return*/];
3514
3536
  });
3515
3537
  }); })];
3516
3538
  case 1:
3517
3539
  _b.sent();
3518
- return [2 /*return*/, { templatesPrepared: templatesPrepared }];
3540
+ return [2 /*return*/, { tasksPrepared: tasksPrepared }];
3519
3541
  }
3520
3542
  });
3521
3543
  });
@@ -3523,7 +3545,7 @@
3523
3545
  /**
3524
3546
  * TODO: [🧠] Add context to each template (if missing)
3525
3547
  * TODO: [🧠] What is better name `prepareTemplate` or `prepareTemplateAndParameters`
3526
- * TODO: [♨][main] !!! Prepare index the examples and maybe templates
3548
+ * TODO: [♨][main] !!! Prepare index the examples and maybe tasks
3527
3549
  * TODO: Write tests for `preparePipeline`
3528
3550
  * TODO: [🏏] Leverage the batch API and build queues @see https://platform.openai.com/docs/guides/batch
3529
3551
  * TODO: [🧊] In future one preparation can take data from previous preparation and save tokens and time
@@ -3540,12 +3562,12 @@
3540
3562
  */
3541
3563
  function preparePipeline(pipeline, tools, options) {
3542
3564
  return __awaiter(this, void 0, void 0, function () {
3543
- var rootDirname, _a, maxParallelCount, _b, isVerbose, parameters, templates,
3565
+ var rootDirname, _a, maxParallelCount, _b, isVerbose, parameters, tasks,
3544
3566
  /*
3545
3567
  <- TODO: [🧠][🪑] `promptbookVersion` */
3546
3568
  knowledgeSources /*
3547
3569
  <- TODO: [🧊] `knowledgePieces` */, personas /*
3548
- <- TODO: [🧊] `preparations` */, _llms, llmTools, llmToolsWithUsage, currentPreparation, preparations, preparedPersonas, knowledgeSourcesPrepared, partialknowledgePiecesPrepared, knowledgePiecesPrepared, templatesPrepared /* TODO: parameters: parametersPrepared*/;
3570
+ <- TODO: [🧊] `preparations` */, _llms, llmTools, llmToolsWithUsage, currentPreparation, preparations, preparedPersonas, knowledgeSourcesPrepared, partialknowledgePiecesPrepared, knowledgePiecesPrepared, tasksPrepared /* TODO: parameters: parametersPrepared*/;
3549
3571
  var _this = this;
3550
3572
  return __generator(this, function (_c) {
3551
3573
  switch (_c.label) {
@@ -3554,7 +3576,7 @@
3554
3576
  return [2 /*return*/, pipeline];
3555
3577
  }
3556
3578
  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;
3557
- parameters = pipeline.parameters, templates = pipeline.templates, knowledgeSources = pipeline.knowledgeSources, personas = pipeline.personas;
3579
+ parameters = pipeline.parameters, tasks = pipeline.tasks, knowledgeSources = pipeline.knowledgeSources, personas = pipeline.personas;
3558
3580
  if (tools === undefined || tools.llm === undefined) {
3559
3581
  throw new MissingToolsError('LLM tools are required for preparing the pipeline');
3560
3582
  }
@@ -3597,9 +3619,9 @@
3597
3619
  case 2:
3598
3620
  partialknowledgePiecesPrepared = _c.sent();
3599
3621
  knowledgePiecesPrepared = partialknowledgePiecesPrepared.map(function (piece) { return (__assign(__assign({}, piece), { preparationIds: [/* TODO: [🧊] -> */ currentPreparation.id] })); });
3600
- return [4 /*yield*/, prepareTemplates({
3622
+ return [4 /*yield*/, prepareTasks({
3601
3623
  parameters: parameters,
3602
- templates: templates,
3624
+ tasks: tasks,
3603
3625
  knowledgePiecesCount: knowledgePiecesPrepared.length,
3604
3626
  }, __assign(__assign({}, tools), { llm: llmToolsWithUsage }), {
3605
3627
  rootDirname: rootDirname,
@@ -3607,12 +3629,12 @@
3607
3629
  isVerbose: isVerbose,
3608
3630
  })];
3609
3631
  case 3:
3610
- templatesPrepared = (_c.sent()).templatesPrepared;
3632
+ tasksPrepared = (_c.sent()).tasksPrepared;
3611
3633
  // ----- /Templates preparation -----
3612
3634
  // Note: Count total usage
3613
3635
  currentPreparation.usage = llmToolsWithUsage.getTotalUsage();
3614
- return [2 /*return*/, $asDeeplyFrozenSerializableJson('Prepared PipelineJson', __assign(__assign({}, clonePipeline(pipeline)), { templates: __spreadArray([], __read(templatesPrepared), false),
3615
- // <- TODO: [🪓] Here should be no need for spreading new array, just ` templates: templatesPrepared`
3636
+ return [2 /*return*/, $asDeeplyFrozenSerializableJson('Prepared PipelineJson', __assign(__assign({}, clonePipeline(pipeline)), { tasks: __spreadArray([], __read(tasksPrepared), false),
3637
+ // <- TODO: [🪓] Here should be no need for spreading new array, just ` tasks: tasksPrepared`
3616
3638
  knowledgeSources: knowledgeSourcesPrepared, knowledgePieces: knowledgePiecesPrepared, personas: preparedPersonas, preparations: __spreadArray([], __read(preparations), false) }))];
3617
3639
  }
3618
3640
  });
@@ -3684,9 +3706,9 @@
3684
3706
  * @throws {ParseError} if the script is invalid
3685
3707
  * @public exported from `@promptbook/utils`
3686
3708
  */
3687
- function extractParameterNamesFromTemplate(template) {
3709
+ function extractParameterNamesFromTask(template) {
3688
3710
  var e_1, _a, e_2, _b, e_3, _c, e_4, _d;
3689
- var title = template.title, description = template.description, templateType = template.templateType, content = template.content, preparedContent = template.preparedContent, jokerParameterNames = template.jokerParameterNames, foreach = template.foreach;
3711
+ var title = template.title, description = template.description, taskType = template.taskType, content = template.content, preparedContent = template.preparedContent, jokerParameterNames = template.jokerParameterNames, foreach = template.foreach;
3690
3712
  var parameterNames = new Set();
3691
3713
  try {
3692
3714
  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()) {
@@ -3701,7 +3723,7 @@
3701
3723
  }
3702
3724
  finally { if (e_1) throw e_1.error; }
3703
3725
  }
3704
- if (templateType === 'SCRIPT_TEMPLATE') {
3726
+ if (taskType === 'SCRIPT_TASK') {
3705
3727
  try {
3706
3728
  for (var _g = __values(extractVariables(content)), _h = _g.next(); !_h.done; _h = _g.next()) {
3707
3729
  var parameterName = _h.value;
@@ -4111,6 +4133,9 @@
4111
4133
  TextFormatDefinition,
4112
4134
  CsvFormatDefinition,
4113
4135
  ];
4136
+ /**
4137
+ * Note: [💞] Ignore a discrepancy between file name and entity name
4138
+ */
4114
4139
 
4115
4140
  /**
4116
4141
  * Maps available parameters to expected parameters
@@ -4196,11 +4221,11 @@
4196
4221
  for (var _b = __values(Object.entries(parameters)), _c = _b.next(); !_c.done; _c = _b.next()) {
4197
4222
  var _d = __read(_c.value, 2), parameterName = _d[0], parameterValue = _d[1];
4198
4223
  if (parameterValue === RESERVED_PARAMETER_MISSING_VALUE) {
4199
- throw new UnexpectedError("Parameter {".concat(parameterName, "} has missing value"));
4224
+ throw new UnexpectedError("Parameter `{".concat(parameterName, "}` has missing value"));
4200
4225
  }
4201
4226
  else if (parameterValue === RESERVED_PARAMETER_RESTRICTED) {
4202
4227
  // TODO: [🍵]
4203
- throw new UnexpectedError("Parameter {".concat(parameterName, "} is restricted to use"));
4228
+ throw new UnexpectedError("Parameter `{".concat(parameterName, "}` is restricted to use"));
4204
4229
  }
4205
4230
  }
4206
4231
  }
@@ -4211,7 +4236,7 @@
4211
4236
  }
4212
4237
  finally { if (e_1) throw e_1.error; }
4213
4238
  }
4214
- var replacedTemplate = template;
4239
+ var replacedTemplates = template;
4215
4240
  var match;
4216
4241
  var loopLimit = LOOP_LIMIT;
4217
4242
  var _loop_1 = function () {
@@ -4227,11 +4252,11 @@
4227
4252
  throw new PipelineExecutionError('Parameter is already opened or not closed');
4228
4253
  }
4229
4254
  if (parameters[parameterName] === undefined) {
4230
- throw new PipelineExecutionError("Parameter {".concat(parameterName, "} is not defined"));
4255
+ throw new PipelineExecutionError("Parameter `{".concat(parameterName, "}` is not defined"));
4231
4256
  }
4232
4257
  var parameterValue = parameters[parameterName];
4233
4258
  if (parameterValue === undefined) {
4234
- throw new PipelineExecutionError("Parameter {".concat(parameterName, "} is not defined"));
4259
+ throw new PipelineExecutionError("Parameter `{".concat(parameterName, "}` is not defined"));
4235
4260
  }
4236
4261
  parameterValue = parameterValue.toString();
4237
4262
  if (parameterValue.includes('\n') && /^\s*\W{0,3}\s*$/.test(precol)) {
@@ -4240,24 +4265,24 @@
4240
4265
  .map(function (line, index) { return (index === 0 ? line : "".concat(precol).concat(line)); })
4241
4266
  .join('\n');
4242
4267
  }
4243
- replacedTemplate =
4244
- replacedTemplate.substring(0, match.index + precol.length) +
4268
+ replacedTemplates =
4269
+ replacedTemplates.substring(0, match.index + precol.length) +
4245
4270
  parameterValue +
4246
- replacedTemplate.substring(match.index + precol.length + parameterName.length + 2);
4271
+ replacedTemplates.substring(match.index + precol.length + parameterName.length + 2);
4247
4272
  };
4248
4273
  while ((match = /^(?<precol>.*){(?<parameterName>\w+)}(.*)/m /* <- Not global */
4249
- .exec(replacedTemplate))) {
4274
+ .exec(replacedTemplates))) {
4250
4275
  _loop_1();
4251
4276
  }
4252
4277
  // [💫] Check if there are parameters that are not closed properly
4253
- if (/{\w+$/.test(replacedTemplate)) {
4278
+ if (/{\w+$/.test(replacedTemplates)) {
4254
4279
  throw new PipelineExecutionError('Parameter is not closed');
4255
4280
  }
4256
4281
  // [💫] Check if there are parameters that are not opened properly
4257
- if (/^\w+}/.test(replacedTemplate)) {
4282
+ if (/^\w+}/.test(replacedTemplates)) {
4258
4283
  throw new PipelineExecutionError('Parameter is not opened');
4259
4284
  }
4260
- return replacedTemplate;
4285
+ return replacedTemplates;
4261
4286
  }
4262
4287
 
4263
4288
  /**
@@ -4287,6 +4312,10 @@
4287
4312
  * @public exported from `@promptbook/utils`
4288
4313
  */
4289
4314
  var LINES_PER_STANDARD_PAGE = 44;
4315
+ /**
4316
+ * TODO: [🧠] Should be this `constants.ts` or `config.ts`?
4317
+ * Note: [💞] Ignore a discrepancy between file name and entity name
4318
+ */
4290
4319
 
4291
4320
  /**
4292
4321
  * Counts number of lines in the text
@@ -4365,6 +4394,7 @@
4365
4394
  };
4366
4395
  /**
4367
4396
  * TODO: [🧠][🤠] This should be probbably as part of `TextFormatDefinition`
4397
+ * Note: [💞] Ignore a discrepancy between file name and entity name
4368
4398
  */
4369
4399
 
4370
4400
  /**
@@ -4413,12 +4443,12 @@
4413
4443
  */
4414
4444
  function executeAttempts(options) {
4415
4445
  return __awaiter(this, void 0, void 0, function () {
4416
- var jokerParameterNames, priority, maxAttempts, preparedContent, parameters, template, preparedPipeline, tools, $executionReport, pipelineIdentification, maxExecutionAttempts, $ongoingTemplateResult, _llms, llmTools, _loop_1, attempt, state_1;
4446
+ var jokerParameterNames, priority, maxAttempts, preparedContent, parameters, task, preparedPipeline, tools, $executionReport, pipelineIdentification, maxExecutionAttempts, $ongoingTaskResult, _llms, llmTools, _loop_1, attempt, state_1;
4417
4447
  return __generator(this, function (_a) {
4418
4448
  switch (_a.label) {
4419
4449
  case 0:
4420
- 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;
4421
- $ongoingTemplateResult = {
4450
+ 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;
4451
+ $ongoingTaskResult = {
4422
4452
  $result: null,
4423
4453
  $resultString: null,
4424
4454
  $expectError: null,
@@ -4438,52 +4468,51 @@
4438
4468
  if (isJokerAttempt && !jokerParameterName) {
4439
4469
  throw new UnexpectedError(spaceTrim.spaceTrim(function (block) { return "\n Joker not found in attempt ".concat(attempt, "\n\n ").concat(block(pipelineIdentification), "\n "); }));
4440
4470
  }
4441
- $ongoingTemplateResult.$result = null;
4442
- $ongoingTemplateResult.$resultString = null;
4443
- $ongoingTemplateResult.$expectError = null;
4471
+ $ongoingTaskResult.$result = null;
4472
+ $ongoingTaskResult.$resultString = null;
4473
+ $ongoingTaskResult.$expectError = null;
4444
4474
  if (isJokerAttempt) {
4445
4475
  if (parameters[jokerParameterName] === undefined) {
4446
4476
  throw new PipelineExecutionError(spaceTrim.spaceTrim(function (block) { return "\n Joker parameter {".concat(jokerParameterName, "} not defined\n\n ").concat(block(pipelineIdentification), "\n "); }));
4447
4477
  // <- TODO: This is maybe `PipelineLogicError` which should be detected in `validatePipeline` and here just thrown as `UnexpectedError`
4448
4478
  }
4449
4479
  else {
4450
- $ongoingTemplateResult.$resultString = parameters[jokerParameterName];
4480
+ $ongoingTaskResult.$resultString = parameters[jokerParameterName];
4451
4481
  }
4452
4482
  }
4453
4483
  _t.label = 1;
4454
4484
  case 1:
4455
4485
  _t.trys.push([1, 43, 44, 45]);
4456
4486
  if (!!isJokerAttempt) return [3 /*break*/, 25];
4457
- _b = template.templateType;
4487
+ _b = task.taskType;
4458
4488
  switch (_b) {
4459
- case 'SIMPLE_TEMPLATE': return [3 /*break*/, 2];
4460
- case 'PROMPT_TEMPLATE': return [3 /*break*/, 3];
4461
- case 'SCRIPT_TEMPLATE': return [3 /*break*/, 11];
4462
- case 'DIALOG_TEMPLATE': return [3 /*break*/, 22];
4489
+ case 'SIMPLE_TASK': return [3 /*break*/, 2];
4490
+ case 'PROMPT_TASK': return [3 /*break*/, 3];
4491
+ case 'SCRIPT_TASK': return [3 /*break*/, 11];
4492
+ case 'DIALOG_TASK': return [3 /*break*/, 22];
4463
4493
  }
4464
4494
  return [3 /*break*/, 24];
4465
4495
  case 2:
4466
- $ongoingTemplateResult.$resultString = replaceParameters(preparedContent, parameters);
4496
+ $ongoingTaskResult.$resultString = replaceParameters(preparedContent, parameters);
4467
4497
  return [3 /*break*/, 25];
4468
4498
  case 3:
4469
- modelRequirements = __assign(__assign({ modelVariant: 'CHAT' }, (preparedPipeline.defaultModelRequirements || {})), (template.modelRequirements || {}));
4470
- $ongoingTemplateResult.$prompt = {
4471
- title: template.title,
4499
+ modelRequirements = __assign(__assign({ modelVariant: 'CHAT' }, (preparedPipeline.defaultModelRequirements || {})), (task.modelRequirements || {}));
4500
+ $ongoingTaskResult.$prompt = {
4501
+ title: task.title,
4472
4502
  pipelineUrl: "".concat(preparedPipeline.pipelineUrl
4473
4503
  ? preparedPipeline.pipelineUrl
4474
- : 'anonymous' /* <- TODO: [🧠] How to deal with anonymous pipelines, do here some auto-url like SHA-256 based ad-hoc identifier? */, "#").concat(template.name
4475
- // <- TODO: Here should be maybe also subformat index to distinguish between same template with different subformat values
4504
+ : 'anonymous' /* <- TODO: [🧠] How to deal with anonymous pipelines, do here some auto-url like SHA-256 based ad-hoc identifier? */, "#").concat(task.name
4505
+ // <- TODO: Here should be maybe also subformat index to distinguish between same task with different subformat values
4476
4506
  ),
4477
4507
  parameters: parameters,
4478
4508
  content: preparedContent,
4479
4509
  modelRequirements: modelRequirements,
4480
4510
  expectations: __assign(__assign({}, (preparedPipeline.personas.find(function (_a) {
4481
4511
  var name = _a.name;
4482
- return name === template.personaName;
4483
- }) ||
4484
- {})), template.expectations),
4485
- format: template.format,
4486
- postprocessingFunctionNames: template.postprocessingFunctionNames,
4512
+ return name === task.personaName;
4513
+ }) || {})), task.expectations),
4514
+ format: task.format,
4515
+ postprocessingFunctionNames: task.postprocessingFunctionNames,
4487
4516
  }; // <- TODO: Not very good type guard
4488
4517
  _c = modelRequirements.modelVariant;
4489
4518
  switch (_c) {
@@ -4493,36 +4522,35 @@
4493
4522
  }
4494
4523
  return [3 /*break*/, 9];
4495
4524
  case 4:
4496
- _d = $ongoingTemplateResult;
4525
+ _d = $ongoingTaskResult;
4497
4526
  return [4 /*yield*/, llmTools.callChatModel(
4498
4527
  // <- TODO: [🧁] Check that `callChatModel` is defined
4499
- $deepFreeze($ongoingTemplateResult.$prompt))];
4528
+ $deepFreeze($ongoingTaskResult.$prompt))];
4500
4529
  case 5:
4501
4530
  _d.$chatResult = _t.sent();
4502
4531
  // TODO: [🍬] Destroy chatThread
4503
- $ongoingTemplateResult.$result = $ongoingTemplateResult.$chatResult;
4504
- $ongoingTemplateResult.$resultString = $ongoingTemplateResult.$chatResult.content;
4532
+ $ongoingTaskResult.$result = $ongoingTaskResult.$chatResult;
4533
+ $ongoingTaskResult.$resultString = $ongoingTaskResult.$chatResult.content;
4505
4534
  return [3 /*break*/, 10];
4506
4535
  case 6:
4507
- _e = $ongoingTemplateResult;
4536
+ _e = $ongoingTaskResult;
4508
4537
  return [4 /*yield*/, llmTools.callCompletionModel(
4509
4538
  // <- TODO: [🧁] Check that `callCompletionModel` is defined
4510
- $deepFreeze($ongoingTemplateResult.$prompt))];
4539
+ $deepFreeze($ongoingTaskResult.$prompt))];
4511
4540
  case 7:
4512
4541
  _e.$completionResult = _t.sent();
4513
- $ongoingTemplateResult.$result = $ongoingTemplateResult.$completionResult;
4514
- $ongoingTemplateResult.$resultString =
4515
- $ongoingTemplateResult.$completionResult.content;
4542
+ $ongoingTaskResult.$result = $ongoingTaskResult.$completionResult;
4543
+ $ongoingTaskResult.$resultString = $ongoingTaskResult.$completionResult.content;
4516
4544
  return [3 /*break*/, 10];
4517
4545
  case 8: throw new PipelineExecutionError(spaceTrim.spaceTrim(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 "); }));
4518
- case 9: throw new PipelineExecutionError(spaceTrim.spaceTrim(function (block) { return "\n Unknown model variant \"".concat(template.modelRequirements.modelVariant, "\"\n\n ").concat(block(pipelineIdentification), "\n\n "); }));
4546
+ case 9: throw new PipelineExecutionError(spaceTrim.spaceTrim(function (block) { return "\n Unknown model variant \"".concat(task.modelRequirements.modelVariant, "\"\n\n ").concat(block(pipelineIdentification), "\n\n "); }));
4519
4547
  case 10: return [3 /*break*/, 25];
4520
4548
  case 11:
4521
4549
  if (arrayableToArray(tools.script).length === 0) {
4522
4550
  throw new PipelineExecutionError(spaceTrim.spaceTrim(function (block) { return "\n No script execution tools are available\n\n ".concat(block(pipelineIdentification), "\n "); }));
4523
4551
  }
4524
- if (!template.contentLanguage) {
4525
- throw new PipelineExecutionError(spaceTrim.spaceTrim(function (block) { return "\n Script language is not defined for SCRIPT TEMPLATE \"".concat(template.name, "\"\n\n ").concat(block(pipelineIdentification), "\n "); }));
4552
+ if (!task.contentLanguage) {
4553
+ throw new PipelineExecutionError(spaceTrim.spaceTrim(function (block) { return "\n Script language is not defined for SCRIPT TASK \"".concat(task.name, "\"\n\n ").concat(block(pipelineIdentification), "\n "); }));
4526
4554
  }
4527
4555
  _t.label = 12;
4528
4556
  case 12:
@@ -4535,9 +4563,9 @@
4535
4563
  _t.label = 14;
4536
4564
  case 14:
4537
4565
  _t.trys.push([14, 16, , 17]);
4538
- _h = $ongoingTemplateResult;
4566
+ _h = $ongoingTaskResult;
4539
4567
  return [4 /*yield*/, scriptTools.execute($deepFreeze({
4540
- scriptLanguage: template.contentLanguage,
4568
+ scriptLanguage: task.contentLanguage,
4541
4569
  script: preparedContent,
4542
4570
  parameters: parameters,
4543
4571
  }))];
@@ -4552,7 +4580,7 @@
4552
4580
  if (error_1 instanceof UnexpectedError) {
4553
4581
  throw error_1;
4554
4582
  }
4555
- $ongoingTemplateResult.$scriptPipelineExecutionErrors.push(error_1);
4583
+ $ongoingTaskResult.$scriptPipelineExecutionErrors.push(error_1);
4556
4584
  return [3 /*break*/, 17];
4557
4585
  case 17:
4558
4586
  _g = _f.next();
@@ -4569,14 +4597,14 @@
4569
4597
  finally { if (e_1) throw e_1.error; }
4570
4598
  return [7 /*endfinally*/];
4571
4599
  case 21:
4572
- if ($ongoingTemplateResult.$resultString !== null) {
4600
+ if ($ongoingTaskResult.$resultString !== null) {
4573
4601
  return [3 /*break*/, 25];
4574
4602
  }
4575
- if ($ongoingTemplateResult.$scriptPipelineExecutionErrors.length === 1) {
4576
- throw $ongoingTemplateResult.$scriptPipelineExecutionErrors[0];
4603
+ if ($ongoingTaskResult.$scriptPipelineExecutionErrors.length === 1) {
4604
+ throw $ongoingTaskResult.$scriptPipelineExecutionErrors[0];
4577
4605
  }
4578
4606
  else {
4579
- throw new PipelineExecutionError(spaceTrim.spaceTrim(function (block) { return "\n Script execution failed ".concat($ongoingTemplateResult.$scriptPipelineExecutionErrors.length, "x\n\n ").concat(block(pipelineIdentification), "\n\n ").concat(block($ongoingTemplateResult.$scriptPipelineExecutionErrors
4607
+ throw new PipelineExecutionError(spaceTrim.spaceTrim(function (block) { return "\n Script execution failed ".concat($ongoingTaskResult.$scriptPipelineExecutionErrors.length, "x\n\n ").concat(block(pipelineIdentification), "\n\n ").concat(block($ongoingTaskResult.$scriptPipelineExecutionErrors
4580
4608
  .map(function (error) { return '- ' + error.message; })
4581
4609
  .join('\n\n')), "\n "); }));
4582
4610
  }
@@ -4584,27 +4612,27 @@
4584
4612
  if (tools.userInterface === undefined) {
4585
4613
  throw new PipelineExecutionError(spaceTrim.spaceTrim(function (block) { return "\n User interface tools are not available\n\n ".concat(block(pipelineIdentification), "\n "); }));
4586
4614
  }
4587
- // TODO: [🌹] When making next attempt for `DIALOG TEMPLATE`, preserve the previous user input
4588
- _j = $ongoingTemplateResult;
4615
+ // TODO: [🌹] When making next attempt for `DIALOG TASK`, preserve the previous user input
4616
+ _j = $ongoingTaskResult;
4589
4617
  return [4 /*yield*/, tools.userInterface.promptDialog($deepFreeze({
4590
- promptTitle: template.title,
4591
- promptMessage: replaceParameters(template.description || '', parameters),
4618
+ promptTitle: task.title,
4619
+ promptMessage: replaceParameters(task.description || '', parameters),
4592
4620
  defaultValue: replaceParameters(preparedContent, parameters),
4593
4621
  // TODO: [🧠] !! Figure out how to define placeholder in .book.md file
4594
4622
  placeholder: undefined,
4595
4623
  priority: priority,
4596
4624
  }))];
4597
4625
  case 23:
4598
- // TODO: [🌹] When making next attempt for `DIALOG TEMPLATE`, preserve the previous user input
4626
+ // TODO: [🌹] When making next attempt for `DIALOG TASK`, preserve the previous user input
4599
4627
  _j.$resultString = _t.sent();
4600
4628
  return [3 /*break*/, 25];
4601
- case 24: throw new PipelineExecutionError(spaceTrim.spaceTrim(function (block) { return "\n Unknown execution type \"".concat(template.templateType, "\"\n\n ").concat(block(pipelineIdentification), "\n "); }));
4629
+ case 24: throw new PipelineExecutionError(spaceTrim.spaceTrim(function (block) { return "\n Unknown execution type \"".concat(task.taskType, "\"\n\n ").concat(block(pipelineIdentification), "\n "); }));
4602
4630
  case 25:
4603
- if (!(!isJokerAttempt && template.postprocessingFunctionNames)) return [3 /*break*/, 42];
4631
+ if (!(!isJokerAttempt && task.postprocessingFunctionNames)) return [3 /*break*/, 42];
4604
4632
  _t.label = 26;
4605
4633
  case 26:
4606
4634
  _t.trys.push([26, 40, 41, 42]);
4607
- _k = (e_3 = void 0, __values(template.postprocessingFunctionNames)), _l = _k.next();
4635
+ _k = (e_3 = void 0, __values(task.postprocessingFunctionNames)), _l = _k.next();
4608
4636
  _t.label = 27;
4609
4637
  case 27:
4610
4638
  if (!!_l.done) return [3 /*break*/, 39];
@@ -4621,13 +4649,13 @@
4621
4649
  _t.label = 30;
4622
4650
  case 30:
4623
4651
  _t.trys.push([30, 32, , 33]);
4624
- _p = $ongoingTemplateResult;
4652
+ _p = $ongoingTaskResult;
4625
4653
  return [4 /*yield*/, scriptTools.execute({
4626
4654
  scriptLanguage: "javascript" /* <- TODO: Try it in each languages; In future allow postprocessing with arbitrary combination of languages to combine */,
4627
4655
  script: "".concat(functionName, "(resultString)"),
4628
4656
  parameters: {
4629
- resultString: $ongoingTemplateResult.$resultString || '',
4630
- // Note: No ...parametersForTemplate, because working with result only
4657
+ resultString: $ongoingTaskResult.$resultString || '',
4658
+ // Note: No ...parametersForTask, because working with result only
4631
4659
  },
4632
4660
  })];
4633
4661
  case 31:
@@ -4643,7 +4671,7 @@
4643
4671
  throw error_2;
4644
4672
  }
4645
4673
  postprocessingError = error_2;
4646
- $ongoingTemplateResult.$scriptPipelineExecutionErrors.push(error_2);
4674
+ $ongoingTaskResult.$scriptPipelineExecutionErrors.push(error_2);
4647
4675
  return [3 /*break*/, 33];
4648
4676
  case 33:
4649
4677
  _o = _m.next();
@@ -4680,12 +4708,12 @@
4680
4708
  return [7 /*endfinally*/];
4681
4709
  case 42:
4682
4710
  // TODO: [💝] Unite object for expecting amount and format
4683
- if (template.format) {
4684
- if (template.format === 'JSON') {
4685
- if (!isValidJsonString($ongoingTemplateResult.$resultString || '')) {
4711
+ if (task.format) {
4712
+ if (task.format === 'JSON') {
4713
+ if (!isValidJsonString($ongoingTaskResult.$resultString || '')) {
4686
4714
  // TODO: [🏢] Do more universally via `FormatDefinition`
4687
4715
  try {
4688
- $ongoingTemplateResult.$resultString = extractJsonBlock($ongoingTemplateResult.$resultString || '');
4716
+ $ongoingTaskResult.$resultString = extractJsonBlock($ongoingTaskResult.$resultString || '');
4689
4717
  }
4690
4718
  catch (error) {
4691
4719
  throw new ExpectError(spaceTrim.spaceTrim(function (block) { return "\n Expected valid JSON string\n\n ".concat(block(
@@ -4694,12 +4722,12 @@
4694
4722
  }
4695
4723
  }
4696
4724
  else {
4697
- throw new UnexpectedError(spaceTrim.spaceTrim(function (block) { return "\n Unknown format \"".concat(template.format, "\"\n\n ").concat(block(pipelineIdentification), "\n "); }));
4725
+ throw new UnexpectedError(spaceTrim.spaceTrim(function (block) { return "\n Unknown format \"".concat(task.format, "\"\n\n ").concat(block(pipelineIdentification), "\n "); }));
4698
4726
  }
4699
4727
  }
4700
4728
  // TODO: [💝] Unite object for expecting amount and format
4701
- if (template.expectations) {
4702
- checkExpectations(template.expectations, $ongoingTemplateResult.$resultString || '');
4729
+ if (task.expectations) {
4730
+ checkExpectations(task.expectations, $ongoingTaskResult.$resultString || '');
4703
4731
  }
4704
4732
  return [2 /*return*/, "break-attempts"];
4705
4733
  case 43:
@@ -4707,38 +4735,38 @@
4707
4735
  if (!(error_3 instanceof ExpectError)) {
4708
4736
  throw error_3;
4709
4737
  }
4710
- $ongoingTemplateResult.$expectError = error_3;
4738
+ $ongoingTaskResult.$expectError = error_3;
4711
4739
  return [3 /*break*/, 45];
4712
4740
  case 44:
4713
4741
  if (!isJokerAttempt &&
4714
- template.templateType === 'PROMPT_TEMPLATE' &&
4715
- $ongoingTemplateResult.$prompt
4742
+ task.taskType === 'PROMPT_TASK' &&
4743
+ $ongoingTaskResult.$prompt
4716
4744
  // <- Note: [2] When some expected parameter is not defined, error will occur in replaceParameters
4717
4745
  // In that case we don’t want to make a report about it because it’s not a llm execution error
4718
4746
  ) {
4719
- // TODO: [🧠] Maybe put other templateTypes into report
4747
+ // TODO: [🧠] Maybe put other taskTypes into report
4720
4748
  $executionReport.promptExecutions.push({
4721
- prompt: __assign({}, $ongoingTemplateResult.$prompt),
4722
- result: $ongoingTemplateResult.$result || undefined,
4723
- error: $ongoingTemplateResult.$expectError === null
4749
+ prompt: __assign({}, $ongoingTaskResult.$prompt),
4750
+ result: $ongoingTaskResult.$result || undefined,
4751
+ error: $ongoingTaskResult.$expectError === null
4724
4752
  ? undefined
4725
- : serializeError($ongoingTemplateResult.$expectError),
4753
+ : serializeError($ongoingTaskResult.$expectError),
4726
4754
  });
4727
4755
  }
4728
4756
  return [7 /*endfinally*/];
4729
4757
  case 45:
4730
- if ($ongoingTemplateResult.$expectError !== null && attempt === maxAttempts - 1) {
4758
+ if ($ongoingTaskResult.$expectError !== null && attempt === maxAttempts - 1) {
4731
4759
  throw new PipelineExecutionError(spaceTrim.spaceTrim(function (block) {
4732
4760
  var _a, _b, _c;
4733
- 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) || '')
4761
+ 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) || '')
4734
4762
  .split('\n')
4735
4763
  .map(function (line) { return "> ".concat(line); })
4736
- .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) || '')
4764
+ .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) || '')
4737
4765
  .split('\n')
4738
4766
  .map(function (line) { return "> ".concat(line); })
4739
- .join('\n')), "\n\n Last result:\n ").concat(block($ongoingTemplateResult.$resultString === null
4767
+ .join('\n')), "\n\n Last result:\n ").concat(block($ongoingTaskResult.$resultString === null
4740
4768
  ? 'null'
4741
- : $ongoingTemplateResult.$resultString
4769
+ : $ongoingTaskResult.$resultString
4742
4770
  .split('\n')
4743
4771
  .map(function (line) { return "> ".concat(line); })
4744
4772
  .join('\n')), "\n ---\n ");
@@ -4763,10 +4791,10 @@
4763
4791
  attempt++;
4764
4792
  return [3 /*break*/, 1];
4765
4793
  case 4:
4766
- if ($ongoingTemplateResult.$resultString === null) {
4794
+ if ($ongoingTaskResult.$resultString === null) {
4767
4795
  throw new UnexpectedError(spaceTrim.spaceTrim(function (block) { return "\n Something went wrong and prompt result is null\n\n ".concat(block(pipelineIdentification), "\n "); }));
4768
4796
  }
4769
- return [2 /*return*/, $ongoingTemplateResult.$resultString];
4797
+ return [2 /*return*/, $ongoingTaskResult.$resultString];
4770
4798
  }
4771
4799
  });
4772
4800
  });
@@ -4782,36 +4810,36 @@
4782
4810
  */
4783
4811
  function executeFormatSubvalues(options) {
4784
4812
  return __awaiter(this, void 0, void 0, function () {
4785
- var template, jokerParameterNames, parameters, priority, csvSettings, pipelineIdentification, parameterValue, formatDefinition, subvalueDefinition, formatSettings, resultString;
4813
+ var task, jokerParameterNames, parameters, priority, csvSettings, pipelineIdentification, parameterValue, formatDefinition, subvalueDefinition, formatSettings, resultString;
4786
4814
  var _this = this;
4787
4815
  return __generator(this, function (_a) {
4788
4816
  switch (_a.label) {
4789
4817
  case 0:
4790
- template = options.template, jokerParameterNames = options.jokerParameterNames, parameters = options.parameters, priority = options.priority, csvSettings = options.csvSettings, pipelineIdentification = options.pipelineIdentification;
4791
- if (template.foreach === undefined) {
4818
+ task = options.task, jokerParameterNames = options.jokerParameterNames, parameters = options.parameters, priority = options.priority, csvSettings = options.csvSettings, pipelineIdentification = options.pipelineIdentification;
4819
+ if (task.foreach === undefined) {
4792
4820
  return [2 /*return*/, /* not await */ executeAttempts(options)];
4793
4821
  }
4794
4822
  if (jokerParameterNames.length !== 0) {
4795
4823
  throw new UnexpectedError(spaceTrim__default["default"](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 "); }));
4796
4824
  }
4797
- parameterValue = parameters[template.foreach.parameterName] || '';
4825
+ parameterValue = parameters[task.foreach.parameterName] || '';
4798
4826
  formatDefinition = FORMAT_DEFINITIONS.find(function (formatDefinition) {
4799
- return __spreadArray([formatDefinition.formatName], __read((formatDefinition.aliases || [])), false).includes(template.foreach.formatName);
4827
+ return __spreadArray([formatDefinition.formatName], __read((formatDefinition.aliases || [])), false).includes(task.foreach.formatName);
4800
4828
  });
4801
4829
  if (formatDefinition === undefined) {
4802
4830
  throw new UnexpectedError(
4803
4831
  // <- TODO: [🧠][🧐] Should be formats fixed per promptbook version or behave as plugins (=> change UnexpectedError)
4804
- spaceTrim__default["default"](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; })
4832
+ spaceTrim__default["default"](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; })
4805
4833
  .map(function (formatName) { return "- ".concat(formatName); })
4806
4834
  .join('\n')), "\n\n [\u26F7] This should never happen because format name should be validated during parsing\n\n ").concat(block(pipelineIdentification), "\n "); }));
4807
4835
  }
4808
4836
  subvalueDefinition = formatDefinition.subvalueDefinitions.find(function (subvalueDefinition) {
4809
- return __spreadArray([subvalueDefinition.subvalueName], __read((subvalueDefinition.aliases || [])), false).includes(template.foreach.subformatName);
4837
+ return __spreadArray([subvalueDefinition.subvalueName], __read((subvalueDefinition.aliases || [])), false).includes(task.foreach.subformatName);
4810
4838
  });
4811
4839
  if (subvalueDefinition === undefined) {
4812
4840
  throw new UnexpectedError(
4813
4841
  // <- TODO: [🧠][🧐] Should be formats fixed per promptbook version or behave as plugins (=> change UnexpectedError)
4814
- spaceTrim__default["default"](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
4842
+ spaceTrim__default["default"](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
4815
4843
  .map(function (subvalueDefinition) { return subvalueDefinition.subvalueName; })
4816
4844
  .map(function (subvalueName) { return "- ".concat(subvalueName); })
4817
4845
  .join('\n')), "\n\n [\u26F7] This should never happen because subformat name should be validated during parsing\n\n ").concat(block(pipelineIdentification), "\n "); }));
@@ -4820,7 +4848,7 @@
4820
4848
  formatSettings = csvSettings;
4821
4849
  // <- TODO: [🤹‍♂️] More universal, make simmilar pattern for other formats for example \n vs \r\n in text
4822
4850
  }
4823
- return [4 /*yield*/, subvalueDefinition.mapValues(parameterValue, template.foreach.outputSubparameterName, formatSettings, function (subparameters, index) { return __awaiter(_this, void 0, void 0, function () {
4851
+ return [4 /*yield*/, subvalueDefinition.mapValues(parameterValue, task.foreach.outputSubparameterName, formatSettings, function (subparameters, index) { return __awaiter(_this, void 0, void 0, function () {
4824
4852
  var mappedParameters, allSubparameters, subresultString;
4825
4853
  return __generator(this, function (_a) {
4826
4854
  switch (_a.label) {
@@ -4829,7 +4857,7 @@
4829
4857
  // TODO: When done [🐚] Report progress also for each subvalue here
4830
4858
  try {
4831
4859
  mappedParameters = mapAvailableToExpectedParameters({
4832
- expectedParameters: Object.fromEntries(template.foreach.inputSubparameterNames.map(function (subparameterName) { return [subparameterName, null]; })),
4860
+ expectedParameters: Object.fromEntries(task.foreach.inputSubparameterNames.map(function (subparameterName) { return [subparameterName, null]; })),
4833
4861
  availableParameters: subparameters,
4834
4862
  });
4835
4863
  }
@@ -4862,7 +4890,7 @@
4862
4890
  *
4863
4891
  * @private internal utility of `createPipelineExecutor`
4864
4892
  */
4865
- function getContextForTemplate(template) {
4893
+ function getContextForTask(task) {
4866
4894
  return __awaiter(this, void 0, void 0, function () {
4867
4895
  return __generator(this, function (_a) {
4868
4896
  return [2 /*return*/, RESERVED_PARAMETER_MISSING_VALUE /* <- TODO: [🏍] Implement */];
@@ -4875,15 +4903,10 @@
4875
4903
  *
4876
4904
  * @private internal utility of `createPipelineExecutor`
4877
4905
  */
4878
- function getKnowledgeForTemplate(options) {
4906
+ function getExamplesForTask(task) {
4879
4907
  return __awaiter(this, void 0, void 0, function () {
4880
- var preparedPipeline;
4881
4908
  return __generator(this, function (_a) {
4882
- preparedPipeline = options.preparedPipeline, options.template;
4883
- return [2 /*return*/, preparedPipeline.knowledgePieces.map(function (_a) {
4884
- var content = _a.content;
4885
- return "- ".concat(content);
4886
- }).join('\n')];
4909
+ return [2 /*return*/, RESERVED_PARAMETER_MISSING_VALUE /* <- TODO: [♨] Implement */];
4887
4910
  });
4888
4911
  });
4889
4912
  }
@@ -4893,10 +4916,15 @@
4893
4916
  *
4894
4917
  * @private internal utility of `createPipelineExecutor`
4895
4918
  */
4896
- function getExamplesForTemplate(template) {
4919
+ function getKnowledgeForTask(options) {
4897
4920
  return __awaiter(this, void 0, void 0, function () {
4921
+ var preparedPipeline;
4898
4922
  return __generator(this, function (_a) {
4899
- return [2 /*return*/, RESERVED_PARAMETER_MISSING_VALUE /* <- TODO: [♨] Implement */];
4923
+ preparedPipeline = options.preparedPipeline, options.task;
4924
+ return [2 /*return*/, preparedPipeline.knowledgePieces.map(function (_a) {
4925
+ var content = _a.content;
4926
+ return "- ".concat(content);
4927
+ }).join('\n')];
4900
4928
  });
4901
4929
  });
4902
4930
  }
@@ -4906,21 +4934,21 @@
4906
4934
  *
4907
4935
  * @private internal utility of `createPipelineExecutor`
4908
4936
  */
4909
- function getReservedParametersForTemplate(options) {
4937
+ function getReservedParametersForTask(options) {
4910
4938
  return __awaiter(this, void 0, void 0, function () {
4911
- var preparedPipeline, template, pipelineIdentification, context, knowledge, examples, currentDate, modelName, reservedParameters, _loop_1, RESERVED_PARAMETER_NAMES_1, RESERVED_PARAMETER_NAMES_1_1, parameterName;
4939
+ var preparedPipeline, task, pipelineIdentification, context, knowledge, examples, currentDate, modelName, reservedParameters, _loop_1, RESERVED_PARAMETER_NAMES_1, RESERVED_PARAMETER_NAMES_1_1, parameterName;
4912
4940
  var e_1, _a;
4913
4941
  return __generator(this, function (_b) {
4914
4942
  switch (_b.label) {
4915
4943
  case 0:
4916
- preparedPipeline = options.preparedPipeline, template = options.template, pipelineIdentification = options.pipelineIdentification;
4917
- return [4 /*yield*/, getContextForTemplate()];
4944
+ preparedPipeline = options.preparedPipeline, task = options.task, pipelineIdentification = options.pipelineIdentification;
4945
+ return [4 /*yield*/, getContextForTask()];
4918
4946
  case 1:
4919
4947
  context = _b.sent();
4920
- return [4 /*yield*/, getKnowledgeForTemplate({ preparedPipeline: preparedPipeline, template: template })];
4948
+ return [4 /*yield*/, getKnowledgeForTask({ preparedPipeline: preparedPipeline, task: task })];
4921
4949
  case 2:
4922
4950
  knowledge = _b.sent();
4923
- return [4 /*yield*/, getExamplesForTemplate()];
4951
+ return [4 /*yield*/, getExamplesForTask()];
4924
4952
  case 3:
4925
4953
  examples = _b.sent();
4926
4954
  currentDate = new Date().toISOString();
@@ -4963,31 +4991,31 @@
4963
4991
  *
4964
4992
  * @private internal utility of `createPipelineExecutor`
4965
4993
  */
4966
- function executeTemplate(options) {
4994
+ function executeTask(options) {
4967
4995
  return __awaiter(this, void 0, void 0, function () {
4968
- 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;
4996
+ 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;
4969
4997
  var e_1, _g, _h;
4970
4998
  return __generator(this, function (_j) {
4971
4999
  switch (_j.label) {
4972
5000
  case 0:
4973
- 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;
4974
- name = "pipeline-executor-frame-".concat(currentTemplate.name);
4975
- title = currentTemplate.title;
4976
- priority = preparedPipeline.templates.length - preparedPipeline.templates.indexOf(currentTemplate);
5001
+ 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;
5002
+ name = "pipeline-executor-frame-".concat(currentTask.name);
5003
+ title = currentTask.title;
5004
+ priority = preparedPipeline.tasks.length - preparedPipeline.tasks.indexOf(currentTask);
4977
5005
  return [4 /*yield*/, onProgress({
4978
5006
  name: name,
4979
5007
  title: title,
4980
5008
  isStarted: false,
4981
5009
  isDone: false,
4982
- templateType: currentTemplate.templateType,
4983
- parameterName: currentTemplate.resultingParameterName,
5010
+ taskType: currentTask.taskType,
5011
+ parameterName: currentTask.resultingParameterName,
4984
5012
  parameterValue: null,
4985
5013
  // <- [🍸]
4986
5014
  })];
4987
5015
  case 1:
4988
5016
  _j.sent();
4989
- usedParameterNames = extractParameterNamesFromTemplate(currentTemplate);
4990
- dependentParameterNames = new Set(currentTemplate.dependentParameterNames);
5017
+ usedParameterNames = extractParameterNamesFromTask(currentTask);
5018
+ dependentParameterNames = new Set(currentTask.dependentParameterNames);
4991
5019
  // TODO: [👩🏾‍🤝‍👩🏻] Use here `mapAvailableToExpectedParameters`
4992
5020
  if (union(difference(usedParameterNames, dependentParameterNames), difference(dependentParameterNames, usedParameterNames)).size !== 0) {
4993
5021
  throw new UnexpectedError(spaceTrim.spaceTrim(function (block) { return "\n Dependent parameters are not consistent with used parameters:\n\n Dependent parameters:\n ".concat(Array.from(dependentParameterNames)
@@ -4998,9 +5026,9 @@
4998
5026
  }
4999
5027
  _c = (_b = Object).freeze;
5000
5028
  _d = [{}];
5001
- return [4 /*yield*/, getReservedParametersForTemplate({
5029
+ return [4 /*yield*/, getReservedParametersForTask({
5002
5030
  preparedPipeline: preparedPipeline,
5003
- template: currentTemplate,
5031
+ task: currentTask,
5004
5032
  pipelineIdentification: pipelineIdentification,
5005
5033
  })];
5006
5034
  case 2:
@@ -5018,11 +5046,11 @@
5018
5046
  else if (!definedParameterNames.has(parameterName) && usedParameterNames.has(parameterName)) {
5019
5047
  // Houston, we have a problem
5020
5048
  // Note: Checking part is also done in `validatePipeline`, but it’s good to doublecheck
5021
- throw new UnexpectedError(spaceTrim.spaceTrim(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 "); }));
5049
+ throw new UnexpectedError(spaceTrim.spaceTrim(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 "); }));
5022
5050
  }
5023
5051
  };
5024
5052
  try {
5025
- // Note: [2] Check that all used parameters are defined and removing unused parameters for this template
5053
+ // Note: [2] Check that all used parameters are defined and removing unused parameters for this task
5026
5054
  // TODO: [👩🏾‍🤝‍👩🏻] Use here `mapAvailableToExpectedParameters`
5027
5055
  for (_e = __values(Array.from(union(definedParameterNames, usedParameterNames, dependentParameterNames))), _f = _e.next(); !_f.done; _f = _e.next()) {
5028
5056
  parameterName = _f.value;
@@ -5038,18 +5066,16 @@
5038
5066
  }
5039
5067
  // 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
5040
5068
  Object.freeze(parameters);
5041
- maxAttempts = currentTemplate.templateType === 'DIALOG_TEMPLATE' ? Infinity : maxExecutionAttempts;
5042
- jokerParameterNames = currentTemplate.jokerParameterNames || [];
5043
- preparedContent = (currentTemplate.preparedContent || '{content}')
5044
- .split('{content}')
5045
- .join(currentTemplate.content);
5069
+ maxAttempts = currentTask.taskType === 'DIALOG_TASK' ? Infinity : maxExecutionAttempts;
5070
+ jokerParameterNames = currentTask.jokerParameterNames || [];
5071
+ preparedContent = (currentTask.preparedContent || '{content}').split('{content}').join(currentTask.content);
5046
5072
  return [4 /*yield*/, executeFormatSubvalues({
5047
5073
  jokerParameterNames: jokerParameterNames,
5048
5074
  priority: priority,
5049
5075
  maxAttempts: maxAttempts,
5050
5076
  preparedContent: preparedContent,
5051
5077
  parameters: parameters,
5052
- template: currentTemplate,
5078
+ task: currentTask,
5053
5079
  preparedPipeline: preparedPipeline,
5054
5080
  tools: tools,
5055
5081
  $executionReport: $executionReport,
@@ -5062,15 +5088,15 @@
5062
5088
  title: title,
5063
5089
  isStarted: true,
5064
5090
  isDone: true,
5065
- templateType: currentTemplate.templateType,
5066
- parameterName: currentTemplate.resultingParameterName,
5091
+ taskType: currentTask.taskType,
5092
+ parameterName: currentTask.resultingParameterName,
5067
5093
  parameterValue: resultString,
5068
5094
  // <- [🍸]
5069
5095
  })];
5070
5096
  case 4:
5071
5097
  _j.sent();
5072
5098
  return [2 /*return*/, Object.freeze((_h = {},
5073
- _h[currentTemplate.resultingParameterName] =
5099
+ _h[currentTask.resultingParameterName] =
5074
5100
  // <- Note: [👩‍👩‍👧] No need to detect parameter collision here because pipeline checks logic consistency during construction
5075
5101
  resultString,
5076
5102
  _h))];
@@ -5097,7 +5123,7 @@
5097
5123
  var _loop_1 = function (parameter) {
5098
5124
  if (parametersToPass[parameter.name] === undefined) {
5099
5125
  // [4]
5100
- $warnings.push(new PipelineExecutionError(spaceTrim.spaceTrim(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 "); })));
5126
+ $warnings.push(new PipelineExecutionError(spaceTrim.spaceTrim(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 "); })));
5101
5127
  return "continue";
5102
5128
  }
5103
5129
  outputParameters[parameter.name] = parametersToPass[parameter.name] || '';
@@ -5132,7 +5158,7 @@
5132
5158
  */
5133
5159
  function executePipeline(options) {
5134
5160
  return __awaiter(this, void 0, void 0, function () {
5135
- 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;
5161
+ 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;
5136
5162
  var e_1, _f, e_2, _g;
5137
5163
  return __generator(this, function (_h) {
5138
5164
  switch (_h.label) {
@@ -5184,7 +5210,7 @@
5184
5210
  case 6: return [2 /*return*/, $asDeeplyFrozenSerializableJson("Unuccessful PipelineExecutorResult (with missing parameter {".concat(parameter.name, "}) PipelineExecutorResult"), {
5185
5211
  isSuccessful: false,
5186
5212
  errors: __spreadArray([
5187
- new PipelineExecutionError("Parameter {".concat(parameter.name, "} is required as an input parameter"))
5213
+ new PipelineExecutionError("Parameter `{".concat(parameter.name, "}` is required as an input parameter"))
5188
5214
  ], __read(errors), false).map(serializeError),
5189
5215
  warnings: [],
5190
5216
  executionReport: executionReport,
@@ -5232,7 +5258,7 @@
5232
5258
  case 3: return [2 /*return*/, { value: $asDeeplyFrozenSerializableJson(spaceTrim.spaceTrim(function (block) { return "\n Unuccessful PipelineExecutorResult (with extra parameter {".concat(parameter.name, "}) PipelineExecutorResult\n\n ").concat(block(pipelineIdentification), "\n "); }), {
5233
5259
  isSuccessful: false,
5234
5260
  errors: __spreadArray([
5235
- new PipelineExecutionError(spaceTrim.spaceTrim(function (block) { return "\n Parameter {".concat(parameter.name, "} is passed as input parameter but it is not input\n\n ").concat(block(pipelineIdentification), "\n "); }))
5261
+ new PipelineExecutionError(spaceTrim.spaceTrim(function (block) { return "\n Parameter `{".concat(parameter.name, "}` is passed as input parameter but it is not input\n\n ").concat(block(pipelineIdentification), "\n "); }))
5236
5262
  ], __read(errors), false).map(serializeError),
5237
5263
  warnings: warnings.map(serializeError),
5238
5264
  executionReport: executionReport,
@@ -5286,11 +5312,11 @@
5286
5312
  var name = _a.name;
5287
5313
  return name;
5288
5314
  });
5289
- unresovedTemplates_1 = __spreadArray([], __read(preparedPipeline.templates), false);
5315
+ unresovedTasks_1 = __spreadArray([], __read(preparedPipeline.tasks), false);
5290
5316
  resolving_1 = [];
5291
5317
  loopLimit = LOOP_LIMIT;
5292
5318
  _loop_2 = function () {
5293
- var currentTemplate, work_1;
5319
+ var currentTask, work_1;
5294
5320
  return __generator(this, function (_k) {
5295
5321
  switch (_k.label) {
5296
5322
  case 0:
@@ -5298,31 +5324,41 @@
5298
5324
  // Note: Really UnexpectedError not LimitReachedError - this should be catched during validatePipeline
5299
5325
  throw new UnexpectedError(spaceTrim.spaceTrim(function (block) { return "\n Loop limit reached during resolving parameters pipeline execution\n\n ".concat(block(pipelineIdentification), "\n "); }));
5300
5326
  }
5301
- currentTemplate = unresovedTemplates_1.find(function (template) {
5302
- return template.dependentParameterNames.every(function (name) {
5327
+ currentTask = unresovedTasks_1.find(function (task) {
5328
+ return task.dependentParameterNames.every(function (name) {
5303
5329
  return __spreadArray(__spreadArray([], __read(resovedParameterNames_1), false), __read(RESERVED_PARAMETER_NAMES), false).includes(name);
5304
5330
  });
5305
5331
  });
5306
- if (!(!currentTemplate && resolving_1.length === 0)) return [3 /*break*/, 1];
5332
+ if (!(!currentTask && resolving_1.length === 0)) return [3 /*break*/, 1];
5307
5333
  throw new UnexpectedError(
5308
5334
  // TODO: [🐎] DRY
5309
- spaceTrim.spaceTrim(function (block) { return "\n Can not resolve some parameters:\n\n ".concat(block(pipelineIdentification), "\n\n Can not resolve:\n ").concat(block(unresovedTemplates_1
5335
+ spaceTrim.spaceTrim(function (block) { return "\n Can not resolve some parameters:\n\n ".concat(block(pipelineIdentification), "\n\n **Can not resolve:**\n ").concat(block(unresovedTasks_1
5310
5336
  .map(function (_a) {
5311
5337
  var resultingParameterName = _a.resultingParameterName, dependentParameterNames = _a.dependentParameterNames;
5312
- return "- Parameter {".concat(resultingParameterName, "} which depends on ").concat(dependentParameterNames
5313
- .map(function (dependentParameterName) { return "{".concat(dependentParameterName, "}"); })
5338
+ return "- Parameter `{".concat(resultingParameterName, "}` which depends on ").concat(dependentParameterNames
5339
+ .map(function (dependentParameterName) { return "`{".concat(dependentParameterName, "}`"); })
5314
5340
  .join(' and '));
5315
5341
  })
5316
- .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 "); }));
5342
+ .join('\n')), "\n\n **Resolved:**\n ").concat(block(resovedParameterNames_1
5343
+ .filter(function (name) {
5344
+ return !RESERVED_PARAMETER_NAMES.includes(name);
5345
+ })
5346
+ .map(function (name) { return "- Parameter `{".concat(name, "}`"); })
5347
+ .join('\n')), "\n\n **Reserved (which are available):**\n ").concat(block(resovedParameterNames_1
5348
+ .filter(function (name) {
5349
+ return RESERVED_PARAMETER_NAMES.includes(name);
5350
+ })
5351
+ .map(function (name) { return "- Parameter `{".concat(name, "}`"); })
5352
+ .join('\n')), "\n\n *Note: This should be catched in `validatePipeline`*\n "); }));
5317
5353
  case 1:
5318
- if (!!currentTemplate) return [3 /*break*/, 3];
5354
+ if (!!currentTask) return [3 /*break*/, 3];
5319
5355
  /* [🤹‍♂️] */ return [4 /*yield*/, Promise.race(resolving_1)];
5320
5356
  case 2:
5321
5357
  /* [🤹‍♂️] */ _k.sent();
5322
5358
  return [3 /*break*/, 4];
5323
5359
  case 3:
5324
- unresovedTemplates_1 = unresovedTemplates_1.filter(function (template) { return template !== currentTemplate; });
5325
- work_1 = executeTemplate(__assign(__assign({}, options), { currentTemplate: currentTemplate, preparedPipeline: preparedPipeline, parametersToPass: parametersToPass, tools: tools, onProgress: function (progress) {
5360
+ unresovedTasks_1 = unresovedTasks_1.filter(function (task) { return task !== currentTask; });
5361
+ work_1 = executeTask(__assign(__assign({}, options), { currentTask: currentTask, preparedPipeline: preparedPipeline, parametersToPass: parametersToPass, tools: tools, onProgress: function (progress) {
5326
5362
  if (isReturned) {
5327
5363
  throw new UnexpectedError(spaceTrim.spaceTrim(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)
5328
5364
  .split('\n')
@@ -5332,16 +5368,16 @@
5332
5368
  if (onProgress) {
5333
5369
  onProgress(progress);
5334
5370
  }
5335
- }, $executionReport: executionReport, pipelineIdentification: spaceTrim.spaceTrim(function (block) { return "\n ".concat(block(pipelineIdentification), "\n Template name: ").concat(currentTemplate.name, "\n Template title: ").concat(currentTemplate.title, "\n "); }) }))
5371
+ }, $executionReport: executionReport, pipelineIdentification: spaceTrim.spaceTrim(function (block) { return "\n ".concat(block(pipelineIdentification), "\n Task name: ").concat(currentTask.name, "\n Task title: ").concat(currentTask.title, "\n "); }) }))
5336
5372
  .then(function (newParametersToPass) {
5337
5373
  parametersToPass = __assign(__assign({}, newParametersToPass), parametersToPass);
5338
- resovedParameterNames_1 = __spreadArray(__spreadArray([], __read(resovedParameterNames_1), false), [currentTemplate.resultingParameterName], false);
5374
+ resovedParameterNames_1 = __spreadArray(__spreadArray([], __read(resovedParameterNames_1), false), [currentTask.resultingParameterName], false);
5339
5375
  })
5340
5376
  .then(function () {
5341
5377
  resolving_1 = resolving_1.filter(function (w) { return w !== work_1; });
5342
5378
  });
5343
5379
  // <- Note: Errors are catched here [3]
5344
- // 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
5380
+ // 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
5345
5381
  resolving_1.push(work_1);
5346
5382
  _k.label = 4;
5347
5383
  case 4: return [2 /*return*/];
@@ -5350,7 +5386,7 @@
5350
5386
  };
5351
5387
  _h.label = 21;
5352
5388
  case 21:
5353
- if (!(unresovedTemplates_1.length > 0)) return [3 /*break*/, 23];
5389
+ if (!(unresovedTasks_1.length > 0)) return [3 /*break*/, 23];
5354
5390
  return [5 /*yield**/, _loop_2()];
5355
5391
  case 22:
5356
5392
  _h.sent();
@@ -5508,6 +5544,9 @@
5508
5544
  * @public exported from `@promptbook/cli`
5509
5545
  */
5510
5546
  $scrapersMetadataRegister.register(markdownScraperMetadata);
5547
+ /**
5548
+ * Note: [💞] Ignore a discrepancy between file name and entity name
5549
+ */
5511
5550
 
5512
5551
  /**
5513
5552
  * Scraper for markdown files
@@ -5702,6 +5741,7 @@
5702
5741
  var _MarkdownScraperRegistration = $scrapersRegister.register(createMarkdownScraper);
5703
5742
  /**
5704
5743
  * TODO: [🎶] Naming "constructor" vs "creator" vs "factory"
5744
+ * Note: [💞] Ignore a discrepancy between file name and entity name
5705
5745
  */
5706
5746
 
5707
5747
  /**