@promptbook/node 0.75.0-2 → 0.75.1

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 (53) hide show
  1. package/README.md +46 -30
  2. package/esm/index.es.js +178 -105
  3. package/esm/index.es.js.map +1 -1
  4. package/esm/typings/src/_packages/core.index.d.ts +16 -4
  5. package/esm/typings/src/_packages/types.index.d.ts +8 -6
  6. package/esm/typings/src/_packages/utils.index.d.ts +2 -0
  7. package/esm/typings/src/commands/EXPECT/ExpectCommand.d.ts +1 -1
  8. package/esm/typings/src/commands/SECTION/SectionCommand.d.ts +1 -1
  9. package/esm/typings/src/commands/_common/types/CommandParser.d.ts +0 -2
  10. package/esm/typings/src/config.d.ts +34 -2
  11. package/esm/typings/src/conversion/pipelineJsonToString.d.ts +1 -1
  12. package/esm/typings/src/conversion/prettify/renderPipelineMermaidOptions.d.ts +2 -2
  13. package/esm/typings/src/conversion/utils/extractParameterNamesFromTask.d.ts +3 -3
  14. package/esm/typings/src/conversion/utils/renameParameter.d.ts +2 -2
  15. package/esm/typings/src/dialogs/simple-prompt/SimplePromptInterfaceTools.d.ts +1 -1
  16. package/esm/typings/src/execution/ScriptExecutionTools.d.ts +1 -1
  17. package/esm/typings/src/formfactors/_boilerplate/BoilerplateFormfactorDefinition.d.ts +2 -2
  18. package/esm/typings/src/formfactors/_common/AbstractFormfactorDefinition.d.ts +3 -0
  19. package/esm/typings/src/formfactors/chatbot/ChatbotFormfactorDefinition.d.ts +32 -2
  20. package/esm/typings/src/formfactors/generator/GeneratorFormfactorDefinition.d.ts +14 -0
  21. package/esm/typings/src/formfactors/generic/GenericFormfactorDefinition.d.ts +2 -2
  22. package/esm/typings/src/formfactors/index.d.ts +72 -10
  23. package/esm/typings/src/formfactors/matcher/MatcherFormfactorDefinition.d.ts +2 -2
  24. package/esm/typings/src/formfactors/sheets/SheetsFormfactorDefinition.d.ts +12 -2
  25. package/esm/typings/src/formfactors/translator/TranslatorFormfactorDefinition.d.ts +12 -2
  26. package/esm/typings/src/pipeline/PipelineInterface/PipelineInterface.d.ts +5 -4
  27. package/esm/typings/src/pipeline/PipelineInterface/constants.d.ts +2 -2
  28. package/esm/typings/src/pipeline/PipelineJson/{TaskJsonCommon.d.ts → CommonTaskJson.d.ts} +13 -13
  29. package/esm/typings/src/pipeline/PipelineJson/DialogTaskJson.d.ts +2 -2
  30. package/esm/typings/src/pipeline/PipelineJson/ParameterJson.d.ts +2 -0
  31. package/esm/typings/src/pipeline/PipelineJson/PersonaJson.d.ts +1 -1
  32. package/esm/typings/src/pipeline/PipelineJson/PipelineJson.d.ts +2 -2
  33. package/esm/typings/src/pipeline/PipelineJson/PromptTaskJson.d.ts +2 -2
  34. package/esm/typings/src/pipeline/PipelineJson/ScriptTaskJson.d.ts +2 -2
  35. package/esm/typings/src/pipeline/PipelineJson/SimpleTaskJson.d.ts +2 -2
  36. package/esm/typings/src/pipeline/PipelineJson/TaskJson.d.ts +1 -1
  37. package/esm/typings/src/pipeline/PipelineString.d.ts +1 -1
  38. package/esm/typings/src/prepare/isPipelinePrepared.d.ts +1 -1
  39. package/esm/typings/src/prepare/prepareTasks.d.ts +5 -5
  40. package/esm/typings/src/types/Prompt.d.ts +3 -3
  41. package/esm/typings/src/types/SectionType.d.ts +21 -0
  42. package/esm/typings/src/types/TaskProgress.d.ts +1 -1
  43. package/esm/typings/src/types/TaskType.d.ts +15 -0
  44. package/esm/typings/src/types/typeAliases.d.ts +1 -1
  45. package/esm/typings/src/utils/organization/TODO_remove_as.d.ts +6 -0
  46. package/esm/typings/src/utils/organization/spaceTrim.d.ts +11 -0
  47. package/esm/typings/src/utils/parameters/extractParameterNames.d.ts +1 -1
  48. package/esm/typings/src/version.d.ts +1 -1
  49. package/package.json +2 -2
  50. package/umd/index.umd.js +178 -105
  51. package/umd/index.umd.js.map +1 -1
  52. package/esm/typings/src/commands/SECTION/SectionType.d.ts +0 -13
  53. /package/esm/typings/{promptbook-collection → books}/index.d.ts +0 -0
package/esm/index.es.js CHANGED
@@ -26,7 +26,7 @@ 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-1';
29
+ var PROMPTBOOK_ENGINE_VERSION = '0.75.0';
30
30
  /**
31
31
  * TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
32
32
  * Note: [💞] Ignore a discrepancy between file name and entity name
@@ -364,7 +364,6 @@ function $asDeeplyFrozenSerializableJson(name, objectValue) {
364
364
  * TODO: [🧠] Is there a way how to meaningfully test this utility
365
365
  */
366
366
 
