@promptbook/cli 0.74.0-8 → 0.74.0

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 (37) hide show
  1. package/README.md +5 -17
  2. package/bin/promptbook-cli.js +8 -4
  3. package/esm/index.es.js +173 -96
  4. package/esm/index.es.js.map +1 -1
  5. package/esm/typings/src/_packages/core.index.d.ts +5 -1
  6. package/esm/typings/src/_packages/utils.index.d.ts +4 -0
  7. package/esm/typings/src/cli/cli-commands/run.d.ts +1 -1
  8. package/esm/typings/src/cli/main.d.ts +4 -1
  9. package/esm/typings/src/cli/promptbookCli.d.ts +1 -1
  10. package/esm/typings/src/cli/test/ptbk.d.ts +1 -1
  11. package/esm/typings/src/collection/collectionToJson.test.d.ts +1 -1
  12. package/esm/typings/src/collection/constructors/createCollectionFromDirectory.d.ts +1 -1
  13. package/esm/typings/src/commands/BOOK_VERSION/BookVersionCommand.d.ts +1 -1
  14. package/esm/typings/src/commands/FOREACH/foreachCommandParser.d.ts +2 -2
  15. package/esm/typings/src/commands/_BOILERPLATE/boilerplateCommandParser.d.ts +1 -1
  16. package/esm/typings/src/config.d.ts +6 -0
  17. package/esm/typings/src/conversion/pipelineJsonToString.d.ts +3 -3
  18. package/esm/typings/src/conversion/pipelineStringToJson.d.ts +2 -2
  19. package/esm/typings/src/conversion/pipelineStringToJsonSync.d.ts +2 -2
  20. package/esm/typings/src/conversion/utils/stringifyPipelineJson.d.ts +1 -1
  21. package/esm/typings/src/conversion/validation/_importPipeline.d.ts +7 -7
  22. package/esm/typings/src/formats/_common/FormatDefinition.d.ts +1 -1
  23. package/esm/typings/src/formats/_common/FormatSubvalueDefinition.d.ts +1 -1
  24. package/esm/typings/src/storage/blackhole/BlackholeStorage.d.ts +33 -0
  25. package/esm/typings/src/storage/memory/MemoryStorage.d.ts +1 -1
  26. package/esm/typings/src/storage/{memory/utils → utils}/PrefixStorage.d.ts +1 -1
  27. package/esm/typings/src/types/PipelineJson/PipelineJson.d.ts +6 -4
  28. package/esm/typings/src/types/PipelineJson/PreparationJson.d.ts +1 -1
  29. package/esm/typings/src/types/Prompt.d.ts +1 -1
  30. package/esm/typings/src/types/typeAliases.d.ts +2 -2
  31. package/esm/typings/src/utils/expectation-counters/config.d.ts +12 -0
  32. package/esm/typings/src/utils/expectation-counters/countLines.d.ts +2 -0
  33. package/esm/typings/src/utils/expectation-counters/countPages.d.ts +2 -0
  34. package/package.json +1 -1
  35. package/umd/index.umd.js +173 -96
  36. package/umd/index.umd.js.map +1 -1
  37. /package/esm/typings/src/storage/{memory → local-storage}/utils/makePromptbookStorageFromWebStorage.d.ts +0 -0
package/umd/index.umd.js CHANGED
@@ -49,7 +49,7 @@
49
49
  *
50
50
  * @see https://github.com/webgptorg/promptbook
51
51
  */
52
- var PROMPTBOOK_ENGINE_VERSION = '0.74.0-7';
52
+ var PROMPTBOOK_ENGINE_VERSION = '0.74.0-13';
53
53
  /**
54
54
  * TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
55
55
  */
@@ -401,6 +401,12 @@
401
401
  */
402
402
  var CLAIM = "Build responsible, controlled and transparent applications on top of LLM models!";
403
403
  // <- TODO: [🐊] Pick the best claim
404
+ /**
405
+ * When the title is not provided, the default title is used
406
+ *
407
+ * @public exported from `@promptbook/core`
408
+ */
409
+ var DEFAULT_TITLE = "Untitled";
404
410
  /**
405
411
  * Warning message for the generated sections and files files
406
412
  *
@@ -722,13 +728,13 @@
722
728
  /**
723
729
  * Converts promptbook in JSON format to string format
724
730
  *
725
- * @param pipelineJson Promptbook in JSON format (.ptbk.json)
726
- * @returns Promptbook in string format (.ptbk.md)
731
+ * @param pipelineJson Promptbook in JSON format (.book.json)
732
+ * @returns Promptbook in string format (.book.md)
727
733
  * @public exported from `@promptbook/core`
728
734
  */
