@promptbook/node 0.75.0-1 → 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 (156) hide show
  1. package/README.md +1 -0
  2. package/esm/index.es.js +456 -414
  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 +22 -20
  6. package/esm/typings/src/_packages/types.index.d.ts +58 -50
  7. package/esm/typings/src/_packages/utils.index.d.ts +2 -2
  8. package/esm/typings/src/cli/cli-commands/about.d.ts +1 -0
  9. package/esm/typings/src/cli/cli-commands/hello.d.ts +1 -0
  10. package/esm/typings/src/cli/cli-commands/make.d.ts +1 -0
  11. package/esm/typings/src/cli/cli-commands/prettify.d.ts +1 -0
  12. package/esm/typings/src/cli/cli-commands/run.d.ts +1 -0
  13. package/esm/typings/src/cli/cli-commands/test-command.d.ts +1 -0
  14. package/esm/typings/src/cli/main.d.ts +1 -0
  15. package/esm/typings/src/collection/PipelineCollection.d.ts +1 -1
  16. package/esm/typings/src/collection/SimplePipelineCollection.d.ts +1 -1
  17. package/esm/typings/src/collection/collectionToJson.d.ts +1 -1
  18. package/esm/typings/src/collection/constructors/createCollectionFromJson.d.ts +1 -1
  19. package/esm/typings/src/collection/constructors/createCollectionFromPromise.d.ts +1 -1
  20. package/esm/typings/src/commands/EXPECT/ExpectCommand.d.ts +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 +2 -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/_common/AbstractFormfactorDefinition.d.ts +4 -1
  63. package/esm/typings/src/formfactors/_common/FormfactorDefinition.d.ts +3 -0
  64. package/esm/typings/src/formfactors/{chat/ChatFormfactorDefinition.d.ts → chatbot/ChatbotFormfactorDefinition.d.ts} +2 -2
  65. package/esm/typings/src/formfactors/generic/GenericFormfactorDefinition.d.ts +1 -1
  66. package/esm/typings/src/formfactors/index.d.ts +15 -4
  67. package/esm/typings/src/formfactors/matcher/MatcherFormfactorDefinition.d.ts +14 -0
  68. package/esm/typings/src/formfactors/sheets/SheetsFormfactorDefinition.d.ts +1 -1
  69. package/esm/typings/src/formfactors/translator/TranslatorFormfactorDefinition.d.ts +1 -1
  70. package/esm/typings/src/llm-providers/anthropic-claude/anthropic-claude-models.d.ts +1 -0
  71. package/esm/typings/src/llm-providers/anthropic-claude/register-configuration.d.ts +3 -0
  72. package/esm/typings/src/llm-providers/anthropic-claude/register-constructor.d.ts +1 -0
  73. package/esm/typings/src/llm-providers/azure-openai/register-configuration.d.ts +3 -0
  74. package/esm/typings/src/llm-providers/azure-openai/register-constructor.d.ts +1 -0
  75. package/esm/typings/src/llm-providers/mocked/$fakeTextToExpectations.d.ts +1 -1
  76. package/esm/typings/src/llm-providers/openai/openai-models.d.ts +1 -0
  77. package/esm/typings/src/llm-providers/openai/register-configuration.d.ts +3 -0
  78. package/esm/typings/src/llm-providers/openai/register-constructor.d.ts +1 -0
  79. package/esm/typings/src/personas/preparePersona.d.ts +1 -1
  80. package/esm/typings/src/pipeline/{pipeline-interface → PipelineInterface}/PipelineInterface.d.ts +3 -0
  81. package/esm/typings/src/pipeline/{pipeline-interface → PipelineInterface}/constants.d.ts +5 -0
  82. package/esm/typings/src/pipeline/{pipeline-interface → PipelineInterface}/getPipelineInterface.d.ts +3 -1
  83. package/esm/typings/src/pipeline/{pipeline-interface → PipelineInterface}/isPipelineImplementingInterface.d.ts +5 -1
  84. package/esm/typings/src/pipeline/{pipeline-interface → PipelineInterface}/isPipelineInterfacesEqual.d.ts +2 -0
  85. package/esm/typings/src/pipeline/PipelineJson/DialogTaskJson.d.ts +13 -0
  86. package/esm/typings/src/{types → pipeline}/PipelineJson/Expectations.d.ts +2 -2
  87. package/esm/typings/src/{types → pipeline}/PipelineJson/KnowledgePieceJson.d.ts +7 -6
  88. package/esm/typings/src/{types → pipeline}/PipelineJson/KnowledgeSourceJson.d.ts +3 -3
  89. package/esm/typings/src/pipeline/PipelineJson/ParameterJson.d.ts +96 -0
  90. package/esm/typings/src/{types → pipeline}/PipelineJson/PersonaJson.d.ts +4 -4
  91. package/esm/typings/src/{types → pipeline}/PipelineJson/PipelineJson.d.ts +10 -10
  92. package/esm/typings/src/{types → pipeline}/PipelineJson/PreparationJson.d.ts +1 -1
  93. package/esm/typings/src/{types/PipelineJson/PromptTemplateJson.d.ts → pipeline/PipelineJson/PromptTaskJson.d.ts} +8 -8
  94. package/esm/typings/src/pipeline/PipelineJson/ScriptTaskJson.d.ts +20 -0
  95. package/esm/typings/src/pipeline/PipelineJson/SimpleTaskJson.d.ts +13 -0
  96. package/esm/typings/src/pipeline/PipelineJson/TaskJson.d.ts +11 -0
  97. package/esm/typings/src/{types/PipelineJson/TemplateJsonCommon.d.ts → pipeline/PipelineJson/TaskJsonCommon.d.ts} +13 -13
  98. package/esm/typings/src/{types → pipeline}/PipelineString.d.ts +1 -1
  99. package/esm/typings/src/prepare/isPipelinePrepared.d.ts +2 -2
  100. package/esm/typings/src/prepare/preparePipeline.d.ts +1 -1
  101. package/esm/typings/src/prepare/{prepareTemplates.d.ts → prepareTasks.d.ts} +7 -7
  102. package/esm/typings/src/prepare/unpreparePipeline.d.ts +1 -1
  103. package/esm/typings/src/scrapers/_common/Scraper.d.ts +1 -1
  104. package/esm/typings/src/scrapers/_common/prepareKnowledgePieces.d.ts +2 -2
  105. package/esm/typings/src/scrapers/_common/utils/makeKnowledgeSourceHandler.d.ts +1 -1
  106. package/esm/typings/src/scrapers/document/DocumentScraper.d.ts +1 -1
  107. package/esm/typings/src/scrapers/document/register-constructor.d.ts +1 -0
  108. package/esm/typings/src/scrapers/document/register-metadata.d.ts +3 -0
  109. package/esm/typings/src/scrapers/document-legacy/LegacyDocumentScraper.d.ts +1 -1
  110. package/esm/typings/src/scrapers/document-legacy/register-constructor.d.ts +1 -0
  111. package/esm/typings/src/scrapers/document-legacy/register-metadata.d.ts +3 -0
  112. package/esm/typings/src/scrapers/markdown/MarkdownScraper.d.ts +1 -1
  113. package/esm/typings/src/scrapers/markdown/register-constructor.d.ts +1 -0
  114. package/esm/typings/src/scrapers/markdown/register-metadata.d.ts +3 -0
  115. package/esm/typings/src/scrapers/pdf/PdfScraper.d.ts +1 -1
  116. package/esm/typings/src/scrapers/pdf/register-constructor.d.ts +1 -0
  117. package/esm/typings/src/scrapers/pdf/register-metadata.d.ts +3 -0
  118. package/esm/typings/src/scrapers/website/WebsiteScraper.d.ts +1 -1
  119. package/esm/typings/src/scrapers/website/register-constructor.d.ts +1 -0
  120. package/esm/typings/src/scrapers/website/register-metadata.d.ts +3 -0
  121. package/esm/typings/src/scripting/javascript/postprocessing-functions.d.ts +1 -0
  122. package/esm/typings/src/types/Prompt.d.ts +1 -1
  123. package/esm/typings/src/types/TaskProgress.d.ts +2 -2
  124. package/esm/typings/src/types/typeAliasEmoji.d.ts +3 -0
  125. package/esm/typings/src/types/typeAliases.d.ts +1 -0
  126. package/esm/typings/src/utils/emojis.d.ts +1 -0
  127. package/esm/typings/src/utils/expectation-counters/constants.d.ts +1 -0
  128. package/esm/typings/src/utils/expectation-counters/countCharacters.d.ts +1 -1
  129. package/esm/typings/src/utils/expectation-counters/countLines.d.ts +1 -1
  130. package/esm/typings/src/utils/expectation-counters/countPages.d.ts +1 -1
  131. package/esm/typings/src/utils/expectation-counters/countParagraphs.d.ts +1 -1
  132. package/esm/typings/src/utils/expectation-counters/countSentences.d.ts +1 -1
  133. package/esm/typings/src/utils/expectation-counters/countWords.d.ts +1 -1
  134. package/esm/typings/src/utils/expectation-counters/index.d.ts +3 -2
  135. package/esm/typings/src/utils/normalization/normalize-to-kebab-case.d.ts +3 -0
  136. package/esm/typings/src/utils/parameters/extractParameterNames.d.ts +2 -2
  137. package/esm/typings/src/utils/serialization/clonePipeline.d.ts +1 -1
  138. package/esm/typings/src/version.d.ts +2 -1
  139. package/package.json +5 -4
  140. package/umd/index.umd.js +456 -414
  141. package/umd/index.umd.js.map +1 -1
  142. package/esm/typings/src/commands/TEMPLATE/TemplateCommand.d.ts +0 -11
  143. package/esm/typings/src/commands/TEMPLATE/TemplateTypes.d.ts +0 -15
  144. package/esm/typings/src/execution/createPipelineExecutor/getKnowledgeForTemplate.d.ts +0 -27
  145. package/esm/typings/src/execution/createPipelineExecutor/getReservedParametersForTemplate.d.ts +0 -30
  146. package/esm/typings/src/types/PipelineJson/DialogTemplateJson.d.ts +0 -13
  147. package/esm/typings/src/types/PipelineJson/ParameterJson.d.ts +0 -39
  148. package/esm/typings/src/types/PipelineJson/ScriptTemplateJson.d.ts +0 -20
  149. package/esm/typings/src/types/PipelineJson/SimpleTemplateJson.d.ts +0 -13
  150. package/esm/typings/src/types/PipelineJson/TemplateJson.d.ts +0 -11
  151. /package/esm/typings/src/commands/{TEMPLATE/templateCommand.test.d.ts → SECTION/sectionCommand.test.d.ts} +0 -0
  152. /package/esm/typings/src/conversion/utils/{extractParameterNamesFromTemplate.test.d.ts → extractParameterNamesFromTask.test.d.ts} +0 -0
  153. /package/esm/typings/src/{types → execution}/execution-report/ExecutionReportString.d.ts +0 -0
  154. /package/esm/typings/src/{types → execution}/execution-report/countWorkingDuration.d.ts +0 -0
  155. /package/esm/typings/src/{types → execution}/execution-report/countWorkingDuration.test.d.ts +0 -0
  156. /package/esm/typings/src/{types → execution}/execution-report/executionReportJsonToString.d.ts +0 -0
package/esm/index.es.js CHANGED
@@ -26,9 +26,10 @@ var BOOK_LANGUAGE_VERSION = '1.0.0';
26
26
  *
27
27
  * @see https://github.com/webgptorg/promptbook
28
28
  */
29
- var PROMPTBOOK_ENGINE_VERSION = '0.75.0-0';
29
+ var PROMPTBOOK_ENGINE_VERSION = '0.75.0-1';
30
30
  /**
31
31
  * TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
32
+ * Note: [💞] Ignore a discrepancy between file name and entity name
32
33
  */
33
34
 
34
35
  /*! *****************************************************************************
@@ -471,6 +472,7 @@ var IS_PIPELINE_LOGIC_VALIDATED = just(
471
472
  true);
472
473
  /**
473
474
  * TODO: Extract `constants.ts` from `config.ts`
475
+ * Note: [💞] Ignore a discrepancy between file name and entity name
474
476
  * TODO: [🧠][🧜‍♂️] Maybe join remoteUrl and path into single value
475
477
  */
476
478
 
