@promptbook/node 0.74.0-7 → 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 (36) hide show
  1. package/README.md +3 -15
  2. package/esm/index.es.js +163 -76
  3. package/esm/index.es.js.map +1 -1
  4. package/esm/typings/src/_packages/core.index.d.ts +5 -1
  5. package/esm/typings/src/_packages/utils.index.d.ts +4 -0
  6. package/esm/typings/src/cli/cli-commands/run.d.ts +1 -1
  7. package/esm/typings/src/cli/main.d.ts +4 -1
  8. package/esm/typings/src/cli/promptbookCli.d.ts +1 -1
  9. package/esm/typings/src/cli/test/ptbk.d.ts +1 -1
  10. package/esm/typings/src/collection/collectionToJson.test.d.ts +1 -1
  11. package/esm/typings/src/collection/constructors/createCollectionFromDirectory.d.ts +1 -1
  12. package/esm/typings/src/commands/BOOK_VERSION/BookVersionCommand.d.ts +1 -1
  13. package/esm/typings/src/commands/FOREACH/foreachCommandParser.d.ts +2 -2
  14. package/esm/typings/src/commands/_BOILERPLATE/boilerplateCommandParser.d.ts +1 -1
  15. package/esm/typings/src/config.d.ts +6 -0
  16. package/esm/typings/src/conversion/pipelineJsonToString.d.ts +3 -3
  17. package/esm/typings/src/conversion/pipelineStringToJson.d.ts +2 -2
  18. package/esm/typings/src/conversion/pipelineStringToJsonSync.d.ts +2 -2
  19. package/esm/typings/src/conversion/utils/stringifyPipelineJson.d.ts +1 -1
  20. package/esm/typings/src/conversion/validation/_importPipeline.d.ts +7 -7
  21. package/esm/typings/src/formats/_common/FormatDefinition.d.ts +1 -1
  22. package/esm/typings/src/formats/_common/FormatSubvalueDefinition.d.ts +1 -1
  23. package/esm/typings/src/storage/blackhole/BlackholeStorage.d.ts +33 -0
  24. package/esm/typings/src/storage/memory/MemoryStorage.d.ts +1 -1
  25. package/esm/typings/src/storage/{memory/utils → utils}/PrefixStorage.d.ts +1 -1
  26. package/esm/typings/src/types/PipelineJson/PipelineJson.d.ts +6 -4
  27. package/esm/typings/src/types/PipelineJson/PreparationJson.d.ts +1 -1
  28. package/esm/typings/src/types/Prompt.d.ts +1 -1
  29. package/esm/typings/src/types/typeAliases.d.ts +2 -2
  30. package/esm/typings/src/utils/expectation-counters/config.d.ts +12 -0
  31. package/esm/typings/src/utils/expectation-counters/countLines.d.ts +2 -0
  32. package/esm/typings/src/utils/expectation-counters/countPages.d.ts +2 -0
  33. package/package.json +2 -2
  34. package/umd/index.umd.js +163 -76
  35. package/umd/index.umd.js.map +1 -1
  36. /package/esm/typings/src/storage/{memory → local-storage}/utils/makePromptbookStorageFromWebStorage.d.ts +0 -0
package/esm/index.es.js CHANGED
@@ -26,7 +26,7 @@ var BOOK_LANGUAGE_VERSION = '1.0.0';
26
26
  *
27
27
  * @see https://github.com/webgptorg/promptbook
28
28
  */
29
- var PROMPTBOOK_ENGINE_VERSION = '0.74.0-6';
29
+ var PROMPTBOOK_ENGINE_VERSION = '0.74.0-13';
30
30
  /**
31
31
  * TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
32
32
  */