729
735
  function pipelineJsonToString(pipelineJson) {
730
736
  var e_1, _a, e_2, _b, e_3, _c, e_4, _d, e_5, _e, e_6, _f;
731
- var title = pipelineJson.title, pipelineUrl = pipelineJson.pipelineUrl, promptbookVersion = pipelineJson.promptbookVersion, description = pipelineJson.description, parameters = pipelineJson.parameters, templates = pipelineJson.templates;
737
+ var title = pipelineJson.title, pipelineUrl = pipelineJson.pipelineUrl, bookVersion = pipelineJson.bookVersion, description = pipelineJson.description, parameters = pipelineJson.parameters, templates = pipelineJson.templates;
732
738
  var pipelineString = "# ".concat(title);
733
739
  if (description) {
734
740
  pipelineString += '\n\n';
@@ -738,8 +744,10 @@
738
744
  if (pipelineUrl) {
739
745
  commands.push("PIPELINE URL ".concat(pipelineUrl));
740
746
  }
741
- commands.push("PROMPTBOOK VERSION ".concat(promptbookVersion));
742
- // TODO: [main] !!! This increase size of the bundle and is probbably not necessary
747
+ if (bookVersion !== "undefined") {
748
+ commands.push("BOOK VERSION ".concat(bookVersion));
749
+ }
750
+ // TODO: [main] !!!!! This increases size of the bundle and is probbably not necessary
743
751
  pipelineString = prettifyMarkdown(pipelineString);
744
752
  try {
745
753
  for (var _g = __values(parameters.filter(function (_a) {
@@ -919,7 +927,7 @@
919
927
  * TODO: [🧠] Is there a way to auto-detect missing features in pipelineJsonToString
920
928
  * TODO: [🏛] Maybe make some markdown builder
921
929
  * TODO: [🏛] Escape all
922
- * TODO: [🧠] Should be in generated .ptbk.md file GENERATOR_WARNING
930
+ * TODO: [🧠] Should be in generated .book.md file GENERATOR_WARNING
923
931
  */
924
932
 
925
933
  /**
@@ -1557,7 +1565,7 @@
1557
1565
  * TODO: [👷‍♂️] @@@ Manual about construction of llmTools
1558
1566
  */
1559
1567
 
1560
- var PipelineCollection = [{title:"Prepare Knowledge from Markdown",pipelineUrl:"https://promptbook.studio/promptbook/prepare-knowledge-from-markdown.ptbk.md",parameters:[{name:"knowledgeContent",description:"Markdown document content",isInput:true,isOutput:false},{name:"knowledgePieces",description:"The knowledge JSON object",isInput:false,isOutput:true}],templates:[{templateType:"PROMPT_TEMPLATE",name:"knowledge",title:"Knowledge",content:"You are experienced data researcher, extract the important knowledge from the document.\n\n# Rules\n\n- Make pieces of information concise, clear, and easy to understand\n- One piece of information should be approximately 1 paragraph\n- Divide the paragraphs by markdown horizontal lines ---\n- Omit irrelevant information\n- Group redundant information\n- Write just extracted information, nothing else\n\n# The document\n\nTake information from this document:\n\n> {knowledgeContent}",resultingParameterName:"knowledgePieces",dependentParameterNames:["knowledgeContent"]}],knowledgeSources:[],knowledgePieces:[],personas:[],preparations:[],sourceFile:"./promptbook-collection/prepare-knowledge-from-markdown.ptbk.md"},{title:"Prepare Keywords",pipelineUrl:"https://promptbook.studio/promptbook/prepare-knowledge-keywords.ptbk.md",parameters:[{name:"knowledgePieceContent",description:"The content",isInput:true,isOutput:false},{name:"keywords",description:"Keywords separated by comma",isInput:false,isOutput:true}],templates:[{templateType:"PROMPT_TEMPLATE",name:"knowledge",title:"Knowledge",content:"You are experienced data researcher, detect the important keywords in the document.\n\n# Rules\n\n- Write just keywords separated by comma\n\n# The document\n\nTake information from this document:\n\n> {knowledgePieceContent}",resultingParameterName:"keywords",dependentParameterNames:["knowledgePieceContent"]}],knowledgeSources:[],knowledgePieces:[],personas:[],preparations:[],sourceFile:"./promptbook-collection/prepare-knowledge-keywords.ptbk.md"},{title:"Prepare Title",pipelineUrl:"https://promptbook.studio/promptbook/prepare-knowledge-title.ptbk.md",parameters:[{name:"knowledgePieceContent",description:"The content",isInput:true,isOutput:false},{name:"title",description:"The title of the document",isInput:false,isOutput:true}],templates:[{templateType:"PROMPT_TEMPLATE",name:"knowledge",title:"Knowledge",content:"You are experienced content creator, write best title for the document.\n\n# Rules\n\n- Write just title, nothing else\n- Title should be concise and clear\n- Write maximum 5 words for the title\n\n# The document\n\n> {knowledgePieceContent}",resultingParameterName:"title",expectations:{words:{min:1,max:8}},dependentParameterNames:["knowledgePieceContent"]}],knowledgeSources:[],knowledgePieces:[],personas:[],preparations:[],sourceFile:"./promptbook-collection/prepare-knowledge-title.ptbk.md"},{title:"Prepare Keywords",pipelineUrl:"https://promptbook.studio/promptbook/prepare-persona.ptbk.md",parameters:[{name:"availableModelNames",description:"List of available model names separated by comma (,)",isInput:true,isOutput:false},{name:"personaDescription",description:"Description of the persona",isInput:true,isOutput:false},{name:"modelRequirements",description:"Specific requirements for the model",isInput:false,isOutput:true}],templates:[{templateType:"PROMPT_TEMPLATE",name:"make-model-requirements",title:"Make modelRequirements",content:"You are experienced AI engineer, you need to create virtual assistant.\nWrite\n\n## Example\n\n```json\n{\n\"modelName\": \"gpt-4o\",\n\"systemMessage\": \"You are experienced AI engineer and helpfull assistant.\",\n\"temperature\": 0.7\n}\n```\n\n## Instructions\n\n- Your output format is JSON object\n- Write just the JSON object, no other text should be present\n- It contains the following keys:\n - `modelName`: The name of the model to use\n - `systemMessage`: The system message to provide context to the model\n - `temperature`: The sampling temperature to use\n\n### Key `modelName`\n\nPick from the following models:\n\n- {availableModelNames}\n\n### Key `systemMessage`\n\nThe system message is used to communicate instructions or provide context to the model at the beginning of a conversation. It is displayed in a different format compared to user messages, helping the model understand its role in the conversation. The system message typically guides the model's behavior, sets the tone, or specifies desired output from the model. By utilizing the system message effectively, users can steer the model towards generating more accurate and relevant responses.\n\nFor example:\n\n> You are an experienced AI engineer and helpful assistant.\n\n> You are a friendly and knowledgeable chatbot.\n\n### Key `temperature`\n\nThe sampling temperature, between 0 and 1. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic. If set to 0, the model will use log probability to automatically increase the temperature until certain thresholds are hit.\n\nYou can pick a value between 0 and 2. For example:\n\n- `0.1`: Low temperature, extremely conservative and deterministic\n- `0.5`: Medium temperature, balanced between conservative and creative\n- `1.0`: High temperature, creative and bit random\n- `1.5`: Very high temperature, extremely creative and often chaotic and unpredictable\n- `2.0`: Maximum temperature, completely random and unpredictable, for some extreme creative use cases\n\n# The assistant\n\nTake this description of the persona:\n\n> {personaDescription}",resultingParameterName:"modelRequirements",format:"JSON",dependentParameterNames:["availableModelNames","personaDescription"]}],knowledgeSources:[],knowledgePieces:[],personas:[],preparations:[],sourceFile:"./promptbook-collection/prepare-persona.ptbk.md"}];
1568
+ var PipelineCollection = [{title:"Prepare Knowledge from Markdown",pipelineUrl:"https://promptbook.studio/promptbook/prepare-knowledge-from-markdown.book.md",parameters:[{name:"knowledgeContent",description:"Markdown document content",isInput:true,isOutput:false},{name:"knowledgePieces",description:"The knowledge JSON object",isInput:false,isOutput:true}],templates:[{templateType:"PROMPT_TEMPLATE",name:"knowledge",title:"Knowledge",content:"You are experienced data researcher, extract the important knowledge from the document.\n\n# Rules\n\n- Make pieces of information concise, clear, and easy to understand\n- One piece of information should be approximately 1 paragraph\n- Divide the paragraphs by markdown horizontal lines ---\n- Omit irrelevant information\n- Group redundant information\n- Write just extracted information, nothing else\n\n# The document\n\nTake information from this document:\n\n> {knowledgeContent}",resultingParameterName:"knowledgePieces",dependentParameterNames:["knowledgeContent"]}],knowledgeSources:[],knowledgePieces:[],personas:[],preparations:[],sourceFile:"./promptbook-collection/prepare-knowledge-from-markdown.book.md"},{title:"Prepare Keywords",pipelineUrl:"https://promptbook.studio/promptbook/prepare-knowledge-keywords.book.md",parameters:[{name:"knowledgePieceContent",description:"The content",isInput:true,isOutput:false},{name:"keywords",description:"Keywords separated by comma",isInput:false,isOutput:true}],templates:[{templateType:"PROMPT_TEMPLATE",name:"knowledge",title:"Knowledge",content:"You are experienced data researcher, detect the important keywords in the document.\n\n# Rules\n\n- Write just keywords separated by comma\n\n# The document\n\nTake information from this document:\n\n> {knowledgePieceContent}",resultingParameterName:"keywords",dependentParameterNames:["knowledgePieceContent"]}],knowledgeSources:[],knowledgePieces:[],personas:[],preparations:[],sourceFile:"./promptbook-collection/prepare-knowledge-keywords.book.md"},{title:"Prepare Title",pipelineUrl:"https://promptbook.studio/promptbook/prepare-knowledge-title.book.md",parameters:[{name:"knowledgePieceContent",description:"The content",isInput:true,isOutput:false},{name:"title",description:"The title of the document",isInput:false,isOutput:true}],templates:[{templateType:"PROMPT_TEMPLATE",name:"knowledge",title:"Knowledge",content:"You are experienced content creator, write best title for the document.\n\n# Rules\n\n- Write just title, nothing else\n- Title should be concise and clear\n- Write maximum 5 words for the title\n\n# The document\n\n> {knowledgePieceContent}",resultingParameterName:"title",expectations:{words:{min:1,max:8}},dependentParameterNames:["knowledgePieceContent"]}],knowledgeSources:[],knowledgePieces:[],personas:[],preparations:[],sourceFile:"./promptbook-collection/prepare-knowledge-title.book.md"},{title:"Prepare Keywords",pipelineUrl:"https://promptbook.studio/promptbook/prepare-persona.book.md",parameters:[{name:"availableModelNames",description:"List of available model names separated by comma (,)",isInput:true,isOutput:false},{name:"personaDescription",description:"Description of the persona",isInput:true,isOutput:false},{name:"modelRequirements",description:"Specific requirements for the model",isInput:false,isOutput:true}],templates:[{templateType:"PROMPT_TEMPLATE",name:"make-model-requirements",title:"Make modelRequirements",content:"You are experienced AI engineer, you need to create virtual assistant.\nWrite\n\n## Example\n\n```json\n{\n\"modelName\": \"gpt-4o\",\n\"systemMessage\": \"You are experienced AI engineer and helpfull assistant.\",\n\"temperature\": 0.7\n}\n```\n\n## Instructions\n\n- Your output format is JSON object\n- Write just the JSON object, no other text should be present\n- It contains the following keys:\n - `modelName`: The name of the model to use\n - `systemMessage`: The system message to provide context to the model\n - `temperature`: The sampling temperature to use\n\n### Key `modelName`\n\nPick from the following models:\n\n- {availableModelNames}\n\n### Key `systemMessage`\n\nThe system message is used to communicate instructions or provide context to the model at the beginning of a conversation. It is displayed in a different format compared to user messages, helping the model understand its role in the conversation. The system message typically guides the model's behavior, sets the tone, or specifies desired output from the model. By utilizing the system message effectively, users can steer the model towards generating more accurate and relevant responses.\n\nFor example:\n\n> You are an experienced AI engineer and helpful assistant.\n\n> You are a friendly and knowledgeable chatbot.\n\n### Key `temperature`\n\nThe sampling temperature, between 0 and 1. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic. If set to 0, the model will use log probability to automatically increase the temperature until certain thresholds are hit.\n\nYou can pick a value between 0 and 2. For example:\n\n- `0.1`: Low temperature, extremely conservative and deterministic\n- `0.5`: Medium temperature, balanced between conservative and creative\n- `1.0`: High temperature, creative and bit random\n- `1.5`: Very high temperature, extremely creative and often chaotic and unpredictable\n- `2.0`: Maximum temperature, completely random and unpredictable, for some extreme creative use cases\n\n# The assistant\n\nTake this description of the persona:\n\n> {personaDescription}",resultingParameterName:"modelRequirements",format:"JSON",dependentParameterNames:["availableModelNames","personaDescription"]}],knowledgeSources:[],knowledgePieces:[],personas:[],preparations:[],sourceFile:"./promptbook-collection/prepare-persona.book.md"}];
1561
1569
 
1562
1570
  /**
1563
1571
  * This error indicates that the promptbook in a markdown format cannot be parsed into a valid promptbook object
@@ -1732,7 +1740,7 @@
1732
1740
  if (!url.startsWith('https://')) {
1733
1741
  return false;
1734
1742
  }
1735
- if (!(url.endsWith('.book.md') || url.endsWith('.book') || url.endsWith('.ptbk.md') || url.endsWith('.ptbk'))) {
1743
+ if (!(url.endsWith('.book.md') || url.endsWith('.book') || url.endsWith('.book.md') || url.endsWith('.ptbk'))) {
1736
1744
  return false;
1737
1745
  }
1738
1746
  if (url.includes('#')) {
@@ -1801,9 +1809,9 @@
1801
1809
  // <- Note: [🚲]
1802
1810
  throw new PipelineLogicError(spaceTrim.spaceTrim(function (block) { return "\n Invalid promptbook URL \"".concat(pipeline.pipelineUrl, "\"\n\n ").concat(block(pipelineIdentification), "\n "); }));
1803
1811
  }
1804
- if (pipeline.promptbookVersion !== undefined && !isValidPromptbookVersion(pipeline.promptbookVersion)) {
1812
+ if (pipeline.bookVersion !== undefined && !isValidPromptbookVersion(pipeline.bookVersion)) {
1805
1813
  // <- Note: [🚲]
1806
- throw new PipelineLogicError(spaceTrim.spaceTrim(function (block) { return "\n Invalid Promptbook Version \"".concat(pipeline.promptbookVersion, "\"\n\n ").concat(block(pipelineIdentification), "\n "); }));
1814
+ throw new PipelineLogicError(spaceTrim.spaceTrim(function (block) { return "\n Invalid Promptbook Version \"".concat(pipeline.bookVersion, "\"\n\n ").concat(block(pipelineIdentification), "\n "); }));
1807
1815
  }
1808
1816
  // TODO: [🧠] Maybe do here some propper JSON-schema / ZOD checking
1809
1817
  if (!Array.isArray(pipeline.parameters)) {
@@ -3193,30 +3201,42 @@
3193
3201
  return text.length;
3194
3202
  }
3195
3203
 
3204
+ /**
3205
+ * Number of characters per standard line with 11pt Arial font size.
3206
+ *
3207
+ * @public exported from `@promptbook/utils`
3208
+ */
3209
+ var CHARACTERS_PER_STANDARD_LINE = 63;
3210
+ /**
3211
+ * Number of lines per standard A4 page with 11pt Arial font size and standard margins and spacing.
3212
+ *
3213
+ * @public exported from `@promptbook/utils`
3214
+ */
3215
+ var LINES_PER_STANDARD_PAGE = 44;
3216
+
3196
3217
  /**
3197
3218
  * Counts number of lines in the text
3198
3219
  *
3220
+ * Note: This does not check only for the presence of newlines, but also for the length of the standard line.
3221
+ *
3199
3222
  * @public exported from `@promptbook/utils`
3200
3223
  */
3201
3224
  function countLines(text) {
3202
- if (text === '') {
3203
- return 0;
3204
- }
3205
- return text.split('\n').length;
3225
+ text = text.replace('\r\n', '\n');
3226
+ text = text.replace('\r', '\n');
3227
+ var lines = text.split('\n');
3228
+ return lines.reduce(function (count, line) { return count + Math.ceil(line.length / CHARACTERS_PER_STANDARD_LINE); }, 0);
3206
3229
  }
3207
3230
 
3208
3231
  /**
3209
3232
  * Counts number of pages in the text
3210
3233
  *
3234
+ * Note: This does not check only for the count of newlines, but also for the length of the standard line and length of the standard page.
3235
+ *
3211
3236
  * @public exported from `@promptbook/utils`
3212
3237
  */
3213
3238
  function countPages(text) {
3214
- if (text === '') {
3215
- return 0;
3216
- }
3217
- var pagesByLinesCount = Math.ceil(countLines(text) / 44);
3218
- var pagesByCharactersCount = Math.ceil(countCharacters(text) / 2772);
3219
- return Math.max(pagesByLinesCount, pagesByCharactersCount);
3239
+ return Math.ceil(countLines(text) / LINES_PER_STANDARD_PAGE);
3220
3240
  }
3221
3241
 
3222
3242
  /**
@@ -3757,7 +3777,7 @@
3757
3777
  promptTitle: template.title,
3758
3778
  promptMessage: replaceParameters(template.description || '', parameters),
3759
3779
  defaultValue: replaceParameters(preparedContent, parameters),
3760
- // TODO: [🧠] !! Figure out how to define placeholder in .ptbk.md file
3780
+ // TODO: [🧠] !! Figure out how to define placeholder in .book.md file
3761
3781
  placeholder: undefined,
3762
3782
  priority: priority,
3763
3783
  }))];
@@ -4323,7 +4343,7 @@
4323
4343
  pipelineUrl: preparedPipeline.pipelineUrl,
4324
4344
  title: preparedPipeline.title,
4325
4345
  promptbookUsedVersion: PROMPTBOOK_ENGINE_VERSION,
4326
- promptbookRequestedVersion: preparedPipeline.promptbookVersion,
4346
+ promptbookRequestedVersion: preparedPipeline.bookVersion,
4327
4347
  description: preparedPipeline.description,
4328
4348
  promptExecutions: [],
4329
4349
  };
@@ -4672,7 +4692,7 @@
4672
4692
  collection = createCollectionFromJson.apply(void 0, __spreadArray([], __read(PipelineCollection), false));
4673
4693
  _b = createPipelineExecutor;
4674
4694
  _c = {};
4675
- return [4 /*yield*/, collection.getPipelineByUrl('https://promptbook.studio/promptbook/prepare-persona.ptbk.md')];
4695
+ return [4 /*yield*/, collection.getPipelineByUrl('https://promptbook.studio/promptbook/prepare-persona.book.md')];
4676
4696
  case 1:
4677
4697
  preparePersonaExecutor = _b.apply(void 0, [(_c.pipeline = _d.sent(),
4678
4698
  _c.tools = tools,
@@ -5429,12 +5449,12 @@
5429
5449
  */
5430
5450
  function clonePipeline(pipeline) {
5431
5451
  // Note: Not using spread operator (...) because @@@
5432
- var pipelineUrl = pipeline.pipelineUrl, sourceFile = pipeline.sourceFile, title = pipeline.title, promptbookVersion = pipeline.promptbookVersion, description = pipeline.description, parameters = pipeline.parameters, templates = pipeline.templates, knowledgeSources = pipeline.knowledgeSources, knowledgePieces = pipeline.knowledgePieces, personas = pipeline.personas, preparations = pipeline.preparations;
5452
+ var pipelineUrl = pipeline.pipelineUrl, sourceFile = pipeline.sourceFile, title = pipeline.title, bookVersion = pipeline.bookVersion, description = pipeline.description, parameters = pipeline.parameters, templates = pipeline.templates, knowledgeSources = pipeline.knowledgeSources, knowledgePieces = pipeline.knowledgePieces, personas = pipeline.personas, preparations = pipeline.preparations;
5433
5453
  return {
5434
5454
  pipelineUrl: pipelineUrl,
5435
5455
  sourceFile: sourceFile,
5436
5456
  title: title,
5437
- promptbookVersion: promptbookVersion,
5457
+ bookVersion: bookVersion,
5438
5458
  description: description,
5439
5459
  parameters: parameters,
5440
5460
  templates: templates,
@@ -5646,7 +5666,7 @@
5646
5666
  throw new ParseError("Source not valid");
5647
5667
  }
5648
5668
  if (sourceContent.startsWith('../') || sourceContent.startsWith('/') || /^[A-Z]:[\\/]+/i.test(sourceContent)) {
5649
- throw new ParseError("Source cannot be outside of the .ptbk.md folder");
5669
+ throw new ParseError("Source cannot be outside of the .book.md folder");
5650
5670
  }
5651
5671
  return {
5652
5672
  type: 'KNOWLEDGE',
@@ -6296,7 +6316,7 @@
6296
6316
  /**
6297
6317
  * Parses the foreach command
6298
6318
  *
6299
- * Note: @@@ This command is used as foreach for new commands - it should NOT be used in any `.ptbk.md` file
6319
+ * Note: @@@ This command is used as foreach for new commands - it should NOT be used in any `.book.md` file
6300
6320
  *
6301
6321
  * @see `documentationUrl` for more details
6302
6322
  * @private within the commands folder
@@ -6446,7 +6466,7 @@
6446
6466
  },
6447
6467
  };
6448
6468
  /**
6449
- * TODO: [🍭] Make .ptbk.md file with examples of the FOREACH with wrong parsing and logic
6469
+ * TODO: [🍭] Make .book.md file with examples of the FOREACH with wrong parsing and logic
6450
6470
  */
6451
6471
 
6452
6472
  /**
@@ -7080,7 +7100,7 @@
7080
7100
  /**
7081
7101
  * Description of the BOOK_VERSION command
7082
7102
  */
7083
- description: "Which version of the Book language is the .ptbk.md using",
7103
+ description: "Which version of the Book language is the .book.md using",
7084
7104
  /**
7085
7105
  * Link to documentation
7086
7106
  */
@@ -7094,19 +7114,19 @@
7094
7114
  */
7095
7115
  parse: function (input) {
7096
7116
  var args = input.args;
7097
- var promptbookVersion = args.pop();
7098
- if (promptbookVersion === undefined) {
7117
+ var bookVersion = args.pop();
7118
+ if (bookVersion === undefined) {
7099
7119
  throw new ParseError("Version is required");
7100
7120
  }
7101
- if (!isValidPromptbookVersion(promptbookVersion)) {
7102
- throw new ParseError("Invalid Promptbook version \"".concat(promptbookVersion, "\""));
7121
+ if (!isValidPromptbookVersion(bookVersion)) {
7122
+ throw new ParseError("Invalid Promptbook version \"".concat(bookVersion, "\""));
7103
7123
  }
7104
7124
  if (args.length > 0 && !(((args.length === 1 && args[0]) || '').toUpperCase() === 'VERSION')) {
7105
7125
  throw new ParseError("Can not have more than one Promptbook version");
7106
7126
  }
7107
7127
  return {
7108
7128
  type: 'BOOK_VERSION',
7109
- promptbookVersion: promptbookVersion,
7129
+ bookVersion: bookVersion,
7110
7130
  };
7111
7131
  },
7112
7132
  /**
@@ -7116,7 +7136,7 @@
7116
7136
  */
7117
7137
  $applyToPipelineJson: function (command, $pipelineJson) {
7118
7138
  // TODO: Warn if the version is overridden
7119
- $pipelineJson.promptbookVersion = command.promptbookVersion;
7139
+ $pipelineJson.bookVersion = command.bookVersion;
7120
7140
  },
7121
7141
  /**
7122
7142
  * Converts the BOOK_VERSION command back to string
@@ -7169,9 +7189,9 @@
7169
7189
  * Example usages of the URL command
7170
7190
  */
7171
7191
  examples: [
7172
- 'PIPELINE URL https://promptbook.studio/library/write-cv.ptbk.md',
7173
- 'URL https://promptbook.studio/library/write-cv.ptbk.md',
7174
- 'https://promptbook.studio/library/write-cv.ptbk.md',
7192
+ 'PIPELINE URL https://promptbook.studio/library/write-cv.book.md',
7193
+ 'URL https://promptbook.studio/library/write-cv.book.md',
7194
+ 'https://promptbook.studio/library/write-cv.book.md',
7175
7195
  ],
7176
7196
  /**
7177
7197
  * Parses the URL command
@@ -7372,7 +7392,7 @@
7372
7392
  /**
7373
7393
  * Parses the boilerplate command
7374
7394
  *
7375
- * Note: @@@ This command is used as boilerplate for new commands - it should NOT be used in any `.ptbk.md` file
7395
+ * Note: @@@ This command is used as boilerplate for new commands - it should NOT be used in any `.book.md` file
7376
7396
  *
7377
7397
  * @see `documentationUrl` for more details
7378
7398
  * @private within the commands folder
@@ -7426,7 +7446,7 @@
7426
7446
  * Note: `$` is used to indicate that this function mutates given `pipelineJson`
7427
7447
  */
7428
7448
  $applyToPipelineJson: function (command, $pipelineJson) {
7429
- throw new ParseError("BOILERPLATE command is only for testing purposes and should not be used in the .ptbk.md file");
7449
+ throw new ParseError("BOILERPLATE command is only for testing purposes and should not be used in the .book.md file");
7430
7450
  },
7431
7451
  /**
7432
7452
  * Apply the BOILERPLATE command to the `pipelineJson`
@@ -7434,7 +7454,7 @@
7434
7454
  * Note: `$` is used to indicate that this function mutates given `templateJson`
7435
7455
  */
7436
7456
  $applyToTemplateJson: function (command, $templateJson, $pipelineJson) {
7437
- throw new ParseError("BOILERPLATE command is only for testing purposes and should not be used in the .ptbk.md file");
7457
+ throw new ParseError("BOILERPLATE command is only for testing purposes and should not be used in the .book.md file");
7438
7458
  },
7439
7459
  /**
7440
7460
  * Converts the BOILERPLATE command back to string
@@ -7450,7 +7470,7 @@
7450
7470
  * Note: This is used in `pipelineJsonToString` utility
7451
7471
  */
7452
7472
  takeFromPipelineJson: function (pipelineJson) {
7453
- throw new ParseError("BOILERPLATE command is only for testing purposes and should not be used in the .ptbk.md file");
7473
+ throw new ParseError("BOILERPLATE command is only for testing purposes and should not be used in the .book.md file");
7454
7474
  },
7455
7475
  /**
7456
7476
  * Reads the BOILERPLATE command from the `TemplateJson`
@@ -7458,7 +7478,7 @@
7458
7478
  * Note: This is used in `pipelineJsonToString` utility
7459
7479
  */
7460
7480
  takeFromTemplateJson: function ($templateJson) {
7461
- throw new ParseError("BOILERPLATE command is only for testing purposes and should not be used in the .ptbk.md file");
7481
+ throw new ParseError("BOILERPLATE command is only for testing purposes and should not be used in the .book.md file");
7462
7482
  },
7463
7483
  };
7464
7484
 
@@ -7787,7 +7807,7 @@
7787
7807
  return;
7788
7808
  }
7789
7809
  if (!section.startsWith('#')) {
7790
- section = "# Untitled\n\n".concat(section);
7810
+ section = "# ".concat(DEFAULT_TITLE, "\n\n").concat(section);
7791
7811
  }
7792
7812
  sections.push(section);
7793
7813
  buffer = [];
@@ -7851,7 +7871,7 @@
7851
7871
  var e_1, _a;
7852
7872
  var sections = splitMarkdownIntoSections(markdown);
7853
7873
  if (sections.length === 0) {
7854
- return '# Untitled';
7874
+ return "# ".concat(DEFAULT_TITLE);
7855
7875
  }
7856
7876
  var flattenedMarkdown = '';
7857
7877
  var parsedSections = sections.map(parseMarkdownSection);
@@ -7862,7 +7882,7 @@
7862
7882
  }
7863
7883
  else {
7864
7884
  parsedSections.unshift(firstSection);
7865
- flattenedMarkdown += "# Untitled" + "\n\n"; // <- [🧠] Maybe 3 new lines?
7885
+ flattenedMarkdown += "# ".concat(DEFAULT_TITLE) + "\n\n"; // <- [🧠] Maybe 3 new lines?
7866
7886
  }
7867
7887
  try {
7868
7888
  for (var parsedSections_1 = __values(parsedSections), parsedSections_1_1 = parsedSections_1.next(); !parsedSections_1_1.done; parsedSections_1_1 = parsedSections_1.next()) {
@@ -7934,8 +7954,8 @@
7934
7954
  * Note: This function does not validate logic of the pipeline only the parsing
7935
7955
  * Note: This function acts as compilation process
7936
7956
  *
7937
- * @param pipelineString {Promptbook} in string markdown format (.ptbk.md)
7938
- * @returns {Promptbook} compiled in JSON format (.ptbk.json)
7957
+ * @param pipelineString {Promptbook} in string markdown format (.book.md)
7958
+ * @returns {Promptbook} compiled in JSON format (.book.json)
7939
7959
  * @throws {ParseError} if the promptbook string is not valid
7940
7960
  * @public exported from `@promptbook/core`
7941
7961
  */
@@ -7944,7 +7964,7 @@
7944
7964
  var $pipelineJson = {
7945
7965
  title: undefined /* <- Note: [🍙] Putting here placeholder to keep `title` on top at final JSON */,
7946
7966
  pipelineUrl: undefined /* <- Note: Putting here placeholder to keep `pipelineUrl` on top at final JSON */,
7947
- promptbookVersion: undefined /* <- Note: By default no explicit version */,
7967
+ bookVersion: undefined /* <- Note: By default no explicit version */,
7948
7968
  description: undefined /* <- Note: [🍙] Putting here placeholder to keep `description` on top at final JSON */,
7949
7969
  parameters: [],
7950
7970
  templates: [],
@@ -8327,10 +8347,10 @@
8327
8347
  * Note: This function does not validate logic of the pipeline only the parsing
8328
8348
  * Note: This function acts as compilation process
8329
8349
  *
8330
- * @param pipelineString {Promptbook} in string markdown format (.ptbk.md)
8350
+ * @param pipelineString {Promptbook} in string markdown format (.book.md)
8331
8351
  * @param tools - Tools for the preparation and scraping - if not provided together with `llm`, the preparation will be skipped
8332
8352
  * @param options - Options and tools for the compilation
8333
- * @returns {Promptbook} compiled in JSON format (.ptbk.json)
8353
+ * @returns {Promptbook} compiled in JSON format (.book.json)
8334
8354
  * @throws {ParseError} if the promptbook string is not valid
8335
8355
  * @public exported from `@promptbook/core`
8336
8356
  */
@@ -9702,13 +9722,13 @@
9702
9722
  return [4 /*yield*/, listAllFiles(path$1, isRecursive, tools.fs)];
9703
9723
  case 1:
9704
9724
  fileNames = _b.sent();
9705
- // Note: First load all .ptbk.json and then .ptbk.md files
9706
- // .ptbk.json can be prepared so it is faster to load
9725
+ // Note: First load all .book.json and then .book.md files
9726
+ // .book.json can be prepared so it is faster to load
9707
9727
  fileNames.sort(function (a, b) {
9708
- if (a.endsWith('.ptbk.json') && b.endsWith('.ptbk.md')) {
9728
+ if (a.endsWith('.book.json') && b.endsWith('.book.md')) {
9709
9729
  return -1;
9710
9730
  }
9711
- if (a.endsWith('.ptbk.md') && b.endsWith('.ptbk.json')) {
9731
+ if (a.endsWith('.book.md') && b.endsWith('.book.json')) {
9712
9732
  return 1;
9713
9733
  }
9714
9734
  return 0;
@@ -9725,7 +9745,7 @@
9725
9745
  case 1:
9726
9746
  _e.trys.push([1, 8, , 9]);
9727
9747
  pipeline = null;
9728
- if (!fileName.endsWith('.ptbk.md')) return [3 /*break*/, 4];
9748
+ if (!fileName.endsWith('.book.md')) return [3 /*break*/, 4];
9729
9749
  return [4 /*yield*/, promises.readFile(fileName, 'utf-8')];
9730
9750
  case 2:
9731
9751
  pipelineString = (_e.sent());
@@ -9737,7 +9757,7 @@
9737
9757
  pipeline = __assign(__assign({}, pipeline), { sourceFile: sourceFile });
9738
9758
  return [3 /*break*/, 7];
9739
9759
  case 4:
9740
- if (!fileName.endsWith('.ptbk.json')) return [3 /*break*/, 6];
9760
+ if (!fileName.endsWith('.book.json')) return [3 /*break*/, 6];
9741
9761
  _d = (_c = JSON).parse;
9742
9762
  return [4 /*yield*/, promises.readFile(fileName, 'utf-8')];
9743
9763
  case 5:
@@ -9905,7 +9925,7 @@
9905
9925
  return pipelineJsonStringified;
9906
9926
  }
9907
9927
  /**
9908
- * TODO: [🐝] Not Working propperly @see https://promptbook.studio/examples/mixed-knowledge.ptbk.md
9928
+ * TODO: [🐝] Not Working propperly @see https://promptbook.studio/examples/mixed-knowledge.book.md
9909
9929
  * TODO: [🧠][0] Maybe rename to `stringifyPipelineJson`, `stringifyIndexedJson`,...
9910
9930
  * TODO: [🧠] Maybe more elegant solution than replacing via regex
9911
9931
  * TODO: [🍙] Make some standard order of json properties
@@ -10086,7 +10106,7 @@
10086
10106
  */
10087
10107
 
10088
10108
  /**
10089
- * Stores
10109
+ * Stores data in memory (HEAP)
10090
10110
  *
10091
10111
  * @public exported from `@promptbook/core`
10092
10112
  */
@@ -10216,13 +10236,18 @@
10216
10236
  promptResult = _c.sent();
10217
10237
  return [3 /*break*/, 11];
10218
10238
  case 10: throw new PipelineExecutionError("Unknown model variant \"".concat(prompt.modelRequirements.modelVariant, "\""));
10219
- case 11: return [4 /*yield*/, storage.setItem(key, {
10239
+ case 11:
10240
+ // TODO: [🧠] !!!!! How to do timing in mixed cache / non-cache situation
10241
+ // promptResult.timing: FromtoItems
10242
+ return [4 /*yield*/, storage.setItem(key, {
10220
10243
  date: $currentDate(),
10221
10244
  promptbookVersion: PROMPTBOOK_ENGINE_VERSION,
10222
10245
  prompt: prompt,
10223
10246
  promptResult: promptResult,
10224
10247
  })];
10225
10248
  case 12:
10249
+ // TODO: [🧠] !!!!! How to do timing in mixed cache / non-cache situation
10250
+ // promptResult.timing: FromtoItems
10226
10251
  _c.sent();
10227
10252
  return [2 /*return*/, promptResult];
10228
10253
  }
@@ -10630,7 +10655,7 @@
10630
10655
  function initializePrettifyCommand(program) {
10631
10656
  var _this = this;
10632
10657
  var prettifyCommand = program.command('prettify');
10633
- prettifyCommand.description(spaceTrim__default["default"]("\n Iterates over `.ptbk.md` files and does multiple enhancing operations on them:\n\n 1) Adds Mermaid graph\n 2) Prettifies the markdown\n "));
10658
+ prettifyCommand.description(spaceTrim__default["default"]("\n Iterates over `.book.md` files and does multiple enhancing operations on them:\n\n 1) Adds Mermaid graph\n 2) Prettifies the markdown\n "));
10634
10659
  prettifyCommand.argument('<filesGlob>',
10635
10660
  // <- TODO: [🧟‍♂️] Unite path to promptbook collection argument
10636
10661
  'Pipelines to prettify as glob pattern');
@@ -10654,7 +10679,7 @@
10654
10679
  case 3:
10655
10680
  if (!!filenames_1_1.done) return [3 /*break*/, 10];
10656
10681
  filename = filenames_1_1.value;
10657
- if (!filename.endsWith('.ptbk.md') && isVerbose) {
10682
+ if (!filename.endsWith('.book.md') && isVerbose) {
10658
10683
  console.info(colors__default["default"].gray("Skipping ".concat(filename)));
10659
10684
  return [3 /*break*/, 9];
10660
10685
  }
@@ -11053,25 +11078,29 @@
11053
11078
  runCommand.description(spaceTrim__default["default"]("\n Runs a pipeline\n "));
11054
11079
  // TODO: [🧅] DRY command arguments
11055
11080
  runCommand.argument('<path>',
11056
- // <- Note: [🧟‍♂️] This is NOT promptbook collection directory BUT direct path to .ptbk.md file
11081
+ // <- Note: [🧟‍♂️] This is NOT promptbook collection directory BUT direct path to .book.md file
11057
11082
  'Path to book file');
11058
11083
  runCommand.option('-r, --reload', "Call LLM models even if same prompt with result is in the cache", false);
11059
11084
  runCommand.option('-v, --verbose', "Is output verbose", false);
11060
- runCommand.option('--no-interactive', "Input is not interactive", false);
11085
+ runCommand.option('--no-interactive', "Input is not interactive, if true you need to pass all the input parameters through --json");
11086
+ runCommand.option('-j, --json <json>', "Pass all or some input parameters as JSON record, if used the output is also returned as JSON");
11061
11087
  runCommand.option('-s, --save-report <path>', "Save report to file");
11062
- // TODO: !!!!!! Implement non-interactive mode - allow to pass input parameters as JSON
11063
- // TODO: !!!!!! JSON output
11064
11088
  runCommand.action(function (filePathRaw, options) { return __awaiter(_this, void 0, void 0, function () {
11065
- var isCacheReloaded, isVerbose, saveReport, prepareAndScrapeOptions, fs, filePath, filePathCandidates, filePathCandidates_1, filePathCandidates_1_1, filePathCandidate, e_1_1, llm, executables, tools, pipelineString, pipeline, error_1, pipelineExecutor, questions, response, inputParameters, result, isSuccessful, errors, warnings, outputParameters, executionReport, executionReportString, _a, _b, error, _c, _d, warning, _e, _f, key, value, separator;
11089
+ var isCacheReloaded, isInteractive, json, isVerbose, saveReport, inputParameters, prepareAndScrapeOptions, fs, filePath, filePathCandidates, filePathCandidates_1, filePathCandidates_1_1, filePathCandidate, e_1_1, llm, executables, tools, pipelineString, pipeline, error_1, pipelineExecutor, questions, response, result, isSuccessful, errors, warnings, outputParameters, executionReport, executionReportString, _a, _b, error, _c, _d, warning, _e, _f, key, value, separator;
11066
11090
  var e_1, _g, _h, e_2, _j, e_3, _k, e_4, _l;
11067
11091
  return __generator(this, function (_m) {
11068
11092
  switch (_m.label) {
11069
11093
  case 0:
11070
- isCacheReloaded = options.reload, options.interactive, isVerbose = options.verbose, saveReport = options.saveReport;
11094
+ isCacheReloaded = options.reload, isInteractive = options.interactive, json = options.json, isVerbose = options.verbose, saveReport = options.saveReport;
11071
11095
  if (saveReport && !saveReport.endsWith('.json') && !saveReport.endsWith('.md')) {
11072
11096
  console.error(colors__default["default"].red("Report file must be .json or .md"));
11073
11097
  return [2 /*return*/, process.exit(1)];
11074
11098
  }
11099
+ inputParameters = {};
11100
+ if (json) {
11101
+ inputParameters = JSON.parse(json);
11102
+ // <- TODO: Maybe check shape of passed JSON and if its valid parameters Record
11103
+ }
11075
11104
  prepareAndScrapeOptions = {
11076
11105
  isVerbose: isVerbose,
11077
11106
  isCacheReloaded: isCacheReloaded,
@@ -11085,7 +11114,7 @@
11085
11114
  filePathRaw,
11086
11115
  "".concat(filePathRaw, ".md"),
11087
11116
  "".concat(filePathRaw, ".book.md"),
11088
- "".concat(filePathRaw, ".ptbk.md"),
11117
+ "".concat(filePathRaw, ".book.md"),
11089
11118
  ];
11090
11119
  _m.label = 1;
11091
11120
  case 1:
@@ -11189,8 +11218,8 @@
11189
11218
  tools: tools,
11190
11219
  isNotPreparedWarningSupressed: true,
11191
11220
  maxExecutionAttempts: 3,
11192
- // <- TODO: !!!!!! Why "LLM execution failed undefinedx"
11193
- maxParallelCount: 1, // <- TODO: !!!!!! Pass
11221
+ // <- TODO: Why "LLM execution failed undefinedx"
11222
+ maxParallelCount: 1, // <- TODO: Pass CLI argument
11194
11223
  });
11195
11224
  if (isVerbose) {
11196
11225
  console.info(colors__default["default"].gray('--- Getting input parameters ---'));
@@ -11199,13 +11228,17 @@
11199
11228
  .filter(function (_a) {
11200
11229
  var isInput = _a.isInput;
11201
11230
  return isInput;
11231
+ })
11232
+ .filter(function (_a) {
11233
+ var name = _a.name;
11234
+ return typeof inputParameters[name] !== 'string';
11202
11235
  })
11203
11236
  .map(function (_a) {
11204
11237
  var name = _a.name, exampleValues = _a.exampleValues;
11205
11238
  var message = name;
11206
11239
  var initial = '';
11207
11240
  if (exampleValues && exampleValues.length > 0) {
11208
- var exampleValuesFiltered = exampleValues.filter(function (exampleValue) { return countLines(exampleValue) <= 1 && countCharacters(exampleValue) <= 30; });
11241
+ var exampleValuesFiltered = exampleValues.filter(function (exampleValue) { return countLines(exampleValue) <= 1; });
11209
11242
  if (exampleValuesFiltered.length !== 0) {
11210
11243
  message += " (e.g. ".concat(exampleValuesFiltered.join(', '), ")");
11211
11244
  }
@@ -11219,10 +11252,44 @@
11219
11252
  // TODO: Maybe use> validate: value => value < 18 ? `Forbidden` : true
11220
11253
  };
11221
11254
  });
11255
+ if (isInteractive === false && questions.length !== 0) {
11256
+ console.error(colors__default["default"].red(spaceTrim__default["default"](function (block) { return "\n When using --no-interactive you need to pass all the input parameters through --json\n\n You are missing:\n ".concat(block(pipeline.parameters
11257
+ .filter(function (_a) {
11258
+ var isInput = _a.isInput;
11259
+ return isInput;
11260
+ })
11261
+ .filter(function (_a) {
11262
+ var parameterName = _a.name;
11263
+ return !questions.some(function (_a) {
11264
+ var questionName = _a.name;
11265
+ return questionName === parameterName;
11266
+ });
11267
+ })
11268
+ .map(function (_a) {
11269
+ var name = _a.name, description = _a.description;
11270
+ return "- **".concat(name, "** ").concat(description);
11271
+ })
11272
+ .join('\n')), "\n\n Example:\n --json '").concat(JSON.stringify(Object.fromEntries(pipeline.parameters
11273
+ .filter(function (_a) {
11274
+ var isInput = _a.isInput;
11275
+ return isInput;
11276
+ })
11277
+ .map(function (_a) {
11278
+ var name = _a.name, exampleValues = _a.exampleValues;
11279
+ return [
11280
+ name,
11281
+ inputParameters[name] || (exampleValues || [])[0] || '...',
11282
+ ];
11283
+ })))
11284
+ .split("'")
11285
+ .join("\\'"), "'\n "); })));
11286
+ return [2 /*return*/, process.exit(1)];
11287
+ }
11222
11288
  return [4 /*yield*/, prompts__default["default"](questions)];
11223
11289
  case 16:
11224
11290
  response = _m.sent();
11225
- inputParameters = response;
11291
+ inputParameters = __assign(__assign({}, inputParameters), response);
11292
+ // TODO: Maybe do some validation of the response (and --json argument which is passed)
11226
11293
  if (isVerbose) {
11227
11294
  console.info(colors__default["default"].gray('--- Executing ---'));
11228
11295
  }
@@ -11259,7 +11326,9 @@
11259
11326
  console.info(colors__default["default"].gray('--- Usage ---'));
11260
11327
  console.info(colors__default["default"].cyan(usageToHuman(result.usage)));
11261
11328
  }
11262
- console.info(colors__default["default"].gray('--- Result ---'));
11329
+ if (json === undefined || isVerbose === true) {
11330
+ console.info(colors__default["default"].gray('--- Result ---'));
11331
+ }
11263
11332
  try {
11264
11333
  // TODO: [🧠] Should be errors or warnings shown first
11265
11334
  for (_a = __values(errors || []), _b = _a.next(); !_b.done; _b = _a.next()) {
@@ -11287,20 +11356,25 @@
11287
11356
  }
11288
11357
  finally { if (e_3) throw e_3.error; }
11289
11358
  }
11290
- try {
11291
- for (_e = __values(Object.keys(outputParameters)), _f = _e.next(); !_f.done; _f = _e.next()) {
11292
- key = _f.value;
11293
- value = outputParameters[key] || colors__default["default"].grey(colors__default["default"].italic('(nothing)'));
11294
- separator = countLines(value) > 1 || countWords(value) > 100 ? ':\n' : ': ';
11295
- console.info(colors__default["default"].green(colors__default["default"].bold(key) + separator + value));
11296
- }
11297
- }
11298
- catch (e_4_1) { e_4 = { error: e_4_1 }; }
11299
- finally {
11359
+ if (json === undefined) {
11300
11360
  try {
11301
- if (_f && !_f.done && (_l = _e.return)) _l.call(_e);
11361
+ for (_e = __values(Object.keys(outputParameters)), _f = _e.next(); !_f.done; _f = _e.next()) {
11362
+ key = _f.value;
11363
+ value = outputParameters[key] || colors__default["default"].grey(colors__default["default"].italic('(nothing)'));
11364
+ separator = countLines(value) > 1 || countWords(value) > 100 ? ':\n' : ': ';
11365
+ console.info(colors__default["default"].green(colors__default["default"].bold(key) + separator + value));
11366
+ }
11367
+ }
11368
+ catch (e_4_1) { e_4 = { error: e_4_1 }; }
11369
+ finally {
11370
+ try {
11371
+ if (_f && !_f.done && (_l = _e.return)) _l.call(_e);
11372
+ }
11373
+ finally { if (e_4) throw e_4.error; }
11302
11374
  }
11303
- finally { if (e_4) throw e_4.error; }
11375
+ }
11376
+ else {
11377
+ console.info(JSON.stringify(outputParameters, null, 4));
11304
11378
  }
11305
11379
  return [2 /*return*/, process.exit(0)];
11306
11380
  }
@@ -11308,7 +11382,7 @@
11308
11382
  }); });
11309
11383
  }
11310
11384
  /**
11311
- * TODO: !!!!!! Catch and wrap all errors from CLI
11385
+ * TODO: !!!!! Catch and wrap all errors from CLI
11312
11386
  * TODO: [🧠] Pass `maxExecutionAttempts`, `csvSettings`
11313
11387
  * TODO: [🥃][main] !!! Allow `ptbk run` without configuring any llm tools
11314
11388
  * Note: [🟡] Code in this file should never be published outside of `@promptbook/cli`
@@ -11323,7 +11397,7 @@
11323
11397
  function initializeTestCommand(program) {
11324
11398
  var _this = this;
11325
11399
  var testCommand = program.command('test');
11326
- testCommand.description(spaceTrim__default["default"]("\n Iterates over `.ptbk.md` and `.ptbk.json` and checks if they are parsable and logically valid\n "));
11400
+ testCommand.description(spaceTrim__default["default"]("\n Iterates over `.book.md` and `.book.json` and checks if they are parsable and logically valid\n "));
11327
11401
  testCommand.argument('<filesGlob>',
11328
11402
  // <- TODO: [🧟‍♂️] Unite path to promptbook collection argument
11329
11403
  'Pipelines to test as glob pattern');
@@ -11373,7 +11447,7 @@
11373
11447
  case 6:
11374
11448
  _f.trys.push([6, 13, , 14]);
11375
11449
  pipeline = void 0;
11376
- if (!filename.endsWith('.ptbk.md')) return [3 /*break*/, 9];
11450
+ if (!filename.endsWith('.book.md')) return [3 /*break*/, 9];
11377
11451
  return [4 /*yield*/, promises.readFile(filename, 'utf-8')];
11378
11452
  case 7:
11379
11453
  pipelineMarkdown = (_f.sent());
@@ -11385,7 +11459,7 @@
11385
11459
  }
11386
11460
  _f.label = 9;
11387
11461
  case 9:
11388
- if (!filename.endsWith('.ptbk.json')) return [3 /*break*/, 11];
11462
+ if (!filename.endsWith('.book.json')) return [3 /*break*/, 11];
11389
11463
  _c = (_b = JSON).parse;
11390
11464
  return [4 /*yield*/, promises.readFile(filename, 'utf-8')];
11391
11465
  case 10:
@@ -11472,13 +11546,16 @@
11472
11546
  });
11473
11547
  }
11474
11548
  /**
11475
- * TODO: [🧠] Maybe `run` command the default, instead of `ptbk run ./foo.ptbk.md` -> `ptbk ./foo.ptbk.md`
11549
+ * TODO: [🧠] Maybe `run` command the default, instead of `ptbk run ./foo.book.md` -> `ptbk ./foo.book.md`
11476
11550
  * TODO: [🥠] Do not export, its just for CLI script
11477
11551
  * TODO: [🕌] When more functionalities, rename
11478
11552
  * Note: 11:11
11479
11553
  * Note: [🟡] Code in this file should never be published outside of `@promptbook/cli`
11480
11554
  */
11481
11555
 
11556
+ /**
11557
+ * Note: [🔺] Purpose of this file is to export CLI for production environment
11558
+ */
11482
11559
  /**
11483
11560
  * Hidden utilities which should not be used by external consumers.
11484
11561
  *
@@ -11486,7 +11563,7 @@
11486
11563
  */
11487
11564
  var _CLI = {
11488
11565
  // Note: [🥠]
11489
- _initialize: promptbookCli,
11566
+ _initialize_promptbookCli: promptbookCli,
11490
11567
  };
11491
11568
  /**
11492
11569
  * Note: [🟡] Code in this file should never be published outside of `@promptbook/cli`
@@ -14040,7 +14117,7 @@
14040
14117
  collection = createCollectionFromJson.apply(void 0, __spreadArray([], __read(PipelineCollection), false));
14041
14118
  _d = createPipelineExecutor;
14042
14119
  _g = {};
14043
- return [4 /*yield*/, collection.getPipelineByUrl('https://promptbook.studio/promptbook/prepare-knowledge-from-markdown.ptbk.md')];
14120
+ return [4 /*yield*/, collection.getPipelineByUrl('https://promptbook.studio/promptbook/prepare-knowledge-from-markdown.book.md')];
14044
14121
  case 1:
14045
14122
  prepareKnowledgeFromMarkdownExecutor = _d.apply(void 0, [(_g.pipeline = _k.sent(),
14046
14123
  _g.tools = {
@@ -14049,7 +14126,7 @@
14049
14126
  _g)]);
14050
14127
  _e = createPipelineExecutor;
14051
14128
  _h = {};
14052
- return [4 /*yield*/, collection.getPipelineByUrl('https://promptbook.studio/promptbook/prepare-knowledge-title.ptbk.md')];
14129
+ return [4 /*yield*/, collection.getPipelineByUrl('https://promptbook.studio/promptbook/prepare-knowledge-title.book.md')];
14053
14130
  case 2:
14054
14131
  prepareTitleExecutor = _e.apply(void 0, [(_h.pipeline = _k.sent(),
14055
14132
  _h.tools = {
@@ -14058,7 +14135,7 @@
14058
14135
  _h)]);
14059
14136
  _f = createPipelineExecutor;
14060
14137
  _j = {};
14061
- return [4 /*yield*/, collection.getPipelineByUrl('https://promptbook.studio/promptbook/prepare-knowledge-keywords.ptbk.md')];
14138
+ return [4 /*yield*/, collection.getPipelineByUrl('https://promptbook.studio/promptbook/prepare-knowledge-keywords.book.md')];
14062
14139
  case 3:
14063
14140
  prepareKeywordsExecutor = _f.apply(void 0, [(_j.pipeline = _k.sent(),
14064
14141
  _j.tools = {