@@ -526,7 +528,7 @@ function capitalize(word) {
526
528
  */
527
529
  function pipelineJsonToString(pipelineJson) {
528
530
  var e_1, _a, e_2, _b, e_3, _c, e_4, _d, e_5, _e, e_6, _f;
529
- var title = pipelineJson.title, pipelineUrl = pipelineJson.pipelineUrl, bookVersion = pipelineJson.bookVersion, description = pipelineJson.description, parameters = pipelineJson.parameters, templates = pipelineJson.templates;
531
+ var title = pipelineJson.title, pipelineUrl = pipelineJson.pipelineUrl, bookVersion = pipelineJson.bookVersion, description = pipelineJson.description, parameters = pipelineJson.parameters, tasks = pipelineJson.tasks;
530
532
  var pipelineString = "# ".concat(title);
531
533
  if (description) {
532
534
  pipelineString += '\n\n';
@@ -576,13 +578,13 @@ function pipelineJsonToString(pipelineJson) {
576
578
  pipelineString += '\n\n';
577
579
  pipelineString += commands.map(function (command) { return "- ".concat(command); }).join('\n');
578
580
  try {
579
- for (var templates_1 = __values(templates), templates_1_1 = templates_1.next(); !templates_1_1.done; templates_1_1 = templates_1.next()) {
580
- var template = templates_1_1.value;
581
+ for (var tasks_1 = __values(tasks), tasks_1_1 = tasks_1.next(); !tasks_1_1.done; tasks_1_1 = tasks_1.next()) {
582
+ var template = tasks_1_1.value;
581
583
  var
582
584
  /* Note: Not using:> name, */
583
585
  title_1 = template.title, description_1 = template.description,
584
586
  /* Note: dependentParameterNames, */
585
- jokers = template.jokerParameterNames, templateType = template.templateType, content = template.content, postprocessing = template.postprocessingFunctionNames, expectations = template.expectations, format = template.format, resultingParameterName = template.resultingParameterName;
587
+ jokers = template.jokerParameterNames, taskType = template.taskType, content = template.content, postprocessing = template.postprocessingFunctionNames, expectations = template.expectations, format = template.format, resultingParameterName = template.resultingParameterName;
586
588
  pipelineString += '\n\n';
587
589
  pipelineString += "## ".concat(title_1);
588
590
  if (description_1) {
@@ -591,7 +593,7 @@ function pipelineJsonToString(pipelineJson) {
591
593
  }
592
594
  var commands_1 = [];
593
595
  var contentLanguage = 'text';
594
- if (templateType === 'PROMPT_TEMPLATE') {
596
+ if (taskType === 'PROMPT_TASK') {
595
597
  var modelRequirements = template.modelRequirements;
596
598
  var _l = modelRequirements || {}, modelName = _l.modelName, modelVariant = _l.modelVariant;
597
599
  commands_1.push("EXECUTE PROMPT TEMPLATE");
@@ -602,11 +604,11 @@ function pipelineJsonToString(pipelineJson) {
602
604
  commands_1.push("MODEL NAME `".concat(modelName, "`"));
603
605
  }
604
606
  }
605
- else if (templateType === 'SIMPLE_TEMPLATE') {
607
+ else if (taskType === 'SIMPLE_TASK') {
606
608
  commands_1.push("SIMPLE TEMPLATE");
607
609
  // Note: Nothing special here
608
610
  }
609
- else if (templateType === 'SCRIPT_TEMPLATE') {
611
+ else if (taskType === 'SCRIPT_TASK') {
610
612
  commands_1.push("SCRIPT TEMPLATE");
611
613
  if (template.contentLanguage) {
612
614
  contentLanguage = template.contentLanguage;
@@ -615,7 +617,7 @@ function pipelineJsonToString(pipelineJson) {
615
617
  contentLanguage = '';
616
618
  }
617
619
  }
618
- else if (templateType === 'DIALOG_TEMPLATE') {
620
+ else if (taskType === 'DIALOG_TASK') {
619
621
  commands_1.push("DIALOG TEMPLATE");
620
622
  // Note: Nothing special here
621
623
  } // <- }else if([🅱]
@@ -697,7 +699,7 @@ function pipelineJsonToString(pipelineJson) {
697
699
  catch (e_3_1) { e_3 = { error: e_3_1 }; }
698
700
  finally {
699
701
  try {
700
- if (templates_1_1 && !templates_1_1.done && (_c = templates_1.return)) _c.call(templates_1);
702
+ if (tasks_1_1 && !tasks_1_1.done && (_c = tasks_1.return)) _c.call(tasks_1);
701
703
  }
702
704
  finally { if (e_3) throw e_3.error; }
703
705
  }
@@ -866,6 +868,9 @@ $deepFreeze({
866
868
  pagesCount: { value: 0, isUncertain: true },
867
869
  },
868
870
  });
871
+ /**
872
+ * Note: [💞] Ignore a discrepancy between file name and entity name
873
+ */
869
874
 
870
875
  /**
871
876
  * @@@
@@ -1357,7 +1362,7 @@ function joinLlmExecutionTools() {
1357
1362
  * TODO: [👷‍♂️] @@@ Manual about construction of llmTools
1358
1363
  */
1359
1364
 
1360
- 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"}];
1365
+ 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"}];
1361
1366
 
1362
1367
  /**
1363
1368
  * This error indicates that the promptbook in a markdown format cannot be parsed into a valid promptbook object
@@ -1611,9 +1616,9 @@ function validatePipelineCore(pipeline) {
1611
1616
  throw new ParseError(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 "); }));
1612
1617
  }
1613
1618
  // TODO: [🧠] Maybe do here some propper JSON-schema / ZOD checking
1614
- if (!Array.isArray(pipeline.templates)) {
1619
+ if (!Array.isArray(pipeline.tasks)) {
1615
1620
  // TODO: [🧠] what is the correct error tp throw - maybe PromptbookSchemaError
1616
- throw new ParseError(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 "); }));
1621
+ throw new ParseError(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 "); }));
1617
1622
  }
1618
1623
  var _loop_1 = function (parameter) {
1619
1624
  if (parameter.isInput && parameter.isOutput) {
@@ -1622,13 +1627,12 @@ function validatePipelineCore(pipeline) {
1622
1627
  // Note: Testing that parameter is either intermediate or output BUT not created and unused
1623
1628
  if (!parameter.isInput &&
1624
1629
  !parameter.isOutput &&
1625
- !pipeline.templates.some(function (template) { return template.dependentParameterNames.includes(parameter.name); })) {
1630
+ !pipeline.tasks.some(function (task) { return task.dependentParameterNames.includes(parameter.name); })) {
1626
1631
  throw new PipelineLogicError(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 "); }));
1627
1632
  }
1628
- // Note: Testing that parameter is either input or result of some template
1629
- if (!parameter.isInput &&
1630
- !pipeline.templates.some(function (template) { return template.resultingParameterName === parameter.name; })) {
1631
- throw new PipelineLogicError(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 "); }));
1633
+ // Note: Testing that parameter is either input or result of some task
1634
+ if (!parameter.isInput && !pipeline.tasks.some(function (task) { return task.resultingParameterName === parameter.name; })) {
1635
+ throw new PipelineLogicError(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 "); }));
1632
1636
  }
1633
1637
  };
1634
1638
  try {
@@ -1645,7 +1649,7 @@ function validatePipelineCore(pipeline) {
1645
1649
  }
1646
1650
  finally { if (e_1) throw e_1.error; }
1647
1651
  }
1648
- // Note: All input parameters are defined - so that they can be used as result of some template
1652
+ // Note: All input parameters are defined - so that they can be used as result of some task
1649
1653
  var definedParameters = new Set(pipeline.parameters.filter(function (_a) {
1650
1654
  var isInput = _a.isInput;
1651
1655
  return isInput;
@@ -1653,27 +1657,27 @@ function validatePipelineCore(pipeline) {
1653
1657
  var name = _a.name;
1654
1658
  return name;
1655
1659
  }));
1656
- var _loop_2 = function (template) {
1660
+ var _loop_2 = function (task) {
1657
1661
  var e_4, _h, e_5, _j;
1658
- if (definedParameters.has(template.resultingParameterName)) {
1659
- throw new PipelineLogicError(spaceTrim(function (block) { return "\n Parameter `{".concat(template.resultingParameterName, "}` is defined multiple times\n\n ").concat(block(pipelineIdentification), "\n "); }));
1662
+ if (definedParameters.has(task.resultingParameterName)) {
1663
+ throw new PipelineLogicError(spaceTrim(function (block) { return "\n Parameter `{".concat(task.resultingParameterName, "}` is defined multiple times\n\n ").concat(block(pipelineIdentification), "\n "); }));
1660
1664
  }
1661
- if (RESERVED_PARAMETER_NAMES.includes(template.resultingParameterName)) {
1662
- throw new PipelineLogicError(spaceTrim(function (block) { return "\n Parameter name {".concat(template.resultingParameterName, "} is reserved, please use different name\n\n ").concat(block(pipelineIdentification), "\n "); }));
1665
+ if (RESERVED_PARAMETER_NAMES.includes(task.resultingParameterName)) {
1666
+ throw new PipelineLogicError(spaceTrim(function (block) { return "\n Parameter name {".concat(task.resultingParameterName, "} is reserved, please use different name\n\n ").concat(block(pipelineIdentification), "\n "); }));
1663
1667
  }
1664
- definedParameters.add(template.resultingParameterName);
1665
- if (template.jokerParameterNames && template.jokerParameterNames.length > 0) {
1666
- if (!template.format &&
1667
- !template.expectations /* <- TODO: Require at least 1 -> min <- expectation to use jokers */) {
1668
- throw new PipelineLogicError(spaceTrim(function (block) { return "\n Joker parameters are used for {".concat(template.resultingParameterName, "} but no expectations are defined\n\n ").concat(block(pipelineIdentification), "\n "); }));
1668
+ definedParameters.add(task.resultingParameterName);
1669
+ if (task.jokerParameterNames && task.jokerParameterNames.length > 0) {
1670
+ if (!task.format &&
1671
+ !task.expectations /* <- TODO: Require at least 1 -> min <- expectation to use jokers */) {
1672
+ throw new PipelineLogicError(spaceTrim(function (block) { return "\n Joker parameters are used for {".concat(task.resultingParameterName, "} but no expectations are defined\n\n ").concat(block(pipelineIdentification), "\n "); }));
1669
1673
  }
1670
1674
  var _loop_4 = function (joker) {
1671
- if (!template.dependentParameterNames.includes(joker)) {
1672
- throw new PipelineLogicError(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 "); }));
1675
+ if (!task.dependentParameterNames.includes(joker)) {
1676
+ throw new PipelineLogicError(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 "); }));
1673
1677
  }
1674
1678
  };
1675
1679
  try {
1676
- for (var _k = (e_4 = void 0, __values(template.jokerParameterNames)), _l = _k.next(); !_l.done; _l = _k.next()) {
1680
+ for (var _k = (e_4 = void 0, __values(task.jokerParameterNames)), _l = _k.next(); !_l.done; _l = _k.next()) {
1677
1681
  var joker = _l.value;
1678
1682
  _loop_4(joker);
1679
1683
  }
@@ -1686,7 +1690,7 @@ function validatePipelineCore(pipeline) {
1686
1690
  finally { if (e_4) throw e_4.error; }
1687
1691
  }
1688
1692
  }
1689
- if (template.expectations) {
1693
+ if (task.expectations) {
1690
1694
  var _loop_5 = function (unit, min, max) {
1691
1695
  if (min !== undefined && max !== undefined && min > max) {
1692
1696
  throw new PipelineLogicError(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 "); }));
@@ -1699,7 +1703,7 @@ function validatePipelineCore(pipeline) {
1699
1703
  }
1700
1704
  };
1701
1705
  try {
1702
- for (var _m = (e_5 = void 0, __values(Object.entries(template.expectations))), _o = _m.next(); !_o.done; _o = _m.next()) {
1706
+ for (var _m = (e_5 = void 0, __values(Object.entries(task.expectations))), _o = _m.next(); !_o.done; _o = _m.next()) {
1703
1707
  var _p = __read(_o.value, 2), unit = _p[0], _q = _p[1], min = _q.min, max = _q.max;
1704
1708
  _loop_5(unit, min, max);
1705
1709
  }
@@ -1714,10 +1718,10 @@ function validatePipelineCore(pipeline) {
1714
1718
  }
1715
1719
  };
1716
1720
  try {
1717
- // Note: Checking each template individually
1718
- for (var _f = __values(pipeline.templates), _g = _f.next(); !_g.done; _g = _f.next()) {
1719
- var template = _g.value;
1720
- _loop_2(template);
1721
+ // Note: Checking each task individually
1722
+ for (var _f = __values(pipeline.tasks), _g = _f.next(); !_g.done; _g = _f.next()) {
1723
+ var task = _g.value;
1724
+ _loop_2(task);
1721
1725
  }
1722
1726
  }
1723
1727
  catch (e_2_1) { e_2 = { error: e_2_1 }; }
@@ -1751,15 +1755,15 @@ function validatePipelineCore(pipeline) {
1751
1755
  }
1752
1756
  finally { if (e_3) throw e_3.error; }
1753
1757
  }
1754
- var unresovedTemplates = __spreadArray([], __read(pipeline.templates), false);
1758
+ var unresovedTemplates = __spreadArray([], __read(pipeline.tasks), false);
1755
1759
  var loopLimit = LOOP_LIMIT;
1756
1760
  var _loop_3 = function () {
1757
1761
  if (loopLimit-- < 0) {
1758
1762
  // Note: Really UnexpectedError not LimitReachedError - this should not happen and be caught below
1759
1763
  throw new UnexpectedError(spaceTrim(function (block) { return "\n Loop limit reached during detection of circular dependencies in `validatePipeline`\n\n ".concat(block(pipelineIdentification), "\n "); }));
1760
1764
  }
1761
- var currentlyResovedTemplates = unresovedTemplates.filter(function (template) {
1762
- return template.dependentParameterNames.every(function (name) { return resovedParameters.includes(name); });
1765
+ var currentlyResovedTemplates = unresovedTemplates.filter(function (task) {
1766
+ return task.dependentParameterNames.every(function (name) { return resovedParameters.includes(name); });
1763
1767
  });
1764
1768
  if (currentlyResovedTemplates.length === 0) {
1765
1769
  throw new PipelineLogicError(
@@ -1787,7 +1791,7 @@ function validatePipelineCore(pipeline) {
1787
1791
  var resultingParameterName = _a.resultingParameterName;
1788
1792
  return resultingParameterName;
1789
1793
  })), false);
1790
- unresovedTemplates = unresovedTemplates.filter(function (template) { return !currentlyResovedTemplates.includes(template); });
1794
+ unresovedTemplates = unresovedTemplates.filter(function (task) { return !currentlyResovedTemplates.includes(task); });
1791
1795
  };
1792
1796
  while (unresovedTemplates.length > 0) {
1793
1797
  _loop_3();
@@ -1849,9 +1853,9 @@ var PipelineUrlError = /** @class */ (function (_super) {
1849
1853
  }(Error));
1850
1854
 
1851
1855
  /**
1852
- * Parses the template and returns the list of all parameter names
1856
+ * Parses the task and returns the list of all parameter names
1853
1857
  *
1854
- * @param template the template with parameters in {curly} braces
1858
+ * @param template the task with parameters in {curly} braces
1855
1859
  * @returns the list of parameter names
1856
1860
  * @public exported from `@promptbook/utils`
1857
1861
  */
@@ -1882,10 +1886,10 @@ function extractParameterNames(template) {
1882
1886
  * @public exported from `@promptbook/core`
1883
1887
  */
1884
1888
  function unpreparePipeline(pipeline) {
1885
- var personas = pipeline.personas, knowledgeSources = pipeline.knowledgeSources, templates = pipeline.templates;
1889
+ var personas = pipeline.personas, knowledgeSources = pipeline.knowledgeSources, tasks = pipeline.tasks;
1886
1890
  personas = personas.map(function (persona) { return (__assign(__assign({}, persona), { modelRequirements: undefined, preparationIds: undefined })); });
1887
1891
  knowledgeSources = knowledgeSources.map(function (knowledgeSource) { return (__assign(__assign({}, knowledgeSource), { preparationIds: undefined })); });
1888
- templates = templates.map(function (template) {
1892
+ tasks = tasks.map(function (template) {
1889
1893
  var dependentParameterNames = template.dependentParameterNames;
1890
1894
  var parameterNames = extractParameterNames(template.preparedContent || '');
1891
1895
  dependentParameterNames = dependentParameterNames.filter(function (dependentParameterName) { return !parameterNames.has(dependentParameterName); });
@@ -1893,7 +1897,7 @@ function unpreparePipeline(pipeline) {
1893
1897
  delete templateUnprepared.preparedContent;
1894
1898
  return templateUnprepared;
1895
1899
  });
1896
- return $asDeeplyFrozenSerializableJson('Unprepared PipelineJson', __assign(__assign({}, pipeline), { templates: templates, knowledgeSources: knowledgeSources, knowledgePieces: [], personas: personas, preparations: [] }));
1900
+ return $asDeeplyFrozenSerializableJson('Unprepared PipelineJson', __assign(__assign({}, pipeline), { tasks: tasks, knowledgeSources: knowledgeSources, knowledgePieces: [], personas: personas, preparations: [] }));
1897
1901
  }
1898
1902
  /**
1899
1903
  * TODO: [🧿] Maybe do same process with same granularity and subfinctions as `preparePipeline`
@@ -2108,6 +2112,9 @@ var ERRORS = {
2108
2112
  UnexpectedError: UnexpectedError,
2109
2113
  // TODO: [🪑]> VersionMismatchError,
2110
2114
  };
2115
+ /**
2116
+ * Note: [💞] Ignore a discrepancy between file name and entity name
2117
+ */
2111
2118
 
2112
2119
  /**
2113
2120
  * Deserializes the error object
@@ -2169,8 +2176,8 @@ function isPipelinePrepared(pipeline) {
2169
2176
  return false;
2170
2177
  }
2171
2178
  /*
2172
- TODO: [🧠][🍫] `templates` can not be determined if they are fully prepared SO ignoring them
2173
- > if (!pipeline.templates.every(({ preparedContent }) => preparedContent === undefined)) {
2179
+ TODO: [🧠][🍫] `tasks` can not be determined if they are fully prepared SO ignoring them
2180
+ > if (!pipeline.tasks.every(({ preparedContent }) => preparedContent === undefined)) {
2174
2181
  > return false;
2175
2182
  > }
2176
2183
  */
@@ -2183,7 +2190,7 @@ function isPipelinePrepared(pipeline) {
2183
2190
  * TODO: [🧿] Maybe do same process with same granularity and subfinctions as `preparePipeline`
2184
2191
  * - [🏍] ? Is context in each template
2185
2192
  * - [♨] Are examples prepared
2186
- * - [♨] Are templates prepared
2193
+ * - [♨] Are tasks prepared
2187
2194
  */
2188
2195
 
2189
2196
  /**
@@ -2260,9 +2267,9 @@ function extractVariables(script) {
2260
2267
  * @throws {ParseError} if the script is invalid
2261
2268
  * @public exported from `@promptbook/utils`
2262
2269
  */
2263
- function extractParameterNamesFromTemplate(template) {
2270
+ function extractParameterNamesFromTask(template) {
2264
2271
  var e_1, _a, e_2, _b, e_3, _c, e_4, _d;
2265
- var title = template.title, description = template.description, templateType = template.templateType, content = template.content, preparedContent = template.preparedContent, jokerParameterNames = template.jokerParameterNames, foreach = template.foreach;
2272
+ var title = template.title, description = template.description, taskType = template.taskType, content = template.content, preparedContent = template.preparedContent, jokerParameterNames = template.jokerParameterNames, foreach = template.foreach;
2266
2273
  var parameterNames = new Set();
2267
2274
  try {
2268
2275
  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()) {
@@ -2277,7 +2284,7 @@ function extractParameterNamesFromTemplate(template) {
2277
2284
  }
2278
2285
  finally { if (e_1) throw e_1.error; }
2279
2286
  }
2280
- if (templateType === 'SCRIPT_TEMPLATE') {
2287
+ if (taskType === 'SCRIPT_TASK') {
2281
2288
  try {
2282
2289
  for (var _g = __values(extractVariables(content)), _h = _g.next(); !_h.done; _h = _g.next()) {
2283
2290
  var parameterName = _h.value;
@@ -2708,6 +2715,9 @@ var FORMAT_DEFINITIONS = [
2708
2715
  TextFormatDefinition,
2709
2716
  CsvFormatDefinition,
2710
2717
  ];
2718
+ /**
2719
+ * Note: [💞] Ignore a discrepancy between file name and entity name
2720
+ */
2711
2721
 
2712
2722
  /**
2713
2723
  * Maps available parameters to expected parameters
@@ -2943,7 +2953,7 @@ function replaceParameters(template, parameters) {
2943
2953
  }
2944
2954
  finally { if (e_1) throw e_1.error; }
2945
2955
  }
2946
- var replacedTemplate = template;
2956
+ var replacedTemplates = template;
2947
2957
  var match;
2948
2958
  var loopLimit = LOOP_LIMIT;
2949
2959
  var _loop_1 = function () {
@@ -2972,24 +2982,24 @@ function replaceParameters(template, parameters) {
2972
2982
  .map(function (line, index) { return (index === 0 ? line : "".concat(precol).concat(line)); })
2973
2983
  .join('\n');
2974
2984
  }
2975
- replacedTemplate =
2976
- replacedTemplate.substring(0, match.index + precol.length) +
2985
+ replacedTemplates =
2986
+ replacedTemplates.substring(0, match.index + precol.length) +
2977
2987
  parameterValue +
2978
- replacedTemplate.substring(match.index + precol.length + parameterName.length + 2);
2988
+ replacedTemplates.substring(match.index + precol.length + parameterName.length + 2);
2979
2989
  };
2980
2990
  while ((match = /^(?<precol>.*){(?<parameterName>\w+)}(.*)/m /* <- Not global */
2981
- .exec(replacedTemplate))) {
2991
+ .exec(replacedTemplates))) {
2982
2992
  _loop_1();
2983
2993
  }
2984
2994
  // [💫] Check if there are parameters that are not closed properly
2985
- if (/{\w+$/.test(replacedTemplate)) {
2995
+ if (/{\w+$/.test(replacedTemplates)) {
2986
2996
  throw new PipelineExecutionError('Parameter is not closed');
2987
2997
  }
2988
2998
  // [💫] Check if there are parameters that are not opened properly
2989
- if (/^\w+}/.test(replacedTemplate)) {
2999
+ if (/^\w+}/.test(replacedTemplates)) {
2990
3000
  throw new PipelineExecutionError('Parameter is not opened');
2991
3001
  }
2992
- return replacedTemplate;
3002
+ return replacedTemplates;
2993
3003
  }
2994
3004
 
2995
3005
  /**
@@ -3021,6 +3031,7 @@ var CHARACTERS_PER_STANDARD_LINE = 63;
3021
3031
  var LINES_PER_STANDARD_PAGE = 44;
3022
3032
  /**
3023
3033
  * TODO: [🧠] Should be this `constants.ts` or `config.ts`?
3034
+ * Note: [💞] Ignore a discrepancy between file name and entity name
3024
3035
  */
3025
3036
 
3026
3037
  /**
@@ -3361,6 +3372,7 @@ var CountUtils = {
3361
3372
  };
3362
3373
  /**
3363
3374
  * TODO: [🧠][🤠] This should be probbably as part of `TextFormatDefinition`
3375
+ * Note: [💞] Ignore a discrepancy between file name and entity name
3364
3376
  */
3365
3377
 
3366
3378
  /**
@@ -3409,12 +3421,12 @@ function checkExpectations(expectations, value) {
3409
3421
  */
3410
3422
  function executeAttempts(options) {
3411
3423
  return __awaiter(this, void 0, void 0, function () {
3412
- var jokerParameterNames, priority, maxAttempts, preparedContent, parameters, template, preparedPipeline, tools, $executionReport, pipelineIdentification, maxExecutionAttempts, $ongoingTemplateResult, _llms, llmTools, _loop_1, attempt, state_1;
3424
+ var jokerParameterNames, priority, maxAttempts, preparedContent, parameters, task, preparedPipeline, tools, $executionReport, pipelineIdentification, maxExecutionAttempts, $ongoingTaskResult, _llms, llmTools, _loop_1, attempt, state_1;
3413
3425
  return __generator(this, function (_a) {
3414
3426
  switch (_a.label) {
3415
3427
  case 0:
3416
- 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;
3417
- $ongoingTemplateResult = {
3428
+ 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;
3429
+ $ongoingTaskResult = {
3418
3430
  $result: null,
3419
3431
  $resultString: null,
3420
3432
  $expectError: null,
@@ -3434,52 +3446,51 @@ function executeAttempts(options) {
3434
3446
  if (isJokerAttempt && !jokerParameterName) {
3435
3447
  throw new UnexpectedError(spaceTrim(function (block) { return "\n Joker not found in attempt ".concat(attempt, "\n\n ").concat(block(pipelineIdentification), "\n "); }));
3436
3448
  }
3437
- $ongoingTemplateResult.$result = null;
3438
- $ongoingTemplateResult.$resultString = null;
3439
- $ongoingTemplateResult.$expectError = null;
3449
+ $ongoingTaskResult.$result = null;
3450
+ $ongoingTaskResult.$resultString = null;
3451
+ $ongoingTaskResult.$expectError = null;
3440
3452
  if (isJokerAttempt) {
3441
3453
  if (parameters[jokerParameterName] === undefined) {
3442
3454
  throw new PipelineExecutionError(spaceTrim(function (block) { return "\n Joker parameter {".concat(jokerParameterName, "} not defined\n\n ").concat(block(pipelineIdentification), "\n "); }));
3443
3455
  // <- TODO: This is maybe `PipelineLogicError` which should be detected in `validatePipeline` and here just thrown as `UnexpectedError`
3444
3456
  }
3445
3457
  else {
3446
- $ongoingTemplateResult.$resultString = parameters[jokerParameterName];
3458
+ $ongoingTaskResult.$resultString = parameters[jokerParameterName];
3447
3459
  }
3448
3460
  }
3449
3461
  _t.label = 1;
3450
3462
  case 1:
3451
3463
  _t.trys.push([1, 43, 44, 45]);
3452
3464
  if (!!isJokerAttempt) return [3 /*break*/, 25];
3453
- _b = template.templateType;
3465
+ _b = task.taskType;
3454
3466
  switch (_b) {
3455
- case 'SIMPLE_TEMPLATE': return [3 /*break*/, 2];
3456
- case 'PROMPT_TEMPLATE': return [3 /*break*/, 3];
3457
- case 'SCRIPT_TEMPLATE': return [3 /*break*/, 11];
3458
- case 'DIALOG_TEMPLATE': return [3 /*break*/, 22];
3467
+ case 'SIMPLE_TASK': return [3 /*break*/, 2];
3468
+ case 'PROMPT_TASK': return [3 /*break*/, 3];
3469
+ case 'SCRIPT_TASK': return [3 /*break*/, 11];
3470
+ case 'DIALOG_TASK': return [3 /*break*/, 22];
3459
3471
  }
3460
3472
  return [3 /*break*/, 24];
3461
3473
  case 2:
3462
- $ongoingTemplateResult.$resultString = replaceParameters(preparedContent, parameters);
3474
+ $ongoingTaskResult.$resultString = replaceParameters(preparedContent, parameters);
3463
3475
  return [3 /*break*/, 25];
3464
3476
  case 3:
3465
- modelRequirements = __assign(__assign({ modelVariant: 'CHAT' }, (preparedPipeline.defaultModelRequirements || {})), (template.modelRequirements || {}));
3466
- $ongoingTemplateResult.$prompt = {
3467
- title: template.title,
3477
+ modelRequirements = __assign(__assign({ modelVariant: 'CHAT' }, (preparedPipeline.defaultModelRequirements || {})), (task.modelRequirements || {}));
3478
+ $ongoingTaskResult.$prompt = {
3479
+ title: task.title,
3468
3480
  pipelineUrl: "".concat(preparedPipeline.pipelineUrl
3469
3481
  ? preparedPipeline.pipelineUrl
3470
- : 'anonymous' /* <- TODO: [🧠] How to deal with anonymous pipelines, do here some auto-url like SHA-256 based ad-hoc identifier? */, "#").concat(template.name
3471
- // <- TODO: Here should be maybe also subformat index to distinguish between same template with different subformat values
3482
+ : 'anonymous' /* <- TODO: [🧠] How to deal with anonymous pipelines, do here some auto-url like SHA-256 based ad-hoc identifier? */, "#").concat(task.name
3483
+ // <- TODO: Here should be maybe also subformat index to distinguish between same task with different subformat values
3472
3484
  ),
3473
3485
  parameters: parameters,
3474
3486
  content: preparedContent,
3475
3487
  modelRequirements: modelRequirements,
3476
3488
  expectations: __assign(__assign({}, (preparedPipeline.personas.find(function (_a) {
3477
3489
  var name = _a.name;
3478
- return name === template.personaName;
3479
- }) ||
3480
- {})), template.expectations),
3481
- format: template.format,
3482
- postprocessingFunctionNames: template.postprocessingFunctionNames,
3490
+ return name === task.personaName;
3491
+ }) || {})), task.expectations),
3492
+ format: task.format,
3493
+ postprocessingFunctionNames: task.postprocessingFunctionNames,
3483
3494
  }; // <- TODO: Not very good type guard
3484
3495
  _c = modelRequirements.modelVariant;
3485
3496
  switch (_c) {
@@ -3489,36 +3500,35 @@ function executeAttempts(options) {
3489
3500
  }
3490
3501
  return [3 /*break*/, 9];
3491
3502
  case 4:
3492
- _d = $ongoingTemplateResult;
3503
+ _d = $ongoingTaskResult;
3493
3504
  return [4 /*yield*/, llmTools.callChatModel(
3494
3505
  // <- TODO: [🧁] Check that `callChatModel` is defined
3495
- $deepFreeze($ongoingTemplateResult.$prompt))];
3506
+ $deepFreeze($ongoingTaskResult.$prompt))];
3496
3507
  case 5:
3497
3508
  _d.$chatResult = _t.sent();
3498
3509
  // TODO: [🍬] Destroy chatThread
3499
- $ongoingTemplateResult.$result = $ongoingTemplateResult.$chatResult;
3500
- $ongoingTemplateResult.$resultString = $ongoingTemplateResult.$chatResult.content;
3510
+ $ongoingTaskResult.$result = $ongoingTaskResult.$chatResult;
3511
+ $ongoingTaskResult.$resultString = $ongoingTaskResult.$chatResult.content;
3501
3512
  return [3 /*break*/, 10];
3502
3513
  case 6:
3503
- _e = $ongoingTemplateResult;
3514
+ _e = $ongoingTaskResult;
3504
3515
  return [4 /*yield*/, llmTools.callCompletionModel(
3505
3516
  // <- TODO: [🧁] Check that `callCompletionModel` is defined
3506
- $deepFreeze($ongoingTemplateResult.$prompt))];
3517
+ $deepFreeze($ongoingTaskResult.$prompt))];
3507
3518
  case 7:
3508
3519
  _e.$completionResult = _t.sent();
3509
- $ongoingTemplateResult.$result = $ongoingTemplateResult.$completionResult;
3510
- $ongoingTemplateResult.$resultString =
3511
- $ongoingTemplateResult.$completionResult.content;
3520
+ $ongoingTaskResult.$result = $ongoingTaskResult.$completionResult;
3521
+ $ongoingTaskResult.$resultString = $ongoingTaskResult.$completionResult.content;
3512
3522
  return [3 /*break*/, 10];
3513
3523
  case 8: throw new PipelineExecutionError(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 "); }));
3514
- case 9: throw new PipelineExecutionError(spaceTrim(function (block) { return "\n Unknown model variant \"".concat(template.modelRequirements.modelVariant, "\"\n\n ").concat(block(pipelineIdentification), "\n\n "); }));
3524
+ case 9: throw new PipelineExecutionError(spaceTrim(function (block) { return "\n Unknown model variant \"".concat(task.modelRequirements.modelVariant, "\"\n\n ").concat(block(pipelineIdentification), "\n\n "); }));
3515
3525
  case 10: return [3 /*break*/, 25];
3516
3526
  case 11:
3517
3527
  if (arrayableToArray(tools.script).length === 0) {
3518
3528
  throw new PipelineExecutionError(spaceTrim(function (block) { return "\n No script execution tools are available\n\n ".concat(block(pipelineIdentification), "\n "); }));
3519
3529
  }
3520
- if (!template.contentLanguage) {
3521
- throw new PipelineExecutionError(spaceTrim(function (block) { return "\n Script language is not defined for SCRIPT TEMPLATE \"".concat(template.name, "\"\n\n ").concat(block(pipelineIdentification), "\n "); }));
3530
+ if (!task.contentLanguage) {
3531
+ throw new PipelineExecutionError(spaceTrim(function (block) { return "\n Script language is not defined for SCRIPT TASK \"".concat(task.name, "\"\n\n ").concat(block(pipelineIdentification), "\n "); }));
3522
3532
  }
3523
3533
  _t.label = 12;
3524
3534
  case 12:
@@ -3531,9 +3541,9 @@ function executeAttempts(options) {
3531
3541
  _t.label = 14;
3532
3542
  case 14:
3533
3543
  _t.trys.push([14, 16, , 17]);
3534
- _h = $ongoingTemplateResult;
3544
+ _h = $ongoingTaskResult;
3535
3545
  return [4 /*yield*/, scriptTools.execute($deepFreeze({
3536
- scriptLanguage: template.contentLanguage,
3546
+ scriptLanguage: task.contentLanguage,
3537
3547
  script: preparedContent,
3538
3548
  parameters: parameters,
3539
3549
  }))];
@@ -3548,7 +3558,7 @@ function executeAttempts(options) {
3548
3558
  if (error_1 instanceof UnexpectedError) {
3549
3559
  throw error_1;
3550
3560
  }
3551
- $ongoingTemplateResult.$scriptPipelineExecutionErrors.push(error_1);
3561
+ $ongoingTaskResult.$scriptPipelineExecutionErrors.push(error_1);
3552
3562
  return [3 /*break*/, 17];
3553
3563
  case 17:
3554
3564
  _g = _f.next();
@@ -3565,14 +3575,14 @@ function executeAttempts(options) {
3565
3575
  finally { if (e_1) throw e_1.error; }
3566
3576
  return [7 /*endfinally*/];
3567
3577
  case 21:
3568
- if ($ongoingTemplateResult.$resultString !== null) {
3578
+ if ($ongoingTaskResult.$resultString !== null) {
3569
3579
  return [3 /*break*/, 25];
3570
3580
  }
3571
- if ($ongoingTemplateResult.$scriptPipelineExecutionErrors.length === 1) {
3572
- throw $ongoingTemplateResult.$scriptPipelineExecutionErrors[0];
3581
+ if ($ongoingTaskResult.$scriptPipelineExecutionErrors.length === 1) {
3582
+ throw $ongoingTaskResult.$scriptPipelineExecutionErrors[0];
3573
3583
  }
3574
3584
  else {
3575
- throw new PipelineExecutionError(spaceTrim(function (block) { return "\n Script execution failed ".concat($ongoingTemplateResult.$scriptPipelineExecutionErrors.length, "x\n\n ").concat(block(pipelineIdentification), "\n\n ").concat(block($ongoingTemplateResult.$scriptPipelineExecutionErrors
3585
+ throw new PipelineExecutionError(spaceTrim(function (block) { return "\n Script execution failed ".concat($ongoingTaskResult.$scriptPipelineExecutionErrors.length, "x\n\n ").concat(block(pipelineIdentification), "\n\n ").concat(block($ongoingTaskResult.$scriptPipelineExecutionErrors
3576
3586
  .map(function (error) { return '- ' + error.message; })
3577
3587
  .join('\n\n')), "\n "); }));
3578
3588
  }
@@ -3580,27 +3590,27 @@ function executeAttempts(options) {
3580
3590
  if (tools.userInterface === undefined) {
3581
3591
  throw new PipelineExecutionError(spaceTrim(function (block) { return "\n User interface tools are not available\n\n ".concat(block(pipelineIdentification), "\n "); }));
3582
3592
  }
3583
- // TODO: [🌹] When making next attempt for `DIALOG TEMPLATE`, preserve the previous user input
3584
- _j = $ongoingTemplateResult;
3593
+ // TODO: [🌹] When making next attempt for `DIALOG TASK`, preserve the previous user input
3594
+ _j = $ongoingTaskResult;
3585
3595
  return [4 /*yield*/, tools.userInterface.promptDialog($deepFreeze({
3586
- promptTitle: template.title,
3587
- promptMessage: replaceParameters(template.description || '', parameters),
3596
+ promptTitle: task.title,
3597
+ promptMessage: replaceParameters(task.description || '', parameters),
3588
3598
  defaultValue: replaceParameters(preparedContent, parameters),
3589
3599
  // TODO: [🧠] !! Figure out how to define placeholder in .book.md file
3590
3600
  placeholder: undefined,
3591
3601
  priority: priority,
3592
3602
  }))];
3593
3603
  case 23:
3594
- // TODO: [🌹] When making next attempt for `DIALOG TEMPLATE`, preserve the previous user input
3604
+ // TODO: [🌹] When making next attempt for `DIALOG TASK`, preserve the previous user input
3595
3605
  _j.$resultString = _t.sent();
3596
3606
  return [3 /*break*/, 25];
3597
- case 24: throw new PipelineExecutionError(spaceTrim(function (block) { return "\n Unknown execution type \"".concat(template.templateType, "\"\n\n ").concat(block(pipelineIdentification), "\n "); }));
3607
+ case 24: throw new PipelineExecutionError(spaceTrim(function (block) { return "\n Unknown execution type \"".concat(task.taskType, "\"\n\n ").concat(block(pipelineIdentification), "\n "); }));
3598
3608
  case 25:
3599
- if (!(!isJokerAttempt && template.postprocessingFunctionNames)) return [3 /*break*/, 42];
3609
+ if (!(!isJokerAttempt && task.postprocessingFunctionNames)) return [3 /*break*/, 42];
3600
3610
  _t.label = 26;
3601
3611
  case 26:
3602
3612
  _t.trys.push([26, 40, 41, 42]);
3603
- _k = (e_3 = void 0, __values(template.postprocessingFunctionNames)), _l = _k.next();
3613
+ _k = (e_3 = void 0, __values(task.postprocessingFunctionNames)), _l = _k.next();
3604
3614
  _t.label = 27;
3605
3615
  case 27:
3606
3616
  if (!!_l.done) return [3 /*break*/, 39];
@@ -3617,13 +3627,13 @@ function executeAttempts(options) {
3617
3627
  _t.label = 30;
3618
3628
  case 30:
3619
3629
  _t.trys.push([30, 32, , 33]);
3620
- _p = $ongoingTemplateResult;
3630
+ _p = $ongoingTaskResult;
3621
3631
  return [4 /*yield*/, scriptTools.execute({
3622
3632
  scriptLanguage: "javascript" /* <- TODO: Try it in each languages; In future allow postprocessing with arbitrary combination of languages to combine */,
3623
3633
  script: "".concat(functionName, "(resultString)"),
3624
3634
  parameters: {
3625
- resultString: $ongoingTemplateResult.$resultString || '',
3626
- // Note: No ...parametersForTemplate, because working with result only
3635
+ resultString: $ongoingTaskResult.$resultString || '',
3636
+ // Note: No ...parametersForTask, because working with result only
3627
3637
  },
3628
3638
  })];
3629
3639
  case 31:
@@ -3639,7 +3649,7 @@ function executeAttempts(options) {
3639
3649
  throw error_2;
3640
3650
  }
3641
3651
  postprocessingError = error_2;
3642
- $ongoingTemplateResult.$scriptPipelineExecutionErrors.push(error_2);
3652
+ $ongoingTaskResult.$scriptPipelineExecutionErrors.push(error_2);
3643
3653
  return [3 /*break*/, 33];
3644
3654
  case 33:
3645
3655
  _o = _m.next();
@@ -3676,12 +3686,12 @@ function executeAttempts(options) {
3676
3686
  return [7 /*endfinally*/];
3677
3687
  case 42:
3678
3688
  // TODO: [💝] Unite object for expecting amount and format
3679
- if (template.format) {
3680
- if (template.format === 'JSON') {
3681
- if (!isValidJsonString($ongoingTemplateResult.$resultString || '')) {
3689
+ if (task.format) {
3690
+ if (task.format === 'JSON') {
3691
+ if (!isValidJsonString($ongoingTaskResult.$resultString || '')) {
3682
3692
  // TODO: [🏢] Do more universally via `FormatDefinition`
3683
3693
  try {
3684
- $ongoingTemplateResult.$resultString = extractJsonBlock($ongoingTemplateResult.$resultString || '');
3694
+ $ongoingTaskResult.$resultString = extractJsonBlock($ongoingTaskResult.$resultString || '');
3685
3695
  }
3686
3696
  catch (error) {
3687
3697
  throw new ExpectError(spaceTrim(function (block) { return "\n Expected valid JSON string\n\n ".concat(block(
@@ -3690,12 +3700,12 @@ function executeAttempts(options) {
3690
3700
  }
3691
3701
  }
3692
3702
  else {
3693
- throw new UnexpectedError(spaceTrim(function (block) { return "\n Unknown format \"".concat(template.format, "\"\n\n ").concat(block(pipelineIdentification), "\n "); }));
3703
+ throw new UnexpectedError(spaceTrim(function (block) { return "\n Unknown format \"".concat(task.format, "\"\n\n ").concat(block(pipelineIdentification), "\n "); }));
3694
3704
  }
3695
3705
  }
3696
3706
  // TODO: [💝] Unite object for expecting amount and format
3697
- if (template.expectations) {
3698
- checkExpectations(template.expectations, $ongoingTemplateResult.$resultString || '');
3707
+ if (task.expectations) {
3708
+ checkExpectations(task.expectations, $ongoingTaskResult.$resultString || '');
3699
3709
  }
3700
3710
  return [2 /*return*/, "break-attempts"];
3701
3711
  case 43:
@@ -3703,38 +3713,38 @@ function executeAttempts(options) {
3703
3713
  if (!(error_3 instanceof ExpectError)) {
3704
3714
  throw error_3;
3705
3715
  }
3706
- $ongoingTemplateResult.$expectError = error_3;
3716
+ $ongoingTaskResult.$expectError = error_3;
3707
3717
  return [3 /*break*/, 45];
3708
3718
  case 44:
3709
3719
  if (!isJokerAttempt &&
3710
- template.templateType === 'PROMPT_TEMPLATE' &&
3711
- $ongoingTemplateResult.$prompt
3720
+ task.taskType === 'PROMPT_TASK' &&
3721
+ $ongoingTaskResult.$prompt
3712
3722
  // <- Note: [2] When some expected parameter is not defined, error will occur in replaceParameters
3713
3723
  // In that case we don’t want to make a report about it because it’s not a llm execution error
3714
3724
  ) {
3715
- // TODO: [🧠] Maybe put other templateTypes into report
3725
+ // TODO: [🧠] Maybe put other taskTypes into report
3716
3726
  $executionReport.promptExecutions.push({
3717
- prompt: __assign({}, $ongoingTemplateResult.$prompt),
3718
- result: $ongoingTemplateResult.$result || undefined,
3719
- error: $ongoingTemplateResult.$expectError === null
3727
+ prompt: __assign({}, $ongoingTaskResult.$prompt),
3728
+ result: $ongoingTaskResult.$result || undefined,
3729
+ error: $ongoingTaskResult.$expectError === null
3720
3730
  ? undefined
3721
- : serializeError($ongoingTemplateResult.$expectError),
3731
+ : serializeError($ongoingTaskResult.$expectError),
3722
3732
  });
3723
3733
  }
3724
3734
  return [7 /*endfinally*/];
3725
3735
  case 45:
3726
- if ($ongoingTemplateResult.$expectError !== null && attempt === maxAttempts - 1) {
3736
+ if ($ongoingTaskResult.$expectError !== null && attempt === maxAttempts - 1) {
3727
3737
  throw new PipelineExecutionError(spaceTrim(function (block) {
3728
3738
  var _a, _b, _c;
3729
- 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) || '')
3739
+ 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) || '')
3730
3740
  .split('\n')
3731
3741
  .map(function (line) { return "> ".concat(line); })
3732
- .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) || '')
3742
+ .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) || '')
3733
3743
  .split('\n')
3734
3744
  .map(function (line) { return "> ".concat(line); })
3735
- .join('\n')), "\n\n Last result:\n ").concat(block($ongoingTemplateResult.$resultString === null
3745
+ .join('\n')), "\n\n Last result:\n ").concat(block($ongoingTaskResult.$resultString === null
3736
3746
  ? 'null'
3737
- : $ongoingTemplateResult.$resultString
3747
+ : $ongoingTaskResult.$resultString
3738
3748
  .split('\n')
3739
3749
  .map(function (line) { return "> ".concat(line); })
3740
3750
  .join('\n')), "\n ---\n ");
@@ -3759,10 +3769,10 @@ function executeAttempts(options) {
3759
3769
  attempt++;
3760
3770
  return [3 /*break*/, 1];
3761
3771
  case 4:
3762
- if ($ongoingTemplateResult.$resultString === null) {
3772
+ if ($ongoingTaskResult.$resultString === null) {
3763
3773
  throw new UnexpectedError(spaceTrim(function (block) { return "\n Something went wrong and prompt result is null\n\n ".concat(block(pipelineIdentification), "\n "); }));
3764
3774
  }
3765
- return [2 /*return*/, $ongoingTemplateResult.$resultString];
3775
+ return [2 /*return*/, $ongoingTaskResult.$resultString];
3766
3776
  }
3767
3777
  });
3768
3778
  });
@@ -3778,36 +3788,36 @@ function executeAttempts(options) {
3778
3788
  */
3779
3789
  function executeFormatSubvalues(options) {
3780
3790
  return __awaiter(this, void 0, void 0, function () {
3781
- var template, jokerParameterNames, parameters, priority, csvSettings, pipelineIdentification, parameterValue, formatDefinition, subvalueDefinition, formatSettings, resultString;
3791
+ var task, jokerParameterNames, parameters, priority, csvSettings, pipelineIdentification, parameterValue, formatDefinition, subvalueDefinition, formatSettings, resultString;
3782
3792
  var _this = this;
3783
3793
  return __generator(this, function (_a) {
3784
3794
  switch (_a.label) {
3785
3795
  case 0:
3786
- template = options.template, jokerParameterNames = options.jokerParameterNames, parameters = options.parameters, priority = options.priority, csvSettings = options.csvSettings, pipelineIdentification = options.pipelineIdentification;
3787
- if (template.foreach === undefined) {
3796
+ task = options.task, jokerParameterNames = options.jokerParameterNames, parameters = options.parameters, priority = options.priority, csvSettings = options.csvSettings, pipelineIdentification = options.pipelineIdentification;
3797
+ if (task.foreach === undefined) {
3788
3798
  return [2 /*return*/, /* not await */ executeAttempts(options)];
3789
3799
  }
3790
3800
  if (jokerParameterNames.length !== 0) {
3791
3801
  throw new UnexpectedError(spaceTrim$1(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 "); }));
3792
3802
  }
3793
- parameterValue = parameters[template.foreach.parameterName] || '';
3803
+ parameterValue = parameters[task.foreach.parameterName] || '';
3794
3804
  formatDefinition = FORMAT_DEFINITIONS.find(function (formatDefinition) {
3795
- return __spreadArray([formatDefinition.formatName], __read((formatDefinition.aliases || [])), false).includes(template.foreach.formatName);
3805
+ return __spreadArray([formatDefinition.formatName], __read((formatDefinition.aliases || [])), false).includes(task.foreach.formatName);
3796
3806
  });
3797
3807
  if (formatDefinition === undefined) {
3798
3808
  throw new UnexpectedError(
3799
3809
  // <- TODO: [🧠][🧐] Should be formats fixed per promptbook version or behave as plugins (=> change UnexpectedError)
3800
- spaceTrim$1(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; })
3810
+ spaceTrim$1(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; })
3801
3811
  .map(function (formatName) { return "- ".concat(formatName); })
3802
3812
  .join('\n')), "\n\n [\u26F7] This should never happen because format name should be validated during parsing\n\n ").concat(block(pipelineIdentification), "\n "); }));
3803
3813
  }
3804
3814
  subvalueDefinition = formatDefinition.subvalueDefinitions.find(function (subvalueDefinition) {
3805
- return __spreadArray([subvalueDefinition.subvalueName], __read((subvalueDefinition.aliases || [])), false).includes(template.foreach.subformatName);
3815
+ return __spreadArray([subvalueDefinition.subvalueName], __read((subvalueDefinition.aliases || [])), false).includes(task.foreach.subformatName);
3806
3816
  });
3807
3817
  if (subvalueDefinition === undefined) {
3808
3818
  throw new UnexpectedError(
3809
3819
  // <- TODO: [🧠][🧐] Should be formats fixed per promptbook version or behave as plugins (=> change UnexpectedError)
3810
- spaceTrim$1(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
3820
+ spaceTrim$1(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
3811
3821
  .map(function (subvalueDefinition) { return subvalueDefinition.subvalueName; })
3812
3822
  .map(function (subvalueName) { return "- ".concat(subvalueName); })
3813
3823
  .join('\n')), "\n\n [\u26F7] This should never happen because subformat name should be validated during parsing\n\n ").concat(block(pipelineIdentification), "\n "); }));
@@ -3816,7 +3826,7 @@ function executeFormatSubvalues(options) {
3816
3826
  formatSettings = csvSettings;
3817
3827
  // <- TODO: [🤹‍♂️] More universal, make simmilar pattern for other formats for example \n vs \r\n in text
3818
3828
  }
3819
- return [4 /*yield*/, subvalueDefinition.mapValues(parameterValue, template.foreach.outputSubparameterName, formatSettings, function (subparameters, index) { return __awaiter(_this, void 0, void 0, function () {
3829
+ return [4 /*yield*/, subvalueDefinition.mapValues(parameterValue, task.foreach.outputSubparameterName, formatSettings, function (subparameters, index) { return __awaiter(_this, void 0, void 0, function () {
3820
3830
  var mappedParameters, allSubparameters, subresultString;
3821
3831
  return __generator(this, function (_a) {
3822
3832
  switch (_a.label) {
@@ -3825,7 +3835,7 @@ function executeFormatSubvalues(options) {
3825
3835
  // TODO: When done [🐚] Report progress also for each subvalue here
3826
3836
  try {
3827
3837
  mappedParameters = mapAvailableToExpectedParameters({
3828
- expectedParameters: Object.fromEntries(template.foreach.inputSubparameterNames.map(function (subparameterName) { return [subparameterName, null]; })),
3838
+ expectedParameters: Object.fromEntries(task.foreach.inputSubparameterNames.map(function (subparameterName) { return [subparameterName, null]; })),
3829
3839
  availableParameters: subparameters,
3830
3840
  });
3831
3841
  }
@@ -3858,7 +3868,7 @@ function executeFormatSubvalues(options) {
3858
3868
  *
3859
3869
  * @private internal utility of `createPipelineExecutor`
3860
3870
  */
3861
- function getContextForTemplate(template) {
3871
+ function getContextForTask(task) {
3862
3872
  return __awaiter(this, void 0, void 0, function () {
3863
3873
  return __generator(this, function (_a) {
3864
3874
  return [2 /*return*/, RESERVED_PARAMETER_MISSING_VALUE /* <- TODO: [🏍] Implement */];
@@ -3871,15 +3881,10 @@ function getContextForTemplate(template) {
3871
3881
  *
3872
3882
  * @private internal utility of `createPipelineExecutor`
3873
3883
  */
3874
- function getKnowledgeForTemplate(options) {
3884
+ function getExamplesForTask(task) {
3875
3885
  return __awaiter(this, void 0, void 0, function () {
3876
- var preparedPipeline;
3877
3886
  return __generator(this, function (_a) {
3878
- preparedPipeline = options.preparedPipeline, options.template;
3879
- return [2 /*return*/, preparedPipeline.knowledgePieces.map(function (_a) {
3880
- var content = _a.content;
3881
- return "- ".concat(content);
3882
- }).join('\n')];
3887
+ return [2 /*return*/, RESERVED_PARAMETER_MISSING_VALUE /* <- TODO: [♨] Implement */];
3883
3888
  });
3884
3889
  });
3885
3890
  }
@@ -3889,10 +3894,15 @@ function getKnowledgeForTemplate(options) {
3889
3894
  *
3890
3895
  * @private internal utility of `createPipelineExecutor`
3891
3896
  */
3892
- function getExamplesForTemplate(template) {
3897
+ function getKnowledgeForTask(options) {
3893
3898
  return __awaiter(this, void 0, void 0, function () {
3899
+ var preparedPipeline;
3894
3900
  return __generator(this, function (_a) {
3895
- return [2 /*return*/, RESERVED_PARAMETER_MISSING_VALUE /* <- TODO: [♨] Implement */];
3901
+ preparedPipeline = options.preparedPipeline, options.task;
3902
+ return [2 /*return*/, preparedPipeline.knowledgePieces.map(function (_a) {
3903
+ var content = _a.content;
3904
+ return "- ".concat(content);
3905
+ }).join('\n')];
3896
3906
  });
3897
3907
  });
3898
3908
  }
@@ -3902,21 +3912,21 @@ function getExamplesForTemplate(template) {
3902
3912
  *
3903
3913
  * @private internal utility of `createPipelineExecutor`
3904
3914
  */
3905
- function getReservedParametersForTemplate(options) {
3915
+ function getReservedParametersForTask(options) {
3906
3916
  return __awaiter(this, void 0, void 0, function () {
3907
- var preparedPipeline, template, pipelineIdentification, context, knowledge, examples, currentDate, modelName, reservedParameters, _loop_1, RESERVED_PARAMETER_NAMES_1, RESERVED_PARAMETER_NAMES_1_1, parameterName;
3917
+ var preparedPipeline, task, pipelineIdentification, context, knowledge, examples, currentDate, modelName, reservedParameters, _loop_1, RESERVED_PARAMETER_NAMES_1, RESERVED_PARAMETER_NAMES_1_1, parameterName;
3908
3918
  var e_1, _a;
3909
3919
  return __generator(this, function (_b) {
3910
3920
  switch (_b.label) {
3911
3921
  case 0:
3912
- preparedPipeline = options.preparedPipeline, template = options.template, pipelineIdentification = options.pipelineIdentification;
3913
- return [4 /*yield*/, getContextForTemplate()];
3922
+ preparedPipeline = options.preparedPipeline, task = options.task, pipelineIdentification = options.pipelineIdentification;
3923
+ return [4 /*yield*/, getContextForTask()];
3914
3924
  case 1:
3915
3925
  context = _b.sent();
3916
- return [4 /*yield*/, getKnowledgeForTemplate({ preparedPipeline: preparedPipeline, template: template })];
3926
+ return [4 /*yield*/, getKnowledgeForTask({ preparedPipeline: preparedPipeline, task: task })];
3917
3927
  case 2:
3918
3928
  knowledge = _b.sent();
3919
- return [4 /*yield*/, getExamplesForTemplate()];
3929
+ return [4 /*yield*/, getExamplesForTask()];
3920
3930
  case 3:
3921
3931
  examples = _b.sent();
3922
3932
  currentDate = new Date().toISOString();
@@ -3959,31 +3969,31 @@ function getReservedParametersForTemplate(options) {
3959
3969
  *
3960
3970
  * @private internal utility of `createPipelineExecutor`
3961
3971
  */
3962
- function executeTemplate(options) {
3972
+ function executeTask(options) {
3963
3973
  return __awaiter(this, void 0, void 0, function () {
3964
- 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;
3974
+ 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;
3965
3975
  var e_1, _g, _h;
3966
3976
  return __generator(this, function (_j) {
3967
3977
  switch (_j.label) {
3968
3978
  case 0:
3969
- 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;
3970
- name = "pipeline-executor-frame-".concat(currentTemplate.name);
3971
- title = currentTemplate.title;
3972
- priority = preparedPipeline.templates.length - preparedPipeline.templates.indexOf(currentTemplate);
3979
+ 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;
3980
+ name = "pipeline-executor-frame-".concat(currentTask.name);
3981
+ title = currentTask.title;
3982
+ priority = preparedPipeline.tasks.length - preparedPipeline.tasks.indexOf(currentTask);
3973
3983
  return [4 /*yield*/, onProgress({
3974
3984
  name: name,
3975
3985
  title: title,
3976
3986
  isStarted: false,
3977
3987
  isDone: false,
3978
- templateType: currentTemplate.templateType,
3979
- parameterName: currentTemplate.resultingParameterName,
3988
+ taskType: currentTask.taskType,
3989
+ parameterName: currentTask.resultingParameterName,
3980
3990
  parameterValue: null,
3981
3991
  // <- [🍸]
3982
3992
  })];
3983
3993
  case 1:
3984
3994
  _j.sent();
3985
- usedParameterNames = extractParameterNamesFromTemplate(currentTemplate);
3986
- dependentParameterNames = new Set(currentTemplate.dependentParameterNames);
3995
+ usedParameterNames = extractParameterNamesFromTask(currentTask);
3996
+ dependentParameterNames = new Set(currentTask.dependentParameterNames);
3987
3997
  // TODO: [👩🏾‍🤝‍👩🏻] Use here `mapAvailableToExpectedParameters`
3988
3998
  if (union(difference(usedParameterNames, dependentParameterNames), difference(dependentParameterNames, usedParameterNames)).size !== 0) {
3989
3999
  throw new UnexpectedError(spaceTrim(function (block) { return "\n Dependent parameters are not consistent with used parameters:\n\n Dependent parameters:\n ".concat(Array.from(dependentParameterNames)
@@ -3994,9 +4004,9 @@ function executeTemplate(options) {
3994
4004
  }
3995
4005
  _c = (_b = Object).freeze;
3996
4006
  _d = [{}];
3997
- return [4 /*yield*/, getReservedParametersForTemplate({
4007
+ return [4 /*yield*/, getReservedParametersForTask({
3998
4008
  preparedPipeline: preparedPipeline,
3999
- template: currentTemplate,
4009
+ task: currentTask,
4000
4010
  pipelineIdentification: pipelineIdentification,
4001
4011
  })];
4002
4012
  case 2:
@@ -4014,11 +4024,11 @@ function executeTemplate(options) {
4014
4024
  else if (!definedParameterNames.has(parameterName) && usedParameterNames.has(parameterName)) {
4015
4025
  // Houston, we have a problem
4016
4026
  // Note: Checking part is also done in `validatePipeline`, but it’s good to doublecheck
4017
- throw new UnexpectedError(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 "); }));
4027
+ throw new UnexpectedError(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 "); }));
4018
4028
  }
4019
4029
  };
4020
4030
  try {
4021
- // Note: [2] Check that all used parameters are defined and removing unused parameters for this template
4031
+ // Note: [2] Check that all used parameters are defined and removing unused parameters for this task
4022
4032
  // TODO: [👩🏾‍🤝‍👩🏻] Use here `mapAvailableToExpectedParameters`
4023
4033
  for (_e = __values(Array.from(union(definedParameterNames, usedParameterNames, dependentParameterNames))), _f = _e.next(); !_f.done; _f = _e.next()) {
4024
4034
  parameterName = _f.value;
@@ -4034,18 +4044,16 @@ function executeTemplate(options) {
4034
4044
  }
4035
4045
  // 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
4036
4046
  Object.freeze(parameters);
4037
- maxAttempts = currentTemplate.templateType === 'DIALOG_TEMPLATE' ? Infinity : maxExecutionAttempts;
4038
- jokerParameterNames = currentTemplate.jokerParameterNames || [];
4039
- preparedContent = (currentTemplate.preparedContent || '{content}')
4040
- .split('{content}')
4041
- .join(currentTemplate.content);
4047
+ maxAttempts = currentTask.taskType === 'DIALOG_TASK' ? Infinity : maxExecutionAttempts;
4048
+ jokerParameterNames = currentTask.jokerParameterNames || [];
4049
+ preparedContent = (currentTask.preparedContent || '{content}').split('{content}').join(currentTask.content);
4042
4050
  return [4 /*yield*/, executeFormatSubvalues({
4043
4051
  jokerParameterNames: jokerParameterNames,
4044
4052
  priority: priority,
4045
4053
  maxAttempts: maxAttempts,
4046
4054
  preparedContent: preparedContent,
4047
4055
  parameters: parameters,
4048
- template: currentTemplate,
4056
+ task: currentTask,
4049
4057
  preparedPipeline: preparedPipeline,
4050
4058
  tools: tools,
4051
4059
  $executionReport: $executionReport,
@@ -4058,15 +4066,15 @@ function executeTemplate(options) {
4058
4066
  title: title,
4059
4067
  isStarted: true,
4060
4068
  isDone: true,
4061
- templateType: currentTemplate.templateType,
4062
- parameterName: currentTemplate.resultingParameterName,
4069
+ taskType: currentTask.taskType,
4070
+ parameterName: currentTask.resultingParameterName,
4063
4071
  parameterValue: resultString,
4064
4072
  // <- [🍸]
4065
4073
  })];
4066
4074
  case 4:
4067
4075
  _j.sent();
4068
4076
  return [2 /*return*/, Object.freeze((_h = {},
4069
- _h[currentTemplate.resultingParameterName] =
4077
+ _h[currentTask.resultingParameterName] =
4070
4078
  // <- Note: [👩‍👩‍👧] No need to detect parameter collision here because pipeline checks logic consistency during construction
4071
4079
  resultString,
4072
4080
  _h))];
@@ -4128,7 +4136,7 @@ function filterJustOutputParameters(options) {
4128
4136
  */
4129
4137
  function executePipeline(options) {
4130
4138
  return __awaiter(this, void 0, void 0, function () {
4131
- 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;
4139
+ 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;
4132
4140
  var e_1, _f, e_2, _g;
4133
4141
  return __generator(this, function (_h) {
4134
4142
  switch (_h.label) {
@@ -4282,11 +4290,11 @@ function executePipeline(options) {
4282
4290
  var name = _a.name;
4283
4291
  return name;
4284
4292
  });
4285
- unresovedTemplates_1 = __spreadArray([], __read(preparedPipeline.templates), false);
4293
+ unresovedTasks_1 = __spreadArray([], __read(preparedPipeline.tasks), false);
4286
4294
  resolving_1 = [];
4287
4295
  loopLimit = LOOP_LIMIT;
4288
4296
  _loop_2 = function () {
4289
- var currentTemplate, work_1;
4297
+ var currentTask, work_1;
4290
4298
  return __generator(this, function (_k) {
4291
4299
  switch (_k.label) {
4292
4300
  case 0:
@@ -4294,15 +4302,15 @@ function executePipeline(options) {
4294
4302
  // Note: Really UnexpectedError not LimitReachedError - this should be catched during validatePipeline
4295
4303
  throw new UnexpectedError(spaceTrim(function (block) { return "\n Loop limit reached during resolving parameters pipeline execution\n\n ".concat(block(pipelineIdentification), "\n "); }));
4296
4304
  }
4297
- currentTemplate = unresovedTemplates_1.find(function (template) {
4298
- return template.dependentParameterNames.every(function (name) {
4305
+ currentTask = unresovedTasks_1.find(function (task) {
4306
+ return task.dependentParameterNames.every(function (name) {
4299
4307
  return __spreadArray(__spreadArray([], __read(resovedParameterNames_1), false), __read(RESERVED_PARAMETER_NAMES), false).includes(name);
4300
4308
  });
4301
4309
  });
4302
- if (!(!currentTemplate && resolving_1.length === 0)) return [3 /*break*/, 1];
4310
+ if (!(!currentTask && resolving_1.length === 0)) return [3 /*break*/, 1];
4303
4311
  throw new UnexpectedError(
4304
4312
  // TODO: [🐎] DRY
4305
- 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
4313
+ 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
4306
4314
  .map(function (_a) {
4307
4315
  var resultingParameterName = _a.resultingParameterName, dependentParameterNames = _a.dependentParameterNames;
4308
4316
  return "- Parameter `{".concat(resultingParameterName, "}` which depends on ").concat(dependentParameterNames
@@ -4321,14 +4329,14 @@ function executePipeline(options) {
4321
4329
  .map(function (name) { return "- Parameter `{".concat(name, "}`"); })
4322
4330
  .join('\n')), "\n\n *Note: This should be catched in `validatePipeline`*\n "); }));
4323
4331
  case 1:
4324
- if (!!currentTemplate) return [3 /*break*/, 3];
4332
+ if (!!currentTask) return [3 /*break*/, 3];
4325
4333
  /* [🤹‍♂️] */ return [4 /*yield*/, Promise.race(resolving_1)];
4326
4334
  case 2:
4327
4335
  /* [🤹‍♂️] */ _k.sent();
4328
4336
  return [3 /*break*/, 4];
4329
4337
  case 3:
4330
- unresovedTemplates_1 = unresovedTemplates_1.filter(function (template) { return template !== currentTemplate; });
4331
- work_1 = executeTemplate(__assign(__assign({}, options), { currentTemplate: currentTemplate, preparedPipeline: preparedPipeline, parametersToPass: parametersToPass, tools: tools, onProgress: function (progress) {
4338
+ unresovedTasks_1 = unresovedTasks_1.filter(function (task) { return task !== currentTask; });
4339
+ work_1 = executeTask(__assign(__assign({}, options), { currentTask: currentTask, preparedPipeline: preparedPipeline, parametersToPass: parametersToPass, tools: tools, onProgress: function (progress) {
4332
4340
  if (isReturned) {
4333
4341
  throw new UnexpectedError(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)
4334
4342
  .split('\n')
@@ -4338,16 +4346,16 @@ function executePipeline(options) {
4338
4346
  if (onProgress) {
4339
4347
  onProgress(progress);
4340
4348
  }
4341
- }, $executionReport: executionReport, pipelineIdentification: spaceTrim(function (block) { return "\n ".concat(block(pipelineIdentification), "\n Template name: ").concat(currentTemplate.name, "\n Template title: ").concat(currentTemplate.title, "\n "); }) }))
4349
+ }, $executionReport: executionReport, pipelineIdentification: spaceTrim(function (block) { return "\n ".concat(block(pipelineIdentification), "\n Task name: ").concat(currentTask.name, "\n Task title: ").concat(currentTask.title, "\n "); }) }))
4342
4350
  .then(function (newParametersToPass) {
4343
4351
  parametersToPass = __assign(__assign({}, newParametersToPass), parametersToPass);
4344
- resovedParameterNames_1 = __spreadArray(__spreadArray([], __read(resovedParameterNames_1), false), [currentTemplate.resultingParameterName], false);
4352
+ resovedParameterNames_1 = __spreadArray(__spreadArray([], __read(resovedParameterNames_1), false), [currentTask.resultingParameterName], false);
4345
4353
  })
4346
4354
  .then(function () {
4347
4355
  resolving_1 = resolving_1.filter(function (w) { return w !== work_1; });
4348
4356
  });
4349
4357
  // <- Note: Errors are catched here [3]
4350
- // 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
4358
+ // 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
4351
4359
  resolving_1.push(work_1);
4352
4360
  _k.label = 4;
4353
4361
  case 4: return [2 /*return*/];
@@ -4356,7 +4364,7 @@ function executePipeline(options) {
4356
4364
  };
4357
4365
  _h.label = 21;
4358
4366
  case 21:
4359
- if (!(unresovedTemplates_1.length > 0)) return [3 /*break*/, 23];
4367
+ if (!(unresovedTasks_1.length > 0)) return [3 /*break*/, 23];
4360
4368
  return [5 /*yield**/, _loop_2()];
4361
4369
  case 22:
4362
4370
  _h.sent();
@@ -4897,6 +4905,9 @@ function normalizeToKebabCase(text) {
4897
4905
  normalizedName = normalizedName.replace(/-$/, '');
4898
4906
  return normalizedName;
4899
4907
  }
4908
+ /**
4909
+ * Note: [💞] Ignore a discrepancy between file name and entity name
4910
+ */
4900
4911
 
4901
4912
  /**
4902
4913
  * Creates unique name for the source
@@ -5268,7 +5279,7 @@ TODO: [🧊] This is how it can look in future
5268
5279
  */
5269
5280
  function clonePipeline(pipeline) {
5270
5281
  // Note: Not using spread operator (...) because @@@
5271
- 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;
5282
+ 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;
5272
5283
  return {
5273
5284
  pipelineUrl: pipelineUrl,
5274
5285
  sourceFile: sourceFile,
@@ -5277,7 +5288,7 @@ function clonePipeline(pipeline) {
5277
5288
  description: description,
5278
5289
  formfactorName: formfactorName,
5279
5290
  parameters: parameters,
5280
- templates: templates,
5291
+ tasks: tasks,
5281
5292
  knowledgeSources: knowledgeSources,
5282
5293
  knowledgePieces: knowledgePieces,
5283
5294
  personas: personas,
@@ -5293,17 +5304,17 @@ function clonePipeline(pipeline) {
5293
5304
  *
5294
5305
  * @public exported from `@promptbook/core`
5295
5306
  */
5296
- function prepareTemplates(pipeline, tools, options) {
5307
+ function prepareTasks(pipeline, tools, options) {
5297
5308
  return __awaiter(this, void 0, void 0, function () {
5298
- var _a, maxParallelCount, templates, knowledgePiecesCount, templatesPrepared;
5309
+ var _a, maxParallelCount, tasks, knowledgePiecesCount, tasksPrepared;
5299
5310
  var _this = this;
5300
5311
  return __generator(this, function (_b) {
5301
5312
  switch (_b.label) {
5302
5313
  case 0:
5303
5314
  _a = options.maxParallelCount, maxParallelCount = _a === void 0 ? DEFAULT_MAX_PARALLEL_COUNT : _a;
5304
- templates = pipeline.templates, pipeline.parameters, knowledgePiecesCount = pipeline.knowledgePiecesCount;
5305
- templatesPrepared = new Array(templates.length);
5306
- 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 () {
5315
+ tasks = pipeline.tasks, pipeline.parameters, knowledgePiecesCount = pipeline.knowledgePiecesCount;
5316
+ tasksPrepared = new Array(tasks.length);
5317
+ 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 () {
5307
5318
  var dependentParameterNames, preparedContent, preparedTemplate;
5308
5319
  return __generator(this, function (_a) {
5309
5320
  dependentParameterNames = template.dependentParameterNames;
@@ -5316,13 +5327,13 @@ function prepareTemplates(pipeline, tools, options) {
5316
5327
  ], false);
5317
5328
  }
5318
5329
  preparedTemplate = __assign(__assign({}, template), { dependentParameterNames: dependentParameterNames, preparedContent: preparedContent });
5319
- templatesPrepared[index] = preparedTemplate;
5330
+ tasksPrepared[index] = preparedTemplate;
5320
5331
  return [2 /*return*/];
5321
5332
  });
5322
5333
  }); })];
5323
5334
  case 1:
5324
5335
  _b.sent();
5325
- return [2 /*return*/, { templatesPrepared: templatesPrepared }];
5336
+ return [2 /*return*/, { tasksPrepared: tasksPrepared }];
5326
5337
  }
5327
5338
  });
5328
5339
  });
@@ -5330,7 +5341,7 @@ function prepareTemplates(pipeline, tools, options) {
5330
5341
  /**
5331
5342
  * TODO: [🧠] Add context to each template (if missing)
5332
5343
  * TODO: [🧠] What is better name `prepareTemplate` or `prepareTemplateAndParameters`
5333
- * TODO: [♨][main] !!! Prepare index the examples and maybe templates
5344
+ * TODO: [♨][main] !!! Prepare index the examples and maybe tasks
5334
5345
  * TODO: Write tests for `preparePipeline`
5335
5346
  * TODO: [🏏] Leverage the batch API and build queues @see https://platform.openai.com/docs/guides/batch
5336
5347
  * TODO: [🧊] In future one preparation can take data from previous preparation and save tokens and time
@@ -5347,12 +5358,12 @@ function prepareTemplates(pipeline, tools, options) {
5347
5358
  */
5348
5359
  function preparePipeline(pipeline, tools, options) {
5349
5360
  return __awaiter(this, void 0, void 0, function () {
5350
- var rootDirname, _a, maxParallelCount, _b, isVerbose, parameters, templates,
5361
+ var rootDirname, _a, maxParallelCount, _b, isVerbose, parameters, tasks,
5351
5362
  /*
5352
5363
  <- TODO: [🧠][🪑] `promptbookVersion` */
5353
5364
  knowledgeSources /*
5354
5365
  <- TODO: [🧊] `knowledgePieces` */, personas /*
5355
- <- TODO: [🧊] `preparations` */, _llms, llmTools, llmToolsWithUsage, currentPreparation, preparations, preparedPersonas, knowledgeSourcesPrepared, partialknowledgePiecesPrepared, knowledgePiecesPrepared, templatesPrepared /* TODO: parameters: parametersPrepared*/;
5366
+ <- TODO: [🧊] `preparations` */, _llms, llmTools, llmToolsWithUsage, currentPreparation, preparations, preparedPersonas, knowledgeSourcesPrepared, partialknowledgePiecesPrepared, knowledgePiecesPrepared, tasksPrepared /* TODO: parameters: parametersPrepared*/;
5356
5367
  var _this = this;
5357
5368
  return __generator(this, function (_c) {
5358
5369
  switch (_c.label) {
@@ -5361,7 +5372,7 @@ function preparePipeline(pipeline, tools, options) {
5361
5372
  return [2 /*return*/, pipeline];
5362
5373
  }
5363
5374
  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;
5364
- parameters = pipeline.parameters, templates = pipeline.templates, knowledgeSources = pipeline.knowledgeSources, personas = pipeline.personas;
5375
+ parameters = pipeline.parameters, tasks = pipeline.tasks, knowledgeSources = pipeline.knowledgeSources, personas = pipeline.personas;
5365
5376
  if (tools === undefined || tools.llm === undefined) {
5366
5377
  throw new MissingToolsError('LLM tools are required for preparing the pipeline');
5367
5378
  }
@@ -5404,9 +5415,9 @@ function preparePipeline(pipeline, tools, options) {
5404
5415
  case 2:
5405
5416
  partialknowledgePiecesPrepared = _c.sent();
5406
5417
  knowledgePiecesPrepared = partialknowledgePiecesPrepared.map(function (piece) { return (__assign(__assign({}, piece), { preparationIds: [/* TODO: [🧊] -> */ currentPreparation.id] })); });
5407
- return [4 /*yield*/, prepareTemplates({
5418
+ return [4 /*yield*/, prepareTasks({
5408
5419
  parameters: parameters,
5409
- templates: templates,
5420
+ tasks: tasks,
5410
5421
  knowledgePiecesCount: knowledgePiecesPrepared.length,
5411
5422
  }, __assign(__assign({}, tools), { llm: llmToolsWithUsage }), {
5412
5423
  rootDirname: rootDirname,
@@ -5414,12 +5425,12 @@ function preparePipeline(pipeline, tools, options) {
5414
5425
  isVerbose: isVerbose,
5415
5426
  })];
5416
5427
  case 3:
5417
- templatesPrepared = (_c.sent()).templatesPrepared;
5428
+ tasksPrepared = (_c.sent()).tasksPrepared;
5418
5429
  // ----- /Templates preparation -----
5419
5430
  // Note: Count total usage
5420
5431
  currentPreparation.usage = llmToolsWithUsage.getTotalUsage();
5421
- return [2 /*return*/, $asDeeplyFrozenSerializableJson('Prepared PipelineJson', __assign(__assign({}, clonePipeline(pipeline)), { templates: __spreadArray([], __read(templatesPrepared), false),
5422
- // <- TODO: [🪓] Here should be no need for spreading new array, just ` templates: templatesPrepared`
5432
+ return [2 /*return*/, $asDeeplyFrozenSerializableJson('Prepared PipelineJson', __assign(__assign({}, clonePipeline(pipeline)), { tasks: __spreadArray([], __read(tasksPrepared), false),
5433
+ // <- TODO: [🪓] Here should be no need for spreading new array, just ` tasks: tasksPrepared`
5423
5434
  knowledgeSources: knowledgeSourcesPrepared, knowledgePieces: knowledgePiecesPrepared, personas: preparedPersonas, preparations: __spreadArray([], __read(preparations), false) }))];
5424
5435
  }
5425
5436
  });
@@ -5449,7 +5460,7 @@ var knowledgeCommandParser = {
5449
5460
  * BOILERPLATE command can be used in:
5450
5461
  */
5451
5462
  isUsedInPipelineHead: true,
5452
- isUsedInPipelineTemplate: false,
5463
+ isUsedInPipelineTask: false,
5453
5464
  /**
5454
5465
  * Description of the KNOWLEDGE command
5455
5466
  */
@@ -5527,36 +5538,36 @@ var knowledgeCommandParser = {
5527
5538
  */
5528
5539
 
5529
5540
  /**
5530
- * Template type describes the way how the template is templated
5541
+ * Section type describes the way how the section is sectiond
5531
5542
  *
5532
- * @see https://github.com/webgptorg/promptbook#template-type
5533
5543
  * @public exported from `@promptbook/core`
5534
5544
  */
5535
- var TemplateTypes = [
5536
- 'PROMPT_TEMPLATE',
5537
- 'SIMPLE_TEMPLATE',
5538
- 'SCRIPT_TEMPLATE',
5539
- 'DIALOG_TEMPLATE',
5545
+ var SectionTypes = [
5546
+ 'PROMPT_TASK',
5547
+ 'SIMPLE_TASK',
5548
+ 'SCRIPT_TASK',
5549
+ 'DIALOG_TASK',
5540
5550
  'EXAMPLE',
5541
5551
  'KNOWLEDGE',
5542
5552
  'INSTRUMENT',
5543
5553
  'ACTION',
5544
5554
  // <- [🅱]
5545
5555
  ];
5556
+ // <- TODO: !!!!!! Make alongside `SectionType` the `TaskType`, `TaskType` + [⛱] and ACRY
5546
5557
 
5547
5558
  /**
5548
- * Parses the template command
5559
+ * Parses the section command
5549
5560
  *
5550
5561
  * @see `documentationUrl` for more details
5551
5562
  * @private within the commands folder
5552
5563
  */
5553
- var templateCommandParser = {
5564
+ var sectionCommandParser = {
5554
5565
  /**
5555
5566
  * Name of the command
5556
5567
  */
5557
- name: 'TEMPLATE',
5568
+ name: 'SECTION',
5558
5569
  /**
5559
- * Aliases for the TEMPLATE command
5570
+ * Aliases for the SECTION command
5560
5571
  */
5561
5572
  aliasNames: [
5562
5573
  'PROMPT',
@@ -5570,24 +5581,24 @@ var templateCommandParser = {
5570
5581
  'ACTION', // <- Note: [⛱]
5571
5582
  ],
5572
5583
  /**
5573
- * Aliases for the TEMPLATE command
5584
+ * Aliases for the SECTION command
5574
5585
  */
5575
- deprecatedNames: ['BLOCK', 'EXECUTE'],
5586
+ deprecatedNames: ['TEMPLATE', 'BLOCK', 'EXECUTE'],
5576
5587
  /**
5577
5588
  * BOILERPLATE command can be used in:
5578
5589
  */
5579
5590
  isUsedInPipelineHead: false,
5580
- isUsedInPipelineTemplate: true,
5591
+ isUsedInPipelineTask: true,
5581
5592
  /**
5582
- * Description of the TEMPLATE command
5593
+ * Description of the SECTION command
5583
5594
  */
5584
- description: "What should the code template template do",
5595
+ description: "Defines the purpose of the markdown section - if its a task and which type or something else",
5585
5596
  /**
5586
5597
  * Link to documentation
5587
5598
  */
5588
5599
  documentationUrl: 'https://github.com/webgptorg/promptbook/discussions/64',
5589
5600
  /**
5590
- * Example usages of the TEMPLATE command
5601
+ * Example usages of the SECTION command
5591
5602
  */
5592
5603
  examples: [
5593
5604
  // Short form:
@@ -5602,101 +5613,100 @@ var templateCommandParser = {
5602
5613
  'ACTION',
5603
5614
  // -----------------
5604
5615
  // Recommended (reversed) form:
5605
- 'PROMPT TEMPLATE',
5606
- 'SIMPLE TEMPLATE',
5607
- 'SCRIPT TEMPLATE',
5608
- 'DIALOG TEMPLATE',
5616
+ 'PROMPT SECTION',
5617
+ 'SIMPLE SECTION',
5618
+ 'SCRIPT SECTION',
5619
+ 'DIALOG SECTION',
5609
5620
  // <- [🅱]
5610
- 'SAMPLE TEMPLATE',
5611
- 'KNOWLEDGE TEMPLATE',
5612
- 'INSTRUMENT TEMPLATE',
5613
- 'ACTION TEMPLATE',
5621
+ 'EXAMPLE SECTION',
5622
+ 'KNOWLEDGE SECTION',
5623
+ 'INSTRUMENT SECTION',
5624
+ 'ACTION SECTION',
5614
5625
  // -----------------
5615
5626
  // Standard form:
5616
- 'TEMPLATE PROMPT',
5617
- 'TEMPLATE SIMPLE',
5618
- 'TEMPLATE SCRIPT',
5619
- 'TEMPLATE DIALOG',
5627
+ 'SECTION PROMPT',
5628
+ 'SECTION SIMPLE',
5629
+ 'SECTION SCRIPT',
5630
+ 'SECTION DIALOG',
5620
5631
  // <- [🅱]
5621
- 'SAMPLE TEMPLATE',
5622
- 'KNOWLEDGE TEMPLATE',
5623
- 'INSTRUMENT TEMPLATE',
5624
- 'ACTION TEMPLATE',
5632
+ 'SECTION EXAMPLE',
5633
+ 'SECTION KNOWLEDGE',
5634
+ 'SECTION INSTRUMENT',
5635
+ 'SECTION ACTION',
5625
5636
  ],
5626
5637
  // TODO: [♓️] order: -10 /* <- Note: Putting before other commands */
5627
5638
  /**
5628
- * Parses the TEMPLATE command
5639
+ * Parses the SECTION command
5629
5640
  */
5630
5641
  parse: function (input) {
5631
5642
  var normalized = input.normalized;
5632
5643
  normalized = normalized.split('SAMPLE').join('EXAMPLE');
5633
- var templateTypes = TemplateTypes.filter(function (templateType) {
5634
- return normalized.includes(templateType.split('_TEMPLATE').join(''));
5635
- });
5636
- if (templateTypes.length !== 1) {
5637
- throw new ParseError(spaceTrim$1(function (template) { return "\n Unknown template type in TEMPLATE command\n\n Supported template types are:\n ".concat(template(TemplateTypes.join(', ')), "\n "); }));
5644
+ normalized = normalized.split('EXECUTE_').join('');
5645
+ var taskTypes = SectionTypes.filter(function (taskType) { return normalized.includes(taskType.split('_TASK').join('')); });
5646
+ if (taskTypes.length !== 1) {
5647
+ throw new ParseError(spaceTrim$1(function (block) { return "\n Unknown section type \"".concat(normalized, "\"\n\n Supported section types are:\n ").concat(block(SectionTypes.join(', ')), "\n "); }));
5638
5648
  }
5639
- var templateType = templateTypes[0];
5649
+ var taskType = taskTypes[0];
5640
5650
  return {
5641
- type: 'TEMPLATE',
5642
- templateType: templateType,
5651
+ type: 'SECTION',
5652
+ taskType: taskType,
5643
5653
  };
5644
5654
  },
5645
5655
  /**
5646
- * Apply the TEMPLATE command to the `pipelineJson`
5656
+ * Apply the SECTION command to the `pipelineJson`
5647
5657
  *
5648
- * Note: `$` is used to indicate that this function mutates given `templateJson`
5658
+ * Note: `$` is used to indicate that this function mutates given `taskJson`
5649
5659
  */
5650
- $applyToTemplateJson: function (command, $templateJson, $pipelineJson) {
5651
- if ($templateJson.isTemplateTypeSet === true) {
5652
- throw new ParseError(spaceTrim$1("\n Template type is already defined in the template.\n It can be defined only once.\n "));
5660
+ $applyToTaskJson: function (command, $taskJson, $pipelineJson) {
5661
+ if ($taskJson.isSectionTypeSet === true) {
5662
+ throw new ParseError(spaceTrim$1("\n Section type is already defined in the section.\n It can be defined only once.\n "));
5653
5663
  }
5654
- $templateJson.isTemplateTypeSet = true;
5664
+ $taskJson.isSectionTypeSet = true;
5655
5665
  // TODO: [🍧] Rearrange better - but at bottom and unwrap from function
5656
5666
  var expectResultingParameterName = function () {
5657
- if ($templateJson.resultingParameterName) {
5667
+ if ($taskJson.resultingParameterName) {
5658
5668
  return;
5659
5669
  }
5660
- throw new ParseError(" Template section must end with -> {parameterName}");
5670
+ throw new ParseError("Task section and example section must end with return statement -> {parameterName}");
5661
5671
  };
5662
- if ($templateJson.content === undefined) {
5663
- throw new UnexpectedError("Content is missing in the templateJson - probbably commands are applied in wrong order");
5672
+ if ($taskJson.content === undefined) {
5673
+ throw new UnexpectedError("Content is missing in the taskJson - probbably commands are applied in wrong order");
5664
5674
  }
5665
- if (command.templateType === 'EXAMPLE') {
5675
+ if (command.taskType === 'EXAMPLE') {
5666
5676
  expectResultingParameterName();
5667
- var parameter = $pipelineJson.parameters.find(function (param) { return param.name === $templateJson.resultingParameterName; });
5677
+ var parameter = $pipelineJson.parameters.find(function (param) { return param.name === $taskJson.resultingParameterName; });
5668
5678
  if (parameter === undefined) {
5669
- throw new ParseError("Can not find parameter {".concat($templateJson.resultingParameterName, "} to assign example value on it"));
5679
+ throw new ParseError("Can not find parameter {".concat($taskJson.resultingParameterName, "} to assign example value on it"));
5670
5680
  }
5671
5681
  parameter.exampleValues = parameter.exampleValues || [];
5672
- parameter.exampleValues.push($templateJson.content);
5673
- $templateJson.isTemplate = false;
5682
+ parameter.exampleValues.push($taskJson.content);
5683
+ $taskJson.isTask = false;
5674
5684
  return;
5675
5685
  }
5676
- if (command.templateType === 'KNOWLEDGE') {
5686
+ if (command.taskType === 'KNOWLEDGE') {
5677
5687
  knowledgeCommandParser.$applyToPipelineJson({
5678
5688
  type: 'KNOWLEDGE',
5679
- sourceContent: $templateJson.content, // <- TODO: [🐝][main] !!! Work with KNOWLEDGE which not referring to the source file or website, but its content itself
5689
+ sourceContent: $taskJson.content, // <- TODO: [🐝][main] !!! Work with KNOWLEDGE which not referring to the source file or website, but its content itself
5680
5690
  }, $pipelineJson);
5681
- $templateJson.isTemplate = false;
5691
+ $taskJson.isTask = false;
5682
5692
  return;
5683
5693
  }
5684
- if (command.templateType === 'ACTION') {
5694
+ if (command.taskType === 'ACTION') {
5685
5695
  console.error(new NotYetImplementedError('Actions are not implemented yet'));
5686
- $templateJson.isTemplate = false;
5696
+ $taskJson.isTask = false;
5687
5697
  return;
5688
5698
  }
5689
- if (command.templateType === 'INSTRUMENT') {
5699
+ if (command.taskType === 'INSTRUMENT') {
5690
5700
  console.error(new NotYetImplementedError('Instruments are not implemented yet'));
5691
- $templateJson.isTemplate = false;
5701
+ $taskJson.isTask = false;
5692
5702
  return;
5693
5703
  }
5694
5704
  expectResultingParameterName();
5695
- $templateJson.templateType = command.templateType;
5696
- $templateJson.isTemplate = true;
5705
+ $taskJson.taskType = command.taskType;
5706
+ $taskJson.isTask = true;
5697
5707
  },
5698
5708
  /**
5699
- * Converts the TEMPLATE command back to string
5709
+ * Converts the SECTION command back to string
5700
5710
  *
5701
5711
  * Note: This is used in `pipelineJsonToString` utility
5702
5712
  */
@@ -5704,11 +5714,11 @@ var templateCommandParser = {
5704
5714
  return "---"; // <- TODO: [🛋] Implement
5705
5715
  },
5706
5716
  /**
5707
- * Reads the TEMPLATE command from the `TemplateJson`
5717
+ * Reads the SECTION command from the `TaskJson`
5708
5718
  *
5709
5719
  * Note: This is used in `pipelineJsonToString` utility
5710
5720
  */
5711
- takeFromTemplateJson: function ($templateJson) {
5721
+ takeFromTaskJson: function ($taskJson) {
5712
5722
  throw new NotYetImplementedError("[\uD83D\uDECB] Not implemented yet"); // <- TODO: [🛋] Implement
5713
5723
  },
5714
5724
  };
@@ -5716,8 +5726,8 @@ var templateCommandParser = {
5716
5726
  * Note: [⛱] There are two types of KNOWLEDGE, ACTION and INSTRUMENT commands:
5717
5727
  * 1) There are commands `KNOWLEDGE`, `ACTION` and `INSTRUMENT` used in the pipeline head, they just define the knowledge, action or instrument as single line after the command
5718
5728
  * - KNOWLEDGE Look at https://en.wikipedia.org/wiki/Artificial_intelligence
5719
- * 2) `KNOWLEDGE TEMPLATE` which has short form `KNOWLEDGE` is used in the template, does not refer the line itself, but the content of the template
5720
- * - KNOWLEDGE TEMPLATE
5729
+ * 2) `KNOWLEDGE SECTION` which has short form `KNOWLEDGE` is used in the sectiom, does not refer the line itself, but the content of the section block
5730
+ * - KNOWLEDGE SECTION
5721
5731
  *
5722
5732
  * ```
5723
5733
  * Look at https://en.wikipedia.org/wiki/Artificial_intelligence
@@ -5745,7 +5755,7 @@ var boilerplateCommandParser = {
5745
5755
  * BOILERPLATE command can be used in:
5746
5756
  */
5747
5757
  isUsedInPipelineHead: true,
5748
- isUsedInPipelineTemplate: true,
5758
+ isUsedInPipelineTask: true,
5749
5759
  /**
5750
5760
  * Description of the BOILERPLATE command
5751
5761
  */
@@ -5786,9 +5796,9 @@ var boilerplateCommandParser = {
5786
5796
  /**
5787
5797
  * Apply the BOILERPLATE command to the `pipelineJson`
5788
5798
  *
5789
- * Note: `$` is used to indicate that this function mutates given `templateJson`
5799
+ * Note: `$` is used to indicate that this function mutates given `taskJson`
5790
5800
  */
5791
- $applyToTemplateJson: function (command, $templateJson, $pipelineJson) {
5801
+ $applyToTaskJson: function (command, $taskJson, $pipelineJson) {
5792
5802
  throw new ParseError("BOILERPLATE command is only for testing purposes and should not be used in the .book.md file");
5793
5803
  },
5794
5804
  /**
@@ -5808,11 +5818,11 @@ var boilerplateCommandParser = {
5808
5818
  throw new ParseError("BOILERPLATE command is only for testing purposes and should not be used in the .book.md file");
5809
5819
  },
5810
5820
  /**
5811
- * Reads the BOILERPLATE command from the `TemplateJson`
5821
+ * Reads the BOILERPLATE command from the `TaskJson`
5812
5822
  *
5813
5823
  * Note: This is used in `pipelineJsonToString` utility
5814
5824
  */
5815
- takeFromTemplateJson: function ($templateJson) {
5825
+ takeFromTaskJson: function ($taskJson) {
5816
5826
  throw new ParseError("BOILERPLATE command is only for testing purposes and should not be used in the .book.md file");
5817
5827
  },
5818
5828
  };
@@ -5833,7 +5843,7 @@ var bookVersionCommandParser = {
5833
5843
  * BOILERPLATE command can be used in:
5834
5844
  */
5835
5845
  isUsedInPipelineHead: true,
5836
- isUsedInPipelineTemplate: false,
5846
+ isUsedInPipelineTask: false,
5837
5847
  /**
5838
5848
  * Description of the BOOK_VERSION command
5839
5849
  */
@@ -5987,7 +5997,7 @@ var expectCommandParser = {
5987
5997
  * BOILERPLATE command can be used in:
5988
5998
  */
5989
5999
  isUsedInPipelineHead: false,
5990
- isUsedInPipelineTemplate: true,
6000
+ isUsedInPipelineTask: true,
5991
6001
  /**
5992
6002
  * Description of the FORMAT command
5993
6003
  */
@@ -6083,24 +6093,24 @@ var expectCommandParser = {
6083
6093
  /**
6084
6094
  * Apply the FORMAT command to the `pipelineJson`
6085
6095
  *
6086
- * Note: `$` is used to indicate that this function mutates given `templateJson`
6096
+ * Note: `$` is used to indicate that this function mutates given `taskJson`
6087
6097
  */
6088
- $applyToTemplateJson: function (command, $templateJson) {
6098
+ $applyToTaskJson: function (command, $taskJson) {
6089
6099
  // eslint-disable-next-line no-case-declarations
6090
6100
  var unit = command.unit.toLowerCase();
6091
- $templateJson.expectations = $templateJson.expectations || {};
6092
- $templateJson.expectations[unit] = $templateJson.expectations[unit] || {};
6101
+ $taskJson.expectations = $taskJson.expectations || {};
6102
+ $taskJson.expectations[unit] = $taskJson.expectations[unit] || {};
6093
6103
  if (command.sign === 'MINIMUM' || command.sign === 'EXACTLY') {
6094
- if ($templateJson.expectations[unit].min !== undefined) {
6095
- throw new ParseError("Already defined minumum ".concat($templateJson.expectations[unit].min, " ").concat(command.unit.toLowerCase(), ", now trying to redefine it to ").concat(command.amount));
6104
+ if ($taskJson.expectations[unit].min !== undefined) {
6105
+ throw new ParseError("Already defined minumum ".concat($taskJson.expectations[unit].min, " ").concat(command.unit.toLowerCase(), ", now trying to redefine it to ").concat(command.amount));
6096
6106
  }
6097
- $templateJson.expectations[unit].min = command.amount;
6107
+ $taskJson.expectations[unit].min = command.amount;
6098
6108
  } /* not else */
6099
6109
  if (command.sign === 'MAXIMUM' || command.sign === 'EXACTLY') {
6100
- if ($templateJson.expectations[unit].max !== undefined) {
6101
- throw new ParseError("Already defined maximum ".concat($templateJson.expectations[unit].max, " ").concat(command.unit.toLowerCase(), ", now trying to redefine it to ").concat(command.amount));
6110
+ if ($taskJson.expectations[unit].max !== undefined) {
6111
+ throw new ParseError("Already defined maximum ".concat($taskJson.expectations[unit].max, " ").concat(command.unit.toLowerCase(), ", now trying to redefine it to ").concat(command.amount));
6102
6112
  }
6103
- $templateJson.expectations[unit].max = command.amount;
6113
+ $taskJson.expectations[unit].max = command.amount;
6104
6114
  }
6105
6115
  },
6106
6116
  /**
@@ -6112,11 +6122,11 @@ var expectCommandParser = {
6112
6122
  return "---"; // <- TODO: [🛋] Implement
6113
6123
  },
6114
6124
  /**
6115
- * Reads the FORMAT command from the `TemplateJson`
6125
+ * Reads the FORMAT command from the `TaskJson`
6116
6126
  *
6117
6127
  * Note: This is used in `pipelineJsonToString` utility
6118
6128
  */
6119
- takeFromTemplateJson: function ($templateJson) {
6129
+ takeFromTaskJson: function ($taskJson) {
6120
6130
  throw new NotYetImplementedError("[\uD83D\uDECB] Not implemented yet"); // <- TODO: [🛋] Implement
6121
6131
  },
6122
6132
  };
@@ -6323,7 +6333,7 @@ var foreachCommandParser = {
6323
6333
  * FOREACH command can be used in:
6324
6334
  */
6325
6335
  isUsedInPipelineHead: false,
6326
- isUsedInPipelineTemplate: true,
6336
+ isUsedInPipelineTask: true,
6327
6337
  /**
6328
6338
  * Description of the FOREACH command
6329
6339
  */
@@ -6422,13 +6432,13 @@ var foreachCommandParser = {
6422
6432
  /**
6423
6433
  * Apply the FOREACH command to the `pipelineJson`
6424
6434
  *
6425
- * Note: `$` is used to indicate that this function mutates given `templateJson`
6435
+ * Note: `$` is used to indicate that this function mutates given `taskJson`
6426
6436
  */
6427
- $applyToTemplateJson: function (command, $templateJson, $pipelineJson) {
6437
+ $applyToTaskJson: function (command, $taskJson, $pipelineJson) {
6428
6438
  var formatName = command.formatName, subformatName = command.subformatName, parameterName = command.parameterName, inputSubparameterNames = command.inputSubparameterNames, outputSubparameterName = command.outputSubparameterName;
6429
6439
  // TODO: [🍭] Detect double use
6430
6440
  // TODO: [🍭] Detect usage with JOKER and don't allow it
6431
- $templateJson.foreach = {
6441
+ $taskJson.foreach = {
6432
6442
  formatName: formatName,
6433
6443
  subformatName: subformatName,
6434
6444
  parameterName: parameterName,
@@ -6446,11 +6456,11 @@ var foreachCommandParser = {
6446
6456
  return "---"; // <- TODO: [🛋] Implement
6447
6457
  },
6448
6458
  /**
6449
- * Reads the FOREACH command from the `TemplateJson`
6459
+ * Reads the FOREACH command from the `TaskJson`
6450
6460
  *
6451
6461
  * Note: This is used in `pipelineJsonToString` utility
6452
6462
  */
6453
- takeFromTemplateJson: function ($templateJson) {
6463
+ takeFromTaskJson: function ($taskJson) {
6454
6464
  throw new NotYetImplementedError("[\uD83D\uDECB] Not implemented yet"); // <- TODO: [🛋] Implement
6455
6465
  },
6456
6466
  };
@@ -6473,7 +6483,7 @@ var formatCommandParser = {
6473
6483
  * BOILERPLATE command can be used in:
6474
6484
  */
6475
6485
  isUsedInPipelineHead: false,
6476
- isUsedInPipelineTemplate: true,
6486
+ isUsedInPipelineTask: true,
6477
6487
  /**
6478
6488
  * Description of the FORMAT command
6479
6489
  */
@@ -6504,13 +6514,13 @@ var formatCommandParser = {
6504
6514
  /**
6505
6515
  * Apply the FORMAT command to the `pipelineJson`
6506
6516
  *
6507
- * Note: `$` is used to indicate that this function mutates given `templateJson`
6517
+ * Note: `$` is used to indicate that this function mutates given `taskJson`
6508
6518
  */
6509
- $applyToTemplateJson: function (command, $templateJson) {
6510
- if ($templateJson.format !== undefined && command.format !== $templateJson.format) {
6511
- throw new ParseError("Format format is already defined to \"".concat($templateJson.format, "\".\n Now you try to redefine it by \"").concat(command.format, "\""));
6519
+ $applyToTaskJson: function (command, $taskJson) {
6520
+ if ($taskJson.format !== undefined && command.format !== $taskJson.format) {
6521
+ throw new ParseError("Format format is already defined to \"".concat($taskJson.format, "\".\n Now you try to redefine it by \"").concat(command.format, "\""));
6512
6522
  }
6513
- $templateJson.format = command.format;
6523
+ $taskJson.format = command.format;
6514
6524
  },
6515
6525
  /**
6516
6526
  * Converts the FORMAT command back to string
@@ -6521,11 +6531,11 @@ var formatCommandParser = {
6521
6531
  return "---"; // <- TODO: [🛋] Implement
6522
6532
  },
6523
6533
  /**
6524
- * Reads the FORMAT command from the `TemplateJson`
6534
+ * Reads the FORMAT command from the `TaskJson`
6525
6535
  *
6526
6536
  * Note: This is used in `pipelineJsonToString` utility
6527
6537
  */
6528
- takeFromTemplateJson: function ($templateJson) {
6538
+ takeFromTaskJson: function ($taskJson) {
6529
6539
  throw new NotYetImplementedError("[\uD83D\uDECB] Not implemented yet"); // <- TODO: [🛋] Implement
6530
6540
  },
6531
6541
  };
@@ -6535,16 +6545,16 @@ var formatCommandParser = {
6535
6545
  *
6536
6546
  * @public exported from `@promptbook/core`
6537
6547
  */
6538
- var ChatFormfactorDefinition = {
6548
+ var ChatbotFormfactorDefinition = {
6539
6549
  name: 'CHATBOT',
6540
6550
  aliasNames: ['CHAT'],
6541
6551
  description: "@@@",
6542
- documentationUrl: "https://github.com/webgptorg/promptbook/discussions/@@",
6552
+ documentationUrl: "https://github.com/webgptorg/promptbook/discussions/174",
6543
6553
  pipelineInterface: {
6544
6554
  inputParameterNames: ['previousTitle', 'previousConversationSummary', 'userMessage'],
6545
6555
  outputParameterNames: ['title', 'conversationSummary', 'chatbotResponse'],
6546
6556
  /*
6547
- <- TODO: !!!!!! Change to
6557
+ <- TODO: !!!!!! Change to full interfaces
6548
6558
 
6549
6559
  - INPUT PARAMETER `{previousTitle}` Previous title of the conversation
6550
6560
  - INPUT PARAMETER `{previousConversationSummary}` Previous conversation summary
@@ -6560,12 +6570,17 @@ var ChatFormfactorDefinition = {
6560
6570
  /**
6561
6571
  * @@@
6562
6572
  *
6573
+ * @see https://github.com/webgptorg/promptbook/discussions/171
6574
+ *
6563
6575
  * @public exported from `@promptbook/core`
6564
6576
  */
6565
6577
  var GENERIC_PIPELINE_INTERFACE = {
6566
6578
  inputParameterNames: [],
6567
6579
  outputParameterNames: [],
6568
6580
  };
6581
+ /**
6582
+ * Note: [💞] Ignore a discrepancy between file name and entity name
6583
+ */
6569
6584
 
6570
6585
  /**
6571
6586
  * @@@
@@ -6575,10 +6590,29 @@ var GENERIC_PIPELINE_INTERFACE = {
6575
6590
  var GenericFormfactorDefinition = {
6576
6591
  name: 'GENERIC',
6577
6592
  description: "@@@",
6578
- documentationUrl: "https://github.com/webgptorg/promptbook/discussions/@@",
6593
+ documentationUrl: "https://github.com/webgptorg/promptbook/discussions/173",
6579
6594
  pipelineInterface: GENERIC_PIPELINE_INTERFACE,
6580
6595
  };
6581
6596
 
6597
+ /**
6598
+ * Matcher is form of app that @@@
6599
+ *
6600
+ * @public exported from `@promptbook/core`
6601
+ */
6602
+ var MatcherFormfactorDefinition = {
6603
+ name: 'EXPERIMENTAL_MATCHER',
6604
+ description: "@@@",
6605
+ documentationUrl: "https://github.com/webgptorg/promptbook/discussions/177",
6606
+ pipelineInterface: {
6607
+ inputParameterNames: [
6608
+ /* @@@ */
6609
+ ],
6610
+ outputParameterNames: [
6611
+ /* @@@ */
6612
+ ],
6613
+ },
6614
+ };
6615
+
6582
6616
  /**
6583
6617
  * Sheets is form of app that @@@
6584
6618
  *
@@ -6587,7 +6621,7 @@ var GenericFormfactorDefinition = {
6587
6621
  var SheetsFormfactorDefinition = {
6588
6622
  name: 'SHEETS',
6589
6623
  description: "@@@",
6590
- documentationUrl: "https://github.com/webgptorg/promptbook/discussions/@@",
6624
+ documentationUrl: "https://github.com/webgptorg/promptbook/discussions/176",
6591
6625
  pipelineInterface: {
6592
6626
  inputParameterNames: ['inputSheet'],
6593
6627
  outputParameterNames: ['outputSheet'],
@@ -6602,10 +6636,12 @@ var SheetsFormfactorDefinition = {
6602
6636
  var TranslatorFormfactorDefinition = {
6603
6637
  name: 'TRANSLATOR',
6604
6638
  description: "@@@",
6605
- documentationUrl: "https://github.com/webgptorg/promptbook/discussions/@@",
6639
+ documentationUrl: "https://github.com/webgptorg/promptbook/discussions/175",
6606
6640
  pipelineInterface: {
6607
6641
  inputParameterNames: ['inputMessage'],
6608
6642
  outputParameterNames: ['outputMessage'],
6643
+ // <- TODO: !!!!!! Maybe add {summary}
6644
+ // <- TODO: [🧠] maybe change to {inputText}, {inputText} / or make system for any name of first input and first outpur parameter
6609
6645
  },
6610
6646
  };
6611
6647
 
@@ -6616,10 +6652,14 @@ var TranslatorFormfactorDefinition = {
6616
6652
  */
6617
6653
  var FORMFACTOR_DEFINITIONS = [
6618
6654
  GenericFormfactorDefinition,
6619
- ChatFormfactorDefinition,
6655
+ ChatbotFormfactorDefinition,
6620
6656
  TranslatorFormfactorDefinition,
6621
6657
  SheetsFormfactorDefinition,
6658
+ MatcherFormfactorDefinition,
6622
6659
  ];
6660
+ /**
6661
+ * Note: [💞] Ignore a discrepancy between file name and entity name
6662
+ */
6623
6663
 
6624
6664
  /**
6625
6665
  * Parses the formfactor command
@@ -6642,7 +6682,7 @@ var formfactorCommandParser = {
6642
6682
  * FORMFACTOR command can be used in:
6643
6683
  */
6644
6684
  isUsedInPipelineHead: true,
6645
- isUsedInPipelineTemplate: false,
6685
+ isUsedInPipelineTask: false,
6646
6686
  /**
6647
6687
  * Description of the FORMFACTOR command
6648
6688
  */
@@ -6724,7 +6764,7 @@ var jokerCommandParser = {
6724
6764
  * BOILERPLATE command can be used in:
6725
6765
  */
6726
6766
  isUsedInPipelineHead: false,
6727
- isUsedInPipelineTemplate: true,
6767
+ isUsedInPipelineTask: true,
6728
6768
  /**
6729
6769
  * Description of the JOKER command
6730
6770
  */
@@ -6755,11 +6795,11 @@ var jokerCommandParser = {
6755
6795
  /**
6756
6796
  * Apply the JOKER command to the `pipelineJson`
6757
6797
  *
6758
- * Note: `$` is used to indicate that this function mutates given `templateJson`
6798
+ * Note: `$` is used to indicate that this function mutates given `taskJson`
6759
6799
  */
6760
- $applyToTemplateJson: function (command, $templateJson) {
6761
- $templateJson.jokerParameterNames = $templateJson.jokerParameterNames || [];
6762
- $templateJson.jokerParameterNames.push(command.parameterName);
6800
+ $applyToTaskJson: function (command, $taskJson) {
6801
+ $taskJson.jokerParameterNames = $taskJson.jokerParameterNames || [];
6802
+ $taskJson.jokerParameterNames.push(command.parameterName);
6763
6803
  },
6764
6804
  /**
6765
6805
  * Converts the JOKER command back to string
@@ -6770,11 +6810,11 @@ var jokerCommandParser = {
6770
6810
  return "---"; // <- TODO: [🛋] Implement
6771
6811
  },
6772
6812
  /**
6773
- * Reads the JOKER command from the `TemplateJson`
6813
+ * Reads the JOKER command from the `TaskJson`
6774
6814
  *
6775
6815
  * Note: This is used in `pipelineJsonToString` utility
6776
6816
  */
6777
- takeFromTemplateJson: function ($templateJson) {
6817
+ takeFromTaskJson: function ($taskJson) {
6778
6818
  throw new NotYetImplementedError("[\uD83D\uDECB] Not implemented yet"); // <- TODO: [🛋] Implement
6779
6819
  },
6780
6820
  };
@@ -6801,11 +6841,11 @@ var modelCommandParser = {
6801
6841
  * BOILERPLATE command can be used in:
6802
6842
  */
6803
6843
  isUsedInPipelineHead: true,
6804
- isUsedInPipelineTemplate: true,
6844
+ isUsedInPipelineTask: true,
6805
6845
  /**
6806
6846
  * Description of the MODEL command
6807
6847
  */
6808
- description: "Tells which `modelRequirements` (for example which model) to use for the prompt template execution",
6848
+ description: "Tells which `modelRequirements` (for example which model) to use for the prompt task execution",
6809
6849
  /**
6810
6850
  * Link to documentation
6811
6851
  */
@@ -6879,30 +6919,30 @@ var modelCommandParser = {
6879
6919
  /**
6880
6920
  * Apply the MODEL command to the `pipelineJson`
6881
6921
  *
6882
- * Note: `$` is used to indicate that this function mutates given `templateJson`
6922
+ * Note: `$` is used to indicate that this function mutates given `taskJson`
6883
6923
  */
6884
- $applyToTemplateJson: function (command, $templateJson, $pipelineJson) {
6885
- if ($templateJson.templateType !== 'PROMPT_TEMPLATE') {
6886
- throw new ParseError("MODEL command can only be used in PROMPT_TEMPLATE block");
6924
+ $applyToTaskJson: function (command, $taskJson, $pipelineJson) {
6925
+ if ($taskJson.taskType !== 'PROMPT_TASK') {
6926
+ throw new ParseError("MODEL command can only be used in PROMPT_TASK block");
6887
6927
  }
6888
- $templateJson.modelRequirements = $templateJson.modelRequirements || {};
6928
+ $taskJson.modelRequirements = $taskJson.modelRequirements || {};
6889
6929
  // TODO: [🚜] DRY
6890
- if ($templateJson.modelRequirements[command.key] !== undefined) {
6891
- if ($templateJson.modelRequirements[command.key] === command.value) {
6930
+ if ($taskJson.modelRequirements[command.key] !== undefined) {
6931
+ if ($taskJson.modelRequirements[command.key] === command.value) {
6892
6932
  console.warn("Multiple commands `MODEL ".concat({
6893
6933
  modelName: 'NAME',
6894
6934
  modelVariant: 'VARIANT',
6895
6935
  maxTokens: '???',
6896
- }[command.key], " ").concat(command.value, "` in the template \"").concat($templateJson.title || $templateJson.name, "\""));
6936
+ }[command.key], " ").concat(command.value, "` in the task \"").concat($taskJson.title || $taskJson.name, "\""));
6897
6937
  }
6898
6938
  else {
6899
- throw new ParseError(spaceTrim$1("\n Redefinition of MODEL `".concat(command.key, "` in the template \"").concat($templateJson.title || $templateJson.name, "\"\n\n You have used:\n - MODEL ").concat(command.key, " ").concat($templateJson.modelRequirements[command.key], "\n - MODEL ").concat(command.key, " ").concat(command.value, "\n ")));
6939
+ throw new ParseError(spaceTrim$1("\n Redefinition of MODEL `".concat(command.key, "` in the task \"").concat($taskJson.title || $taskJson.name, "\"\n\n You have used:\n - MODEL ").concat(command.key, " ").concat($taskJson.modelRequirements[command.key], "\n - MODEL ").concat(command.key, " ").concat(command.value, "\n ")));
6900
6940
  }
6901
6941
  }
6902
6942
  if (command.value === ($pipelineJson.defaultModelRequirements || {})[command.key]) {
6903
- console.log(spaceTrim$1("\n Setting MODEL `".concat(command.key, "` in the template \"").concat($templateJson.title || $templateJson.name, "\" to the same value as in the pipeline head\n\n In pipeline head:\n - MODEL ").concat(command.key, " ").concat(($pipelineJson.defaultModelRequirements || {})[command.key], "\n\n But same value is used in the template:\n - MODEL ").concat(command.key, " ").concat(command.value, "\n ")));
6943
+ console.log(spaceTrim$1("\n Setting MODEL `".concat(command.key, "` in the task \"").concat($taskJson.title || $taskJson.name, "\" to the same value as in the pipeline head\n\n In pipeline head:\n - MODEL ").concat(command.key, " ").concat(($pipelineJson.defaultModelRequirements || {})[command.key], "\n\n But same value is used in the task:\n - MODEL ").concat(command.key, " ").concat(command.value, "\n ")));
6904
6944
  }
6905
- $templateJson.modelRequirements[command.key] = command.value;
6945
+ $taskJson.modelRequirements[command.key] = command.value;
6906
6946
  },
6907
6947
  /**
6908
6948
  * Converts the MODEL command back to string
@@ -6921,11 +6961,11 @@ var modelCommandParser = {
6921
6961
  throw new NotYetImplementedError("[\uD83D\uDECB] Not implemented yet"); // <- TODO: [🛋] Implement
6922
6962
  },
6923
6963
  /**
6924
- * Reads the MODEL command from the `TemplateJson`
6964
+ * Reads the MODEL command from the `TaskJson`
6925
6965
  *
6926
6966
  * Note: This is used in `pipelineJsonToString` utility
6927
6967
  */
6928
- takeFromTemplateJson: function ($templateJson) {
6968
+ takeFromTaskJson: function ($taskJson) {
6929
6969
  throw new NotYetImplementedError("[\uD83D\uDECB] Not implemented yet"); // <- TODO: [🛋] Implement
6930
6970
  },
6931
6971
  };
@@ -6952,7 +6992,7 @@ var parameterCommandParser = {
6952
6992
  * BOILERPLATE command can be used in:
6953
6993
  */
6954
6994
  isUsedInPipelineHead: true,
6955
- isUsedInPipelineTemplate: true,
6995
+ isUsedInPipelineTask: true,
6956
6996
  /**
6957
6997
  * Description of the PARAMETER command
6958
6998
  */
@@ -7004,9 +7044,9 @@ var parameterCommandParser = {
7004
7044
  /**
7005
7045
  * Apply the PARAMETER command to the `pipelineJson`
7006
7046
  *
7007
- * Note: `$` is used to indicate that this function mutates given `templateJson`
7047
+ * Note: `$` is used to indicate that this function mutates given `taskJson`
7008
7048
  */
7009
- $applyToTemplateJson: function (command, $templateJson, $pipelineJson) {
7049
+ $applyToTaskJson: function (command, $taskJson, $pipelineJson) {
7010
7050
  // Note: [🍣] Do nothing, its application is implemented separately in `pipelineStringToJsonSync`
7011
7051
  },
7012
7052
  /**
@@ -7026,11 +7066,11 @@ var parameterCommandParser = {
7026
7066
  throw new NotYetImplementedError("[\uD83D\uDECB] Not implemented yet"); // <- TODO: [🛋] Implement
7027
7067
  },
7028
7068
  /**
7029
- * Reads the PARAMETER command from the `TemplateJson`
7069
+ * Reads the PARAMETER command from the `TaskJson`
7030
7070
  *
7031
7071
  * Note: This is used in `pipelineJsonToString` utility
7032
7072
  */
7033
- takeFromTemplateJson: function ($templateJson) {
7073
+ takeFromTaskJson: function ($taskJson) {
7034
7074
  throw new NotYetImplementedError("[\uD83D\uDECB] Not implemented yet"); // <- TODO: [🛋] Implement
7035
7075
  },
7036
7076
  };
@@ -7054,7 +7094,7 @@ var personaCommandParser = {
7054
7094
  * PERSONA command can be used in:
7055
7095
  */
7056
7096
  isUsedInPipelineHead: true,
7057
- isUsedInPipelineTemplate: true,
7097
+ isUsedInPipelineTask: true,
7058
7098
  /**
7059
7099
  * Description of the PERSONA command
7060
7100
  */
@@ -7093,9 +7133,9 @@ var personaCommandParser = {
7093
7133
  * Note: `$` is used to indicate that this function mutates given `pipelineJson`
7094
7134
  */
7095
7135
  $applyToPipelineJson: function (command, $pipelineJson) {
7096
- $applyToTemplateJson(command, null, $pipelineJson);
7136
+ $applyToTaskJson(command, null, $pipelineJson);
7097
7137
  },
7098
- $applyToTemplateJson: $applyToTemplateJson,
7138
+ $applyToTaskJson: $applyToTaskJson,
7099
7139
  /**
7100
7140
  * Converts the PERSONA command back to string
7101
7141
  *
@@ -7113,26 +7153,26 @@ var personaCommandParser = {
7113
7153
  throw new NotYetImplementedError("[\uD83D\uDECB] Not implemented yet"); // <- TODO: [🛋] Implement
7114
7154
  },
7115
7155
  /**
7116
- * Reads the PERSONA command from the `TemplateJson`
7156
+ * Reads the PERSONA command from the `TaskJson`
7117
7157
  *
7118
7158
  * Note: This is used in `pipelineJsonToString` utility
7119
7159
  */
7120
- takeFromTemplateJson: function ($templateJson) {
7160
+ takeFromTaskJson: function ($taskJson) {
7121
7161
  throw new NotYetImplementedError("[\uD83D\uDECB] Not implemented yet"); // <- TODO: [🛋] Implement
7122
7162
  },
7123
7163
  };
7124
7164
  /**
7125
7165
  * Apply the PERSONA command to the `pipelineJson`
7126
7166
  *
7127
- * Note: `$` is used to indicate that this function mutates given `templateJson`
7167
+ * Note: `$` is used to indicate that this function mutates given `taskJson`
7128
7168
  */
7129
- function $applyToTemplateJson(command, $templateJson, $pipelineJson) {
7169
+ function $applyToTaskJson(command, $taskJson, $pipelineJson) {
7130
7170
  var personaName = command.personaName, personaDescription = command.personaDescription;
7131
- if ($templateJson !== null) {
7132
- if ($templateJson.templateType !== 'PROMPT_TEMPLATE') {
7133
- throw new ParseError("PERSONA command can be used only in PROMPT_TEMPLATE block");
7171
+ if ($taskJson !== null) {
7172
+ if ($taskJson.taskType !== 'PROMPT_TASK') {
7173
+ throw new ParseError("PERSONA command can be used only in PROMPT_TASK block");
7134
7174
  }
7135
- $templateJson.personaName = personaName;
7175
+ $taskJson.personaName = personaName;
7136
7176
  }
7137
7177
  var persona = $pipelineJson.personas.find(function (persona) { return persona.name === personaName; });
7138
7178
  if (persona === undefined) {
@@ -7186,7 +7226,7 @@ var postprocessCommandParser = {
7186
7226
  * BOILERPLATE command can be used in:
7187
7227
  */
7188
7228
  isUsedInPipelineHead: false,
7189
- isUsedInPipelineTemplate: true,
7229
+ isUsedInPipelineTask: true,
7190
7230
  /**
7191
7231
  * Description of the POSTPROCESS command
7192
7232
  */
@@ -7224,11 +7264,11 @@ var postprocessCommandParser = {
7224
7264
  /**
7225
7265
  * Apply the POSTPROCESS command to the `pipelineJson`
7226
7266
  *
7227
- * Note: `$` is used to indicate that this function mutates given `templateJson`
7267
+ * Note: `$` is used to indicate that this function mutates given `taskJson`
7228
7268
  */
7229
- $applyToTemplateJson: function (command, $templateJson) {
7230
- $templateJson.postprocessingFunctionNames = $templateJson.postprocessingFunctionNames || [];
7231
- $templateJson.postprocessingFunctionNames.push(command.functionName);
7269
+ $applyToTaskJson: function (command, $taskJson) {
7270
+ $taskJson.postprocessingFunctionNames = $taskJson.postprocessingFunctionNames || [];
7271
+ $taskJson.postprocessingFunctionNames.push(command.functionName);
7232
7272
  },
7233
7273
  /**
7234
7274
  * Converts the POSTPROCESS command back to string
@@ -7239,11 +7279,11 @@ var postprocessCommandParser = {
7239
7279
  return "---"; // <- TODO: [🛋] Implement
7240
7280
  },
7241
7281
  /**
7242
- * Reads the POSTPROCESS command from the `TemplateJson`
7282
+ * Reads the POSTPROCESS command from the `TaskJson`
7243
7283
  *
7244
7284
  * Note: This is used in `pipelineJsonToString` utility
7245
7285
  */
7246
- takeFromTemplateJson: function ($templateJson) {
7286
+ takeFromTaskJson: function ($taskJson) {
7247
7287
  throw new NotYetImplementedError("[\uD83D\uDECB] Not implemented yet"); // <- TODO: [🛋] Implement
7248
7288
  },
7249
7289
  };
@@ -7268,7 +7308,7 @@ var urlCommandParser = {
7268
7308
  * BOILERPLATE command can be used in:
7269
7309
  */
7270
7310
  isUsedInPipelineHead: true,
7271
- isUsedInPipelineTemplate: false,
7311
+ isUsedInPipelineTask: false,
7272
7312
  /**
7273
7313
  * Description of the URL command
7274
7314
  */
@@ -7364,7 +7404,7 @@ var actionCommandParser = {
7364
7404
  * ACTION command can be used in:
7365
7405
  */
7366
7406
  isUsedInPipelineHead: true,
7367
- isUsedInPipelineTemplate: false,
7407
+ isUsedInPipelineTask: false,
7368
7408
  /**
7369
7409
  * Description of the ACTION command
7370
7410
  */
@@ -7430,7 +7470,7 @@ var instrumentCommandParser = {
7430
7470
  * INSTRUMENT command can be used in:
7431
7471
  */
7432
7472
  isUsedInPipelineHead: true,
7433
- isUsedInPipelineTemplate: false,
7473
+ isUsedInPipelineTask: false,
7434
7474
  /**
7435
7475
  * Description of the INSTRUMENT command
7436
7476
  */
@@ -7487,7 +7527,7 @@ var instrumentCommandParser = {
7487
7527
  * @private internal index of `parseCommand`
7488
7528
  */
7489
7529
  var COMMANDS = [
7490
- templateCommandParser,
7530
+ sectionCommandParser,
7491
7531
  expectCommandParser,
7492
7532
  formatCommandParser,
7493
7533
  jokerCommandParser,
@@ -7505,6 +7545,9 @@ var COMMANDS = [
7505
7545
  boilerplateCommandParser, // <- TODO: !! Only in development, remove in production
7506
7546
  // <- Note: [♓️] This is the order of the commands in the pipeline, BUT its not used in parsing and before usage maybe it should be done better
7507
7547
  ];
7548
+ /**
7549
+ * Note: [💞] Ignore a discrepancy between file name and entity name
7550
+ */
7508
7551
 
7509
7552
  /**
7510
7553
  * Gets the parser for the command
@@ -7565,7 +7608,7 @@ function parseCommand(raw, usagePlace) {
7565
7608
  normalized = normalized.split('(').join('');
7566
7609
  normalized = normalized.split(')').join('');
7567
7610
  normalized = normalizeTo_SCREAMING_CASE(normalized);
7568
- normalized = normalized.split('DIALOGUE').join('DIALOG');
7611
+ normalized = normalized.split('DIALOGUE').join('DIALOG'); // <- TODO: !!!!!! Move to sectionCommandParser
7569
7612
  var items = raw
7570
7613
  .trim()
7571
7614
  // Note: [🐡]
@@ -7646,12 +7689,12 @@ function parseCommandVariant(input) {
7646
7689
  var commandName = normalizeTo_SCREAMING_CASE(commandNameRaw);
7647
7690
  var _loop_1 = function (commandParser) {
7648
7691
  // <- Note: [🦦] Its strange that this type assertion is needed
7649
- var name_1 = commandParser.name, isUsedInPipelineHead = commandParser.isUsedInPipelineHead, isUsedInPipelineTemplate = commandParser.isUsedInPipelineTemplate, aliasNames = commandParser.aliasNames, deprecatedNames = commandParser.deprecatedNames, parse = commandParser.parse;
7692
+ var name_1 = commandParser.name, isUsedInPipelineHead = commandParser.isUsedInPipelineHead, isUsedInPipelineTask = commandParser.isUsedInPipelineTask, aliasNames = commandParser.aliasNames, deprecatedNames = commandParser.deprecatedNames, parse = commandParser.parse;
7650
7693
  if (just(false)) ;
7651
7694
  else if (usagePlace === 'PIPELINE_HEAD' && !isUsedInPipelineHead) {
7652
7695
  return "continue";
7653
7696
  }
7654
- else if (usagePlace === 'PIPELINE_TEMPLATE' && !isUsedInPipelineTemplate) {
7697
+ else if (usagePlace === 'PIPELINE_TASK' && !isUsedInPipelineTask) {
7655
7698
  return "continue";
7656
7699
  }
7657
7700
  var names = __spreadArray(__spreadArray([name_1], __read((aliasNames || [])), false), __read((deprecatedNames || [])), false);
@@ -7968,7 +8011,7 @@ function pipelineStringToJsonSync(pipelineString) {
7968
8011
  description: undefined /* <- Note: [🍙] Putting here placeholder to keep `description` on top at final JSON */,
7969
8012
  formfactorName: 'GENERIC',
7970
8013
  parameters: [],
7971
- templates: [],
8014
+ tasks: [],
7972
8015
  knowledgeSources: [],
7973
8016
  knowledgePieces: [],
7974
8017
  personas: [],
@@ -8106,10 +8149,10 @@ function pipelineStringToJsonSync(pipelineString) {
8106
8149
  if (description_1 === '') {
8107
8150
  description_1 = undefined;
8108
8151
  }
8109
- var $templateJson = {
8110
- isTemplateTypeSet: false,
8111
- isTemplate: true,
8112
- templateType: undefined /* <- Note: [🍙] Putting here placeholder to keep `templateType` on top at final JSON */,
8152
+ var $taskJson = {
8153
+ isSectionTypeSet: false,
8154
+ isTask: true,
8155
+ taskType: undefined /* <- Note: [🍙] Putting here placeholder to keep `taskType` on top at final JSON */,
8113
8156
  name: titleToName(section.title),
8114
8157
  title: section.title,
8115
8158
  description: description_1,
@@ -8121,35 +8164,35 @@ function pipelineStringToJsonSync(pipelineString) {
8121
8164
  if (resultingParameterNameMatch &&
8122
8165
  resultingParameterNameMatch.groups !== undefined &&
8123
8166
  resultingParameterNameMatch.groups.resultingParamName !== undefined) {
8124
- $templateJson.resultingParameterName = resultingParameterNameMatch.groups.resultingParamName;
8167
+ $taskJson.resultingParameterName = resultingParameterNameMatch.groups.resultingParamName;
8125
8168
  }
8126
8169
  // TODO: [🥥] Maybe move this logic to `$parseAndApplyPipelineTemplateCommands`
8127
8170
  var commands = listItems_2.map(function (listItem) { return ({
8128
8171
  listItem: listItem,
8129
- command: parseCommand(listItem, 'PIPELINE_TEMPLATE'),
8172
+ command: parseCommand(listItem, 'PIPELINE_TASK'),
8130
8173
  }); });
8131
- // Note: If block type is not set, set it to 'PROMPT_TEMPLATE'
8174
+ // Note: If block type is not set, set it to 'PROMPT_TASK'
8132
8175
  if (commands.some(function (_a) {
8133
8176
  var command = _a.command;
8134
- return command.type === 'TEMPLATE';
8177
+ return command.type === 'SECTION';
8135
8178
  }) === false) {
8136
- templateCommandParser.$applyToTemplateJson({ type: 'TEMPLATE', templateType: 'PROMPT_TEMPLATE' }, $templateJson, $pipelineJson);
8179
+ sectionCommandParser.$applyToTaskJson({ type: 'SECTION', taskType: 'PROMPT_TASK' }, $taskJson, $pipelineJson);
8137
8180
  }
8138
8181
  var _loop_4 = function (listItem, command) {
8139
8182
  var commandParser = getParserForCommand(command);
8140
- if (commandParser.isUsedInPipelineTemplate !== true /* <- Note: [🦦][4] */) {
8183
+ if (commandParser.isUsedInPipelineTask !== true /* <- Note: [🦦][4] */) {
8141
8184
  throw new ParseError(spaceTrim(function (block) { return "\n Command ".concat(command.type, " is not allowed in the template of the promptbook ONLY at the pipeline head\n\n ").concat(block(getPipelineIdentification()), "\n "); })); // <- TODO: [🚞]
8142
8185
  }
8143
8186
  try {
8144
- commandParser.$applyToTemplateJson(
8187
+ commandParser.$applyToTaskJson(
8145
8188
  // <- Note: [🦦] Its strange that this assertion must be here, [🦦][4] should do this assertion implicitelly
8146
- command, $templateJson, $pipelineJson);
8189
+ command, $taskJson, $pipelineJson);
8147
8190
  }
8148
8191
  catch (error) {
8149
8192
  if (!(error instanceof ParseError)) {
8150
8193
  throw error;
8151
8194
  }
8152
- throw new ParseError(spaceTrim(function (block) { return "\n Command ".concat(command.type, " failed to apply to the template\n\n The error:\n ").concat(block(error.message), "\n\n Current state of the template:\n ").concat(block(JSON.stringify($templateJson, null, 4)), "\n <- Maybe wrong order of commands?\n\n Raw command:\n - ").concat(listItem, "\n\n Usage of ").concat(command.type, ":\n ").concat(block(commandParser.examples.map(function (example) { return "- ".concat(example); }).join('\n')), "\n\n ").concat(block(getPipelineIdentification()), "\n "); })); // <- TODO: [🚞]
8195
+ throw new ParseError(spaceTrim(function (block) { return "\n Command ".concat(command.type, " failed to apply to the template\n\n The error:\n ").concat(block(error.message), "\n\n Current state of the template:\n ").concat(block(JSON.stringify($taskJson, null, 4)), "\n <- Maybe wrong order of commands?\n\n Raw command:\n - ").concat(listItem, "\n\n Usage of ").concat(command.type, ":\n ").concat(block(commandParser.examples.map(function (example) { return "- ".concat(example); }).join('\n')), "\n\n ").concat(block(getPipelineIdentification()), "\n "); })); // <- TODO: [🚞]
8153
8196
  }
8154
8197
  if (command.type === 'PARAMETER') {
8155
8198
  defineParam(command);
@@ -8171,19 +8214,18 @@ function pipelineStringToJsonSync(pipelineString) {
8171
8214
  finally { if (e_5) throw e_5.error; }
8172
8215
  }
8173
8216
  // TODO: [🍧] Should be done in TEMPLATE command
8174
- if ($templateJson.templateType === 'SCRIPT_TEMPLATE') {
8217
+ if ($taskJson.taskType === 'SCRIPT_TASK') {
8175
8218
  if (!language) {
8176
8219
  throw new ParseError(spaceTrim(function (block) { return "\n You must specify the language of the script in the SCRIPT TEMPLATE\n\n ".concat(block(getPipelineIdentification()), "\n "); }));
8177
8220
  }
8178
8221
  if (!SUPPORTED_SCRIPT_LANGUAGES.includes(language)) {
8179
8222
  throw new ParseError(spaceTrim(function (block) { return "\n Script language ".concat(language, " is not supported.\n\n Supported languages are:\n ").concat(block(SUPPORTED_SCRIPT_LANGUAGES.join(', ')), "\n\n "); }));
8180
8223
  }
8181
- $templateJson.contentLanguage =
8182
- language;
8224
+ $taskJson.contentLanguage = language;
8183
8225
  }
8184
- $templateJson.dependentParameterNames = Array.from(extractParameterNamesFromTemplate($templateJson));
8226
+ $taskJson.dependentParameterNames = Array.from(extractParameterNamesFromTask($taskJson));
8185
8227
  try {
8186
- for (var _q = (e_6 = void 0, __values($templateJson.dependentParameterNames)), _r = _q.next(); !_r.done; _r = _q.next()) {
8228
+ for (var _q = (e_6 = void 0, __values($taskJson.dependentParameterNames)), _r = _q.next(); !_r.done; _r = _q.next()) {
8187
8229
  var parameterName = _r.value;
8188
8230
  // TODO: [🧠] This definition should be made first in the template
8189
8231
  defineParam({
@@ -8204,12 +8246,12 @@ function pipelineStringToJsonSync(pipelineString) {
8204
8246
  }
8205
8247
  /*
8206
8248
  // TODO: [🍧] This should be checked in `MODEL` command + better error message
8207
- if ($templateJson.templateType !== 'PROMPT_TEMPLATE' && $templateJson.modelRequirements !== undefined) {
8249
+ if ($taskJson.taskType !== 'PROMPT_TASK' && $taskJson.modelRequirements !== undefined) {
8208
8250
  throw new UnexpectedError(
8209
8251
  spaceTrim(
8210
8252
  (block) => `
8211
8253
  Model requirements are defined for the block type ${
8212
- $templateJson.templateType
8254
+ $taskJson.taskType
8213
8255
  } which is not a PROMPT TEMPLATE
8214
8256
 
8215
8257
  This should be avoided by the \`modelCommandParser\`
@@ -8220,11 +8262,11 @@ function pipelineStringToJsonSync(pipelineString) {
8220
8262
  );
8221
8263
  }
8222
8264
  */
8223
- if ($templateJson.isTemplate) {
8224
- delete $templateJson.isTemplateTypeSet;
8225
- delete $templateJson.isTemplate;
8226
- // TODO: [🍙] Maybe do reorder of `$templateJson` here
8227
- $pipelineJson.templates.push($templateJson);
8265
+ if ($taskJson.isTask) {
8266
+ delete $taskJson.isSectionTypeSet;
8267
+ delete $taskJson.isTask;
8268
+ // TODO: [🍙] Maybe do reorder of `$taskJson` here
8269
+ $pipelineJson.tasks.push($taskJson);
8228
8270
  }
8229
8271
  };
8230
8272
  try {
@@ -8246,7 +8288,7 @@ function pipelineStringToJsonSync(pipelineString) {
8246
8288
  // Note: 5️⃣ Mark parameters as INPUT if not explicitly set
8247
8289
  if ($pipelineJson.parameters.every(function (parameter) { return !parameter.isInput; })) {
8248
8290
  var _loop_3 = function (parameter) {
8249
- var isThisParameterResulting = $pipelineJson.templates.some(function (template) { return template.resultingParameterName === parameter.name; });
8291
+ var isThisParameterResulting = $pipelineJson.tasks.some(function (template) { return template.resultingParameterName === parameter.name; });
8250
8292
  if (!isThisParameterResulting) {
8251
8293
  parameter.isInput = true;
8252
8294
  }
@@ -8286,13 +8328,13 @@ function pipelineStringToJsonSync(pipelineString) {
8286
8328
  }
8287
8329
  // =============================================================
8288
8330
  // Note: 7️⃣ Cleanup of undefined values
8289
- $pipelineJson.templates.forEach(function (templates) {
8331
+ $pipelineJson.tasks.forEach(function (tasks) {
8290
8332
  var e_7, _a;
8291
8333
  try {
8292
- for (var _b = __values(Object.entries(templates)), _c = _b.next(); !_c.done; _c = _b.next()) {
8334
+ for (var _b = __values(Object.entries(tasks)), _c = _b.next(); !_c.done; _c = _b.next()) {
8293
8335
  var _d = __read(_c.value, 2), key = _d[0], value = _d[1];
8294
8336
  if (value === undefined) {
8295
- delete templates[key];
8337
+ delete tasks[key];
8296
8338
  }
8297
8339
  }
8298
8340
  }
@@ -8332,7 +8374,7 @@ function pipelineStringToJsonSync(pipelineString) {
8332
8374
  * TODO: Use spaceTrim more effectively
8333
8375
  * TODO: [🧠] Parameter flags - isInput, isOutput, isInternal
8334
8376
  * TODO: [🥞] Not optimal parsing because `splitMarkdownIntoSections` is executed twice with same string, once through `flattenMarkdown` and second directly here
8335
- * TODO: [♈] Probbably move expectations from templates to parameters
8377
+ * TODO: [♈] Probbably move expectations from tasks to parameters
8336
8378
  * TODO: [🛠] Actions, instruments (and maybe knowledge) => Functions and tools
8337
8379
  * TODO: [🍙] Make some standard order of json properties
8338
8380
  */