@promptbook/markdown-utils 0.74.0-8 → 0.75.0-1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -11
- package/esm/index.es.js +102 -55
- package/esm/index.es.js.map +1 -1
- package/esm/typings/promptbook-collection/index.d.ts +3 -0
- package/esm/typings/src/_packages/core.index.d.ts +25 -1
- package/esm/typings/src/_packages/types.index.d.ts +10 -0
- package/esm/typings/src/_packages/utils.index.d.ts +4 -0
- package/esm/typings/src/cli/cli-commands/run.d.ts +1 -1
- package/esm/typings/src/cli/main.d.ts +4 -1
- package/esm/typings/src/cli/promptbookCli.d.ts +1 -1
- package/esm/typings/src/cli/test/ptbk.d.ts +1 -1
- package/esm/typings/src/collection/collectionToJson.test.d.ts +1 -1
- package/esm/typings/src/collection/constructors/createCollectionFromDirectory.d.ts +1 -1
- package/esm/typings/src/commands/BOOK_VERSION/BookVersionCommand.d.ts +1 -1
- package/esm/typings/src/commands/FOREACH/foreachCommandParser.d.ts +2 -2
- package/esm/typings/src/commands/FORMFACTOR/FormfactorCommand.d.ts +11 -0
- package/esm/typings/src/commands/FORMFACTOR/formfactorCommand.test.d.ts +1 -0
- package/esm/typings/src/commands/FORMFACTOR/formfactorCommandParser.d.ts +11 -0
- package/esm/typings/src/commands/_BOILERPLATE/boilerplateCommandParser.d.ts +1 -1
- package/esm/typings/src/commands/_common/types/CommandParser.d.ts +2 -0
- package/esm/typings/src/commands/index.d.ts +1 -1
- package/esm/typings/src/config.d.ts +7 -0
- package/esm/typings/src/conversion/pipelineJsonToString.d.ts +3 -3
- package/esm/typings/src/conversion/pipelineStringToJson.d.ts +2 -2
- package/esm/typings/src/conversion/pipelineStringToJsonSync.d.ts +2 -2
- package/esm/typings/src/conversion/utils/stringifyPipelineJson.d.ts +1 -1
- package/esm/typings/src/conversion/validation/_importPipeline.d.ts +7 -7
- package/esm/typings/src/formats/_common/FormatDefinition.d.ts +1 -1
- package/esm/typings/src/formats/_common/FormatSubvalueDefinition.d.ts +1 -1
- package/esm/typings/src/formfactors/_boilerplate/BoilerplateFormfactorDefinition.d.ts +14 -0
- package/esm/typings/src/formfactors/_common/AbstractFormfactorDefinition.d.ts +34 -0
- package/esm/typings/src/formfactors/_common/FormfactorDefinition.d.ts +5 -0
- package/esm/typings/src/formfactors/_common/string_formfactor_name.d.ts +5 -0
- package/esm/typings/src/formfactors/chat/ChatFormfactorDefinition.d.ts +15 -0
- package/esm/typings/src/formfactors/generic/GenericFormfactorDefinition.d.ts +14 -0
- package/esm/typings/src/formfactors/index.d.ts +39 -0
- package/esm/typings/src/formfactors/sheets/SheetsFormfactorDefinition.d.ts +14 -0
- package/esm/typings/src/formfactors/translator/TranslatorFormfactorDefinition.d.ts +14 -0
- package/esm/typings/src/pipeline/pipeline-interface/PipelineInterface.d.ts +22 -0
- package/esm/typings/src/pipeline/pipeline-interface/constants.d.ts +9 -0
- package/esm/typings/src/pipeline/pipeline-interface/getPipelineInterface.d.ts +11 -0
- package/esm/typings/src/pipeline/pipeline-interface/isPipelineImplementingInterface.d.ts +25 -0
- package/esm/typings/src/pipeline/pipeline-interface/isPipelineInterfacesEqual.d.ts +11 -0
- package/esm/typings/src/storage/blackhole/BlackholeStorage.d.ts +33 -0
- package/esm/typings/src/storage/memory/MemoryStorage.d.ts +1 -1
- package/esm/typings/src/storage/{memory/utils → utils}/PrefixStorage.d.ts +1 -1
- package/esm/typings/src/types/PipelineJson/PipelineJson.d.ts +11 -4
- package/esm/typings/src/types/PipelineJson/PreparationJson.d.ts +1 -1
- package/esm/typings/src/types/Prompt.d.ts +1 -1
- package/esm/typings/src/types/typeAliases.d.ts +2 -2
- package/esm/typings/src/utils/expectation-counters/constants.d.ts +15 -0
- package/esm/typings/src/utils/expectation-counters/countLines.d.ts +2 -0
- package/esm/typings/src/utils/expectation-counters/countPages.d.ts +2 -0
- package/package.json +1 -1
- package/umd/index.umd.js +102 -55
- package/umd/index.umd.js.map +1 -1
- /package/esm/typings/src/storage/{memory → local-storage}/utils/makePromptbookStorageFromWebStorage.d.ts +0 -0
package/README.md
CHANGED
|
@@ -18,7 +18,7 @@ Build responsible, controlled and transparent applications on top of LLM models!
|
|
|
18
18
|
|
|
19
19
|
## ✨ New Features
|
|
20
20
|
|
|
21
|
-
- 💙 Working
|
|
21
|
+
- 💙 Working [the **Book** language v1.0.0](https://github.com/webgptorg/book)
|
|
22
22
|
- 📚 Support of `.docx`, `.doc` and `.pdf` documents
|
|
23
23
|
- ✨ **Support of [OpenAI o1 model](https://openai.com/o1/)**
|
|
24
24
|
|
|
@@ -148,7 +148,7 @@ Following is the documentation and blueprint of the Book language.
|
|
|
148
148
|
|
|
149
149
|
File is designed to be easy to read and write. It is strict subset of markdown. It is designed to be understandable by both humans and machines and without specific knowledge of the language.
|
|
150
150
|
|
|
151
|
-
It has file with `.
|
|
151
|
+
It has file with `.book.md` or `.book` extension with `UTF-8` non BOM encoding.
|
|
152
152
|
|
|
153
153
|
As it is source code, it can leverage all the features of version control systems like git and does not suffer from the problems of binary formats, proprietary formats, or no-code solutions.
|
|
154
154
|
|
|
@@ -241,11 +241,6 @@ Or you can install them separately:
|
|
|
241
241
|
|
|
242
242
|
## 📚 Dictionary
|
|
243
243
|
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
244
|
### 📚 Dictionary
|
|
250
245
|
|
|
251
246
|
The following glossary is used to clarify certain concepts:
|
|
@@ -261,8 +256,6 @@ The following glossary is used to clarify certain concepts:
|
|
|
261
256
|
- **Retrieval-augmented generation** is a machine learning paradigm where a model generates text by retrieving relevant information from a large database of text. This approach combines the benefits of generative models and retrieval models.
|
|
262
257
|
- **Longtail** refers to non-common or rare events, items, or entities that are not well-represented in the training data of machine learning models. Longtail items are often challenging for models to predict accurately.
|
|
263
258
|
|
|
264
|
-
|
|
265
|
-
|
|
266
259
|
_Note: Thos section is not complete dictionary, more list of general AI / LLM terms that has connection with Promptbook_
|
|
267
260
|
|
|
268
261
|
#### Promptbook core
|
|
@@ -323,8 +316,6 @@ _Note: Thos section is not complete dictionary, more list of general AI / LLM te
|
|
|
323
316
|
- [👮 Agent adversary expectations](https://github.com/webgptorg/promptbook/discussions/39)
|
|
324
317
|
- [view more](https://github.com/webgptorg/promptbook/discussions/categories/concepts)
|
|
325
318
|
|
|
326
|
-
|
|
327
|
-
|
|
328
319
|
### Terms specific to Promptbook TypeScript implementation
|
|
329
320
|
|
|
330
321
|
- Anonymous mode
|
package/esm/index.es.js
CHANGED
|
@@ -20,7 +20,7 @@ var BOOK_LANGUAGE_VERSION = '1.0.0';
|
|
|
20
20
|
*
|
|
21
21
|
* @see https://github.com/webgptorg/promptbook
|
|
22
22
|
*/
|
|
23
|
-
var PROMPTBOOK_ENGINE_VERSION = '0.
|
|
23
|
+
var PROMPTBOOK_ENGINE_VERSION = '0.75.0-0';
|
|
24
24
|
/**
|
|
25
25
|
* TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
|
|
26
26
|
*/
|
|
@@ -355,7 +355,7 @@ function extractJsonBlock(markdown) {
|
|
|
355
355
|
* TODO: [🏢] Make this logic part of `JsonFormatDefinition` or `isValidJsonString`
|
|
356
356
|
*/
|
|
357
357
|
|
|
358
|
-
var PipelineCollection = [{title:"Prepare Knowledge from Markdown",pipelineUrl:"https://promptbook.studio/promptbook/prepare-knowledge-from-markdown.
|
|
358
|
+
var PipelineCollection = [{title:"Prepare Knowledge from Markdown",pipelineUrl:"https://promptbook.studio/promptbook/prepare-knowledge-from-markdown.book.md",formfactorName:"GENERIC",parameters:[{name:"knowledgeContent",description:"Markdown document content",isInput:true,isOutput:false},{name:"knowledgePieces",description:"The knowledge JSON object",isInput:false,isOutput:true}],templates:[{templateType:"PROMPT_TEMPLATE",name:"knowledge",title:"Knowledge",content:"You are experienced data researcher, extract the important knowledge from the document.\n\n# Rules\n\n- Make pieces of information concise, clear, and easy to understand\n- One piece of information should be approximately 1 paragraph\n- Divide the paragraphs by markdown horizontal lines ---\n- Omit irrelevant information\n- Group redundant information\n- Write just extracted information, nothing else\n\n# The document\n\nTake information from this document:\n\n> {knowledgeContent}",resultingParameterName:"knowledgePieces",dependentParameterNames:["knowledgeContent"]}],knowledgeSources:[],knowledgePieces:[],personas:[],preparations:[],sourceFile:"./promptbook-collection/prepare-knowledge-from-markdown.book.md"},{title:"Prepare Keywords",pipelineUrl:"https://promptbook.studio/promptbook/prepare-knowledge-keywords.book.md",formfactorName:"GENERIC",parameters:[{name:"knowledgePieceContent",description:"The content",isInput:true,isOutput:false},{name:"keywords",description:"Keywords separated by comma",isInput:false,isOutput:true}],templates:[{templateType:"PROMPT_TEMPLATE",name:"knowledge",title:"Knowledge",content:"You are experienced data researcher, detect the important keywords in the document.\n\n# Rules\n\n- Write just keywords separated by comma\n\n# The document\n\nTake information from this document:\n\n> {knowledgePieceContent}",resultingParameterName:"keywords",dependentParameterNames:["knowledgePieceContent"]}],knowledgeSources:[],knowledgePieces:[],personas:[],preparations:[],sourceFile:"./promptbook-collection/prepare-knowledge-keywords.book.md"},{title:"Prepare Title",pipelineUrl:"https://promptbook.studio/promptbook/prepare-knowledge-title.book.md",formfactorName:"GENERIC",parameters:[{name:"knowledgePieceContent",description:"The content",isInput:true,isOutput:false},{name:"title",description:"The title of the document",isInput:false,isOutput:true}],templates:[{templateType:"PROMPT_TEMPLATE",name:"knowledge",title:"Knowledge",content:"You are experienced content creator, write best title for the document.\n\n# Rules\n\n- Write just title, nothing else\n- Title should be concise and clear\n- Write maximum 5 words for the title\n\n# The document\n\n> {knowledgePieceContent}",resultingParameterName:"title",expectations:{words:{min:1,max:8}},dependentParameterNames:["knowledgePieceContent"]}],knowledgeSources:[],knowledgePieces:[],personas:[],preparations:[],sourceFile:"./promptbook-collection/prepare-knowledge-title.book.md"},{title:"Prepare Keywords",pipelineUrl:"https://promptbook.studio/promptbook/prepare-persona.book.md",formfactorName:"GENERIC",parameters:[{name:"availableModelNames",description:"List of available model names separated by comma (,)",isInput:true,isOutput:false},{name:"personaDescription",description:"Description of the persona",isInput:true,isOutput:false},{name:"modelRequirements",description:"Specific requirements for the model",isInput:false,isOutput:true}],templates:[{templateType:"PROMPT_TEMPLATE",name:"make-model-requirements",title:"Make modelRequirements",content:"You are experienced AI engineer, you need to create virtual assistant.\nWrite\n\n## Example\n\n```json\n{\n\"modelName\": \"gpt-4o\",\n\"systemMessage\": \"You are experienced AI engineer and helpfull assistant.\",\n\"temperature\": 0.7\n}\n```\n\n## Instructions\n\n- Your output format is JSON object\n- Write just the JSON object, no other text should be present\n- It contains the following keys:\n - `modelName`: The name of the model to use\n - `systemMessage`: The system message to provide context to the model\n - `temperature`: The sampling temperature to use\n\n### Key `modelName`\n\nPick from the following models:\n\n- {availableModelNames}\n\n### Key `systemMessage`\n\nThe system message is used to communicate instructions or provide context to the model at the beginning of a conversation. It is displayed in a different format compared to user messages, helping the model understand its role in the conversation. The system message typically guides the model's behavior, sets the tone, or specifies desired output from the model. By utilizing the system message effectively, users can steer the model towards generating more accurate and relevant responses.\n\nFor example:\n\n> You are an experienced AI engineer and helpful assistant.\n\n> You are a friendly and knowledgeable chatbot.\n\n### Key `temperature`\n\nThe sampling temperature, between 0 and 1. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic. If set to 0, the model will use log probability to automatically increase the temperature until certain thresholds are hit.\n\nYou can pick a value between 0 and 2. For example:\n\n- `0.1`: Low temperature, extremely conservative and deterministic\n- `0.5`: Medium temperature, balanced between conservative and creative\n- `1.0`: High temperature, creative and bit random\n- `1.5`: Very high temperature, extremely creative and often chaotic and unpredictable\n- `2.0`: Maximum temperature, completely random and unpredictable, for some extreme creative use cases\n\n# The assistant\n\nTake this description of the persona:\n\n> {personaDescription}",resultingParameterName:"modelRequirements",format:"JSON",dependentParameterNames:["availableModelNames","personaDescription"]}],knowledgeSources:[],knowledgePieces:[],personas:[],preparations:[],sourceFile:"./promptbook-collection/prepare-persona.book.md"}];
|
|
359
359
|
|
|
360
360
|
/**
|
|
361
361
|
* Prettify the html code
|
|
@@ -394,13 +394,13 @@ function prettifyMarkdown(content) {
|
|
|
394
394
|
/**
|
|
395
395
|
* Converts promptbook in JSON format to string format
|
|
396
396
|
*
|
|
397
|
-
* @param pipelineJson Promptbook in JSON format (.
|
|
398
|
-
* @returns Promptbook in string format (.
|
|
397
|
+
* @param pipelineJson Promptbook in JSON format (.book.json)
|
|
398
|
+
* @returns Promptbook in string format (.book.md)
|
|
399
399
|
* @public exported from `@promptbook/core`
|
|
400
400
|
*/
|
|
401
401
|
function pipelineJsonToString(pipelineJson) {
|
|
402
402
|
var e_1, _a, e_2, _b, e_3, _c, e_4, _d, e_5, _e, e_6, _f;
|
|
403
|
-
var title = pipelineJson.title, pipelineUrl = pipelineJson.pipelineUrl,
|
|
403
|
+
var title = pipelineJson.title, pipelineUrl = pipelineJson.pipelineUrl, bookVersion = pipelineJson.bookVersion, description = pipelineJson.description, parameters = pipelineJson.parameters, templates = pipelineJson.templates;
|
|
404
404
|
var pipelineString = "# ".concat(title);
|
|
405
405
|
if (description) {
|
|
406
406
|
pipelineString += '\n\n';
|
|
@@ -410,8 +410,10 @@ function pipelineJsonToString(pipelineJson) {
|
|
|
410
410
|
if (pipelineUrl) {
|
|
411
411
|
commands.push("PIPELINE URL ".concat(pipelineUrl));
|
|
412
412
|
}
|
|
413
|
-
|
|
414
|
-
|
|
413
|
+
if (bookVersion !== "undefined") {
|
|
414
|
+
commands.push("BOOK VERSION ".concat(bookVersion));
|
|
415
|
+
}
|
|
416
|
+
// TODO: [main] !!!!! This increases size of the bundle and is probbably not necessary
|
|
415
417
|
pipelineString = prettifyMarkdown(pipelineString);
|
|
416
418
|
try {
|
|
417
419
|
for (var _g = __values(parameters.filter(function (_a) {
|
|
@@ -591,7 +593,7 @@ function templateParameterJsonToString(templateParameterJson) {
|
|
|
591
593
|
* TODO: [🧠] Is there a way to auto-detect missing features in pipelineJsonToString
|
|
592
594
|
* TODO: [🏛] Maybe make some markdown builder
|
|
593
595
|
* TODO: [🏛] Escape all
|
|
594
|
-
* TODO: [🧠] Should be in generated .
|
|
596
|
+
* TODO: [🧠] Should be in generated .book.md file GENERATOR_WARNING
|
|
595
597
|
*/
|
|
596
598
|
|
|
597
599
|
/**
|
|
@@ -813,6 +815,13 @@ function $asDeeplyFrozenSerializableJson(name, objectValue) {
|
|
|
813
815
|
* @private within the repository
|
|
814
816
|
*/
|
|
815
817
|
var GENERATOR_WARNING = "\u26A0\uFE0F WARNING: This code has been generated so that any manual changes will be overwritten";
|
|
818
|
+
// <- TODO: [🐊] Pick the best claim
|
|
819
|
+
/**
|
|
820
|
+
* When the title is not provided, the default title is used
|
|
821
|
+
*
|
|
822
|
+
* @public exported from `@promptbook/core`
|
|
823
|
+
*/
|
|
824
|
+
var DEFAULT_TITLE = "Untitled";
|
|
816
825
|
// <- TODO: [🧠] Better system for generator warnings - not always "code" and "by `@promptbook/cli`"
|
|
817
826
|
/**
|
|
818
827
|
* The maximum number of iterations for a loops
|
|
@@ -901,6 +910,7 @@ var IS_PIPELINE_LOGIC_VALIDATED = just(
|
|
|
901
910
|
// Note: In normal situations, we check the pipeline logic:
|
|
902
911
|
true);
|
|
903
912
|
/**
|
|
913
|
+
* TODO: Extract `constants.ts` from `config.ts`
|
|
904
914
|
* TODO: [🧠][🧜♂️] Maybe join remoteUrl and path into single value
|
|
905
915
|
*/
|
|
906
916
|
|
|
@@ -1058,7 +1068,7 @@ function isValidPipelineUrl(url) {
|
|
|
1058
1068
|
if (!url.startsWith('https://')) {
|
|
1059
1069
|
return false;
|
|
1060
1070
|
}
|
|
1061
|
-
if (!(url.endsWith('.book.md') || url.endsWith('.book') || url.endsWith('.
|
|
1071
|
+
if (!(url.endsWith('.book.md') || url.endsWith('.book') || url.endsWith('.book.md') || url.endsWith('.ptbk'))) {
|
|
1062
1072
|
return false;
|
|
1063
1073
|
}
|
|
1064
1074
|
if (url.includes('#')) {
|
|
@@ -1127,9 +1137,9 @@ function validatePipelineCore(pipeline) {
|
|
|
1127
1137
|
// <- Note: [🚲]
|
|
1128
1138
|
throw new PipelineLogicError(spaceTrim$1(function (block) { return "\n Invalid promptbook URL \"".concat(pipeline.pipelineUrl, "\"\n\n ").concat(block(pipelineIdentification), "\n "); }));
|
|
1129
1139
|
}
|
|
1130
|
-
if (pipeline.
|
|
1140
|
+
if (pipeline.bookVersion !== undefined && !isValidPromptbookVersion(pipeline.bookVersion)) {
|
|
1131
1141
|
// <- Note: [🚲]
|
|
1132
|
-
throw new PipelineLogicError(spaceTrim$1(function (block) { return "\n Invalid Promptbook Version \"".concat(pipeline.
|
|
1142
|
+
throw new PipelineLogicError(spaceTrim$1(function (block) { return "\n Invalid Promptbook Version \"".concat(pipeline.bookVersion, "\"\n\n ").concat(block(pipelineIdentification), "\n "); }));
|
|
1133
1143
|
}
|
|
1134
1144
|
// TODO: [🧠] Maybe do here some propper JSON-schema / ZOD checking
|
|
1135
1145
|
if (!Array.isArray(pipeline.parameters)) {
|
|
@@ -1143,18 +1153,18 @@ function validatePipelineCore(pipeline) {
|
|
|
1143
1153
|
}
|
|
1144
1154
|
var _loop_1 = function (parameter) {
|
|
1145
1155
|
if (parameter.isInput && parameter.isOutput) {
|
|
1146
|
-
throw new PipelineLogicError(spaceTrim$1(function (block) { return "\n\n Parameter {".concat(parameter.name, "} can not be both input and output\n\n ").concat(block(pipelineIdentification), "\n "); }));
|
|
1156
|
+
throw new PipelineLogicError(spaceTrim$1(function (block) { return "\n\n Parameter `{".concat(parameter.name, "}` can not be both input and output\n\n ").concat(block(pipelineIdentification), "\n "); }));
|
|
1147
1157
|
}
|
|
1148
1158
|
// Note: Testing that parameter is either intermediate or output BUT not created and unused
|
|
1149
1159
|
if (!parameter.isInput &&
|
|
1150
1160
|
!parameter.isOutput &&
|
|
1151
1161
|
!pipeline.templates.some(function (template) { return template.dependentParameterNames.includes(parameter.name); })) {
|
|
1152
|
-
throw new PipelineLogicError(spaceTrim$1(function (block) { return "\n Parameter {".concat(parameter.name, "} is created but not used\n\n You can declare {").concat(parameter.name, "} as output parameter by adding in the header:\n - OUTPUT PARAMETER `{").concat(parameter.name, "}` ").concat(parameter.description || '', "\n\n ").concat(block(pipelineIdentification), "\n\n "); }));
|
|
1162
|
+
throw new PipelineLogicError(spaceTrim$1(function (block) { return "\n Parameter `{".concat(parameter.name, "}` is created but not used\n\n You can declare {").concat(parameter.name, "} as output parameter by adding in the header:\n - OUTPUT PARAMETER `{").concat(parameter.name, "}` ").concat(parameter.description || '', "\n\n ").concat(block(pipelineIdentification), "\n\n "); }));
|
|
1153
1163
|
}
|
|
1154
1164
|
// Note: Testing that parameter is either input or result of some template
|
|
1155
1165
|
if (!parameter.isInput &&
|
|
1156
1166
|
!pipeline.templates.some(function (template) { return template.resultingParameterName === parameter.name; })) {
|
|
1157
|
-
throw new PipelineLogicError(spaceTrim$1(function (block) { return "\n Parameter {".concat(parameter.name, "} is declared but not defined\n\n You can do one of these:\n 1) Remove declaration of {").concat(parameter.name, "}
|
|
1167
|
+
throw new PipelineLogicError(spaceTrim$1(function (block) { return "\n Parameter `{".concat(parameter.name, "}` is declared but not defined\n\n You can do one of these:\n 1) Remove declaration of `{").concat(parameter.name, "}`\n 2) Add template that results in `-> {").concat(parameter.name, "}`\n\n ").concat(block(pipelineIdentification), "\n "); }));
|
|
1158
1168
|
}
|
|
1159
1169
|
};
|
|
1160
1170
|
try {
|
|
@@ -1182,7 +1192,7 @@ function validatePipelineCore(pipeline) {
|
|
|
1182
1192
|
var _loop_2 = function (template) {
|
|
1183
1193
|
var e_4, _h, e_5, _j;
|
|
1184
1194
|
if (definedParameters.has(template.resultingParameterName)) {
|
|
1185
|
-
throw new PipelineLogicError(spaceTrim$1(function (block) { return "\n Parameter {".concat(template.resultingParameterName, "} is defined multiple times\n\n ").concat(block(pipelineIdentification), "\n "); }));
|
|
1195
|
+
throw new PipelineLogicError(spaceTrim$1(function (block) { return "\n Parameter `{".concat(template.resultingParameterName, "}` is defined multiple times\n\n ").concat(block(pipelineIdentification), "\n "); }));
|
|
1186
1196
|
}
|
|
1187
1197
|
if (RESERVED_PARAMETER_NAMES.includes(template.resultingParameterName)) {
|
|
1188
1198
|
throw new PipelineLogicError(spaceTrim$1(function (block) { return "\n Parameter name {".concat(template.resultingParameterName, "} is reserved, please use different name\n\n ").concat(block(pipelineIdentification), "\n "); }));
|
|
@@ -1195,7 +1205,7 @@ function validatePipelineCore(pipeline) {
|
|
|
1195
1205
|
}
|
|
1196
1206
|
var _loop_4 = function (joker) {
|
|
1197
1207
|
if (!template.dependentParameterNames.includes(joker)) {
|
|
1198
|
-
throw new PipelineLogicError(spaceTrim$1(function (block) { return "\n Parameter {".concat(joker, "} is used for {").concat(template.resultingParameterName, "} as joker but not in `dependentParameterNames`\n\n ").concat(block(pipelineIdentification), "\n "); }));
|
|
1208
|
+
throw new PipelineLogicError(spaceTrim$1(function (block) { return "\n Parameter `{".concat(joker, "}` is used for {").concat(template.resultingParameterName, "} as joker but not in `dependentParameterNames`\n\n ").concat(block(pipelineIdentification), "\n "); }));
|
|
1199
1209
|
}
|
|
1200
1210
|
};
|
|
1201
1211
|
try {
|
|
@@ -1290,14 +1300,24 @@ function validatePipelineCore(pipeline) {
|
|
|
1290
1300
|
if (currentlyResovedTemplates.length === 0) {
|
|
1291
1301
|
throw new PipelineLogicError(
|
|
1292
1302
|
// TODO: [🐎] DRY
|
|
1293
|
-
spaceTrim$1(function (block) { return "\n\n Can not resolve some parameters:\n Either you are using a parameter that is not defined, or there are some circular dependencies.\n\n ".concat(block(pipelineIdentification), "\n\n Can not resolve
|
|
1303
|
+
spaceTrim$1(function (block) { return "\n\n Can not resolve some parameters:\n Either you are using a parameter that is not defined, or there are some circular dependencies.\n\n ".concat(block(pipelineIdentification), "\n\n **Can not resolve:**\n ").concat(block(unresovedTemplates
|
|
1294
1304
|
.map(function (_a) {
|
|
1295
1305
|
var resultingParameterName = _a.resultingParameterName, dependentParameterNames = _a.dependentParameterNames;
|
|
1296
|
-
return "- Parameter {".concat(resultingParameterName, "} which depends on ").concat(dependentParameterNames
|
|
1297
|
-
.map(function (dependentParameterName) { return "{".concat(dependentParameterName, "}"); })
|
|
1306
|
+
return "- Parameter `{".concat(resultingParameterName, "}` which depends on ").concat(dependentParameterNames
|
|
1307
|
+
.map(function (dependentParameterName) { return "`{".concat(dependentParameterName, "}`"); })
|
|
1298
1308
|
.join(' and '));
|
|
1299
1309
|
})
|
|
1300
|
-
.join('\n')), "\n\n Resolved
|
|
1310
|
+
.join('\n')), "\n\n **Resolved:**\n ").concat(block(resovedParameters
|
|
1311
|
+
.filter(function (name) {
|
|
1312
|
+
return !RESERVED_PARAMETER_NAMES.includes(name);
|
|
1313
|
+
})
|
|
1314
|
+
.map(function (name) { return "- Parameter `{".concat(name, "}`"); })
|
|
1315
|
+
.join('\n')), "\n\n\n **Reserved (which are available):**\n ").concat(block(resovedParameters
|
|
1316
|
+
.filter(function (name) {
|
|
1317
|
+
return RESERVED_PARAMETER_NAMES.includes(name);
|
|
1318
|
+
})
|
|
1319
|
+
.map(function (name) { return "- Parameter `{".concat(name, "}`"); })
|
|
1320
|
+
.join('\n')), "\n\n\n "); }));
|
|
1301
1321
|
}
|
|
1302
1322
|
resovedParameters = __spreadArray(__spreadArray([], __read(resovedParameters), false), __read(currentlyResovedTemplates.map(function (_a) {
|
|
1303
1323
|
var resultingParameterName = _a.resultingParameterName;
|
|
@@ -1308,6 +1328,7 @@ function validatePipelineCore(pipeline) {
|
|
|
1308
1328
|
while (unresovedTemplates.length > 0) {
|
|
1309
1329
|
_loop_3();
|
|
1310
1330
|
}
|
|
1331
|
+
// TODO: !!!!!! Test that pipeline interface implements declared formfactor interface
|
|
1311
1332
|
}
|
|
1312
1333
|
/**
|
|
1313
1334
|
* TODO: !! [🧞♀️] Do not allow joker + foreach
|
|
@@ -2663,8 +2684,8 @@ var MultipleLlmExecutionTools = /** @class */ (function () {
|
|
|
2663
2684
|
else if (errors.length > 1) {
|
|
2664
2685
|
throw new PipelineExecutionError(
|
|
2665
2686
|
// TODO: Tell which execution tools failed like
|
|
2666
|
-
// 1) OpenAI throw PipelineExecutionError: Parameter {knowledge} is not defined
|
|
2667
|
-
// 2) AnthropicClaude throw PipelineExecutionError: Parameter {knowledge} is not defined
|
|
2687
|
+
// 1) OpenAI throw PipelineExecutionError: Parameter `{knowledge}` is not defined
|
|
2688
|
+
// 2) AnthropicClaude throw PipelineExecutionError: Parameter `{knowledge}` is not defined
|
|
2668
2689
|
// 3) ...
|
|
2669
2690
|
spaceTrim(function (block) { return "\n All execution tools failed:\n\n ".concat(block(errors
|
|
2670
2691
|
.map(function (error, i) { return "".concat(i + 1, ") **").concat(error.name || 'Error', ":** ").concat(error.message); })
|
|
@@ -2778,7 +2799,7 @@ function preparePersona(personaDescription, tools, options) {
|
|
|
2778
2799
|
collection = createCollectionFromJson.apply(void 0, __spreadArray([], __read(PipelineCollection), false));
|
|
2779
2800
|
_b = createPipelineExecutor;
|
|
2780
2801
|
_c = {};
|
|
2781
|
-
return [4 /*yield*/, collection.getPipelineByUrl('https://promptbook.studio/promptbook/prepare-persona.
|
|
2802
|
+
return [4 /*yield*/, collection.getPipelineByUrl('https://promptbook.studio/promptbook/prepare-persona.book.md')];
|
|
2782
2803
|
case 1:
|
|
2783
2804
|
preparePersonaExecutor = _b.apply(void 0, [(_c.pipeline = _d.sent(),
|
|
2784
2805
|
_c.tools = tools,
|
|
@@ -3450,13 +3471,14 @@ TODO: [🧊] This is how it can look in future
|
|
|
3450
3471
|
*/
|
|
3451
3472
|
function clonePipeline(pipeline) {
|
|
3452
3473
|
// Note: Not using spread operator (...) because @@@
|
|
3453
|
-
var pipelineUrl = pipeline.pipelineUrl, sourceFile = pipeline.sourceFile, title = pipeline.title,
|
|
3474
|
+
var pipelineUrl = pipeline.pipelineUrl, sourceFile = pipeline.sourceFile, title = pipeline.title, bookVersion = pipeline.bookVersion, description = pipeline.description, formfactorName = pipeline.formfactorName, parameters = pipeline.parameters, templates = pipeline.templates, knowledgeSources = pipeline.knowledgeSources, knowledgePieces = pipeline.knowledgePieces, personas = pipeline.personas, preparations = pipeline.preparations;
|
|
3454
3475
|
return {
|
|
3455
3476
|
pipelineUrl: pipelineUrl,
|
|
3456
3477
|
sourceFile: sourceFile,
|
|
3457
3478
|
title: title,
|
|
3458
|
-
|
|
3479
|
+
bookVersion: bookVersion,
|
|
3459
3480
|
description: description,
|
|
3481
|
+
formfactorName: formfactorName,
|
|
3460
3482
|
parameters: parameters,
|
|
3461
3483
|
templates: templates,
|
|
3462
3484
|
knowledgeSources: knowledgeSources,
|
|
@@ -4184,11 +4206,11 @@ function replaceParameters(template, parameters) {
|
|
|
4184
4206
|
for (var _b = __values(Object.entries(parameters)), _c = _b.next(); !_c.done; _c = _b.next()) {
|
|
4185
4207
|
var _d = __read(_c.value, 2), parameterName = _d[0], parameterValue = _d[1];
|
|
4186
4208
|
if (parameterValue === RESERVED_PARAMETER_MISSING_VALUE) {
|
|
4187
|
-
throw new UnexpectedError("Parameter {".concat(parameterName, "} has missing value"));
|
|
4209
|
+
throw new UnexpectedError("Parameter `{".concat(parameterName, "}` has missing value"));
|
|
4188
4210
|
}
|
|
4189
4211
|
else if (parameterValue === RESERVED_PARAMETER_RESTRICTED) {
|
|
4190
4212
|
// TODO: [🍵]
|
|
4191
|
-
throw new UnexpectedError("Parameter {".concat(parameterName, "} is restricted to use"));
|
|
4213
|
+
throw new UnexpectedError("Parameter `{".concat(parameterName, "}` is restricted to use"));
|
|
4192
4214
|
}
|
|
4193
4215
|
}
|
|
4194
4216
|
}
|
|
@@ -4215,11 +4237,11 @@ function replaceParameters(template, parameters) {
|
|
|
4215
4237
|
throw new PipelineExecutionError('Parameter is already opened or not closed');
|
|
4216
4238
|
}
|
|
4217
4239
|
if (parameters[parameterName] === undefined) {
|
|
4218
|
-
throw new PipelineExecutionError("Parameter {".concat(parameterName, "} is not defined"));
|
|
4240
|
+
throw new PipelineExecutionError("Parameter `{".concat(parameterName, "}` is not defined"));
|
|
4219
4241
|
}
|
|
4220
4242
|
var parameterValue = parameters[parameterName];
|
|
4221
4243
|
if (parameterValue === undefined) {
|
|
4222
|
-
throw new PipelineExecutionError("Parameter {".concat(parameterName, "} is not defined"));
|
|
4244
|
+
throw new PipelineExecutionError("Parameter `{".concat(parameterName, "}` is not defined"));
|
|
4223
4245
|
}
|
|
4224
4246
|
parameterValue = parameterValue.toString();
|
|
4225
4247
|
if (parameterValue.includes('\n') && /^\s*\W{0,3}\s*$/.test(precol)) {
|
|
@@ -4263,30 +4285,45 @@ function countCharacters(text) {
|
|
|
4263
4285
|
return text.length;
|
|
4264
4286
|
}
|
|
4265
4287
|
|
|
4288
|
+
/**
|
|
4289
|
+
* Number of characters per standard line with 11pt Arial font size.
|
|
4290
|
+
*
|
|
4291
|
+
* @public exported from `@promptbook/utils`
|
|
4292
|
+
*/
|
|
4293
|
+
var CHARACTERS_PER_STANDARD_LINE = 63;
|
|
4294
|
+
/**
|
|
4295
|
+
* Number of lines per standard A4 page with 11pt Arial font size and standard margins and spacing.
|
|
4296
|
+
*
|
|
4297
|
+
* @public exported from `@promptbook/utils`
|
|
4298
|
+
*/
|
|
4299
|
+
var LINES_PER_STANDARD_PAGE = 44;
|
|
4300
|
+
/**
|
|
4301
|
+
* TODO: [🧠] Should be this `constants.ts` or `config.ts`?
|
|
4302
|
+
*/
|
|
4303
|
+
|
|
4266
4304
|
/**
|
|
4267
4305
|
* Counts number of lines in the text
|
|
4268
4306
|
*
|
|
4307
|
+
* Note: This does not check only for the presence of newlines, but also for the length of the standard line.
|
|
4308
|
+
*
|
|
4269
4309
|
* @public exported from `@promptbook/utils`
|
|
4270
4310
|
*/
|
|
4271
4311
|
function countLines(text) {
|
|
4272
|
-
|
|
4273
|
-
|
|
4274
|
-
|
|
4275
|
-
return
|
|
4312
|
+
text = text.replace('\r\n', '\n');
|
|
4313
|
+
text = text.replace('\r', '\n');
|
|
4314
|
+
var lines = text.split('\n');
|
|
4315
|
+
return lines.reduce(function (count, line) { return count + Math.ceil(line.length / CHARACTERS_PER_STANDARD_LINE); }, 0);
|
|
4276
4316
|
}
|
|
4277
4317
|
|
|
4278
4318
|
/**
|
|
4279
4319
|
* Counts number of pages in the text
|
|
4280
4320
|
*
|
|
4321
|
+
* 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.
|
|
4322
|
+
*
|
|
4281
4323
|
* @public exported from `@promptbook/utils`
|
|
4282
4324
|
*/
|
|
4283
4325
|
function countPages(text) {
|
|
4284
|
-
|
|
4285
|
-
return 0;
|
|
4286
|
-
}
|
|
4287
|
-
var pagesByLinesCount = Math.ceil(countLines(text) / 44);
|
|
4288
|
-
var pagesByCharactersCount = Math.ceil(countCharacters(text) / 2772);
|
|
4289
|
-
return Math.max(pagesByLinesCount, pagesByCharactersCount);
|
|
4326
|
+
return Math.ceil(countLines(text) / LINES_PER_STANDARD_PAGE);
|
|
4290
4327
|
}
|
|
4291
4328
|
|
|
4292
4329
|
/**
|
|
@@ -4566,7 +4603,7 @@ function executeAttempts(options) {
|
|
|
4566
4603
|
promptTitle: template.title,
|
|
4567
4604
|
promptMessage: replaceParameters(template.description || '', parameters),
|
|
4568
4605
|
defaultValue: replaceParameters(preparedContent, parameters),
|
|
4569
|
-
// TODO: [🧠] !! Figure out how to define placeholder in .
|
|
4606
|
+
// TODO: [🧠] !! Figure out how to define placeholder in .book.md file
|
|
4570
4607
|
placeholder: undefined,
|
|
4571
4608
|
priority: priority,
|
|
4572
4609
|
}))];
|
|
@@ -4994,7 +5031,7 @@ function executeTemplate(options) {
|
|
|
4994
5031
|
else if (!definedParameterNames.has(parameterName) && usedParameterNames.has(parameterName)) {
|
|
4995
5032
|
// Houston, we have a problem
|
|
4996
5033
|
// Note: Checking part is also done in `validatePipeline`, but it’s good to doublecheck
|
|
4997
|
-
throw new UnexpectedError(spaceTrim$1(function (block) { return "\n Parameter {".concat(parameterName, "} is NOT defined\n BUT used in template \"").concat(currentTemplate.title || currentTemplate.name, "\"\n\n This should be catched in `validatePipeline`\n\n ").concat(block(pipelineIdentification), "\n\n "); }));
|
|
5034
|
+
throw new UnexpectedError(spaceTrim$1(function (block) { return "\n Parameter `{".concat(parameterName, "}` is NOT defined\n BUT used in template \"").concat(currentTemplate.title || currentTemplate.name, "\"\n\n This should be catched in `validatePipeline`\n\n ").concat(block(pipelineIdentification), "\n\n "); }));
|
|
4998
5035
|
}
|
|
4999
5036
|
};
|
|
5000
5037
|
try {
|
|
@@ -5073,7 +5110,7 @@ function filterJustOutputParameters(options) {
|
|
|
5073
5110
|
var _loop_1 = function (parameter) {
|
|
5074
5111
|
if (parametersToPass[parameter.name] === undefined) {
|
|
5075
5112
|
// [4]
|
|
5076
|
-
$warnings.push(new PipelineExecutionError(spaceTrim$1(function (block) { return "\n Parameter {".concat(parameter.name, "} should be an output parameter, but it was not generated during pipeline execution\n\n ").concat(block(pipelineIdentification), "\n "); })));
|
|
5113
|
+
$warnings.push(new PipelineExecutionError(spaceTrim$1(function (block) { return "\n Parameter `{".concat(parameter.name, "}` should be an output parameter, but it was not generated during pipeline execution\n\n ").concat(block(pipelineIdentification), "\n "); })));
|
|
5077
5114
|
return "continue";
|
|
5078
5115
|
}
|
|
5079
5116
|
outputParameters[parameter.name] = parametersToPass[parameter.name] || '';
|
|
@@ -5132,7 +5169,7 @@ function executePipeline(options) {
|
|
|
5132
5169
|
pipelineUrl: preparedPipeline.pipelineUrl,
|
|
5133
5170
|
title: preparedPipeline.title,
|
|
5134
5171
|
promptbookUsedVersion: PROMPTBOOK_ENGINE_VERSION,
|
|
5135
|
-
promptbookRequestedVersion: preparedPipeline.
|
|
5172
|
+
promptbookRequestedVersion: preparedPipeline.bookVersion,
|
|
5136
5173
|
description: preparedPipeline.description,
|
|
5137
5174
|
promptExecutions: [],
|
|
5138
5175
|
};
|
|
@@ -5160,7 +5197,7 @@ function executePipeline(options) {
|
|
|
5160
5197
|
case 6: return [2 /*return*/, $asDeeplyFrozenSerializableJson("Unuccessful PipelineExecutorResult (with missing parameter {".concat(parameter.name, "}) PipelineExecutorResult"), {
|
|
5161
5198
|
isSuccessful: false,
|
|
5162
5199
|
errors: __spreadArray([
|
|
5163
|
-
new PipelineExecutionError("Parameter {".concat(parameter.name, "} is required as an input parameter"))
|
|
5200
|
+
new PipelineExecutionError("Parameter `{".concat(parameter.name, "}` is required as an input parameter"))
|
|
5164
5201
|
], __read(errors), false).map(serializeError),
|
|
5165
5202
|
warnings: [],
|
|
5166
5203
|
executionReport: executionReport,
|
|
@@ -5208,7 +5245,7 @@ function executePipeline(options) {
|
|
|
5208
5245
|
case 3: return [2 /*return*/, { value: $asDeeplyFrozenSerializableJson(spaceTrim$1(function (block) { return "\n Unuccessful PipelineExecutorResult (with extra parameter {".concat(parameter.name, "}) PipelineExecutorResult\n\n ").concat(block(pipelineIdentification), "\n "); }), {
|
|
5209
5246
|
isSuccessful: false,
|
|
5210
5247
|
errors: __spreadArray([
|
|
5211
|
-
new PipelineExecutionError(spaceTrim$1(function (block) { return "\n Parameter {".concat(parameter.name, "} is passed as input parameter but it is not input\n\n ").concat(block(pipelineIdentification), "\n "); }))
|
|
5248
|
+
new PipelineExecutionError(spaceTrim$1(function (block) { return "\n Parameter `{".concat(parameter.name, "}` is passed as input parameter but it is not input\n\n ").concat(block(pipelineIdentification), "\n "); }))
|
|
5212
5249
|
], __read(errors), false).map(serializeError),
|
|
5213
5250
|
warnings: warnings.map(serializeError),
|
|
5214
5251
|
executionReport: executionReport,
|
|
@@ -5282,14 +5319,24 @@ function executePipeline(options) {
|
|
|
5282
5319
|
if (!(!currentTemplate && resolving_1.length === 0)) return [3 /*break*/, 1];
|
|
5283
5320
|
throw new UnexpectedError(
|
|
5284
5321
|
// TODO: [🐎] DRY
|
|
5285
|
-
spaceTrim$1(function (block) { return "\n Can not resolve some parameters:\n\n ".concat(block(pipelineIdentification), "\n\n Can not resolve
|
|
5322
|
+
spaceTrim$1(function (block) { return "\n Can not resolve some parameters:\n\n ".concat(block(pipelineIdentification), "\n\n **Can not resolve:**\n ").concat(block(unresovedTemplates_1
|
|
5286
5323
|
.map(function (_a) {
|
|
5287
5324
|
var resultingParameterName = _a.resultingParameterName, dependentParameterNames = _a.dependentParameterNames;
|
|
5288
|
-
return "- Parameter {".concat(resultingParameterName, "} which depends on ").concat(dependentParameterNames
|
|
5289
|
-
.map(function (dependentParameterName) { return "{".concat(dependentParameterName, "}"); })
|
|
5325
|
+
return "- Parameter `{".concat(resultingParameterName, "}` which depends on ").concat(dependentParameterNames
|
|
5326
|
+
.map(function (dependentParameterName) { return "`{".concat(dependentParameterName, "}`"); })
|
|
5290
5327
|
.join(' and '));
|
|
5291
5328
|
})
|
|
5292
|
-
.join('\n')), "\n\n Resolved
|
|
5329
|
+
.join('\n')), "\n\n **Resolved:**\n ").concat(block(resovedParameterNames_1
|
|
5330
|
+
.filter(function (name) {
|
|
5331
|
+
return !RESERVED_PARAMETER_NAMES.includes(name);
|
|
5332
|
+
})
|
|
5333
|
+
.map(function (name) { return "- Parameter `{".concat(name, "}`"); })
|
|
5334
|
+
.join('\n')), "\n\n **Reserved (which are available):**\n ").concat(block(resovedParameterNames_1
|
|
5335
|
+
.filter(function (name) {
|
|
5336
|
+
return RESERVED_PARAMETER_NAMES.includes(name);
|
|
5337
|
+
})
|
|
5338
|
+
.map(function (name) { return "- Parameter `{".concat(name, "}`"); })
|
|
5339
|
+
.join('\n')), "\n\n *Note: This should be catched in `validatePipeline`*\n "); }));
|
|
5293
5340
|
case 1:
|
|
5294
5341
|
if (!!currentTemplate) return [3 /*break*/, 3];
|
|
5295
5342
|
/* [🤹♂️] */ return [4 /*yield*/, Promise.race(resolving_1)];
|
|
@@ -5528,7 +5575,7 @@ var MarkdownScraper = /** @class */ (function () {
|
|
|
5528
5575
|
collection = createCollectionFromJson.apply(void 0, __spreadArray([], __read(PipelineCollection), false));
|
|
5529
5576
|
_d = createPipelineExecutor;
|
|
5530
5577
|
_g = {};
|
|
5531
|
-
return [4 /*yield*/, collection.getPipelineByUrl('https://promptbook.studio/promptbook/prepare-knowledge-from-markdown.
|
|
5578
|
+
return [4 /*yield*/, collection.getPipelineByUrl('https://promptbook.studio/promptbook/prepare-knowledge-from-markdown.book.md')];
|
|
5532
5579
|
case 1:
|
|
5533
5580
|
prepareKnowledgeFromMarkdownExecutor = _d.apply(void 0, [(_g.pipeline = _k.sent(),
|
|
5534
5581
|
_g.tools = {
|
|
@@ -5537,7 +5584,7 @@ var MarkdownScraper = /** @class */ (function () {
|
|
|
5537
5584
|
_g)]);
|
|
5538
5585
|
_e = createPipelineExecutor;
|
|
5539
5586
|
_h = {};
|
|
5540
|
-
return [4 /*yield*/, collection.getPipelineByUrl('https://promptbook.studio/promptbook/prepare-knowledge-title.
|
|
5587
|
+
return [4 /*yield*/, collection.getPipelineByUrl('https://promptbook.studio/promptbook/prepare-knowledge-title.book.md')];
|
|
5541
5588
|
case 2:
|
|
5542
5589
|
prepareTitleExecutor = _e.apply(void 0, [(_h.pipeline = _k.sent(),
|
|
5543
5590
|
_h.tools = {
|
|
@@ -5546,7 +5593,7 @@ var MarkdownScraper = /** @class */ (function () {
|
|
|
5546
5593
|
_h)]);
|
|
5547
5594
|
_f = createPipelineExecutor;
|
|
5548
5595
|
_j = {};
|
|
5549
|
-
return [4 /*yield*/, collection.getPipelineByUrl('https://promptbook.studio/promptbook/prepare-knowledge-keywords.
|
|
5596
|
+
return [4 /*yield*/, collection.getPipelineByUrl('https://promptbook.studio/promptbook/prepare-knowledge-keywords.book.md')];
|
|
5550
5597
|
case 3:
|
|
5551
5598
|
prepareKeywordsExecutor = _f.apply(void 0, [(_j.pipeline = _k.sent(),
|
|
5552
5599
|
_j.tools = {
|
|
@@ -5904,7 +5951,7 @@ function splitMarkdownIntoSections(markdown) {
|
|
|
5904
5951
|
return;
|
|
5905
5952
|
}
|
|
5906
5953
|
if (!section.startsWith('#')) {
|
|
5907
|
-
section = "#
|
|
5954
|
+
section = "# ".concat(DEFAULT_TITLE, "\n\n").concat(section);
|
|
5908
5955
|
}
|
|
5909
5956
|
sections.push(section);
|
|
5910
5957
|
buffer = [];
|
|
@@ -5968,7 +6015,7 @@ function flattenMarkdown(markdown) {
|
|
|
5968
6015
|
var e_1, _a;
|
|
5969
6016
|
var sections = splitMarkdownIntoSections(markdown);
|
|
5970
6017
|
if (sections.length === 0) {
|
|
5971
|
-
return
|
|
6018
|
+
return "# ".concat(DEFAULT_TITLE);
|
|
5972
6019
|
}
|
|
5973
6020
|
var flattenedMarkdown = '';
|
|
5974
6021
|
var parsedSections = sections.map(parseMarkdownSection);
|
|
@@ -5979,7 +6026,7 @@ function flattenMarkdown(markdown) {
|
|
|
5979
6026
|
}
|
|
5980
6027
|
else {
|
|
5981
6028
|
parsedSections.unshift(firstSection);
|
|
5982
|
-
flattenedMarkdown += "#
|
|
6029
|
+
flattenedMarkdown += "# ".concat(DEFAULT_TITLE) + "\n\n"; // <- [🧠] Maybe 3 new lines?
|
|
5983
6030
|
}
|
|
5984
6031
|
try {
|
|
5985
6032
|
for (var parsedSections_1 = __values(parsedSections), parsedSections_1_1 = parsedSections_1.next(); !parsedSections_1_1.done; parsedSections_1_1 = parsedSections_1.next()) {
|