@promptbook/cli 0.75.0-2 → 0.75.0-4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (50) hide show
  1. package/README.md +30 -20
  2. package/esm/index.es.js +206 -125
  3. package/esm/index.es.js.map +1 -1
  4. package/esm/typings/src/_packages/core.index.d.ts +10 -4
  5. package/esm/typings/src/_packages/types.index.d.ts +8 -6
  6. package/esm/typings/src/commands/EXPECT/ExpectCommand.d.ts +1 -1
  7. package/esm/typings/src/commands/SECTION/SectionCommand.d.ts +1 -1
  8. package/esm/typings/src/commands/_common/types/CommandParser.d.ts +0 -2
  9. package/esm/typings/src/config.d.ts +9 -2
  10. package/esm/typings/src/conversion/pipelineJsonToString.d.ts +1 -1
  11. package/esm/typings/src/conversion/prettify/renderPipelineMermaidOptions.d.ts +2 -2
  12. package/esm/typings/src/conversion/utils/extractParameterNamesFromTask.d.ts +3 -3
  13. package/esm/typings/src/conversion/utils/renameParameter.d.ts +2 -2
  14. package/esm/typings/src/dialogs/simple-prompt/SimplePromptInterfaceTools.d.ts +1 -1
  15. package/esm/typings/src/execution/ScriptExecutionTools.d.ts +1 -1
  16. package/esm/typings/src/formfactors/_boilerplate/BoilerplateFormfactorDefinition.d.ts +2 -2
  17. package/esm/typings/src/formfactors/_common/AbstractFormfactorDefinition.d.ts +3 -0
  18. package/esm/typings/src/formfactors/chatbot/ChatbotFormfactorDefinition.d.ts +32 -2
  19. package/esm/typings/src/formfactors/generator/GeneratorFormfactorDefinition.d.ts +14 -0
  20. package/esm/typings/src/formfactors/generic/GenericFormfactorDefinition.d.ts +2 -2
  21. package/esm/typings/src/formfactors/index.d.ts +72 -10
  22. package/esm/typings/src/formfactors/matcher/MatcherFormfactorDefinition.d.ts +2 -2
  23. package/esm/typings/src/formfactors/sheets/SheetsFormfactorDefinition.d.ts +12 -2
  24. package/esm/typings/src/formfactors/translator/TranslatorFormfactorDefinition.d.ts +12 -2
  25. package/esm/typings/src/pipeline/PipelineInterface/PipelineInterface.d.ts +5 -4
  26. package/esm/typings/src/pipeline/PipelineInterface/constants.d.ts +2 -2
  27. package/esm/typings/src/pipeline/PipelineJson/{TaskJsonCommon.d.ts → CommonTaskJson.d.ts} +13 -13
  28. package/esm/typings/src/pipeline/PipelineJson/DialogTaskJson.d.ts +2 -2
  29. package/esm/typings/src/pipeline/PipelineJson/ParameterJson.d.ts +2 -0
  30. package/esm/typings/src/pipeline/PipelineJson/PersonaJson.d.ts +1 -1
  31. package/esm/typings/src/pipeline/PipelineJson/PipelineJson.d.ts +2 -2
  32. package/esm/typings/src/pipeline/PipelineJson/PromptTaskJson.d.ts +2 -2
  33. package/esm/typings/src/pipeline/PipelineJson/ScriptTaskJson.d.ts +2 -2
  34. package/esm/typings/src/pipeline/PipelineJson/SimpleTaskJson.d.ts +2 -2
  35. package/esm/typings/src/pipeline/PipelineJson/TaskJson.d.ts +1 -1
  36. package/esm/typings/src/pipeline/PipelineString.d.ts +1 -1
  37. package/esm/typings/src/prepare/isPipelinePrepared.d.ts +1 -1
  38. package/esm/typings/src/prepare/prepareTasks.d.ts +5 -5
  39. package/esm/typings/src/types/Prompt.d.ts +3 -3
  40. package/esm/typings/src/types/SectionType.d.ts +21 -0
  41. package/esm/typings/src/types/TaskProgress.d.ts +1 -1
  42. package/esm/typings/src/types/TaskType.d.ts +15 -0
  43. package/esm/typings/src/types/typeAliases.d.ts +1 -1
  44. package/esm/typings/src/utils/organization/TODO_remove_as.d.ts +6 -0
  45. package/esm/typings/src/utils/parameters/extractParameterNames.d.ts +1 -1
  46. package/package.json +1 -1
  47. package/umd/index.umd.js +206 -125
  48. package/umd/index.umd.js.map +1 -1
  49. package/esm/typings/src/commands/SECTION/SectionType.d.ts +0 -13
  50. /package/esm/typings/{promptbook-collection → books}/index.d.ts +0 -0
package/esm/index.es.js CHANGED
@@ -37,7 +37,7 @@ var BOOK_LANGUAGE_VERSION = '1.0.0';
37
37
  *
38
38
  * @see https://github.com/webgptorg/promptbook
39
39
  */
40
- var PROMPTBOOK_ENGINE_VERSION = '0.75.0-1';
40
+ var PROMPTBOOK_ENGINE_VERSION = '0.75.0-3';
41
41
  /**
42
42
  * TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
43
43
  * Note: [💞] Ignore a discrepancy between file name and entity name
@@ -453,6 +453,13 @@ var DEFAULT_MAX_PARALLEL_COUNT = 5; // <- TODO: [🤹‍♂️]
453
453
  * @public exported from `@promptbook/core`
454
454
  */
455
455
  var DEFAULT_MAX_EXECUTION_ATTEMPTS = 3; // <- TODO: [🤹‍♂️]
456
+ /**
457
+ * Where to store your books
458
+ * This is kind of a "src" for your books
459
+ *
460
+ * @public exported from `@promptbook/core`
461
+ */
462
+ var DEFAULT_BOOKS_DIRNAME = './books';
456
463
  /**
457
464
  * Where to store the cache of executions for promptbook CLI
458
465
  *
@@ -460,7 +467,7 @@ var DEFAULT_MAX_EXECUTION_ATTEMPTS = 3; // <- TODO: [🤹‍♂️]
460
467
  *
461
468
  * @public exported from `@promptbook/core`
462
469
  */