367
- // <- TODO: [🐊] Pick the best claim
368
367
  /**
369
368
  * When the title is not provided, the default title is used
370
369
  *
@@ -549,7 +548,7 @@ function pipelineJsonToString(pipelineJson) {
549
548
  return isInput;
550
549
  })), _h = _g.next(); !_h.done; _h = _g.next()) {
551
550
  var parameter = _h.value;
552
- commands.push("INPUT PARAMETER ".concat(templateParameterJsonToString(parameter)));
551
+ commands.push("INPUT PARAMETER ".concat(taskParameterJsonToString(parameter)));
553
552
  }
554
553
  }
555
554
  catch (e_1_1) { e_1 = { error: e_1_1 }; }
@@ -565,7 +564,7 @@ function pipelineJsonToString(pipelineJson) {
565
564
  return isOutput;
566
565
  })), _k = _j.next(); !_k.done; _k = _j.next()) {
567
566
  var parameter = _k.value;
568
- commands.push("OUTPUT PARAMETER ".concat(templateParameterJsonToString(parameter)));
567
+ commands.push("OUTPUT PARAMETER ".concat(taskParameterJsonToString(parameter)));
569
568
  }
570
569
  }
571
570
  catch (e_2_1) { e_2 = { error: e_2_1 }; }
@@ -579,12 +578,12 @@ function pipelineJsonToString(pipelineJson) {
579
578
  pipelineString += commands.map(function (command) { return "- ".concat(command); }).join('\n');
580
579
  try {
581
580
  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
+ var task = tasks_1_1.value;
583
582
  var
584
583
  /* Note: Not using:> name, */
585
- title_1 = template.title, description_1 = template.description,
584
+ title_1 = task.title, description_1 = task.description,
586
585
  /* Note: dependentParameterNames, */
587
- jokers = template.jokerParameterNames, taskType = template.taskType, content = template.content, postprocessing = template.postprocessingFunctionNames, expectations = template.expectations, format = template.format, resultingParameterName = template.resultingParameterName;
586
+ jokers = task.jokerParameterNames, taskType = task.taskType, content = task.content, postprocessing = task.postprocessingFunctionNames, expectations = task.expectations, format = task.format, resultingParameterName = task.resultingParameterName;
588
587
  pipelineString += '\n\n';
589
588
  pipelineString += "## ".concat(title_1);