@@ -363,6 +363,13 @@ function $asDeeplyFrozenSerializableJson(name, objectValue) {
363
363
  * TODO: [🧠] Is there a way how to meaningfully test this utility
364
364
  */
365
365
 
366
+ // <- TODO: [🐊] Pick the best claim
367
+ /**
368
+ * When the title is not provided, the default title is used
369
+ *
370
+ * @public exported from `@promptbook/core`
371
+ */
372
+ var DEFAULT_TITLE = "Untitled";
366
373
  // <- TODO: [🧠] Better system for generator warnings - not always "code" and "by `@promptbook/cli`"
367
374
  /**
368
375
  * The maximum number of iterations for a loops
@@ -512,13 +519,13 @@ function capitalize(word) {
512
519
  /**
513
520
  * Converts promptbook in JSON format to string format
514
521
  *
515
- * @param pipelineJson Promptbook in JSON format (.ptbk.json)
516
- * @returns Promptbook in string format (.ptbk.md)
522
+ * @param pipelineJson Promptbook in JSON format (.book.json)
523
+ * @returns Promptbook in string format (.book.md)
517
524
  * @public exported from `@promptbook/core`
518
525
  */
519
526
  function pipelineJsonToString(pipelineJson) {
520
527
  var e_1, _a, e_2, _b, e_3, _c, e_4, _d, e_5, _e, e_6, _f;
521
- var title = pipelineJson.title, pipelineUrl = pipelineJson.pipelineUrl, promptbookVersion = pipelineJson.promptbookVersion, description = pipelineJson.description, parameters = pipelineJson.parameters, templates = pipelineJson.templates;
528
+ var title = pipelineJson.title, pipelineUrl = pipelineJson.pipelineUrl, bookVersion = pipelineJson.bookVersion, description = pipelineJson.description, parameters = pipelineJson.parameters, templates = pipelineJson.templates;
522
529
  var pipelineString = "# ".concat(title);
523
530
  if (description) {
524
531
  pipelineString += '\n\n';
@@ -528,8 +535,10 @@ function pipelineJsonToString(pipelineJson) {
528
535
  if (pipelineUrl) {
529
536
  commands.push("PIPELINE URL ".concat(pipelineUrl));
530
537
  }
531
- commands.push("PROMPTBOOK VERSION ".concat(promptbookVersion));
532
- // TODO: [main] !!! This increase size of the bundle and is probbably not necessary
538
+ if (bookVersion !== "undefined") {
539
+ commands.push("BOOK VERSION ".concat(bookVersion));
540
+ }
541
+ // TODO: [main] !!!!! This increases size of the bundle and is probbably not necessary
533
542
  pipelineString = prettifyMarkdown(pipelineString);
534
543
  try {
535
544
  for (var _g = __values(parameters.filter(function (_a) {
@@ -709,7 +718,7 @@ function templateParameterJsonToString(templateParameterJson) {
709
718
  * TODO: [🧠] Is there a way to auto-detect missing features in pipelineJsonToString
710
719
  * TODO: [🏛] Maybe make some markdown builder
711
720
  * TODO: [🏛] Escape all
712
- * TODO: [🧠] Should be in generated .ptbk.md file GENERATOR_WARNING
721
+ * TODO: [🧠] Should be in generated .book.md file GENERATOR_WARNING
713
722
  */
714
723
 
715
724
  /**
@@ -1347,7 +1356,7 @@ function joinLlmExecutionTools() {
1347
1356
  * TODO: [👷‍♂️] @@@ Manual about construction of llmTools
1348
1357
  */
1349
1358
 
1350
- 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"}];
1359
+ 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"}];
1351
1360
 
1352
1361
  /**
1353
1362
  * This error indicates that the promptbook in a markdown format cannot be parsed into a valid promptbook object
@@ -1522,7 +1531,7 @@ function isValidPipelineUrl(url) {
1522
1531
  if (!url.startsWith('https://')) {
1523
1532
  return false;
1524
1533
  }
1525
- if (!(url.endsWith('.book.md') || url.endsWith('.book') || url.endsWith('.ptbk.md') || url.endsWith('.ptbk'))) {
1534
+ if (!(url.endsWith('.book.md') || url.endsWith('.book') || url.endsWith('.book.md') || url.endsWith('.ptbk'))) {
1526
1535
  return false;
1527
1536
  }
1528
1537
  if (url.includes('#')) {
@@ -1591,9 +1600,9 @@ function validatePipelineCore(pipeline) {
1591
1600
  // <- Note: [🚲]
1592
1601
  throw new PipelineLogicError(spaceTrim(function (block) { return "\n Invalid promptbook URL \"".concat(pipeline.pipelineUrl, "\"\n\n ").concat(block(pipelineIdentification), "\n "); }));
1593
1602
  }
1594
- if (pipeline.promptbookVersion !== undefined && !isValidPromptbookVersion(pipeline.promptbookVersion)) {
1603
+ if (pipeline.bookVersion !== undefined && !isValidPromptbookVersion(pipeline.bookVersion)) {
1595
1604
  // <- Note: [🚲]
1596
- throw new PipelineLogicError(spaceTrim(function (block) { return "\n Invalid Promptbook Version \"".concat(pipeline.promptbookVersion, "\"\n\n ").concat(block(pipelineIdentification), "\n "); }));
1605
+ throw new PipelineLogicError(spaceTrim(function (block) { return "\n Invalid Promptbook Version \"".concat(pipeline.bookVersion, "\"\n\n ").concat(block(pipelineIdentification), "\n "); }));
1597
1606
  }
1598
1607
  // TODO: [🧠] Maybe do here some propper JSON-schema / ZOD checking
1599
1608
  if (!Array.isArray(pipeline.parameters)) {
@@ -2986,28 +2995,42 @@ function countCharacters(text) {
2986
2995
  return text.length;
2987
2996
  }
2988
2997
 
2998
+ /**
2999
+ * Number of characters per standard line with 11pt Arial font size.
3000
+ *
3001
+ * @public exported from `@promptbook/utils`
3002
+ */
3003
+ var CHARACTERS_PER_STANDARD_LINE = 63;
3004
+ /**
3005
+ * Number of lines per standard A4 page with 11pt Arial font size and standard margins and spacing.
3006
+ *
3007
+ * @public exported from `@promptbook/utils`
3008
+ */
3009
+ var LINES_PER_STANDARD_PAGE = 44;
3010
+
2989
3011
  /**
2990
3012
  * Counts number of lines in the text
2991
3013
  *
3014
+ * Note: This does not check only for the presence of newlines, but also for the length of the standard line.
3015
+ *
2992
3016
  * @public exported from `@promptbook/utils`
2993
3017
  */
2994
3018
  function countLines(text) {
2995
- if (text === '') {
2996
- return 0;
2997
- }
2998
- return text.split('\n').length;
3019
+ text = text.replace('\r\n', '\n');
3020
+ text = text.replace('\r', '\n');
3021
+ var lines = text.split('\n');
3022
+ return lines.reduce(function (count, line) { return count + Math.ceil(line.length / CHARACTERS_PER_STANDARD_LINE); }, 0);
2999
3023
  }
3000
3024
 
3001
3025
  /**
3002
3026
  * Counts number of pages in the text
3003
3027
  *
3028
+ * 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.
3029
+ *
3004
3030
  * @public exported from `@promptbook/utils`
3005
3031
  */
3006
3032
  function countPages(text) {
3007
- var sentencesPerPage = 5; // Assuming each page has 5 sentences
3008
- var sentences = text.split(/[.!?]+/).filter(function (sentence) { return sentence.trim() !== ''; });
3009
- var pageCount = Math.ceil(sentences.length / sentencesPerPage);
3010
- return pageCount;
3033
+ return Math.ceil(countLines(text) / LINES_PER_STANDARD_PAGE);
3011
3034
  }
3012
3035
 
3013
3036
  /**
@@ -3548,7 +3571,7 @@ function executeAttempts(options) {
3548
3571
  promptTitle: template.title,
3549
3572
  promptMessage: replaceParameters(template.description || '', parameters),
3550
3573
  defaultValue: replaceParameters(preparedContent, parameters),
3551
- // TODO: [🧠] !! Figure out how to define placeholder in .ptbk.md file
3574
+ // TODO: [🧠] !! Figure out how to define placeholder in .book.md file
3552
3575
  placeholder: undefined,
3553
3576
  priority: priority,
3554
3577
  }))];
@@ -4114,7 +4137,7 @@ function executePipeline(options) {
4114
4137
  pipelineUrl: preparedPipeline.pipelineUrl,
4115
4138
  title: preparedPipeline.title,
4116
4139
  promptbookUsedVersion: PROMPTBOOK_ENGINE_VERSION,
4117
- promptbookRequestedVersion: preparedPipeline.promptbookVersion,
4140
+ promptbookRequestedVersion: preparedPipeline.bookVersion,
4118
4141
  description: preparedPipeline.description,
4119
4142
  promptExecutions: [],
4120
4143
  };
@@ -4463,7 +4486,7 @@ function preparePersona(personaDescription, tools, options) {
4463
4486
  collection = createCollectionFromJson.apply(void 0, __spreadArray([], __read(PipelineCollection), false));
4464
4487
  _b = createPipelineExecutor;
4465
4488
  _c = {};
4466
- return [4 /*yield*/, collection.getPipelineByUrl('https://promptbook.studio/promptbook/prepare-persona.ptbk.md')];
4489
+ return [4 /*yield*/, collection.getPipelineByUrl('https://promptbook.studio/promptbook/prepare-persona.book.md')];
4467
4490
  case 1:
4468
4491
  preparePersonaExecutor = _b.apply(void 0, [(_c.pipeline = _d.sent(),
4469
4492
  _c.tools = tools,
@@ -5220,12 +5243,12 @@ TODO: [🧊] This is how it can look in future
5220
5243
  */
5221
5244
  function clonePipeline(pipeline) {
5222
5245
  // Note: Not using spread operator (...) because @@@
5223
- 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;
5246
+ 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;
5224
5247
  return {
5225
5248
  pipelineUrl: pipelineUrl,
5226
5249
  sourceFile: sourceFile,
5227
5250
  title: title,
5228
- promptbookVersion: promptbookVersion,
5251
+ bookVersion: bookVersion,
5229
5252
  description: description,
5230
5253
  parameters: parameters,
5231
5254
  templates: templates,
@@ -5437,7 +5460,7 @@ var knowledgeCommandParser = {
5437
5460
  throw new ParseError("Source not valid");
5438
5461
  }
5439
5462
  if (sourceContent.startsWith('../') || sourceContent.startsWith('/') || /^[A-Z]:[\\/]+/i.test(sourceContent)) {
5440
- throw new ParseError("Source cannot be outside of the .ptbk.md folder");
5463
+ throw new ParseError("Source cannot be outside of the .book.md folder");
5441
5464
  }
5442
5465
  return {
5443
5466
  type: 'KNOWLEDGE',
@@ -6087,7 +6110,7 @@ function validateParameterName(parameterName) {
6087
6110
  /**
6088
6111
  * Parses the foreach command
6089
6112
  *
6090
- * Note: @@@ This command is used as foreach for new commands - it should NOT be used in any `.ptbk.md` file
6113
+ * Note: @@@ This command is used as foreach for new commands - it should NOT be used in any `.book.md` file
6091
6114
  *
6092
6115
  * @see `documentationUrl` for more details
6093
6116
  * @private within the commands folder
@@ -6237,7 +6260,7 @@ var foreachCommandParser = {
6237
6260
  },
6238
6261
  };
6239
6262
  /**
6240
- * TODO: [🍭] Make .ptbk.md file with examples of the FOREACH with wrong parsing and logic
6263
+ * TODO: [🍭] Make .book.md file with examples of the FOREACH with wrong parsing and logic
6241
6264
  */
6242
6265
 
6243
6266
  /**
@@ -6871,7 +6894,7 @@ var bookVersionCommandParser = {
6871
6894
  /**
6872
6895
  * Description of the BOOK_VERSION command
6873
6896
  */
6874
- description: "Which version of the Book language is the .ptbk.md using",
6897
+ description: "Which version of the Book language is the .book.md using",
6875
6898
  /**
6876
6899
  * Link to documentation
6877
6900
  */
@@ -6885,19 +6908,19 @@ var bookVersionCommandParser = {
6885
6908
  */
6886
6909
  parse: function (input) {
6887
6910
  var args = input.args;
6888
- var promptbookVersion = args.pop();
6889
- if (promptbookVersion === undefined) {
6911
+ var bookVersion = args.pop();
6912
+ if (bookVersion === undefined) {
6890
6913
  throw new ParseError("Version is required");
6891
6914
  }
6892
- if (!isValidPromptbookVersion(promptbookVersion)) {
6893
- throw new ParseError("Invalid Promptbook version \"".concat(promptbookVersion, "\""));
6915
+ if (!isValidPromptbookVersion(bookVersion)) {
6916
+ throw new ParseError("Invalid Promptbook version \"".concat(bookVersion, "\""));
6894
6917
  }
6895
6918
  if (args.length > 0 && !(((args.length === 1 && args[0]) || '').toUpperCase() === 'VERSION')) {
6896
6919
  throw new ParseError("Can not have more than one Promptbook version");
6897
6920
  }
6898
6921
  return {
6899
6922
  type: 'BOOK_VERSION',
6900
- promptbookVersion: promptbookVersion,
6923
+ bookVersion: bookVersion,
6901
6924
  };
6902
6925
  },
6903
6926
  /**
@@ -6907,7 +6930,7 @@ var bookVersionCommandParser = {
6907
6930
  */
6908
6931
  $applyToPipelineJson: function (command, $pipelineJson) {
6909
6932
  // TODO: Warn if the version is overridden
6910
- $pipelineJson.promptbookVersion = command.promptbookVersion;
6933
+ $pipelineJson.bookVersion = command.bookVersion;
6911
6934
  },
6912
6935
  /**
6913
6936
  * Converts the BOOK_VERSION command back to string
@@ -6960,9 +6983,9 @@ var urlCommandParser = {
6960
6983
  * Example usages of the URL command
6961
6984
  */
6962
6985
  examples: [
6963
- 'PIPELINE URL https://promptbook.studio/library/write-cv.ptbk.md',
6964
- 'URL https://promptbook.studio/library/write-cv.ptbk.md',
6965
- 'https://promptbook.studio/library/write-cv.ptbk.md',
6986
+ 'PIPELINE URL https://promptbook.studio/library/write-cv.book.md',
6987
+ 'URL https://promptbook.studio/library/write-cv.book.md',
6988
+ 'https://promptbook.studio/library/write-cv.book.md',
6966
6989
  ],
6967
6990
  /**
6968
6991
  * Parses the URL command
@@ -7163,7 +7186,7 @@ var instrumentCommandParser = {
7163
7186
  /**
7164
7187
  * Parses the boilerplate command
7165
7188
  *
7166
- * Note: @@@ This command is used as boilerplate for new commands - it should NOT be used in any `.ptbk.md` file
7189
+ * Note: @@@ This command is used as boilerplate for new commands - it should NOT be used in any `.book.md` file
7167
7190
  *
7168
7191
  * @see `documentationUrl` for more details
7169
7192
  * @private within the commands folder
@@ -7217,7 +7240,7 @@ var boilerplateCommandParser = {
7217
7240
  * Note: `$` is used to indicate that this function mutates given `pipelineJson`
7218
7241
  */
7219
7242
  $applyToPipelineJson: function (command, $pipelineJson) {
7220
- throw new ParseError("BOILERPLATE command is only for testing purposes and should not be used in the .ptbk.md file");
7243
+ throw new ParseError("BOILERPLATE command is only for testing purposes and should not be used in the .book.md file");
7221
7244
  },
7222
7245
  /**
7223
7246
  * Apply the BOILERPLATE command to the `pipelineJson`
@@ -7225,7 +7248,7 @@ var boilerplateCommandParser = {
7225
7248
  * Note: `$` is used to indicate that this function mutates given `templateJson`
7226
7249
  */
7227
7250
  $applyToTemplateJson: function (command, $templateJson, $pipelineJson) {
7228
- throw new ParseError("BOILERPLATE command is only for testing purposes and should not be used in the .ptbk.md file");
7251
+ throw new ParseError("BOILERPLATE command is only for testing purposes and should not be used in the .book.md file");
7229
7252
  },
7230
7253
  /**
7231
7254
  * Converts the BOILERPLATE command back to string
@@ -7241,7 +7264,7 @@ var boilerplateCommandParser = {
7241
7264
  * Note: This is used in `pipelineJsonToString` utility
7242
7265
  */
7243
7266
  takeFromPipelineJson: function (pipelineJson) {
7244
- throw new ParseError("BOILERPLATE command is only for testing purposes and should not be used in the .ptbk.md file");
7267
+ throw new ParseError("BOILERPLATE command is only for testing purposes and should not be used in the .book.md file");
7245
7268
  },
7246
7269
  /**
7247
7270
  * Reads the BOILERPLATE command from the `TemplateJson`
@@ -7249,7 +7272,7 @@ var boilerplateCommandParser = {
7249
7272
  * Note: This is used in `pipelineJsonToString` utility
7250
7273
  */
7251
7274
  takeFromTemplateJson: function ($templateJson) {
7252
- throw new ParseError("BOILERPLATE command is only for testing purposes and should not be used in the .ptbk.md file");
7275
+ throw new ParseError("BOILERPLATE command is only for testing purposes and should not be used in the .book.md file");
7253
7276
  },
7254
7277
  };
7255
7278
 
@@ -7578,7 +7601,7 @@ function splitMarkdownIntoSections(markdown) {
7578
7601
  return;
7579
7602
  }
7580
7603
  if (!section.startsWith('#')) {
7581
- section = "# Untitled\n\n".concat(section);
7604
+ section = "# ".concat(DEFAULT_TITLE, "\n\n").concat(section);
7582
7605
  }
7583
7606
  sections.push(section);
7584
7607
  buffer = [];
@@ -7642,7 +7665,7 @@ function flattenMarkdown(markdown) {
7642
7665
  var e_1, _a;
7643
7666
  var sections = splitMarkdownIntoSections(markdown);
7644
7667
  if (sections.length === 0) {
7645
- return '# Untitled';
7668
+ return "# ".concat(DEFAULT_TITLE);
7646
7669
  }
7647
7670
  var flattenedMarkdown = '';
7648
7671
  var parsedSections = sections.map(parseMarkdownSection);
@@ -7653,7 +7676,7 @@ function flattenMarkdown(markdown) {
7653
7676
  }
7654
7677
  else {
7655
7678
  parsedSections.unshift(firstSection);
7656
- flattenedMarkdown += "# Untitled" + "\n\n"; // <- [🧠] Maybe 3 new lines?
7679
+ flattenedMarkdown += "# ".concat(DEFAULT_TITLE) + "\n\n"; // <- [🧠] Maybe 3 new lines?
7657
7680
  }
7658
7681
  try {
7659
7682
  for (var parsedSections_1 = __values(parsedSections), parsedSections_1_1 = parsedSections_1.next(); !parsedSections_1_1.done; parsedSections_1_1 = parsedSections_1.next()) {
@@ -7725,17 +7748,17 @@ function titleToName(value) {
7725
7748
  * Note: This function does not validate logic of the pipeline only the parsing
7726
7749
  * Note: This function acts as compilation process
7727
7750
  *
7728
- * @param pipelineString {Promptbook} in string markdown format (.ptbk.md)
7729
- * @returns {Promptbook} compiled in JSON format (.ptbk.json)
7751
+ * @param pipelineString {Promptbook} in string markdown format (.book.md)
7752
+ * @returns {Promptbook} compiled in JSON format (.book.json)
7730
7753
  * @throws {ParseError} if the promptbook string is not valid
7731
7754
  * @public exported from `@promptbook/core`
7732
7755
  */
7733
7756
  function pipelineStringToJsonSync(pipelineString) {
7734
- var e_1, _a, e_2, _b;
7757
+ var e_1, _a, e_2, _b, e_3, _c, e_4, _d;
7735
7758
  var $pipelineJson = {
7736
7759
  title: undefined /* <- Note: [🍙] Putting here placeholder to keep `title` on top at final JSON */,
7737
7760
  pipelineUrl: undefined /* <- Note: Putting here placeholder to keep `pipelineUrl` on top at final JSON */,
7738
- promptbookVersion: undefined /* <- Note: By default no explicit version */,
7761
+ bookVersion: undefined /* <- Note: By default no explicit version */,
7739
7762
  description: undefined /* <- Note: [🍙] Putting here placeholder to keep `description` on top at final JSON */,
7740
7763
  parameters: [],
7741
7764
  templates: [],
@@ -7759,7 +7782,7 @@ function pipelineStringToJsonSync(pipelineString) {
7759
7782
  // =============================================================
7760
7783
  // Note: 1️⃣ Parsing of the markdown into object
7761
7784
  if (pipelineString.startsWith('#!')) {
7762
- var _c = __read(pipelineString.split('\n')), shebangLine_1 = _c[0], restLines = _c.slice(1);
7785
+ var _e = __read(pipelineString.split('\n')), shebangLine_1 = _e[0], restLines = _e.slice(1);
7763
7786
  if (!(shebangLine_1 || '').includes('ptbk')) {
7764
7787
  throw new ParseError(spaceTrim(function (block) { return "\n It seems that you try to parse a book file which has non-standard shebang line for book files:\n Shebang line must contain 'ptbk'\n\n You have:\n ".concat(block(shebangLine_1 || '(empty line)'), "\n\n It should look like this:\n #!/usr/bin/env ptbk\n\n ").concat(block(getPipelineIdentification()), "\n "); }));
7765
7788
  }
@@ -7769,7 +7792,7 @@ function pipelineStringToJsonSync(pipelineString) {
7769
7792
  pipelineString = flattenMarkdown(pipelineString) /* <- Note: [🥞] */;
7770
7793
  pipelineString = pipelineString.replaceAll(/`\{(?<parameterName>[a-z0-9_]+)\}`/gi, '{$<parameterName>}');
7771
7794
  pipelineString = pipelineString.replaceAll(/`->\s+\{(?<parameterName>[a-z0-9_]+)\}`/gi, '-> {$<parameterName>}');
7772
- var _d = __read(splitMarkdownIntoSections(pipelineString).map(parseMarkdownSection)), pipelineHead = _d[0], pipelineSections = _d.slice(1); /* <- Note: [🥞] */
7795
+ var _f = __read(splitMarkdownIntoSections(pipelineString).map(parseMarkdownSection)), pipelineHead = _f[0], pipelineSections = _f.slice(1); /* <- Note: [🥞] */
7773
7796
  if (pipelineHead === undefined) {
7774
7797
  throw new UnexpectedError(spaceTrim(function (block) { return "\n Pipeline head is not defined\n\n ".concat(block(getPipelineIdentification()), "\n\n This should never happen, because the pipeline already flattened\n "); }));
7775
7798
  }
@@ -7797,6 +7820,8 @@ function pipelineStringToJsonSync(pipelineString) {
7797
7820
  if (parameterDescription) {
7798
7821
  existingParameter.description = parameterDescription;
7799
7822
  }
7823
+ existingParameter.isInput = existingParameter.isInput || isInput;
7824
+ existingParameter.isOutput = existingParameter.isOutput || isOutput;
7800
7825
  }
7801
7826
  else {
7802
7827
  $pipelineJson.parameters.push({
@@ -7859,10 +7884,10 @@ function pipelineStringToJsonSync(pipelineString) {
7859
7884
  finally { if (e_1) throw e_1.error; }
7860
7885
  }
7861
7886
  var _loop_2 = function (section) {
7862
- var e_3, _e;
7887
+ var e_5, _l, e_6, _m;
7863
7888
  // TODO: Parse template description (the content out of the codeblock and lists)
7864
7889
  var listItems_2 = extractAllListItemsFromMarkdown(section.content);
7865
- var _f = extractOneBlockFromMarkdown(section.content), language = _f.language, content = _f.content;
7890
+ var _o = extractOneBlockFromMarkdown(section.content), language = _o.language, content = _o.content;
7866
7891
  // TODO: [🎾][1] DRY description
7867
7892
  var description_1 = section.content;
7868
7893
  // Note: Remove codeblocks - TODO: [🎾]
@@ -7903,7 +7928,7 @@ function pipelineStringToJsonSync(pipelineString) {
7903
7928
  }) === false) {
7904
7929
  templateCommandParser.$applyToTemplateJson({ type: 'TEMPLATE', templateType: 'PROMPT_TEMPLATE' }, $templateJson, $pipelineJson);
7905
7930
  }
7906
- var _loop_3 = function (listItem, command) {
7931
+ var _loop_4 = function (listItem, command) {
7907
7932
  var commandParser = getParserForCommand(command);
7908
7933
  if (commandParser.isUsedInPipelineTemplate !== true /* <- Note: [🦦][4] */) {
7909
7934
  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: [🚞]
@@ -7926,17 +7951,17 @@ function pipelineStringToJsonSync(pipelineString) {
7926
7951
  };
7927
7952
  try {
7928
7953
  // TODO [♓️] List commands and before apply order them to achieve order-agnostic commands
7929
- for (var commands_1 = (e_3 = void 0, __values(commands)), commands_1_1 = commands_1.next(); !commands_1_1.done; commands_1_1 = commands_1.next()) {
7930
- var _g = commands_1_1.value, listItem = _g.listItem, command = _g.command;
7931
- _loop_3(listItem, command);
7954
+ for (var commands_1 = (e_5 = void 0, __values(commands)), commands_1_1 = commands_1.next(); !commands_1_1.done; commands_1_1 = commands_1.next()) {
7955
+ var _p = commands_1_1.value, listItem = _p.listItem, command = _p.command;
7956
+ _loop_4(listItem, command);
7932
7957
  }
7933
7958
  }
7934
- catch (e_3_1) { e_3 = { error: e_3_1 }; }
7959
+ catch (e_5_1) { e_5 = { error: e_5_1 }; }
7935
7960
  finally {
7936
7961
  try {
7937
- if (commands_1_1 && !commands_1_1.done && (_e = commands_1.return)) _e.call(commands_1);
7962
+ if (commands_1_1 && !commands_1_1.done && (_l = commands_1.return)) _l.call(commands_1);
7938
7963
  }
7939
- finally { if (e_3) throw e_3.error; }
7964
+ finally { if (e_5) throw e_5.error; }
7940
7965
  }
7941
7966
  // TODO: [🍧] Should be done in TEMPLATE command
7942
7967
  if ($templateJson.templateType === 'SCRIPT_TEMPLATE') {
@@ -7950,6 +7975,26 @@ function pipelineStringToJsonSync(pipelineString) {
7950
7975
  language;
7951
7976
  }
7952
7977
  $templateJson.dependentParameterNames = Array.from(extractParameterNamesFromTemplate($templateJson));
7978
+ try {
7979
+ for (var _q = (e_6 = void 0, __values($templateJson.dependentParameterNames)), _r = _q.next(); !_r.done; _r = _q.next()) {
7980
+ var parameterName = _r.value;
7981
+ // TODO: [🧠] This definition should be made first in the template
7982
+ defineParam({
7983
+ parameterName: parameterName,
7984
+ parameterDescription: null,
7985
+ isInput: false,
7986
+ isOutput: false,
7987
+ // <- Note: In this case null+false+false means that we do not know yet if it is input or output and we will set it later
7988
+ });
7989
+ }
7990
+ }
7991
+ catch (e_6_1) { e_6 = { error: e_6_1 }; }
7992
+ finally {
7993
+ try {
7994
+ if (_r && !_r.done && (_m = _q.return)) _m.call(_q);
7995
+ }
7996
+ finally { if (e_6) throw e_6.error; }
7997
+ }
7953
7998
  /*
7954
7999
  // TODO: [🍧] This should be checked in `MODEL` command + better error message
7955
8000
  if ($templateJson.templateType !== 'PROMPT_TEMPLATE' && $templateJson.modelRequirements !== undefined) {
@@ -7991,9 +8036,51 @@ function pipelineStringToJsonSync(pipelineString) {
7991
8036
  finally { if (e_2) throw e_2.error; }
7992
8037
  }
7993
8038
  // =============================================================
7994
- // Note: 5️⃣ Cleanup of undefined values
8039
+ // Note: 5️⃣ Mark parameters as INPUT if not explicitly set
8040
+ if ($pipelineJson.parameters.every(function (parameter) { return !parameter.isInput; })) {
8041
+ var _loop_3 = function (parameter) {
8042
+ var isThisParameterResulting = $pipelineJson.templates.some(function (template) { return template.resultingParameterName === parameter.name; });
8043
+ if (!isThisParameterResulting) {
8044
+ parameter.isInput = true;
8045
+ }
8046
+ };
8047
+ try {
8048
+ for (var _g = __values($pipelineJson.parameters), _h = _g.next(); !_h.done; _h = _g.next()) {
8049
+ var parameter = _h.value;
8050
+ _loop_3(parameter);
8051
+ }
8052
+ }
8053
+ catch (e_3_1) { e_3 = { error: e_3_1 }; }
8054
+ finally {
8055
+ try {
8056
+ if (_h && !_h.done && (_c = _g.return)) _c.call(_g);
8057
+ }
8058
+ finally { if (e_3) throw e_3.error; }
8059
+ }
8060
+ }
8061
+ // =============================================================
8062
+ // Note: 6️⃣ Mark all non-INPUT parameters as OUTPUT if any OUTPUT is not set
8063
+ if ($pipelineJson.parameters.every(function (parameter) { return !parameter.isOutput; })) {
8064
+ try {
8065
+ for (var _j = __values($pipelineJson.parameters), _k = _j.next(); !_k.done; _k = _j.next()) {
8066
+ var parameter = _k.value;
8067
+ if (!parameter.isInput) {
8068
+ parameter.isOutput = true;
8069
+ }
8070
+ }
8071
+ }
8072
+ catch (e_4_1) { e_4 = { error: e_4_1 }; }
8073
+ finally {
8074
+ try {
8075
+ if (_k && !_k.done && (_d = _j.return)) _d.call(_j);
8076
+ }
8077
+ finally { if (e_4) throw e_4.error; }
8078
+ }
8079
+ }
8080
+ // =============================================================
8081
+ // Note: 7️⃣ Cleanup of undefined values
7995
8082
  $pipelineJson.templates.forEach(function (templates) {
7996
- var e_4, _a;
8083
+ var e_7, _a;
7997
8084
  try {
7998
8085
  for (var _b = __values(Object.entries(templates)), _c = _b.next(); !_c.done; _c = _b.next()) {
7999
8086
  var _d = __read(_c.value, 2), key = _d[0], value = _d[1];
@@ -8002,16 +8089,16 @@ function pipelineStringToJsonSync(pipelineString) {
8002
8089
  }
8003
8090
  }
8004
8091
  }
8005
- catch (e_4_1) { e_4 = { error: e_4_1 }; }
8092
+ catch (e_7_1) { e_7 = { error: e_7_1 }; }
8006
8093
  finally {
8007
8094
  try {
8008
8095
  if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
8009
8096
  }
8010
- finally { if (e_4) throw e_4.error; }
8097
+ finally { if (e_7) throw e_7.error; }
8011
8098
  }
8012
8099
  });
8013
8100
  $pipelineJson.parameters.forEach(function (parameter) {
8014
- var e_5, _a;
8101
+ var e_8, _a;
8015
8102
  try {
8016
8103
  for (var _b = __values(Object.entries(parameter)), _c = _b.next(); !_c.done; _c = _b.next()) {
8017
8104
  var _d = __read(_c.value, 2), key = _d[0], value = _d[1];
@@ -8020,12 +8107,12 @@ function pipelineStringToJsonSync(pipelineString) {
8020
8107
  }
8021
8108
  }
8022
8109
  }
8023
- catch (e_5_1) { e_5 = { error: e_5_1 }; }
8110
+ catch (e_8_1) { e_8 = { error: e_8_1 }; }
8024
8111
  finally {
8025
8112
  try {
8026
8113
  if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
8027
8114
  }
8028
- finally { if (e_5) throw e_5.error; }
8115
+ finally { if (e_8) throw e_8.error; }
8029
8116
  }
8030
8117
  });
8031
8118
  // =============================================================
@@ -8054,10 +8141,10 @@ function pipelineStringToJsonSync(pipelineString) {
8054
8141
  * Note: This function does not validate logic of the pipeline only the parsing
8055
8142
  * Note: This function acts as compilation process
8056
8143
  *
8057
- * @param pipelineString {Promptbook} in string markdown format (.ptbk.md)
8144
+ * @param pipelineString {Promptbook} in string markdown format (.book.md)
8058
8145
  * @param tools - Tools for the preparation and scraping - if not provided together with `llm`, the preparation will be skipped
8059
8146
  * @param options - Options and tools for the compilation
8060
- * @returns {Promptbook} compiled in JSON format (.ptbk.json)
8147
+ * @returns {Promptbook} compiled in JSON format (.book.json)
8061
8148
  * @throws {ParseError} if the promptbook string is not valid
8062
8149
  * @public exported from `@promptbook/core`
8063
8150
  */
@@ -9438,13 +9525,13 @@ function createCollectionFromDirectory(path, tools, options) {
9438
9525
  return [4 /*yield*/, listAllFiles(path, isRecursive, tools.fs)];
9439
9526
  case 1:
9440
9527
  fileNames = _b.sent();
9441
- // Note: First load all .ptbk.json and then .ptbk.md files
9442
- // .ptbk.json can be prepared so it is faster to load
9528
+ // Note: First load all .book.json and then .book.md files
9529
+ // .book.json can be prepared so it is faster to load
9443
9530
  fileNames.sort(function (a, b) {
9444
- if (a.endsWith('.ptbk.json') && b.endsWith('.ptbk.md')) {
9531
+ if (a.endsWith('.book.json') && b.endsWith('.book.md')) {
9445
9532
  return -1;
9446
9533
  }
9447
- if (a.endsWith('.ptbk.md') && b.endsWith('.ptbk.json')) {
9534
+ if (a.endsWith('.book.md') && b.endsWith('.book.json')) {
9448
9535
  return 1;
9449
9536
  }
9450
9537
  return 0;
@@ -9461,7 +9548,7 @@ function createCollectionFromDirectory(path, tools, options) {
9461
9548
  case 1:
9462
9549
  _e.trys.push([1, 8, , 9]);
9463
9550
  pipeline = null;
9464
- if (!fileName.endsWith('.ptbk.md')) return [3 /*break*/, 4];
9551
+ if (!fileName.endsWith('.book.md')) return [3 /*break*/, 4];
9465
9552
  return [4 /*yield*/, readFile(fileName, 'utf-8')];
9466
9553
  case 2:
9467
9554
  pipelineString = (_e.sent());
@@ -9473,7 +9560,7 @@ function createCollectionFromDirectory(path, tools, options) {
9473
9560
  pipeline = __assign(__assign({}, pipeline), { sourceFile: sourceFile });
9474
9561
  return [3 /*break*/, 7];
9475
9562
  case 4:
9476
- if (!fileName.endsWith('.ptbk.json')) return [3 /*break*/, 6];
9563
+ if (!fileName.endsWith('.book.json')) return [3 /*break*/, 6];
9477
9564
  _d = (_c = JSON).parse;
9478
9565
  return [4 /*yield*/, readFile(fileName, 'utf-8')];
9479
9566
  case 5:
@@ -9641,7 +9728,7 @@ function stringifyPipelineJson(pipeline) {
9641
9728
  return pipelineJsonStringified;
9642
9729
  }
9643
9730
  /**
9644
- * TODO: [🐝] Not Working propperly @see https://promptbook.studio/examples/mixed-knowledge.ptbk.md
9731
+ * TODO: [🐝] Not Working propperly @see https://promptbook.studio/examples/mixed-knowledge.book.md
9645
9732
  * TODO: [🧠][0] Maybe rename to `stringifyPipelineJson`, `stringifyIndexedJson`,...
9646
9733
  * TODO: [🧠] Maybe more elegant solution than replacing via regex
9647
9734
  * TODO: [🍙] Make some standard order of json properties