463
- var DEFAULT_EXECUTIONS_CACHE_DIRNAME = '/.promptbook/executions-cache';
470
+ var DEFAULT_EXECUTIONS_CACHE_DIRNAME = './.promptbook/executions-cache';
464
471
  /**
465
472
  * Where to store the scrape cache
466
473
  *
@@ -468,7 +475,7 @@ var DEFAULT_EXECUTIONS_CACHE_DIRNAME = '/.promptbook/executions-cache';
468
475
  *
469
476
  * @public exported from `@promptbook/core`
470
477
  */
471
- var DEFAULT_SCRAPE_CACHE_DIRNAME = '/.promptbook/scrape-cache';
478
+ var DEFAULT_SCRAPE_CACHE_DIRNAME = './.promptbook/scrape-cache';
472
479
  /**
473
480
  * The name of the builded pipeline collection made by CLI `ptbk make` and for lookup in `createCollectionFromDirectory`
474
481
  *
@@ -748,7 +755,7 @@ function pipelineJsonToString(pipelineJson) {
748
755
  return isInput;
749
756
  })), _h = _g.next(); !_h.done; _h = _g.next()) {
750
757
  var parameter = _h.value;
751
- commands.push("INPUT PARAMETER ".concat(templateParameterJsonToString(parameter)));
758
+ commands.push("INPUT PARAMETER ".concat(taskParameterJsonToString(parameter)));
752
759
  }
753
760
  }
754
761
  catch (e_1_1) { e_1 = { error: e_1_1 }; }
@@ -764,7 +771,7 @@ function pipelineJsonToString(pipelineJson) {
764
771
  return isOutput;
765
772
  })), _k = _j.next(); !_k.done; _k = _j.next()) {
766
773
  var parameter = _k.value;
767
- commands.push("OUTPUT PARAMETER ".concat(templateParameterJsonToString(parameter)));
774
+ commands.push("OUTPUT PARAMETER ".concat(taskParameterJsonToString(parameter)));
768
775
  }
769
776
  }
770
777
  catch (e_2_1) { e_2 = { error: e_2_1 }; }
@@ -778,12 +785,12 @@ function pipelineJsonToString(pipelineJson) {
778
785
  pipelineString += commands.map(function (command) { return "- ".concat(command); }).join('\n');
779
786
  try {
780
787
  for (var tasks_1 = __values(tasks), tasks_1_1 = tasks_1.next(); !tasks_1_1.done; tasks_1_1 = tasks_1.next()) {
781
- var template = tasks_1_1.value;
788
+ var task = tasks_1_1.value;
782
789
  var
783
790
  /* Note: Not using:> name, */
784
- title_1 = template.title, description_1 = template.description,
791
+ title_1 = task.title, description_1 = task.description,
785
792
  /* Note: dependentParameterNames, */
786
- jokers = template.jokerParameterNames, taskType = template.taskType, content = template.content, postprocessing = template.postprocessingFunctionNames, expectations = template.expectations, format = template.format, resultingParameterName = template.resultingParameterName;
793
+ jokers = task.jokerParameterNames, taskType = task.taskType, content = task.content, postprocessing = task.postprocessingFunctionNames, expectations = task.expectations, format = task.format, resultingParameterName = task.resultingParameterName;
787
794
  pipelineString += '\n\n';
788
795
  pipelineString += "## ".concat(title_1);