590
589
  if (description_1) {
@@ -594,9 +593,10 @@ function pipelineJsonToString(pipelineJson) {
594
593
  var commands_1 = [];
595
594
  var contentLanguage = 'text';
596
595
  if (taskType === 'PROMPT_TASK') {
597
- var modelRequirements = template.modelRequirements;
596
+ var modelRequirements = task.modelRequirements;
598
597
  var _l = modelRequirements || {}, modelName = _l.modelName, modelVariant = _l.modelVariant;
599
- commands_1.push("EXECUTE PROMPT TEMPLATE");
598
+ // Note: Do nothing, it is default
599
+ // commands.push(`PROMPT`);
600
600
  if (modelVariant) {
601
601
  commands_1.push("MODEL VARIANT ".concat(capitalize(modelVariant)));
602
602
  }
@@ -609,16 +609,16 @@ function pipelineJsonToString(pipelineJson) {
609
609
  // Note: Nothing special here
610
610
  }
611
611
  else if (taskType === 'SCRIPT_TASK') {
612
- commands_1.push("SCRIPT TEMPLATE");
613
- if (template.contentLanguage) {
614
- contentLanguage = template.contentLanguage;
612
+ commands_1.push("SCRIPT");
613
+ if (task.contentLanguage) {
614
+ contentLanguage = task.contentLanguage;
615
615
  }
616
616
  else {
617
617
  contentLanguage = '';
618
618
  }
619
619
  }
620
620
  else if (taskType === 'DIALOG_TASK') {
621
- commands_1.push("DIALOG TEMPLATE");
621
+ commands_1.push("DIALOG");
622
622
  // Note: Nothing special here
623
623
  } // <- }else if([🅱]
624
624
  if (jokers) {
@@ -693,7 +693,7 @@ function pipelineJsonToString(pipelineJson) {
693
693
  pipelineString += '\n';
694
694
  pipelineString += '```';
695
695
  pipelineString += '\n\n';
696
- pipelineString += "`-> {".concat(resultingParameterName, "}`"); // <- TODO: [main] !!! If the parameter here has description, add it and use templateParameterJsonToString
696
+ pipelineString += "`-> {".concat(resultingParameterName, "}`"); // <- TODO: [main] !!! If the parameter here has description, add it and use taskParameterJsonToString
697
697
  }
698
698
  }
699
699
  catch (e_3_1) { e_3 = { error: e_3_1 }; }
@@ -708,8 +708,8 @@ function pipelineJsonToString(pipelineJson) {
708
708
  /**
709
709
  * @private internal utility of `pipelineJsonToString`
710
710
  */
711
- function templateParameterJsonToString(templateParameterJson) {
712
- var name = templateParameterJson.name, description = templateParameterJson.description;
711
+ function taskParameterJsonToString(taskParameterJson) {
712
+ var name = taskParameterJson.name, description = taskParameterJson.description;
713
713
  var parameterString = "{".concat(name, "}");
714
714
  if (description) {
715
715
  parameterString = "".concat(parameterString, " ").concat(description);
@@ -717,7 +717,7 @@ function templateParameterJsonToString(templateParameterJson) {
717
717
  return parameterString;
718
718
  }
719
719
  /**
720
- * TODO: [🛋] Implement new features and commands into `pipelineJsonToString` + `templateParameterJsonToString` , use `stringifyCommand`
720
+ * TODO: [🛋] Implement new features and commands into `pipelineJsonToString` + `taskParameterJsonToString` , use `stringifyCommand`
721
721
  * TODO: [🧠] Is there a way to auto-detect missing features in pipelineJsonToString
722
722
  * TODO: [🏛] Maybe make some markdown builder
723
723
  * TODO: [🏛] Escape all
@@ -1362,7 +1362,7 @@ function joinLlmExecutionTools() {
1362
1362
  * TODO: [👷‍♂️] @@@ Manual about construction of llmTools
1363
1363
  */
1364
1364
 
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"}];
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:"./books/prepare-knowledge-from-markdown.book.md"},{title:"Prepare Keywords",pipelineUrl:"https://promptbook.studio/promptbook/prepare-knowledge-keywords.book.md",formfactorName:"GENERIC",parameters:[{name:"knowledgePieceContent",description:"The content",isInput:true,isOutput:false},{name:"keywords",description:"Keywords separated by comma",isInput:false,isOutput:true}],tasks:[{taskType:"PROMPT_TASK",name:"knowledge",title:"Knowledge",content:"You are experienced data researcher, detect the important keywords in the document.\n\n# Rules\n\n- Write just keywords separated by comma\n\n# The document\n\nTake information from this document:\n\n> {knowledgePieceContent}",resultingParameterName:"keywords",dependentParameterNames:["knowledgePieceContent"]}],knowledgeSources:[],knowledgePieces:[],personas:[],preparations:[],sourceFile:"./books/prepare-knowledge-keywords.book.md"},{title:"Prepare Title",pipelineUrl:"https://promptbook.studio/promptbook/prepare-knowledge-title.book.md",formfactorName:"GENERIC",parameters:[{name:"knowledgePieceContent",description:"The content",isInput:true,isOutput:false},{name:"title",description:"The title of the document",isInput:false,isOutput:true}],tasks:[{taskType:"PROMPT_TASK",name:"knowledge",title:"Knowledge",content:"You are experienced content creator, write best title for the document.\n\n# Rules\n\n- Write just title, nothing else\n- Title should be concise and clear\n- Write maximum 5 words for the title\n\n# The document\n\n> {knowledgePieceContent}",resultingParameterName:"title",expectations:{words:{min:1,max:8}},dependentParameterNames:["knowledgePieceContent"]}],knowledgeSources:[],knowledgePieces:[],personas:[],preparations:[],sourceFile:"./books/prepare-knowledge-title.book.md"},{title:"Prepare Keywords",pipelineUrl:"https://promptbook.studio/promptbook/prepare-persona.book.md",formfactorName:"GENERIC",parameters:[{name:"availableModelNames",description:"List of available model names separated by comma (,)",isInput:true,isOutput:false},{name:"personaDescription",description:"Description of the persona",isInput:true,isOutput:false},{name:"modelRequirements",description:"Specific requirements for the model",isInput:false,isOutput:true}],tasks:[{taskType:"PROMPT_TASK",name:"make-model-requirements",title:"Make modelRequirements",content:"You are experienced AI engineer, you need to create virtual assistant.\nWrite\n\n## Example\n\n```json\n{\n\"modelName\": \"gpt-4o\",\n\"systemMessage\": \"You are experienced AI engineer and helpfull assistant.\",\n\"temperature\": 0.7\n}\n```\n\n## Instructions\n\n- Your output format is JSON object\n- Write just the JSON object, no other text should be present\n- It contains the following keys:\n - `modelName`: The name of the model to use\n - `systemMessage`: The system message to provide context to the model\n - `temperature`: The sampling temperature to use\n\n### Key `modelName`\n\nPick from the following models:\n\n- {availableModelNames}\n\n### Key `systemMessage`\n\nThe system message is used to communicate instructions or provide context to the model at the beginning of a conversation. It is displayed in a different format compared to user messages, helping the model understand its role in the conversation. The system message typically guides the model's behavior, sets the tone, or specifies desired output from the model. By utilizing the system message effectively, users can steer the model towards generating more accurate and relevant responses.\n\nFor example:\n\n> You are an experienced AI engineer and helpful assistant.\n\n> You are a friendly and knowledgeable chatbot.\n\n### Key `temperature`\n\nThe sampling temperature, between 0 and 1. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic. If set to 0, the model will use log probability to automatically increase the temperature until certain thresholds are hit.\n\nYou can pick a value between 0 and 2. For example:\n\n- `0.1`: Low temperature, extremely conservative and deterministic\n- `0.5`: Medium temperature, balanced between conservative and creative\n- `1.0`: High temperature, creative and bit random\n- `1.5`: Very high temperature, extremely creative and often chaotic and unpredictable\n- `2.0`: Maximum temperature, completely random and unpredictable, for some extreme creative use cases\n\n# The assistant\n\nTake this description of the persona:\n\n> {personaDescription}",resultingParameterName:"modelRequirements",format:"JSON",dependentParameterNames:["availableModelNames","personaDescription"]}],knowledgeSources:[],knowledgePieces:[],personas:[],preparations:[],sourceFile:"./books/prepare-persona.book.md"}];
1366
1366
 
1367
1367
  /**
1368
1368
  * This error indicates that the promptbook in a markdown format cannot be parsed into a valid promptbook object
@@ -1755,20 +1755,20 @@ function validatePipelineCore(pipeline) {
1755
1755
  }
1756
1756
  finally { if (e_3) throw e_3.error; }
1757
1757
  }
1758
- var unresovedTemplates = __spreadArray([], __read(pipeline.tasks), false);
1758
+ var unresovedTasks = __spreadArray([], __read(pipeline.tasks), false);
1759
1759
  var loopLimit = LOOP_LIMIT;
1760
1760
  var _loop_3 = function () {
1761
1761
  if (loopLimit-- < 0) {
1762
1762
  // Note: Really UnexpectedError not LimitReachedError - this should not happen and be caught below
1763
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 "); }));
1764
1764
  }
1765
- var currentlyResovedTemplates = unresovedTemplates.filter(function (task) {
1765
+ var currentlyResovedTasks = unresovedTasks.filter(function (task) {
1766
1766
  return task.dependentParameterNames.every(function (name) { return resovedParameters.includes(name); });
1767
1767
  });
1768
- if (currentlyResovedTemplates.length === 0) {
1768
+ if (currentlyResovedTasks.length === 0) {
1769
1769
  throw new PipelineLogicError(
1770
1770
  // TODO: [🐎] DRY
1771
- spaceTrim(function (block) { return "\n\n Can not resolve some parameters:\n Either you are using a parameter that is not defined, or there are some circular dependencies.\n\n ".concat(block(pipelineIdentification), "\n\n **Can not resolve:**\n ").concat(block(unresovedTemplates
1771
+ spaceTrim(function (block) { return "\n\n Can not resolve some parameters:\n Either you are using a parameter that is not defined, or there are some circular dependencies.\n\n ".concat(block(pipelineIdentification), "\n\n **Can not resolve:**\n ").concat(block(unresovedTasks
1772
1772
  .map(function (_a) {
1773
1773
  var resultingParameterName = _a.resultingParameterName, dependentParameterNames = _a.dependentParameterNames;
1774
1774
  return "- Parameter `{".concat(resultingParameterName, "}` which depends on ").concat(dependentParameterNames
@@ -1787,13 +1787,13 @@ function validatePipelineCore(pipeline) {
1787
1787
  .map(function (name) { return "- Parameter `{".concat(name, "}`"); })
1788
1788
  .join('\n')), "\n\n\n "); }));
1789
1789
  }
1790
- resovedParameters = __spreadArray(__spreadArray([], __read(resovedParameters), false), __read(currentlyResovedTemplates.map(function (_a) {
1790
+ resovedParameters = __spreadArray(__spreadArray([], __read(resovedParameters), false), __read(currentlyResovedTasks.map(function (_a) {
1791
1791
  var resultingParameterName = _a.resultingParameterName;
1792
1792
  return resultingParameterName;
1793
1793
  })), false);
1794
- unresovedTemplates = unresovedTemplates.filter(function (task) { return !currentlyResovedTemplates.includes(task); });
1794
+ unresovedTasks = unresovedTasks.filter(function (task) { return !currentlyResovedTasks.includes(task); });
1795
1795
  };
1796
- while (unresovedTemplates.length > 0) {
1796
+ while (unresovedTasks.length > 0) {
1797
1797
  _loop_3();
1798
1798
  }
1799
1799
  // TODO: !!!!!! Test that pipeline interface implements declared formfactor interface
@@ -1855,7 +1855,7 @@ var PipelineUrlError = /** @class */ (function (_super) {
1855
1855
  /**
1856
1856
  * Parses the task and returns the list of all parameter names
1857
1857
  *
1858
- * @param template the task with parameters in {curly} braces
1858
+ * @param template the string template with parameters in {curly} braces
1859
1859
  * @returns the list of parameter names
1860
1860
  * @public exported from `@promptbook/utils`
1861
1861
  */
@@ -1889,13 +1889,13 @@ function unpreparePipeline(pipeline) {
1889
1889
  var personas = pipeline.personas, knowledgeSources = pipeline.knowledgeSources, tasks = pipeline.tasks;
1890
1890
  personas = personas.map(function (persona) { return (__assign(__assign({}, persona), { modelRequirements: undefined, preparationIds: undefined })); });
1891
1891
  knowledgeSources = knowledgeSources.map(function (knowledgeSource) { return (__assign(__assign({}, knowledgeSource), { preparationIds: undefined })); });
1892
- tasks = tasks.map(function (template) {
1893
- var dependentParameterNames = template.dependentParameterNames;
1894
- var parameterNames = extractParameterNames(template.preparedContent || '');
1892
+ tasks = tasks.map(function (task) {
1893
+ var dependentParameterNames = task.dependentParameterNames;
1894
+ var parameterNames = extractParameterNames(task.preparedContent || '');
1895
1895
  dependentParameterNames = dependentParameterNames.filter(function (dependentParameterName) { return !parameterNames.has(dependentParameterName); });
1896
- var templateUnprepared = __assign(__assign({}, template), { dependentParameterNames: dependentParameterNames });
1897
- delete templateUnprepared.preparedContent;
1898
- return templateUnprepared;
1896
+ var taskUnprepared = __assign(__assign({}, task), { dependentParameterNames: dependentParameterNames });
1897
+ delete taskUnprepared.preparedContent;
1898
+ return taskUnprepared;
1899
1899
  });
1900
1900
  return $asDeeplyFrozenSerializableJson('Unprepared PipelineJson', __assign(__assign({}, pipeline), { tasks: tasks, knowledgeSources: knowledgeSources, knowledgePieces: [], personas: personas, preparations: [] }));
1901
1901
  }
@@ -2188,7 +2188,7 @@ function isPipelinePrepared(pipeline) {
2188
2188
  * TODO: [🐠] Maybe base this on `makeValidator`
2189
2189
  * TODO: [🧊] Pipeline can be partially prepared, this should return true ONLY if fully prepared
2190
2190
  * TODO: [🧿] Maybe do same process with same granularity and subfinctions as `preparePipeline`
2191
- * - [🏍] ? Is context in each template
2191
+ * - [🏍] ? Is context in each task
2192
2192
  * - [♨] Are examples prepared
2193
2193
  * - [♨] Are tasks prepared
2194
2194
  */
@@ -2260,16 +2260,16 @@ function extractVariables(script) {
2260
2260
  */
2261
2261
 
2262
2262
  /**
2263
- * Parses the template and returns the set of all used parameters
2263
+ * Parses the task and returns the set of all used parameters
2264
2264
  *
2265
- * @param template the template with used parameters
2265
+ * @param task the task with used parameters
2266
2266
  * @returns the set of parameter names
2267
2267
  * @throws {ParseError} if the script is invalid
2268
2268
  * @public exported from `@promptbook/utils`
2269
2269
  */
2270
- function extractParameterNamesFromTask(template) {
2270
+ function extractParameterNamesFromTask(task) {
2271
2271
  var e_1, _a, e_2, _b, e_3, _c, e_4, _d;
2272
- var title = template.title, description = template.description, taskType = template.taskType, content = template.content, preparedContent = template.preparedContent, jokerParameterNames = template.jokerParameterNames, foreach = template.foreach;
2272
+ var title = task.title, description = task.description, taskType = task.taskType, content = task.content, preparedContent = task.preparedContent, jokerParameterNames = task.jokerParameterNames, foreach = task.foreach;
2273
2273
  var parameterNames = new Set();
2274
2274
  try {
2275
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()) {
@@ -5314,10 +5314,10 @@ function prepareTasks(pipeline, tools, options) {
5314
5314
  _a = options.maxParallelCount, maxParallelCount = _a === void 0 ? DEFAULT_MAX_PARALLEL_COUNT : _a;
5315
5315
  tasks = pipeline.tasks, pipeline.parameters, knowledgePiecesCount = pipeline.knowledgePiecesCount;
5316
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 () {
5318
- var dependentParameterNames, preparedContent, preparedTemplate;
5317
+ return [4 /*yield*/, forEachAsync(tasks, { maxParallelCount: maxParallelCount /* <- TODO: [🪂] When there are subtasks, this maximul limit can be broken */ }, function (task, index) { return __awaiter(_this, void 0, void 0, function () {
5318
+ var dependentParameterNames, preparedContent, preparedTask;
5319
5319
  return __generator(this, function (_a) {
5320
- dependentParameterNames = template.dependentParameterNames;
5320
+ dependentParameterNames = task.dependentParameterNames;
5321
5321
  preparedContent = undefined;
5322
5322
  if (knowledgePiecesCount > 0 && !dependentParameterNames.includes('knowledge')) {
5323
5323
  preparedContent = spaceTrim("\n {content}\n\n ## Knowledge\n\n {knowledge}\n ");
@@ -5326,8 +5326,8 @@ function prepareTasks(pipeline, tools, options) {
5326
5326
  'knowledge',
5327
5327
  ], false);
5328
5328
  }
5329
- preparedTemplate = __assign(__assign({}, template), { dependentParameterNames: dependentParameterNames, preparedContent: preparedContent });
5330
- tasksPrepared[index] = preparedTemplate;
5329
+ preparedTask = __assign(__assign({}, task), { dependentParameterNames: dependentParameterNames, preparedContent: preparedContent });
5330
+ tasksPrepared[index] = preparedTask;
5331
5331
  return [2 /*return*/];
5332
5332
  });
5333
5333
  }); })];
@@ -5339,8 +5339,8 @@ function prepareTasks(pipeline, tools, options) {
5339
5339
  });
5340
5340
  }
5341
5341
  /**
5342
- * TODO: [🧠] Add context to each template (if missing)
5343
- * TODO: [🧠] What is better name `prepareTemplate` or `prepareTemplateAndParameters`
5342
+ * TODO: [🧠] Add context to each task (if missing)
5343
+ * TODO: [🧠] What is better name `prepareTask` or `prepareTaskAndParameters`
5344
5344
  * TODO: [♨][main] !!! Prepare index the examples and maybe tasks
5345
5345
  * TODO: Write tests for `preparePipeline`
5346
5346
  * TODO: [🏏] Leverage the batch API and build queues @see https://platform.openai.com/docs/guides/batch
@@ -5426,7 +5426,7 @@ function preparePipeline(pipeline, tools, options) {
5426
5426
  })];
5427
5427
  case 3:
5428
5428
  tasksPrepared = (_c.sent()).tasksPrepared;
5429
- // ----- /Templates preparation -----
5429
+ // ----- /Tasks preparation -----
5430
5430
  // Note: Count total usage
5431
5431
  currentPreparation.usage = llmToolsWithUsage.getTotalUsage();
5432
5432
  return [2 /*return*/, $asDeeplyFrozenSerializableJson('Prepared PipelineJson', __assign(__assign({}, clonePipeline(pipeline)), { tasks: __spreadArray([], __read(tasksPrepared), false),
@@ -5445,6 +5445,40 @@ function preparePipeline(pipeline, tools, options) {
5445
5445
  * @see https://docs.anthropic.com/en/docs/test-and-evaluate/strengthen-guardrails/increase-consistency#specify-the-desired-output-format
5446
5446
  */
5447
5447
 
5448
+ /**
5449
+ * All available task types
5450
+ *
5451
+ * There is is distinction between task types and section types
5452
+ * - Every section in markdown has its SectionType
5453
+ * - Some sections are tasks but other can be non-task sections
5454
+ *
5455
+ * @public exported from `@promptbook/core`
5456
+ */
5457
+ var TaskTypes = [
5458
+ 'PROMPT',
5459
+ 'SIMPLE',
5460
+ 'SCRIPT',
5461
+ 'DIALOG',
5462
+ // <- [🅱]
5463
+ ];
5464
+
5465
+ /**
5466
+ * All available sections which are not tasks
5467
+ *
5468
+ * @public exported from `@promptbook/core`
5469
+ */
5470
+ var NonTaskSectionTypes = ['EXAMPLE', 'KNOWLEDGE', 'INSTRUMENT', 'ACTION'];
5471
+ /**
5472
+ * All available section types
5473
+ *
5474
+ * There is is distinction between task types and section types
5475
+ * - Every section in markdown has its SectionType
5476
+ * - Some sections are tasks but other can be non-task sections
5477
+ *
5478
+ * @public exported from `@promptbook/core`
5479
+ */
5480
+ var SectionTypes = __spreadArray(__spreadArray([], __read(TaskTypes.map(function (TaskType) { return "".concat(TaskType, "_TASK"); })), false), __read(NonTaskSectionTypes), false);
5481
+
5448
5482
  /**
5449
5483
  * Parses the knowledge command
5450
5484
  *
@@ -5537,24 +5571,6 @@ var knowledgeCommandParser = {
5537
5571
  * Note: [⛱] There are two types of KNOWLEDGE commands *...(read more in [⛱])*
5538
5572
  */
5539
5573
 
5540
- /**
5541
- * Section type describes the way how the section is sectiond
5542
- *
5543
- * @public exported from `@promptbook/core`
5544
- */
5545
- var SectionTypes = [
5546
- 'PROMPT_TASK',
5547
- 'SIMPLE_TASK',
5548
- 'SCRIPT_TASK',
5549
- 'DIALOG_TASK',
5550
- 'EXAMPLE',
5551
- 'KNOWLEDGE',
5552
- 'INSTRUMENT',
5553
- 'ACTION',
5554
- // <- [🅱]
5555
- ];
5556
- // <- TODO: !!!!!! Make alongside `SectionType` the `TaskType`, `TaskType` + [⛱] and ACRY
5557
-
5558
5574
  /**
5559
5575
  * Parses the section command
5560
5576
  *
@@ -5642,7 +5658,10 @@ var sectionCommandParser = {
5642
5658
  var normalized = input.normalized;
5643
5659
  normalized = normalized.split('SAMPLE').join('EXAMPLE');
5644
5660
  normalized = normalized.split('EXECUTE_').join('');
5645
- var taskTypes = SectionTypes.filter(function (taskType) { return normalized.includes(taskType.split('_TASK').join('')); });
5661
+ normalized = normalized.split('DIALOGUE').join('DIALOG');
5662
+ var taskTypes = SectionTypes.filter(function (sectionType) {
5663
+ return normalized.includes(sectionType.split('_TASK').join(''));
5664
+ });
5646
5665
  if (taskTypes.length !== 1) {
5647
5666
  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 "); }));
5648
5667
  }
@@ -6001,7 +6020,7 @@ var expectCommandParser = {
6001
6020
  /**
6002
6021
  * Description of the FORMAT command
6003
6022
  */
6004
- description: spaceTrim$1("\n Expect command describes the desired output of the template (after post-processing)\n It can set limits for the maximum/minimum length of the output, measured in characters, words, sentences, paragraphs or some other shape of the output.\n "),
6023
+ description: spaceTrim$1("\n Expect command describes the desired output of the task *(after post-processing)*\n It can set limits for the maximum/minimum length of the output, measured in characters, words, sentences, paragraphs or some other shape of the output.\n "),
6005
6024
  /**
6006
6025
  * Link to documentation
6007
6026
  */
@@ -6487,7 +6506,7 @@ var formatCommandParser = {
6487
6506
  /**
6488
6507
  * Description of the FORMAT command
6489
6508
  */
6490
- description: spaceTrim$1("\n Format command describes the desired output of the template (after post-processing)\n It can set limits for the maximum/minimum length of the output, measured in characters, words, sentences, paragraphs or some other shape of the output.\n "),
6509
+ description: spaceTrim$1("\n Format command describes the desired output of the task (after post-processing)\n It can set limits for the maximum/minimum length of the output, measured in characters, words, sentences, paragraphs or some other shape of the output.\n "),
6491
6510
  /**
6492
6511
  * Link to documentation
6493
6512
  */
@@ -6551,19 +6570,45 @@ var ChatbotFormfactorDefinition = {
6551
6570
  description: "@@@",
6552
6571
  documentationUrl: "https://github.com/webgptorg/promptbook/discussions/174",
6553
6572
  pipelineInterface: {
6554
- inputParameterNames: ['previousTitle', 'previousConversationSummary', 'userMessage'],
6555
- outputParameterNames: ['title', 'conversationSummary', 'chatbotResponse'],
6556
- /*
6557
- <- TODO: !!!!!! Change to full interfaces
6558
-
6559
- - INPUT PARAMETER `{previousTitle}` Previous title of the conversation
6560
- - INPUT PARAMETER `{previousConversationSummary}` Previous conversation summary
6561
- - INPUT PARAMETER `{userMessage}` User message
6562
- - OUTPUT PARAMETER `{title}` Title of the conversation
6563
- - OUTPUT PARAMETER `{conversationSummary}` Summary of the conversation
6564
- - OUTPUT PARAMETER `{chatbotResponse}` Chatbot response
6573
+ inputParameters: [
6574
+ {
6575
+ name: 'previousTitle',
6576
+ description: "Previous title of the conversation",
6577
+ isInput: true,
6578
+ isOutput: false,
6579
+ },
6580
+ {
6581
+ name: 'previousConversationSummary',
6582
+ description: "Previous conversation summary",
6583
+ isInput: true,
6584
+ isOutput: false,
6585
+ },
6586
+ { name: 'userMessage', description: "User message", isInput: true, isOutput: false },
6587
+ ],
6588
+ outputParameters: [
6589
+ { name: 'title', description: "Title of the conversation", isInput: false, isOutput: true },
6590
+ { name: 'conversationSummary', description: "Summary of the conversation", isInput: false, isOutput: true },
6591
+ { name: 'chatbotResponse', description: "Chatbot response", isInput: false, isOutput: true },
6592
+ ],
6593
+ },
6594
+ };
6565
6595
 
6566
- */
6596
+ /**
6597
+ * Generator is form of app that @@@
6598
+ *
6599
+ * @public exported from `@promptbook/core`
6600
+ */
6601
+ var GeneratorFormfactorDefinition = {
6602
+ name: 'GENERATOR',
6603
+ description: "@@@",
6604
+ documentationUrl: "https://github.com/webgptorg/promptbook/discussions/184",
6605
+ pipelineInterface: {
6606
+ inputParameters: [
6607
+ /* @@@ */
6608
+ ],
6609
+ outputParameters: [
6610
+ /* @@@ */
6611
+ ],
6567
6612
  },
6568
6613
  };
6569
6614
 
@@ -6575,8 +6620,8 @@ var ChatbotFormfactorDefinition = {
6575
6620
  * @public exported from `@promptbook/core`
6576
6621
  */
6577
6622
  var GENERIC_PIPELINE_INTERFACE = {
6578
- inputParameterNames: [],
6579
- outputParameterNames: [],
6623
+ inputParameters: [],
6624
+ outputParameters: [],
6580
6625
  };
6581
6626
  /**
6582
6627
  * Note: [💞] Ignore a discrepancy between file name and entity name
@@ -6604,10 +6649,10 @@ var MatcherFormfactorDefinition = {
6604
6649
  description: "@@@",
6605
6650
  documentationUrl: "https://github.com/webgptorg/promptbook/discussions/177",
6606
6651
  pipelineInterface: {
6607
- inputParameterNames: [
6652
+ inputParameters: [
6608
6653
  /* @@@ */
6609
6654
  ],
6610
- outputParameterNames: [
6655
+ outputParameters: [
6611
6656
  /* @@@ */
6612
6657
  ],
6613
6658
  },
@@ -6623,8 +6668,22 @@ var SheetsFormfactorDefinition = {
6623
6668
  description: "@@@",
6624
6669
  documentationUrl: "https://github.com/webgptorg/promptbook/discussions/176",
6625
6670
  pipelineInterface: {
6626
- inputParameterNames: ['inputSheet'],
6627
- outputParameterNames: ['outputSheet'],
6671
+ inputParameters: [
6672
+ {
6673
+ name: 'inputSheet',
6674
+ description: "Input sheet to be processed as csv",
6675
+ isInput: true,
6676
+ isOutput: false,
6677
+ },
6678
+ ],
6679
+ outputParameters: [
6680
+ {
6681
+ name: 'outputSheet',
6682
+ description: "Output sheet as csv",
6683
+ isInput: false,
6684
+ isOutput: true,
6685
+ },
6686
+ ],
6628
6687
  },
6629
6688
  };
6630
6689
 
@@ -6638,9 +6697,23 @@ var TranslatorFormfactorDefinition = {
6638
6697
  description: "@@@",
6639
6698
  documentationUrl: "https://github.com/webgptorg/promptbook/discussions/175",
6640
6699
  pipelineInterface: {
6641
- inputParameterNames: ['inputMessage'],
6642
- outputParameterNames: ['outputMessage'],
6643
- // <- TODO: !!!!!! Maybe add {summary}
6700
+ inputParameters: [
6701
+ {
6702
+ name: 'inputMessage',
6703
+ description: "Input message to be translated",
6704
+ isInput: true,
6705
+ isOutput: false,
6706
+ },
6707
+ ],
6708
+ outputParameters: [
6709
+ {
6710
+ name: 'outputMessage',
6711
+ description: "Translated output message",
6712
+ isInput: false,
6713
+ isOutput: true,
6714
+ },
6715
+ ],
6716
+ // <- TODO: [🤓] Maybe add {summary}
6644
6717
  // <- TODO: [🧠] maybe change to {inputText}, {inputText} / or make system for any name of first input and first outpur parameter
6645
6718
  },
6646
6719
  };
@@ -6656,6 +6729,7 @@ var FORMFACTOR_DEFINITIONS = [
6656
6729
  TranslatorFormfactorDefinition,
6657
6730
  SheetsFormfactorDefinition,
6658
6731
  MatcherFormfactorDefinition,
6732
+ GeneratorFormfactorDefinition,
6659
6733
  ];
6660
6734
  /**
6661
6735
  * Note: [💞] Ignore a discrepancy between file name and entity name
@@ -6768,7 +6842,7 @@ var jokerCommandParser = {
6768
6842
  /**
6769
6843
  * Description of the JOKER command
6770
6844
  */
6771
- description: "Joker parameter is used instead of executing the template result if jokers value meets the expectations requirements",
6845
+ description: "Joker parameter is used instead of executing the task result if jokers value meets the expectations requirements",
6772
6846
  /**
6773
6847
  * Link to documentation
6774
6848
  */
@@ -6996,7 +7070,7 @@ var parameterCommandParser = {
6996
7070
  /**
6997
7071
  * Description of the PARAMETER command
6998
7072
  */
6999
- description: "Describes one parameter of the template",
7073
+ description: "Describes one parameter of the task",
7000
7074
  /**
7001
7075
  * Link to documentation
7002
7076
  */
@@ -7352,7 +7426,7 @@ var urlCommandParser = {
7352
7426
  spaceTrim(
7353
7427
  `
7354
7428
  URL must not contain hash
7355
- Hash is used for identification of the template in the pipeline
7429
+ Hash is used for identification of the section of the pipeline
7356
7430
  `,
7357
7431
  ),
7358
7432
  );
@@ -7408,7 +7482,7 @@ var actionCommandParser = {
7408
7482
  /**
7409
7483
  * Description of the ACTION command
7410
7484
  */
7411
- description: "Actions influences from the pipeline or template into external world. Like turning on a light, sending an email, etc.",
7485
+ description: "Actions influences from the pipeline or task into external world. Like turning on a light, sending an email, etc.",
7412
7486
  /**
7413
7487
  * Link to documentation
7414
7488
  */
@@ -7474,7 +7548,7 @@ var instrumentCommandParser = {
7474
7548
  /**
7475
7549
  * Description of the INSTRUMENT command
7476
7550
  */
7477
- description: "Instrument command is used to specify the instrument to be used in the pipeline or template like search, calculate, etc.",
7551
+ description: "Instrument command is used to specify the instrument to be used in the pipeline or task like search, calculate, etc.",
7478
7552
  /**
7479
7553
  * Link to documentation
7480
7554
  */
@@ -7608,7 +7682,6 @@ function parseCommand(raw, usagePlace) {
7608
7682
  normalized = normalized.split('(').join('');
7609
7683
  normalized = normalized.split(')').join('');
7610
7684
  normalized = normalizeTo_SCREAMING_CASE(normalized);
7611
- normalized = normalized.split('DIALOGUE').join('DIALOG'); // <- TODO: !!!!!! Move to sectionCommandParser
7612
7685
  var items = raw
7613
7686
  .trim()
7614
7687
  // Note: [🐡]
@@ -7796,7 +7869,7 @@ function extractAllListItemsFromMarkdown(markdown) {
7796
7869
  function extractOneBlockFromMarkdown(markdown) {
7797
7870
  var codeBlocks = extractAllBlocksFromMarkdown(markdown);
7798
7871
  if (codeBlocks.length !== 1) {
7799
- throw new ParseError(spaceTrim$1(function (block) { return "\n There should be exactly 1 code block in template, found ".concat(codeBlocks.length, " code blocks\n\n ").concat(block(codeBlocks.map(function (block, i) { return "Block ".concat(i + 1, ":\n").concat(block.content); }).join('\n\n\n')), "\n "); }));
7872
+ throw new ParseError(spaceTrim$1(function (block) { return "\n There should be exactly 1 code block in task section, found ".concat(codeBlocks.length, " code blocks\n\n ").concat(block(codeBlocks.map(function (block, i) { return "Block ".concat(i + 1, ":\n").concat(block.content); }).join('\n\n\n')), "\n "); }));
7800
7873
  }
7801
7874
  return codeBlocks[0];
7802
7875
  }
@@ -8103,7 +8176,7 @@ function pipelineStringToJsonSync(pipelineString) {
8103
8176
  var command = parseCommand(listItem, 'PIPELINE_HEAD');
8104
8177
  var commandParser = getParserForCommand(command);
8105
8178
  if (commandParser.isUsedInPipelineHead !== true /* <- Note: [🦦][4] */) {
8106
- throw new ParseError(spaceTrim(function (block) { return "\n Command ".concat(command.type, " is not allowed in the head of the promptbook ONLY at the pipeline template\n\n ").concat(block(getPipelineIdentification()), "\n "); })); // <- TODO: [🚞]
8179
+ throw new ParseError(spaceTrim(function (block) { return "\n Command `".concat(command.type, "` is not allowed in the head of the pipeline ONLY at the pipeline task\n\n ").concat(block(getPipelineIdentification()), "\n "); })); // <- TODO: [🚞]
8107
8180
  }
8108
8181
  try {
8109
8182
  commandParser.$applyToPipelineJson(command, $pipelineJson);
@@ -8135,7 +8208,7 @@ function pipelineStringToJsonSync(pipelineString) {
8135
8208
  }
8136
8209
  var _loop_2 = function (section) {
8137
8210
  var e_5, _l, e_6, _m;
8138
- // TODO: Parse template description (the content out of the codeblock and lists)
8211
+ // TODO: Parse section's description (the content out of the codeblock and lists)
8139
8212
  var listItems_2 = extractAllListItemsFromMarkdown(section.content);
8140
8213
  var _o = extractOneBlockFromMarkdown(section.content), language = _o.language, content = _o.content;
8141
8214
  // TODO: [🎾][1] DRY description
@@ -8166,7 +8239,7 @@ function pipelineStringToJsonSync(pipelineString) {
8166
8239
  resultingParameterNameMatch.groups.resultingParamName !== undefined) {
8167
8240
  $taskJson.resultingParameterName = resultingParameterNameMatch.groups.resultingParamName;
8168
8241
  }
8169
- // TODO: [🥥] Maybe move this logic to `$parseAndApplyPipelineTemplateCommands`
8242
+ // TODO: [🥥] Maybe move this logic to `$parseAndApplyPipelineTaskCommands`
8170
8243
  var commands = listItems_2.map(function (listItem) { return ({
8171
8244
  listItem: listItem,
8172
8245
  command: parseCommand(listItem, 'PIPELINE_TASK'),
@@ -8181,7 +8254,7 @@ function pipelineStringToJsonSync(pipelineString) {
8181
8254
  var _loop_4 = function (listItem, command) {
8182
8255
  var commandParser = getParserForCommand(command);
8183
8256
  if (commandParser.isUsedInPipelineTask !== true /* <- Note: [🦦][4] */) {
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: [🚞]
8257
+ throw new ParseError(spaceTrim(function (block) { return "\n Command `".concat(command.type, "` is not allowed in the task of the promptbook ONLY at the pipeline head\n\n ").concat(block(getPipelineIdentification()), "\n "); })); // <- TODO: [🚞]
8185
8258
  }
8186
8259
  try {
8187
8260
  commandParser.$applyToTaskJson(
@@ -8192,7 +8265,7 @@ function pipelineStringToJsonSync(pipelineString) {
8192
8265
  if (!(error instanceof ParseError)) {
8193
8266
  throw error;
8194
8267
  }
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: [🚞]
8268
+ throw new ParseError(spaceTrim(function (block) { return "\n Command `".concat(command.type, "` failed to apply to the task\n\n The error:\n ").concat(block(error.message), "\n\n Current state of the task:\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: [🚞]
8196
8269
  }
8197
8270
  if (command.type === 'PARAMETER') {
8198
8271
  defineParam(command);
@@ -8213,10 +8286,10 @@ function pipelineStringToJsonSync(pipelineString) {
8213
8286
  }
8214
8287
  finally { if (e_5) throw e_5.error; }
8215
8288
  }
8216
- // TODO: [🍧] Should be done in TEMPLATE command
8289
+ // TODO: [🍧] Should be done in SECTION command
8217
8290
  if ($taskJson.taskType === 'SCRIPT_TASK') {
8218
8291
  if (!language) {
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 "); }));
8292
+ throw new ParseError(spaceTrim(function (block) { return "\n You must specify the language of the script in the `SCRIPT` task\n\n ".concat(block(getPipelineIdentification()), "\n "); }));
8220
8293
  }
8221
8294
  if (!SUPPORTED_SCRIPT_LANGUAGES.includes(language)) {
8222
8295
  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 "); }));
@@ -8227,7 +8300,7 @@ function pipelineStringToJsonSync(pipelineString) {
8227
8300
  try {
8228
8301
  for (var _q = (e_6 = void 0, __values($taskJson.dependentParameterNames)), _r = _q.next(); !_r.done; _r = _q.next()) {
8229
8302
  var parameterName = _r.value;
8230
- // TODO: [🧠] This definition should be made first in the template
8303
+ // TODO: [🧠] This definition should be made first in the task
8231
8304
  defineParam({
8232
8305
  parameterName: parameterName,
8233
8306
  parameterDescription: null,
@@ -8252,7 +8325,7 @@ function pipelineStringToJsonSync(pipelineString) {
8252
8325
  (block) => `
8253
8326
  Model requirements are defined for the block type ${
8254
8327
  $taskJson.taskType
8255
- } which is not a PROMPT TEMPLATE
8328
+ } which is not a \`PROMPT\` task
8256
8329
 
8257
8330
  This should be avoided by the \`modelCommandParser\`
8258
8331
 
@@ -8271,7 +8344,7 @@ function pipelineStringToJsonSync(pipelineString) {
8271
8344
  };
8272
8345
  try {
8273
8346
  // =============================================================
8274
- // Note: 4️⃣ Process each template of the pipeline
8347
+ // Note: 4️⃣ Process each section of the pipeline
8275
8348
  for (var pipelineSections_1 = __values(pipelineSections), pipelineSections_1_1 = pipelineSections_1.next(); !pipelineSections_1_1.done; pipelineSections_1_1 = pipelineSections_1.next()) {
8276
8349
  var section = pipelineSections_1_1.value;
8277
8350
  _loop_2(section);
@@ -8288,7 +8361,7 @@ function pipelineStringToJsonSync(pipelineString) {
8288
8361
  // Note: 5️⃣ Mark parameters as INPUT if not explicitly set
8289
8362
  if ($pipelineJson.parameters.every(function (parameter) { return !parameter.isInput; })) {
8290
8363
  var _loop_3 = function (parameter) {
8291
- var isThisParameterResulting = $pipelineJson.tasks.some(function (template) { return template.resultingParameterName === parameter.name; });
8364
+ var isThisParameterResulting = $pipelineJson.tasks.some(function (task) { return task.resultingParameterName === parameter.name; });
8292
8365
  if (!isThisParameterResulting) {
8293
8366
  parameter.isInput = true;
8294
8367
  }