789
796
  if (description_1) {
@@ -793,9 +800,10 @@ function pipelineJsonToString(pipelineJson) {
793
800
  var commands_1 = [];
794
801
  var contentLanguage = 'text';
795
802
  if (taskType === 'PROMPT_TASK') {
796
- var modelRequirements = template.modelRequirements;
803
+ var modelRequirements = task.modelRequirements;
797
804
  var _l = modelRequirements || {}, modelName = _l.modelName, modelVariant = _l.modelVariant;
798
- commands_1.push("EXECUTE PROMPT TEMPLATE");
805
+ // Note: Do nothing, it is default
806
+ // commands.push(`PROMPT`);
799
807
  if (modelVariant) {
800
808
  commands_1.push("MODEL VARIANT ".concat(capitalize(modelVariant)));
801
809
  }
@@ -808,16 +816,16 @@ function pipelineJsonToString(pipelineJson) {
808
816
  // Note: Nothing special here
809
817
  }
810
818
  else if (taskType === 'SCRIPT_TASK') {
811
- commands_1.push("SCRIPT TEMPLATE");
812
- if (template.contentLanguage) {
813
- contentLanguage = template.contentLanguage;
819
+ commands_1.push("SCRIPT");
820
+ if (task.contentLanguage) {
821
+ contentLanguage = task.contentLanguage;
814
822
  }
815
823
  else {
816
824
  contentLanguage = '';
817
825
  }
818
826
  }
819
827
  else if (taskType === 'DIALOG_TASK') {
820
- commands_1.push("DIALOG TEMPLATE");
828
+ commands_1.push("DIALOG");
821
829
  // Note: Nothing special here
822
830
  } // <- }else if([🅱]
823
831
  if (jokers) {
@@ -892,7 +900,7 @@ function pipelineJsonToString(pipelineJson) {
892
900
  pipelineString += '\n';
893
901
  pipelineString += '```';
894
902
  pipelineString += '\n\n';
895
- pipelineString += "`-> {".concat(resultingParameterName, "}`"); // <- TODO: [main] !!! If the parameter here has description, add it and use templateParameterJsonToString
903
+ pipelineString += "`-> {".concat(resultingParameterName, "}`"); // <- TODO: [main] !!! If the parameter here has description, add it and use taskParameterJsonToString
896
904
  }
897
905
  }
898
906
  catch (e_3_1) { e_3 = { error: e_3_1 }; }
@@ -907,8 +915,8 @@ function pipelineJsonToString(pipelineJson) {
907
915
  /**
908
916
  * @private internal utility of `pipelineJsonToString`
909
917
  */
910
- function templateParameterJsonToString(templateParameterJson) {
911
- var name = templateParameterJson.name, description = templateParameterJson.description;
918
+ function taskParameterJsonToString(taskParameterJson) {
919
+ var name = taskParameterJson.name, description = taskParameterJson.description;
912
920
  var parameterString = "{".concat(name, "}");
913
921
  if (description) {
914
922
  parameterString = "".concat(parameterString, " ").concat(description);
@@ -916,7 +924,7 @@ function templateParameterJsonToString(templateParameterJson) {
916
924
  return parameterString;
917
925
  }
918
926
  /**
919
- * TODO: [🛋] Implement new features and commands into `pipelineJsonToString` + `templateParameterJsonToString` , use `stringifyCommand`
927
+ * TODO: [🛋] Implement new features and commands into `pipelineJsonToString` + `taskParameterJsonToString` , use `stringifyCommand`
920
928
  * TODO: [🧠] Is there a way to auto-detect missing features in pipelineJsonToString
921
929
  * TODO: [🏛] Maybe make some markdown builder
922
930
  * TODO: [🏛] Escape all
@@ -1561,7 +1569,7 @@ function joinLlmExecutionTools() {
1561
1569
  * TODO: [👷‍♂️] @@@ Manual about construction of llmTools
1562
1570
  */
1563
1571
 
1564
- 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"}];
1572
+ 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"}];
1565
1573
 
1566
1574
  /**
1567
1575
  * This error indicates that the promptbook in a markdown format cannot be parsed into a valid promptbook object
@@ -1954,20 +1962,20 @@ function validatePipelineCore(pipeline) {
1954
1962
  }
1955
1963
  finally { if (e_3) throw e_3.error; }
1956
1964
  }
1957
- var unresovedTemplates = __spreadArray([], __read(pipeline.tasks), false);
1965
+ var unresovedTasks = __spreadArray([], __read(pipeline.tasks), false);
1958
1966
  var loopLimit = LOOP_LIMIT;
1959
1967
  var _loop_3 = function () {
1960
1968
  if (loopLimit-- < 0) {
1961
1969
  // Note: Really UnexpectedError not LimitReachedError - this should not happen and be caught below
1962
1970
  throw new UnexpectedError(spaceTrim(function (block) { return "\n Loop limit reached during detection of circular dependencies in `validatePipeline`\n\n ".concat(block(pipelineIdentification), "\n "); }));
1963
1971
  }
1964
- var currentlyResovedTemplates = unresovedTemplates.filter(function (task) {
1972
+ var currentlyResovedTasks = unresovedTasks.filter(function (task) {
1965
1973
  return task.dependentParameterNames.every(function (name) { return resovedParameters.includes(name); });
1966
1974
  });
1967
- if (currentlyResovedTemplates.length === 0) {
1975
+ if (currentlyResovedTasks.length === 0) {
1968
1976
  throw new PipelineLogicError(
1969
1977
  // TODO: [🐎] DRY
1970
- 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
1978
+ 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
1971
1979
  .map(function (_a) {
1972
1980
  var resultingParameterName = _a.resultingParameterName, dependentParameterNames = _a.dependentParameterNames;
1973
1981
  return "- Parameter `{".concat(resultingParameterName, "}` which depends on ").concat(dependentParameterNames
@@ -1986,13 +1994,13 @@ function validatePipelineCore(pipeline) {
1986
1994
  .map(function (name) { return "- Parameter `{".concat(name, "}`"); })
1987
1995
  .join('\n')), "\n\n\n "); }));
1988
1996
  }
1989
- resovedParameters = __spreadArray(__spreadArray([], __read(resovedParameters), false), __read(currentlyResovedTemplates.map(function (_a) {
1997
+ resovedParameters = __spreadArray(__spreadArray([], __read(resovedParameters), false), __read(currentlyResovedTasks.map(function (_a) {
1990
1998
  var resultingParameterName = _a.resultingParameterName;
1991
1999
  return resultingParameterName;
1992
2000
  })), false);
1993
- unresovedTemplates = unresovedTemplates.filter(function (task) { return !currentlyResovedTemplates.includes(task); });
2001
+ unresovedTasks = unresovedTasks.filter(function (task) { return !currentlyResovedTasks.includes(task); });
1994
2002
  };
1995
- while (unresovedTemplates.length > 0) {
2003
+ while (unresovedTasks.length > 0) {
1996
2004
  _loop_3();
1997
2005
  }
1998
2006
  // TODO: !!!!!! Test that pipeline interface implements declared formfactor interface
@@ -2054,7 +2062,7 @@ var PipelineUrlError = /** @class */ (function (_super) {
2054
2062
  /**
2055
2063
  * Parses the task and returns the list of all parameter names
2056
2064
  *
2057
- * @param template the task with parameters in {curly} braces
2065
+ * @param template the string template with parameters in {curly} braces
2058
2066
  * @returns the list of parameter names
2059
2067
  * @public exported from `@promptbook/utils`
2060
2068
  */
@@ -2088,13 +2096,13 @@ function unpreparePipeline(pipeline) {
2088
2096
  var personas = pipeline.personas, knowledgeSources = pipeline.knowledgeSources, tasks = pipeline.tasks;
2089
2097
  personas = personas.map(function (persona) { return (__assign(__assign({}, persona), { modelRequirements: undefined, preparationIds: undefined })); });
2090
2098
  knowledgeSources = knowledgeSources.map(function (knowledgeSource) { return (__assign(__assign({}, knowledgeSource), { preparationIds: undefined })); });
2091
- tasks = tasks.map(function (template) {
2092
- var dependentParameterNames = template.dependentParameterNames;
2093
- var parameterNames = extractParameterNames(template.preparedContent || '');
2099
+ tasks = tasks.map(function (task) {
2100
+ var dependentParameterNames = task.dependentParameterNames;
2101
+ var parameterNames = extractParameterNames(task.preparedContent || '');
2094
2102
  dependentParameterNames = dependentParameterNames.filter(function (dependentParameterName) { return !parameterNames.has(dependentParameterName); });
2095
- var templateUnprepared = __assign(__assign({}, template), { dependentParameterNames: dependentParameterNames });
2096
- delete templateUnprepared.preparedContent;
2097
- return templateUnprepared;
2103
+ var taskUnprepared = __assign(__assign({}, task), { dependentParameterNames: dependentParameterNames });
2104
+ delete taskUnprepared.preparedContent;
2105
+ return taskUnprepared;
2098
2106
  });
2099
2107
  return $asDeeplyFrozenSerializableJson('Unprepared PipelineJson', __assign(__assign({}, pipeline), { tasks: tasks, knowledgeSources: knowledgeSources, knowledgePieces: [], personas: personas, preparations: [] }));
2100
2108
  }
@@ -2371,7 +2379,7 @@ function isPipelinePrepared(pipeline) {
2371
2379
  * TODO: [🐠] Maybe base this on `makeValidator`
2372
2380
  * TODO: [🧊] Pipeline can be partially prepared, this should return true ONLY if fully prepared
2373
2381
  * TODO: [🧿] Maybe do same process with same granularity and subfinctions as `preparePipeline`
2374
- * - [🏍] ? Is context in each template
2382
+ * - [🏍] ? Is context in each task
2375
2383
  * - [♨] Are examples prepared
2376
2384
  * - [♨] Are tasks prepared
2377
2385
  */
@@ -2443,16 +2451,16 @@ function extractVariables(script) {
2443
2451
  */
2444
2452
 
2445
2453
  /**
2446
- * Parses the template and returns the set of all used parameters
2454
+ * Parses the task and returns the set of all used parameters
2447
2455
  *
2448
- * @param template the template with used parameters
2456
+ * @param task the task with used parameters
2449
2457
  * @returns the set of parameter names
2450
2458
  * @throws {ParseError} if the script is invalid
2451
2459
  * @public exported from `@promptbook/utils`
2452
2460
  */
2453
- function extractParameterNamesFromTask(template) {
2461
+ function extractParameterNamesFromTask(task) {
2454
2462
  var e_1, _a, e_2, _b, e_3, _c, e_4, _d;
2455
- var title = template.title, description = template.description, taskType = template.taskType, content = template.content, preparedContent = template.preparedContent, jokerParameterNames = template.jokerParameterNames, foreach = template.foreach;
2463
+ var title = task.title, description = task.description, taskType = task.taskType, content = task.content, preparedContent = task.preparedContent, jokerParameterNames = task.jokerParameterNames, foreach = task.foreach;
2456
2464
  var parameterNames = new Set();
2457
2465
  try {
2458
2466
  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()) {
@@ -5510,10 +5518,10 @@ function prepareTasks(pipeline, tools, options) {
5510
5518
  _a = options.maxParallelCount, maxParallelCount = _a === void 0 ? DEFAULT_MAX_PARALLEL_COUNT : _a;
5511
5519
  tasks = pipeline.tasks, pipeline.parameters, knowledgePiecesCount = pipeline.knowledgePiecesCount;
5512
5520
  tasksPrepared = new Array(tasks.length);
5513
- 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 () {
5514
- var dependentParameterNames, preparedContent, preparedTemplate;
5521
+ 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 () {
5522
+ var dependentParameterNames, preparedContent, preparedTask;
5515
5523
  return __generator(this, function (_a) {
5516
- dependentParameterNames = template.dependentParameterNames;
5524
+ dependentParameterNames = task.dependentParameterNames;
5517
5525
  preparedContent = undefined;
5518
5526
  if (knowledgePiecesCount > 0 && !dependentParameterNames.includes('knowledge')) {
5519
5527
  preparedContent = spaceTrim("\n {content}\n\n ## Knowledge\n\n {knowledge}\n ");
@@ -5522,8 +5530,8 @@ function prepareTasks(pipeline, tools, options) {
5522
5530
  'knowledge',
5523
5531
  ], false);
5524
5532
  }
5525
- preparedTemplate = __assign(__assign({}, template), { dependentParameterNames: dependentParameterNames, preparedContent: preparedContent });
5526
- tasksPrepared[index] = preparedTemplate;
5533
+ preparedTask = __assign(__assign({}, task), { dependentParameterNames: dependentParameterNames, preparedContent: preparedContent });
5534
+ tasksPrepared[index] = preparedTask;
5527
5535
  return [2 /*return*/];
5528
5536
  });
5529
5537
  }); })];
@@ -5535,8 +5543,8 @@ function prepareTasks(pipeline, tools, options) {
5535
5543
  });
5536
5544
  }
5537
5545
  /**
5538
- * TODO: [🧠] Add context to each template (if missing)
5539
- * TODO: [🧠] What is better name `prepareTemplate` or `prepareTemplateAndParameters`
5546
+ * TODO: [🧠] Add context to each task (if missing)
5547
+ * TODO: [🧠] What is better name `prepareTask` or `prepareTaskAndParameters`
5540
5548
  * TODO: [♨][main] !!! Prepare index the examples and maybe tasks
5541
5549
  * TODO: Write tests for `preparePipeline`
5542
5550
  * TODO: [🏏] Leverage the batch API and build queues @see https://platform.openai.com/docs/guides/batch
@@ -5622,7 +5630,7 @@ function preparePipeline(pipeline, tools, options) {
5622
5630
  })];
5623
5631
  case 3:
5624
5632
  tasksPrepared = (_c.sent()).tasksPrepared;
5625
- // ----- /Templates preparation -----
5633
+ // ----- /Tasks preparation -----
5626
5634
  // Note: Count total usage
5627
5635
  currentPreparation.usage = llmToolsWithUsage.getTotalUsage();
5628
5636
  return [2 /*return*/, $asDeeplyFrozenSerializableJson('Prepared PipelineJson', __assign(__assign({}, clonePipeline(pipeline)), { tasks: __spreadArray([], __read(tasksPrepared), false),
@@ -5641,6 +5649,40 @@ function preparePipeline(pipeline, tools, options) {
5641
5649
  * @see https://docs.anthropic.com/en/docs/test-and-evaluate/strengthen-guardrails/increase-consistency#specify-the-desired-output-format
5642
5650
  */
5643
5651
 
5652
+ /**
5653
+ * All available task types
5654
+ *
5655
+ * There is is distinction between task types and section types
5656
+ * - Every section in markdown has its SectionType
5657
+ * - Some sections are tasks but other can be non-task sections
5658
+ *
5659
+ * @public exported from `@promptbook/core`
5660
+ */
5661
+ var TaskTypes = [
5662
+ 'PROMPT',
5663
+ 'SIMPLE',
5664
+ 'SCRIPT',
5665
+ 'DIALOG',
5666
+ // <- [🅱]
5667
+ ];
5668
+
5669
+ /**
5670
+ * All available sections which are not tasks
5671
+ *
5672
+ * @public exported from `@promptbook/core`
5673
+ */
5674
+ var NonTaskSectionTypes = ['EXAMPLE', 'KNOWLEDGE', 'INSTRUMENT', 'ACTION'];
5675
+ /**
5676
+ * All available section types
5677
+ *
5678
+ * There is is distinction between task types and section types
5679
+ * - Every section in markdown has its SectionType
5680
+ * - Some sections are tasks but other can be non-task sections
5681
+ *
5682
+ * @public exported from `@promptbook/core`
5683
+ */
5684
+ var SectionTypes = __spreadArray(__spreadArray([], __read(TaskTypes.map(function (TaskType) { return "".concat(TaskType, "_TASK"); })), false), __read(NonTaskSectionTypes), false);
5685
+
5644
5686
  /**
5645
5687
  * Parses the knowledge command
5646
5688
  *
@@ -5733,24 +5775,6 @@ var knowledgeCommandParser = {
5733
5775
  * Note: [⛱] There are two types of KNOWLEDGE commands *...(read more in [⛱])*
5734
5776
  */
5735
5777
 
5736
- /**
5737
- * Section type describes the way how the section is sectiond
5738
- *
5739
- * @public exported from `@promptbook/core`
5740
- */
5741
- var SectionTypes = [
5742
- 'PROMPT_TASK',
5743
- 'SIMPLE_TASK',
5744
- 'SCRIPT_TASK',
5745
- 'DIALOG_TASK',
5746
- 'EXAMPLE',
5747
- 'KNOWLEDGE',
5748
- 'INSTRUMENT',
5749
- 'ACTION',
5750
- // <- [🅱]
5751
- ];
5752
- // <- TODO: !!!!!! Make alongside `SectionType` the `TaskType`, `TaskType` + [⛱] and ACRY
5753
-
5754
5778
  /**
5755
5779
  * Parses the section command
5756
5780
  *
@@ -5838,7 +5862,10 @@ var sectionCommandParser = {
5838
5862
  var normalized = input.normalized;
5839
5863
  normalized = normalized.split('SAMPLE').join('EXAMPLE');
5840
5864
  normalized = normalized.split('EXECUTE_').join('');
5841
- var taskTypes = SectionTypes.filter(function (taskType) { return normalized.includes(taskType.split('_TASK').join('')); });
5865
+ normalized = normalized.split('DIALOGUE').join('DIALOG');
5866
+ var taskTypes = SectionTypes.filter(function (sectionType) {
5867
+ return normalized.includes(sectionType.split('_TASK').join(''));
5868
+ });
5842
5869
  if (taskTypes.length !== 1) {
5843
5870
  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 "); }));
5844
5871
  }
@@ -6197,7 +6224,7 @@ var expectCommandParser = {
6197
6224
  /**
6198
6225
  * Description of the FORMAT command
6199
6226
  */
6200
- 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 "),
6227
+ 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 "),
6201
6228
  /**
6202
6229
  * Link to documentation
6203
6230
  */
@@ -6683,7 +6710,7 @@ var formatCommandParser = {
6683
6710
  /**
6684
6711
  * Description of the FORMAT command
6685
6712
  */
6686
- 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 "),
6713
+ 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 "),
6687
6714
  /**
6688
6715
  * Link to documentation
6689
6716
  */
@@ -6747,19 +6774,45 @@ var ChatbotFormfactorDefinition = {
6747
6774
  description: "@@@",
6748
6775
  documentationUrl: "https://github.com/webgptorg/promptbook/discussions/174",
6749
6776
  pipelineInterface: {
6750
- inputParameterNames: ['previousTitle', 'previousConversationSummary', 'userMessage'],
6751
- outputParameterNames: ['title', 'conversationSummary', 'chatbotResponse'],
6752
- /*
6753
- <- TODO: !!!!!! Change to full interfaces
6754
-
6755
- - INPUT PARAMETER `{previousTitle}` Previous title of the conversation
6756
- - INPUT PARAMETER `{previousConversationSummary}` Previous conversation summary
6757
- - INPUT PARAMETER `{userMessage}` User message
6758
- - OUTPUT PARAMETER `{title}` Title of the conversation
6759
- - OUTPUT PARAMETER `{conversationSummary}` Summary of the conversation
6760
- - OUTPUT PARAMETER `{chatbotResponse}` Chatbot response
6777
+ inputParameters: [
6778
+ {
6779
+ name: 'previousTitle',
6780
+ description: "Previous title of the conversation",
6781
+ isInput: true,
6782
+ isOutput: false,
6783
+ },
6784
+ {
6785
+ name: 'previousConversationSummary',
6786
+ description: "Previous conversation summary",
6787
+ isInput: true,
6788
+ isOutput: false,
6789
+ },
6790
+ { name: 'userMessage', description: "User message", isInput: true, isOutput: false },
6791
+ ],
6792
+ outputParameters: [
6793
+ { name: 'title', description: "Title of the conversation", isInput: false, isOutput: true },
6794
+ { name: 'conversationSummary', description: "Summary of the conversation", isInput: false, isOutput: true },
6795
+ { name: 'chatbotResponse', description: "Chatbot response", isInput: false, isOutput: true },
6796
+ ],
6797
+ },
6798
+ };
6761
6799
 
6762
- */
6800
+ /**
6801
+ * Generator is form of app that @@@
6802
+ *
6803
+ * @public exported from `@promptbook/core`
6804
+ */
6805
+ var GeneratorFormfactorDefinition = {
6806
+ name: 'GENERATOR',
6807
+ description: "@@@",
6808
+ documentationUrl: "https://github.com/webgptorg/promptbook/discussions/184",
6809
+ pipelineInterface: {
6810
+ inputParameters: [
6811
+ /* @@@ */
6812
+ ],
6813
+ outputParameters: [
6814
+ /* @@@ */
6815
+ ],
6763
6816
  },
6764
6817
  };
6765
6818
 
@@ -6771,8 +6824,8 @@ var ChatbotFormfactorDefinition = {
6771
6824
  * @public exported from `@promptbook/core`
6772
6825
  */
6773
6826
  var GENERIC_PIPELINE_INTERFACE = {
6774
- inputParameterNames: [],
6775
- outputParameterNames: [],
6827
+ inputParameters: [],
6828
+ outputParameters: [],
6776
6829
  };
6777
6830
  /**
6778
6831
  * Note: [💞] Ignore a discrepancy between file name and entity name
@@ -6800,10 +6853,10 @@ var MatcherFormfactorDefinition = {
6800
6853
  description: "@@@",
6801
6854
  documentationUrl: "https://github.com/webgptorg/promptbook/discussions/177",
6802
6855
  pipelineInterface: {
6803
- inputParameterNames: [
6856
+ inputParameters: [
6804
6857
  /* @@@ */
6805
6858
  ],
6806
- outputParameterNames: [
6859
+ outputParameters: [
6807
6860
  /* @@@ */
6808
6861
  ],
6809
6862
  },
@@ -6819,8 +6872,22 @@ var SheetsFormfactorDefinition = {
6819
6872
  description: "@@@",
6820
6873
  documentationUrl: "https://github.com/webgptorg/promptbook/discussions/176",
6821
6874
  pipelineInterface: {
6822
- inputParameterNames: ['inputSheet'],
6823
- outputParameterNames: ['outputSheet'],
6875
+ inputParameters: [
6876
+ {
6877
+ name: 'inputSheet',
6878
+ description: "Input sheet to be processed as csv",
6879
+ isInput: true,
6880
+ isOutput: false,
6881
+ },
6882
+ ],
6883
+ outputParameters: [
6884
+ {
6885
+ name: 'outputSheet',
6886
+ description: "Output sheet as csv",
6887
+ isInput: false,
6888
+ isOutput: true,
6889
+ },
6890
+ ],
6824
6891
  },
6825
6892
  };
6826
6893
 
@@ -6834,9 +6901,23 @@ var TranslatorFormfactorDefinition = {
6834
6901
  description: "@@@",
6835
6902
  documentationUrl: "https://github.com/webgptorg/promptbook/discussions/175",
6836
6903
  pipelineInterface: {
6837
- inputParameterNames: ['inputMessage'],
6838
- outputParameterNames: ['outputMessage'],
6839
- // <- TODO: !!!!!! Maybe add {summary}
6904
+ inputParameters: [
6905
+ {
6906
+ name: 'inputMessage',
6907
+ description: "Input message to be translated",
6908
+ isInput: true,
6909
+ isOutput: false,
6910
+ },
6911
+ ],
6912
+ outputParameters: [
6913
+ {
6914
+ name: 'outputMessage',
6915
+ description: "Translated output message",
6916
+ isInput: false,
6917
+ isOutput: true,
6918
+ },
6919
+ ],
6920
+ // <- TODO: [🤓] Maybe add {summary}
6840
6921
  // <- TODO: [🧠] maybe change to {inputText}, {inputText} / or make system for any name of first input and first outpur parameter
6841
6922
  },
6842
6923
  };
@@ -6852,6 +6933,7 @@ var FORMFACTOR_DEFINITIONS = [
6852
6933
  TranslatorFormfactorDefinition,
6853
6934
  SheetsFormfactorDefinition,
6854
6935
  MatcherFormfactorDefinition,
6936
+ GeneratorFormfactorDefinition,
6855
6937
  ];
6856
6938
  /**
6857
6939
  * Note: [💞] Ignore a discrepancy between file name and entity name
@@ -6964,7 +7046,7 @@ var jokerCommandParser = {
6964
7046
  /**
6965
7047
  * Description of the JOKER command
6966
7048
  */
6967
- description: "Joker parameter is used instead of executing the template result if jokers value meets the expectations requirements",
7049
+ description: "Joker parameter is used instead of executing the task result if jokers value meets the expectations requirements",
6968
7050
  /**
6969
7051
  * Link to documentation
6970
7052
  */
@@ -7192,7 +7274,7 @@ var parameterCommandParser = {
7192
7274
  /**
7193
7275
  * Description of the PARAMETER command
7194
7276
  */
7195
- description: "Describes one parameter of the template",
7277
+ description: "Describes one parameter of the task",
7196
7278
  /**
7197
7279
  * Link to documentation
7198
7280
  */
@@ -7548,7 +7630,7 @@ var urlCommandParser = {
7548
7630
  spaceTrim(
7549
7631
  `
7550
7632
  URL must not contain hash
7551
- Hash is used for identification of the template in the pipeline
7633
+ Hash is used for identification of the section of the pipeline
7552
7634
  `,
7553
7635
  ),
7554
7636
  );
@@ -7604,7 +7686,7 @@ var actionCommandParser = {
7604
7686
  /**
7605
7687
  * Description of the ACTION command
7606
7688
  */
7607
- description: "Actions influences from the pipeline or template into external world. Like turning on a light, sending an email, etc.",
7689
+ description: "Actions influences from the pipeline or task into external world. Like turning on a light, sending an email, etc.",
7608
7690
  /**
7609
7691
  * Link to documentation
7610
7692
  */
@@ -7670,7 +7752,7 @@ var instrumentCommandParser = {
7670
7752
  /**
7671
7753
  * Description of the INSTRUMENT command
7672
7754
  */
7673
- description: "Instrument command is used to specify the instrument to be used in the pipeline or template like search, calculate, etc.",
7755
+ description: "Instrument command is used to specify the instrument to be used in the pipeline or task like search, calculate, etc.",
7674
7756
  /**
7675
7757
  * Link to documentation
7676
7758
  */
@@ -7804,7 +7886,6 @@ function parseCommand(raw, usagePlace) {
7804
7886
  normalized = normalized.split('(').join('');
7805
7887
  normalized = normalized.split(')').join('');
7806
7888
  normalized = normalizeTo_SCREAMING_CASE(normalized);
7807
- normalized = normalized.split('DIALOGUE').join('DIALOG'); // <- TODO: !!!!!! Move to sectionCommandParser
7808
7889
  var items = raw
7809
7890
  .trim()
7810
7891
  // Note: [🐡]
@@ -7992,7 +8073,7 @@ function extractAllListItemsFromMarkdown(markdown) {
7992
8073
  function extractOneBlockFromMarkdown(markdown) {
7993
8074
  var codeBlocks = extractAllBlocksFromMarkdown(markdown);
7994
8075
  if (codeBlocks.length !== 1) {
7995
- 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 "); }));
8076
+ 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 "); }));
7996
8077
  }
7997
8078
  return codeBlocks[0];
7998
8079
  }
@@ -8299,7 +8380,7 @@ function pipelineStringToJsonSync(pipelineString) {
8299
8380
  var command = parseCommand(listItem, 'PIPELINE_HEAD');
8300
8381
  var commandParser = getParserForCommand(command);
8301
8382
  if (commandParser.isUsedInPipelineHead !== true /* <- Note: [🦦][4] */) {
8302
- 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: [🚞]
8383
+ 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: [🚞]
8303
8384
  }
8304
8385
  try {
8305
8386
  commandParser.$applyToPipelineJson(command, $pipelineJson);
@@ -8331,7 +8412,7 @@ function pipelineStringToJsonSync(pipelineString) {
8331
8412
  }
8332
8413
  var _loop_2 = function (section) {
8333
8414
  var e_5, _l, e_6, _m;
8334
- // TODO: Parse template description (the content out of the codeblock and lists)
8415
+ // TODO: Parse section's description (the content out of the codeblock and lists)
8335
8416
  var listItems_2 = extractAllListItemsFromMarkdown(section.content);
8336
8417
  var _o = extractOneBlockFromMarkdown(section.content), language = _o.language, content = _o.content;
8337
8418
  // TODO: [🎾][1] DRY description
@@ -8362,7 +8443,7 @@ function pipelineStringToJsonSync(pipelineString) {
8362
8443
  resultingParameterNameMatch.groups.resultingParamName !== undefined) {
8363
8444
  $taskJson.resultingParameterName = resultingParameterNameMatch.groups.resultingParamName;
8364
8445
  }
8365
- // TODO: [🥥] Maybe move this logic to `$parseAndApplyPipelineTemplateCommands`
8446
+ // TODO: [🥥] Maybe move this logic to `$parseAndApplyPipelineTaskCommands`
8366
8447
  var commands = listItems_2.map(function (listItem) { return ({
8367
8448
  listItem: listItem,
8368
8449
  command: parseCommand(listItem, 'PIPELINE_TASK'),
@@ -8377,7 +8458,7 @@ function pipelineStringToJsonSync(pipelineString) {
8377
8458
  var _loop_4 = function (listItem, command) {
8378
8459
  var commandParser = getParserForCommand(command);
8379
8460
  if (commandParser.isUsedInPipelineTask !== true /* <- Note: [🦦][4] */) {
8380
- 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: [🚞]
8461
+ 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: [🚞]
8381
8462
  }
8382
8463
  try {
8383
8464
  commandParser.$applyToTaskJson(
@@ -8388,7 +8469,7 @@ function pipelineStringToJsonSync(pipelineString) {
8388
8469
  if (!(error instanceof ParseError)) {
8389
8470
  throw error;
8390
8471
  }
8391
- 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: [🚞]
8472
+ 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: [🚞]
8392
8473
  }
8393
8474
  if (command.type === 'PARAMETER') {
8394
8475
  defineParam(command);
@@ -8409,10 +8490,10 @@ function pipelineStringToJsonSync(pipelineString) {
8409
8490
  }
8410
8491
  finally { if (e_5) throw e_5.error; }
8411
8492
  }
8412
- // TODO: [🍧] Should be done in TEMPLATE command
8493
+ // TODO: [🍧] Should be done in SECTION command
8413
8494
  if ($taskJson.taskType === 'SCRIPT_TASK') {
8414
8495
  if (!language) {
8415
- 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 "); }));
8496
+ 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 "); }));
8416
8497
  }
8417
8498
  if (!SUPPORTED_SCRIPT_LANGUAGES.includes(language)) {
8418
8499
  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 "); }));
@@ -8423,7 +8504,7 @@ function pipelineStringToJsonSync(pipelineString) {
8423
8504
  try {
8424
8505
  for (var _q = (e_6 = void 0, __values($taskJson.dependentParameterNames)), _r = _q.next(); !_r.done; _r = _q.next()) {
8425
8506
  var parameterName = _r.value;
8426
- // TODO: [🧠] This definition should be made first in the template
8507
+ // TODO: [🧠] This definition should be made first in the task
8427
8508
  defineParam({
8428
8509
  parameterName: parameterName,
8429
8510
  parameterDescription: null,
@@ -8448,7 +8529,7 @@ function pipelineStringToJsonSync(pipelineString) {
8448
8529
  (block) => `
8449
8530
  Model requirements are defined for the block type ${
8450
8531
  $taskJson.taskType
8451
- } which is not a PROMPT TEMPLATE
8532
+ } which is not a \`PROMPT\` task
8452
8533
 
8453
8534
  This should be avoided by the \`modelCommandParser\`
8454
8535
 
@@ -8467,7 +8548,7 @@ function pipelineStringToJsonSync(pipelineString) {
8467
8548
  };
8468
8549
  try {
8469
8550
  // =============================================================
8470
- // Note: 4️⃣ Process each template of the pipeline
8551
+ // Note: 4️⃣ Process each section of the pipeline
8471
8552
  for (var pipelineSections_1 = __values(pipelineSections), pipelineSections_1_1 = pipelineSections_1.next(); !pipelineSections_1_1.done; pipelineSections_1_1 = pipelineSections_1.next()) {
8472
8553
  var section = pipelineSections_1_1.value;
8473
8554
  _loop_2(section);
@@ -8484,7 +8565,7 @@ function pipelineStringToJsonSync(pipelineString) {
8484
8565
  // Note: 5️⃣ Mark parameters as INPUT if not explicitly set
8485
8566
  if ($pipelineJson.parameters.every(function (parameter) { return !parameter.isInput; })) {
8486
8567
  var _loop_3 = function (parameter) {
8487
- var isThisParameterResulting = $pipelineJson.tasks.some(function (template) { return template.resultingParameterName === parameter.name; });
8568
+ var isThisParameterResulting = $pipelineJson.tasks.some(function (task) { return task.resultingParameterName === parameter.name; });
8488
8569
  if (!isThisParameterResulting) {
8489
8570
  parameter.isInput = true;
8490
8571
  }
@@ -10565,7 +10646,7 @@ function initializeMakeCommand(program) {
10565
10646
  // TODO: [🧅] DRY command arguments
10566
10647
  makeCommand.argument('[path]',
10567
10648
  // <- TODO: [🧟‍♂️] Unite path to promptbook collection argument
10568
- 'Path to promptbook collection directory', './promptbook-collection');
10649
+ 'Path to promptbook collection directory', DEFAULT_BOOKS_DIRNAME);
10569
10650
  makeCommand.option('--project-name', "Name of the project for whom collection is", 'Untitled Promptbook project');
10570
10651
  makeCommand.option('-f, --format <format>', spaceTrim$1("\n Output format of builded collection \"javascript\", \"typescript\" or \"json\"\n\n Note: You can use multiple formats separated by comma\n "), 'javascript' /* <- Note: [🏳‍🌈] */);
10571
10652
  makeCommand.option('--no-validation', "Do not validate logic of pipelines in collection", true);
@@ -10793,8 +10874,8 @@ function addAutoGeneratedSection(content, options) {
10793
10874
  * @public exported from `@promptbook/utils`
10794
10875
  */
10795
10876
  function renderPromptbookMermaid(pipelineJson, options) {
10796
- var _a = (options || {}).linkTemplate, linkTemplate = _a === void 0 ? function () { return null; } : _a;
10797
- var parameterNameToTemplateName = function (parameterName) {
10877
+ var _a = (options || {}).linkTask, linkTask = _a === void 0 ? function () { return null; } : _a;
10878
+ var parameterNameToTaskName = function (parameterName) {
10798
10879
  var parameter = pipelineJson.parameters.find(function (parameter) { return parameter.name === parameterName; });
10799
10880
  if (!parameter) {
10800
10881
  throw new UnexpectedError("Could not find {".concat(parameterName, "}"));
@@ -10802,19 +10883,19 @@ function renderPromptbookMermaid(pipelineJson, options) {
10802
10883
  if (parameter.isInput) {
10803
10884
  return 'input';
10804
10885
  }
10805
- var template = pipelineJson.tasks.find(function (template) { return template.resultingParameterName === parameterName; });
10806
- if (!template) {
10807
- throw new Error("Could not find template for {".concat(parameterName, "}"));
10886
+ var task = pipelineJson.tasks.find(function (task) { return task.resultingParameterName === parameterName; });
10887
+ if (!task) {
10888
+ throw new Error("Could not find task for {".concat(parameterName, "}"));
10808
10889
  }
10809
- return normalizeTo_camelCase('template-' + titleToName(template.title));
10890
+ return normalizeTo_camelCase('task-' + titleToName(task.title));
10810
10891
  };
10811
10892
  var promptbookMermaid = spaceTrim(function (block) { return "\n\n %% \uD83D\uDD2E Tip: Open this on GitHub or in the VSCode website to see the Mermaid graph visually\n\n flowchart LR\n subgraph \"".concat(pipelineJson.title, "\"\n\n direction TB\n\n input((Input)):::input\n ").concat(block(pipelineJson.tasks
10812
10893
  .flatMap(function (_a) {
10813
10894
  var title = _a.title, dependentParameterNames = _a.dependentParameterNames, resultingParameterName = _a.resultingParameterName;
10814
10895
  return __spreadArray([
10815
- "".concat(parameterNameToTemplateName(resultingParameterName), "(\"").concat(title, "\")")
10896
+ "".concat(parameterNameToTaskName(resultingParameterName), "(\"").concat(title, "\")")
10816
10897
  ], __read(dependentParameterNames.map(function (dependentParameterName) {
10817
- return "".concat(parameterNameToTemplateName(dependentParameterName), "--\"{").concat(dependentParameterName, "}\"-->").concat(parameterNameToTemplateName(resultingParameterName));
10898
+ return "".concat(parameterNameToTaskName(dependentParameterName), "--\"{").concat(dependentParameterName, "}\"-->").concat(parameterNameToTaskName(resultingParameterName));
10818
10899
  })), false);
10819
10900
  })
10820
10901
  .join('\n')), "\n\n ").concat(block(pipelineJson.parameters
@@ -10824,17 +10905,17 @@ function renderPromptbookMermaid(pipelineJson, options) {
10824
10905
  })
10825
10906
  .map(function (_a) {
10826
10907
  var name = _a.name;
10827
- return "".concat(parameterNameToTemplateName(name), "--\"{").concat(name, "}\"-->output");
10908
+ return "".concat(parameterNameToTaskName(name), "--\"{").concat(name, "}\"-->output");
10828
10909
  })
10829
10910
  .join('\n')), "\n output((Output)):::output\n\n ").concat(block(pipelineJson.tasks
10830
- .map(function (template) {
10831
- var link = linkTemplate(template);
10911
+ .map(function (task) {
10912
+ var link = linkTask(task);
10832
10913
  if (link === null) {
10833
10914
  return '';
10834
10915
  }
10835
10916
  var href = link.href, title = link.title;
10836
- var templateName = parameterNameToTemplateName(template.resultingParameterName);
10837
- return "click ".concat(templateName, " href \"").concat(href, "\" \"").concat(title, "\";");
10917
+ var taskName = parameterNameToTaskName(task.resultingParameterName);
10918
+ return "click ".concat(taskName, " href \"").concat(href, "\" \"").concat(title, "\";");
10838
10919
  })
10839
10920
  .filter(function (line) { return line !== ''; })
10840
10921
  .join('\n')), "\n\n classDef input color: grey;\n classDef output color: grey;\n\n end;\n\n "); });
@@ -10865,7 +10946,7 @@ function prettifyPipelineString(pipelineString, options) {
10865
10946
  case 1:
10866
10947
  pipelineJson = _a.sent();
10867
10948
  promptbookMermaid_1 = renderPromptbookMermaid(pipelineJson, {
10868
- linkTemplate: function (task) {
10949
+ linkTask: function (task) {
10869
10950
  return { href: "#".concat(task.name), title: task.title };
10870
10951
  },
10871
10952
  });
@@ -11208,7 +11289,7 @@ function executionReportJsonToString(executionReportJson, options) {
11208
11289
  if (/^\s*\p{Extended_Pictographic}/u.test(promptExecution.prompt.title)) {
11209
11290
  hash = '-' + hash;
11210
11291
  }
11211
- // TODO: Make working hash link for the template in md + pdf
11292
+ // TODO: Make working hash link for the task in md + pdf
11212
11293
  return "- [".concat(promptExecution.prompt.title, "](#").concat(hash, ")");
11213
11294
  })
11214
11295
  .join('\n');
@@ -11217,7 +11298,7 @@ function executionReportJsonToString(executionReportJson, options) {
11217
11298
  '## ⌚ Time chart' +
11218
11299
  '\n\n' +
11219
11300
  createMarkdownChart({
11220
- nameHeader: 'Template',
11301
+ nameHeader: 'Task',
11221
11302
  valueHeader: 'Timeline',
11222
11303
  items: timingItems,
11223
11304
  width: chartsWidth,
@@ -11228,7 +11309,7 @@ function executionReportJsonToString(executionReportJson, options) {
11228
11309
  '## 💸 Cost chart' +
11229
11310
  '\n\n' +
11230
11311
  createMarkdownChart({
11231
- nameHeader: 'Template',
11312
+ nameHeader: 'Task',
11232
11313
  valueHeader: 'Cost',
11233
11314
  items: costItems,
11234
11315
  width: chartsWidth,
@@ -11527,7 +11608,7 @@ function initializeRunCommand(program) {
11527
11608
  return [4 /*yield*/, prompts(questions)];
11528
11609
  case 16:
11529
11610
  response = _m.sent();
11530
- // <- TODO: [🧠] Change behavior according to the formfactor
11611
+ // <- TODO: [🧠][🍼] Change behavior according to the formfactor
11531
11612
  inputParameters = __assign(__assign({}, inputParameters), response);
11532
11613
  // TODO: Maybe do some validation of the response (and --json argument which is passed)
11533
11614
  if (isVerbose) {