@promptbook/markdown-utils 0.78.4 โ†’ 0.80.0-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 +4 -0
  2. package/esm/index.es.js +400 -321
  3. package/esm/index.es.js.map +1 -1
  4. package/esm/typings/books/index.d.ts +6 -6
  5. package/esm/typings/src/_packages/core.index.d.ts +4 -2
  6. package/esm/typings/src/_packages/types.index.d.ts +10 -0
  7. package/esm/typings/src/_packages/utils.index.d.ts +4 -0
  8. package/esm/typings/src/cli/cli-commands/runInteractiveChatbot.d.ts +32 -0
  9. package/esm/typings/src/commands/_common/types/CommandParser.d.ts +5 -2
  10. package/esm/typings/src/config.d.ts +0 -25
  11. package/esm/typings/src/constants.d.ts +35 -0
  12. package/esm/typings/src/conversion/pipelineJsonToString.d.ts +1 -0
  13. package/esm/typings/src/conversion/pipelineStringToJsonSync.d.ts +1 -0
  14. package/esm/typings/src/formfactors/generator/GeneratorFormfactorDefinition.d.ts +6 -1
  15. package/esm/typings/src/formfactors/index.d.ts +12 -2
  16. package/esm/typings/src/formfactors/matcher/MatcherFormfactorDefinition.d.ts +6 -1
  17. package/esm/typings/src/high-level-abstractions/_common/HighLevelAbstraction.d.ts +20 -0
  18. package/esm/typings/src/high-level-abstractions/implicit-formfactor/ImplicitFormfactorHla.d.ts +10 -0
  19. package/esm/typings/src/high-level-abstractions/index.d.ts +44 -0
  20. package/esm/typings/src/high-level-abstractions/quick-chatbot/QuickChatbotHla.d.ts +10 -0
  21. package/esm/typings/src/llm-providers/remote/RemoteLlmExecutionTools.d.ts +1 -1
  22. package/esm/typings/src/llm-providers/remote/startRemoteServer.d.ts +1 -1
  23. package/esm/typings/src/prepare/prepareTasks.d.ts +1 -0
  24. package/esm/typings/src/types/typeAliases.d.ts +1 -1
  25. package/esm/typings/src/utils/normalization/orderJson.d.ts +21 -0
  26. package/esm/typings/src/utils/normalization/orderJson.test.d.ts +4 -0
  27. package/esm/typings/src/utils/organization/keepTypeImported.d.ts +9 -0
  28. package/esm/typings/src/utils/serialization/$deepFreeze.d.ts +1 -1
  29. package/esm/typings/src/utils/serialization/checkSerializableAsJson.d.ts +20 -2
  30. package/esm/typings/src/utils/serialization/deepClone.test.d.ts +1 -0
  31. package/esm/typings/src/utils/serialization/exportJson.d.ts +29 -0
  32. package/esm/typings/src/utils/serialization/isSerializableAsJson.d.ts +2 -1
  33. package/package.json +1 -1
  34. package/umd/index.umd.js +400 -321
  35. package/umd/index.umd.js.map +1 -1
  36. package/esm/typings/src/utils/serialization/$asDeeplyFrozenSerializableJson.d.ts +0 -17
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.78.3';
23
+ var PROMPTBOOK_ENGINE_VERSION = '0.79.0';
24
24
  /**
25
25
  * TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
26
26
  * Note: [๐Ÿ’ž] Ignore a discrepancy between file name and entity name
@@ -356,7 +356,7 @@ function extractJsonBlock(markdown) {
356
356
  * TODO: [๐Ÿข] Make this logic part of `JsonFormatDefinition` or `isValidJsonString`
357
357
  */
358
358
 
359
- var PipelineCollection = [{title:"Prepare Knowledge from Markdown",pipelineUrl:"https://promptbook.studio/promptbook/prepare-knowledge-from-markdown.book.md",formfactorName:"GENERIC",parameters:[{name:"knowledgeContent",description:"Markdown document content",isInput:true,isOutput:false},{name:"knowledgePieces",description:"The knowledge JSON object",isInput:false,isOutput:true}],tasks:[{taskType:"PROMPT_TASK",name:"knowledge",title:"Knowledge",content:"You are experienced data researcher, extract the important knowledge from the document.\n\n# Rules\n\n- Make pieces of information concise, clear, and easy to understand\n- One piece of information should be approximately 1 paragraph\n- Divide the paragraphs by markdown horizontal lines ---\n- Omit irrelevant information\n- Group redundant information\n- Write just extracted information, nothing else\n\n# The document\n\nTake information from this document:\n\n> {knowledgeContent}",resultingParameterName:"knowledgePieces",dependentParameterNames:["knowledgeContent"]}],knowledgeSources:[],knowledgePieces:[],personas:[],preparations:[],sourceFile:"./books/prepare-knowledge-from-markdown.book.md"},{title:"Prepare Keywords",pipelineUrl:"https://promptbook.studio/promptbook/prepare-knowledge-keywords.book.md",formfactorName:"GENERIC",parameters:[{name:"knowledgePieceContent",description:"The content",isInput:true,isOutput:false},{name:"keywords",description:"Keywords separated by comma",isInput:false,isOutput:true}],tasks:[{taskType:"PROMPT_TASK",name:"knowledge",title:"Knowledge",content:"You are experienced data researcher, detect the important keywords in the document.\n\n# Rules\n\n- Write just keywords separated by comma\n\n# The document\n\nTake information from this document:\n\n> {knowledgePieceContent}",resultingParameterName:"keywords",dependentParameterNames:["knowledgePieceContent"]}],knowledgeSources:[],knowledgePieces:[],personas:[],preparations:[],sourceFile:"./books/prepare-knowledge-keywords.book.md"},{title:"Prepare Title",pipelineUrl:"https://promptbook.studio/promptbook/prepare-knowledge-title.book.md",formfactorName:"GENERIC",parameters:[{name:"knowledgePieceContent",description:"The content",isInput:true,isOutput:false},{name:"title",description:"The title of the document",isInput:false,isOutput:true}],tasks:[{taskType:"PROMPT_TASK",name:"knowledge",title:"Knowledge",content:"You are experienced content creator, write best title for the document.\n\n# Rules\n\n- Write just title, nothing else\n- Title should be concise and clear\n- Write maximum 5 words for the title\n\n# The document\n\n> {knowledgePieceContent}",resultingParameterName:"title",expectations:{words:{min:1,max:8}},dependentParameterNames:["knowledgePieceContent"]}],knowledgeSources:[],knowledgePieces:[],personas:[],preparations:[],sourceFile:"./books/prepare-knowledge-title.book.md"},{title:"Prepare Keywords",pipelineUrl:"https://promptbook.studio/promptbook/prepare-persona.book.md",formfactorName:"GENERIC",parameters:[{name:"availableModelNames",description:"List of available model names separated by comma (,)",isInput:true,isOutput:false},{name:"personaDescription",description:"Description of the persona",isInput:true,isOutput:false},{name:"modelRequirements",description:"Specific requirements for the model",isInput:false,isOutput:true}],tasks:[{taskType:"PROMPT_TASK",name:"make-model-requirements",title:"Make modelRequirements",content:"You are experienced AI engineer, you need to create virtual assistant.\nWrite\n\n## Example\n\n```json\n{\n\"modelName\": \"gpt-4o\",\n\"systemMessage\": \"You are experienced AI engineer and helpfull assistant.\",\n\"temperature\": 0.7\n}\n```\n\n## Instructions\n\n- Your output format is JSON object\n- Write just the JSON object, no other text should be present\n- It contains the following keys:\n - `modelName`: The name of the model to use\n - `systemMessage`: The system message to provide context to the model\n - `temperature`: The sampling temperature to use\n\n### Key `modelName`\n\nPick from the following models:\n\n- {availableModelNames}\n\n### Key `systemMessage`\n\nThe system message is used to communicate instructions or provide context to the model at the beginning of a conversation. It is displayed in a different format compared to user messages, helping the model understand its role in the conversation. The system message typically guides the model's behavior, sets the tone, or specifies desired output from the model. By utilizing the system message effectively, users can steer the model towards generating more accurate and relevant responses.\n\nFor example:\n\n> You are an experienced AI engineer and helpful assistant.\n\n> You are a friendly and knowledgeable chatbot.\n\n### Key `temperature`\n\nThe sampling temperature, between 0 and 1. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic. If set to 0, the model will use log probability to automatically increase the temperature until certain thresholds are hit.\n\nYou can pick a value between 0 and 2. For example:\n\n- `0.1`: Low temperature, extremely conservative and deterministic\n- `0.5`: Medium temperature, balanced between conservative and creative\n- `1.0`: High temperature, creative and bit random\n- `1.5`: Very high temperature, extremely creative and often chaotic and unpredictable\n- `2.0`: Maximum temperature, completely random and unpredictable, for some extreme creative use cases\n\n# The assistant\n\nTake this description of the persona:\n\n> {personaDescription}",resultingParameterName:"modelRequirements",format:"JSON",dependentParameterNames:["availableModelNames","personaDescription"]}],knowledgeSources:[],knowledgePieces:[],personas:[],preparations:[],sourceFile:"./books/prepare-persona.book.md"}];
359
+ var PipelineCollection = [{title:"Prepare Knowledge from Markdown",pipelineUrl:"https://promptbook.studio/promptbook/prepare-knowledge-from-markdown.book.md",formfactorName:"GENERIC",parameters:[{name:"knowledgeContent",description:"Markdown document content",isInput:true,isOutput:false},{name:"knowledgePieces",description:"The knowledge JSON object",isInput:false,isOutput:true}],tasks:[{taskType:"PROMPT_TASK",name:"knowledge",title:"Knowledge",content:"You are experienced data researcher, extract the important knowledge from the document.\n\n# Rules\n\n- Make pieces of information concise, clear, and easy to understand\n- One piece of information should be approximately 1 paragraph\n- Divide the paragraphs by markdown horizontal lines ---\n- Omit irrelevant information\n- Group redundant information\n- Write just extracted information, nothing else\n\n# The document\n\nTake information from this document:\n\n> {knowledgeContent}",resultingParameterName:"knowledgePieces",dependentParameterNames:["knowledgeContent"]}],personas:[],preparations:[],knowledgeSources:[],knowledgePieces:[],sourceFile:"./books/prepare-knowledge-from-markdown.book.md"},{title:"Prepare Keywords",pipelineUrl:"https://promptbook.studio/promptbook/prepare-knowledge-keywords.book.md",formfactorName:"GENERIC",parameters:[{name:"knowledgePieceContent",description:"The content",isInput:true,isOutput:false},{name:"keywords",description:"Keywords separated by comma",isInput:false,isOutput:true}],tasks:[{taskType:"PROMPT_TASK",name:"knowledge",title:"Knowledge",content:"You are experienced data researcher, detect the important keywords in the document.\n\n# Rules\n\n- Write just keywords separated by comma\n\n# The document\n\nTake information from this document:\n\n> {knowledgePieceContent}",resultingParameterName:"keywords",dependentParameterNames:["knowledgePieceContent"]}],personas:[],preparations:[],knowledgeSources:[],knowledgePieces:[],sourceFile:"./books/prepare-knowledge-keywords.book.md"},{title:"Prepare Title",pipelineUrl:"https://promptbook.studio/promptbook/prepare-knowledge-title.book.md",formfactorName:"GENERIC",parameters:[{name:"knowledgePieceContent",description:"The content",isInput:true,isOutput:false},{name:"title",description:"The title of the document",isInput:false,isOutput:true}],tasks:[{taskType:"PROMPT_TASK",name:"knowledge",title:"Knowledge",content:"You are experienced content creator, write best title for the document.\n\n# Rules\n\n- Write just title, nothing else\n- Title should be concise and clear\n- Write maximum 5 words for the title\n\n# The document\n\n> {knowledgePieceContent}",resultingParameterName:"title",expectations:{words:{min:1,max:8}},dependentParameterNames:["knowledgePieceContent"]}],personas:[],preparations:[],knowledgeSources:[],knowledgePieces:[],sourceFile:"./books/prepare-knowledge-title.book.md"},{title:"Prepare Keywords",pipelineUrl:"https://promptbook.studio/promptbook/prepare-persona.book.md",formfactorName:"GENERIC",parameters:[{name:"availableModelNames",description:"List of available model names separated by comma (,)",isInput:true,isOutput:false},{name:"personaDescription",description:"Description of the persona",isInput:true,isOutput:false},{name:"modelRequirements",description:"Specific requirements for the model",isInput:false,isOutput:true}],tasks:[{taskType:"PROMPT_TASK",name:"make-model-requirements",title:"Make modelRequirements",content:"You are experienced AI engineer, you need to create virtual assistant.\nWrite\n\n## Example\n\n```json\n{\n\"modelName\": \"gpt-4o\",\n\"systemMessage\": \"You are experienced AI engineer and helpfull assistant.\",\n\"temperature\": 0.7\n}\n```\n\n## Instructions\n\n- Your output format is JSON object\n- Write just the JSON object, no other text should be present\n- It contains the following keys:\n - `modelName`: The name of the model to use\n - `systemMessage`: The system message to provide context to the model\n - `temperature`: The sampling temperature to use\n\n### Key `modelName`\n\nPick from the following models:\n\n- {availableModelNames}\n\n### Key `systemMessage`\n\nThe system message is used to communicate instructions or provide context to the model at the beginning of a conversation. It is displayed in a different format compared to user messages, helping the model understand its role in the conversation. The system message typically guides the model's behavior, sets the tone, or specifies desired output from the model. By utilizing the system message effectively, users can steer the model towards generating more accurate and relevant responses.\n\nFor example:\n\n> You are an experienced AI engineer and helpful assistant.\n\n> You are a friendly and knowledgeable chatbot.\n\n### Key `temperature`\n\nThe sampling temperature, between 0 and 1. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic. If set to 0, the model will use log probability to automatically increase the temperature until certain thresholds are hit.\n\nYou can pick a value between 0 and 2. For example:\n\n- `0.1`: Low temperature, extremely conservative and deterministic\n- `0.5`: Medium temperature, balanced between conservative and creative\n- `1.0`: High temperature, creative and bit random\n- `1.5`: Very high temperature, extremely creative and often chaotic and unpredictable\n- `2.0`: Maximum temperature, completely random and unpredictable, for some extreme creative use cases\n\n# The assistant\n\nTake this description of the persona:\n\n> {personaDescription}",resultingParameterName:"modelRequirements",format:"JSON",dependentParameterNames:["availableModelNames","personaDescription"]}],personas:[],preparations:[],knowledgeSources:[],knowledgePieces:[],sourceFile:"./books/prepare-persona.book.md"}];
360
360
 
361
361
  /**
362
362
  * Prettify the html code
@@ -395,6 +395,7 @@ function prettifyMarkdown(content) {
395
395
  /**
396
396
  * Converts promptbook in JSON format to string format
397
397
  *
398
+ * @deprecated TODO: [๐Ÿฅ][๐Ÿง ] Backup original files in `PipelineJson` same as in Promptbook.studio
398
399
  * @param pipelineJson Promptbook in JSON format (.book.json)
399
400
  * @returns Promptbook in string format (.book.md)
400
401
  * @public exported from `@promptbook/core`
@@ -690,41 +691,6 @@ var DEFAULT_MAX_EXECUTION_ATTEMPTS = 3; // <- TODO: [๐Ÿคนโ€โ™‚๏ธ]
690
691
  * @public exported from `@promptbook/core`
691
692
  */
692
693
  var DEFAULT_SCRAPE_CACHE_DIRNAME = './.promptbook/scrape-cache';
693
- /**
694
- * Nonce which is used for replacing things in strings
695
- *
696
- * @private within the repository
697
- */
698
- var REPLACING_NONCE = 'u$k42k%!V2zo34w7Fu#@QUHYPW';
699
- /**
700
- * The names of the parameters that are reserved for special purposes
701
- *
702
- * @public exported from `@promptbook/core`
703
- */
704
- var RESERVED_PARAMETER_NAMES =
705
- /* !!!!!! $asDeeplyFrozenSerializableJson('RESERVED_PARAMETER_NAMES', _____ as const); */ [
706
- 'content',
707
- 'context',
708
- 'knowledge',
709
- 'examples',
710
- 'modelName',
711
- 'currentDate',
712
- // <- TODO: list here all command names
713
- // <- TODO: Add more like 'date', 'modelName',...
714
- // <- TODO: Add [emoji] + instructions ACRY when adding new reserved parameter
715
- ];
716
- /**
717
- * @@@
718
- *
719
- * @private within the repository
720
- */
721
- var RESERVED_PARAMETER_MISSING_VALUE = 'MISSING-' + REPLACING_NONCE;
722
- /**
723
- * @@@
724
- *
725
- * @private within the repository
726
- */
727
- var RESERVED_PARAMETER_RESTRICTED = 'RESTRICTED-' + REPLACING_NONCE;
728
694
  // <- TODO: [๐Ÿงœโ€โ™‚๏ธ]
729
695
  /**
730
696
  * @@@
@@ -759,26 +725,59 @@ var IS_PIPELINE_LOGIC_VALIDATED = just(
759
725
  // Note: In normal situations, we check the pipeline logic:
760
726
  true);
761
727
  /**
762
- * TODO: Extract `constants.ts` from `config.ts`
763
728
  * Note: [๐Ÿ’ž] Ignore a discrepancy between file name and entity name
764
729
  * TODO: [๐Ÿง ][๐Ÿงœโ€โ™‚๏ธ] Maybe join remoteUrl and path into single value
765
730
  */
766
731
 
767
732
  /**
768
- * This error indicates that the promptbook object has valid syntax (=can be parsed) but contains logical errors (like circular dependencies)
733
+ * Orders JSON object by keys
769
734
  *
770
- * @public exported from `@promptbook/core`
735
+ * @returns The same type of object as the input re-ordered
736
+ * @public exported from `@promptbook/utils`
771
737
  */
772
- var PipelineLogicError = /** @class */ (function (_super) {
773
- __extends(PipelineLogicError, _super);
774
- function PipelineLogicError(message) {
775
- var _this = _super.call(this, message) || this;
776
- _this.name = 'PipelineLogicError';
777
- Object.setPrototypeOf(_this, PipelineLogicError.prototype);
778
- return _this;
738
+ function orderJson(options) {
739
+ var value = options.value, order = options.order;
740
+ var orderedValue = __assign(__assign({}, (order === undefined ? {} : Object.fromEntries(order.map(function (key) { return [key, undefined]; })))), value);
741
+ return orderedValue;
742
+ }
743
+
744
+ /**
745
+ * Freezes the given object and all its nested objects recursively
746
+ *
747
+ * Note: `$` is used to indicate that this function is not a pure function - it mutates given object
748
+ * Note: This function mutates the object and returns the original (but mutated-deep-freezed) object
749
+ *
750
+ * @returns The same object as the input, but deeply frozen
751
+ * @public exported from `@promptbook/utils`
752
+ */
753
+ function $deepFreeze(objectValue) {
754
+ var e_1, _a;
755
+ if (Array.isArray(objectValue)) {
756
+ return Object.freeze(objectValue.map(function (item) { return $deepFreeze(item); }));
779
757
  }
780
- return PipelineLogicError;
781
- }(Error));
758
+ var propertyNames = Object.getOwnPropertyNames(objectValue);
759
+ try {
760
+ for (var propertyNames_1 = __values(propertyNames), propertyNames_1_1 = propertyNames_1.next(); !propertyNames_1_1.done; propertyNames_1_1 = propertyNames_1.next()) {
761
+ var propertyName = propertyNames_1_1.value;
762
+ var value = objectValue[propertyName];
763
+ if (value && typeof value === 'object') {
764
+ $deepFreeze(value);
765
+ }
766
+ }
767
+ }
768
+ catch (e_1_1) { e_1 = { error: e_1_1 }; }
769
+ finally {
770
+ try {
771
+ if (propertyNames_1_1 && !propertyNames_1_1.done && (_a = propertyNames_1.return)) _a.call(propertyNames_1);
772
+ }
773
+ finally { if (e_1) throw e_1.error; }
774
+ }
775
+ Object.freeze(objectValue);
776
+ return objectValue;
777
+ }
778
+ /**
779
+ * TODO: [๐Ÿง ] Is there a way how to meaningfully test this utility
780
+ */
782
781
 
783
782
  /**
784
783
  * Make error report URL for the given error
@@ -814,6 +813,264 @@ var UnexpectedError = /** @class */ (function (_super) {
814
813
  return UnexpectedError;
815
814
  }(Error));
816
815
 
816
+ /**
817
+ * Checks if the value is [๐Ÿš‰] serializable as JSON
818
+ * If not, throws an UnexpectedError with a rich error message and tracking
819
+ *
820
+ * - Almost all primitives are serializable BUT:
821
+ * - `undefined` is not serializable
822
+ * - `NaN` is not serializable
823
+ * - Objects and arrays are serializable if all their properties are serializable
824
+ * - Functions are not serializable
825
+ * - Circular references are not serializable
826
+ * - `Date` objects are not serializable
827
+ * - `Map` and `Set` objects are not serializable
828
+ * - `RegExp` objects are not serializable
829
+ * - `Error` objects are not serializable
830
+ * - `Symbol` objects are not serializable
831
+ * - And much more...
832
+ *
833
+ * @throws UnexpectedError if the value is not serializable as JSON
834
+ * @public exported from `@promptbook/utils`
835
+ */
836
+ function checkSerializableAsJson(options) {
837
+ var e_1, _a;
838
+ var value = options.value, name = options.name, message = options.message;
839
+ if (value === undefined) {
840
+ throw new UnexpectedError("".concat(name, " is undefined"));
841
+ }
842
+ else if (value === null) {
843
+ return;
844
+ }
845
+ else if (typeof value === 'boolean') {
846
+ return;
847
+ }
848
+ else if (typeof value === 'number' && !isNaN(value)) {
849
+ return;
850
+ }
851
+ else if (typeof value === 'string') {
852
+ return;
853
+ }
854
+ else if (typeof value === 'symbol') {
855
+ throw new UnexpectedError("".concat(name, " is symbol"));
856
+ }
857
+ else if (typeof value === 'function') {
858
+ throw new UnexpectedError("".concat(name, " is function"));
859
+ }
860
+ else if (typeof value === 'object' && Array.isArray(value)) {
861
+ for (var i = 0; i < value.length; i++) {
862
+ checkSerializableAsJson({ name: "".concat(name, "[").concat(i, "]"), value: value[i], message: message });
863
+ }
864
+ }
865
+ else if (typeof value === 'object') {
866
+ if (value instanceof Date) {
867
+ throw new UnexpectedError(spaceTrim(function (block) { return "\n `".concat(name, "` is Date\n\n Use `string_date_iso8601` instead\n\n Additional message for `").concat(name, "`:\n ").concat(block(message || '(nothing)'), "\n "); }));
868
+ }
869
+ else if (value instanceof Map) {
870
+ throw new UnexpectedError("".concat(name, " is Map"));
871
+ }
872
+ else if (value instanceof Set) {
873
+ throw new UnexpectedError("".concat(name, " is Set"));
874
+ }
875
+ else if (value instanceof RegExp) {
876
+ throw new UnexpectedError("".concat(name, " is RegExp"));
877
+ }
878
+ else if (value instanceof Error) {
879
+ throw new UnexpectedError(spaceTrim(function (block) { return "\n `".concat(name, "` is unserialized Error\n\n Use function `serializeError`\n\n Additional message for `").concat(name, "`:\n ").concat(block(message || '(nothing)'), "\n\n "); }));
880
+ }
881
+ else {
882
+ try {
883
+ for (var _b = __values(Object.entries(value)), _c = _b.next(); !_c.done; _c = _b.next()) {
884
+ var _d = __read(_c.value, 2), subName = _d[0], subValue = _d[1];
885
+ if (subValue === undefined) {
886
+ // Note: undefined in object is serializable - it is just omited
887
+ continue;
888
+ }
889
+ checkSerializableAsJson({ name: "".concat(name, ".").concat(subName), value: subValue, message: message });
890
+ }
891
+ }
892
+ catch (e_1_1) { e_1 = { error: e_1_1 }; }
893
+ finally {
894
+ try {
895
+ if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
896
+ }
897
+ finally { if (e_1) throw e_1.error; }
898
+ }
899
+ try {
900
+ JSON.stringify(value); // <- TODO: [0]
901
+ }
902
+ catch (error) {
903
+ if (!(error instanceof Error)) {
904
+ throw error;
905
+ }
906
+ throw new UnexpectedError(spaceTrim(function (block) { return "\n `".concat(name, "` is not serializable\n\n ").concat(block(error.toString()), "\n\n Additional message for `").concat(name, "`:\n ").concat(block(message || '(nothing)'), "\n "); }));
907
+ }
908
+ /*
909
+ TODO: [0] Is there some more elegant way to check circular references?
910
+ const seen = new Set();
911
+ const stack = [{ value }];
912
+ while (stack.length > 0) {
913
+ const { value } = stack.pop()!;
914
+ if (typeof value === 'object' && value !== null) {
915
+ if (seen.has(value)) {
916
+ throw new UnexpectedError(`${name} has circular reference`);
917
+ }
918
+ seen.add(value);
919
+ if (Array.isArray(value)) {
920
+ stack.push(...value.map((value) => ({ value })));
921
+ } else {
922
+ stack.push(...Object.values(value).map((value) => ({ value })));
923
+ }
924
+ }
925
+ }
926
+ */
927
+ return;
928
+ }
929
+ }
930
+ else {
931
+ throw new UnexpectedError(spaceTrim(function (block) { return "\n `".concat(name, "` is unknown type\n\n Additional message for `").concat(name, "`:\n ").concat(block(message || '(nothing)'), "\n "); }));
932
+ }
933
+ }
934
+ /**
935
+ * TODO: Can be return type more type-safe? like `asserts options.value is JsonValue`
936
+ * TODO: [๐Ÿง ][main] !!! In-memory cache of same values to prevent multiple checks
937
+ * Note: [๐Ÿ ] This is how `checkSerializableAsJson` + `isSerializableAsJson` together can just retun true/false or rich error message
938
+ */
939
+
940
+ /**
941
+ * @@@
942
+ *
943
+ * @public exported from `@promptbook/utils`
944
+ */
945
+ function deepClone(objectValue) {
946
+ return JSON.parse(JSON.stringify(objectValue));
947
+ /*
948
+ !!!!!!!!
949
+ TODO: [๐Ÿง ] Is there a better implementation?
950
+ > const propertyNames = Object.getOwnPropertyNames(objectValue);
951
+ > for (const propertyName of propertyNames) {
952
+ > const value = (objectValue as really_any)[propertyName];
953
+ > if (value && typeof value === 'object') {
954
+ > deepClone(value);
955
+ > }
956
+ > }
957
+ > return Object.assign({}, objectValue);
958
+ */
959
+ }
960
+ /**
961
+ * TODO: [๐Ÿง ] Is there a way how to meaningfully test this utility
962
+ */
963
+
964
+ /**
965
+ * Utility to export a JSON object from a function
966
+ *
967
+ * 1) Checks if the value is serializable as JSON
968
+ * 2) Makes a deep clone of the object
969
+ * 2) Orders the object properties
970
+ * 2) Deeply freezes the cloned object
971
+ *
972
+ * Note: This function does not mutates the given object
973
+ *
974
+ * @returns The same type of object as the input but read-only and re-ordered
975
+ * @public exported from `@promptbook/utils`
976
+ */
977
+ function exportJson(options) {
978
+ var name = options.name, value = options.value, order = options.order, message = options.message;
979
+ checkSerializableAsJson({ name: name, value: value, message: message });
980
+ var orderedValue =
981
+ // TODO: Fix error "Type instantiation is excessively deep and possibly infinite."
982
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment
983
+ // @ts-ignore
984
+ order === undefined
985
+ ? deepClone(value)
986
+ : orderJson({
987
+ value: value,
988
+ // <- Note: checkSerializableAsJson asserts that the value is serializable as JSON
989
+ order: order,
990
+ });
991
+ $deepFreeze(orderedValue);
992
+ return orderedValue;
993
+ }
994
+ /**
995
+ * TODO: [๐Ÿง ] Is there a way how to meaningfully test this utility
996
+ */
997
+
998
+ /**
999
+ * Order of keys in the pipeline JSON
1000
+ *
1001
+ * @public exported from `@promptbook/core`
1002
+ */
1003
+ var ORDER_OF_PIPELINE_JSON = [
1004
+ 'title',
1005
+ 'pipelineUrl',
1006
+ 'bookVersion',
1007
+ 'description',
1008
+ 'formfactorName',
1009
+ 'parameters',
1010
+ 'tasks',
1011
+ 'personas',
1012
+ 'preparations',
1013
+ 'knowledgeSources',
1014
+ 'knowledgePieces',
1015
+ ];
1016
+ /**
1017
+ * Nonce which is used for replacing things in strings
1018
+ *
1019
+ * @private within the repository
1020
+ */
1021
+ var REPLACING_NONCE = 'u$k42k%!V2zo34w7Fu#@QUHYPW';
1022
+ /**
1023
+ * @@@
1024
+ *
1025
+ * @private within the repository
1026
+ */
1027
+ var RESERVED_PARAMETER_MISSING_VALUE = 'MISSING-' + REPLACING_NONCE;
1028
+ /**
1029
+ * @@@
1030
+ *
1031
+ * @private within the repository
1032
+ */
1033
+ var RESERVED_PARAMETER_RESTRICTED = 'RESTRICTED-' + REPLACING_NONCE;
1034
+ /**
1035
+ * The names of the parameters that are reserved for special purposes
1036
+ *
1037
+ * @public exported from `@promptbook/core`
1038
+ */
1039
+ var RESERVED_PARAMETER_NAMES = exportJson({
1040
+ name: 'RESERVED_PARAMETER_NAMES',
1041
+ message: "The names of the parameters that are reserved for special purposes",
1042
+ value: [
1043
+ 'content',
1044
+ 'context',
1045
+ 'knowledge',
1046
+ 'examples',
1047
+ 'modelName',
1048
+ 'currentDate',
1049
+ // <- TODO: list here all command names
1050
+ // <- TODO: Add more like 'date', 'modelName',...
1051
+ // <- TODO: Add [emoji] + instructions ACRY when adding new reserved parameter
1052
+ ],
1053
+ });
1054
+ /**
1055
+ * Note: [๐Ÿ’ž] Ignore a discrepancy between file name and entity name
1056
+ */
1057
+
1058
+ /**
1059
+ * This error indicates that the promptbook object has valid syntax (=can be parsed) but contains logical errors (like circular dependencies)
1060
+ *
1061
+ * @public exported from `@promptbook/core`
1062
+ */
1063
+ var PipelineLogicError = /** @class */ (function (_super) {
1064
+ __extends(PipelineLogicError, _super);
1065
+ function PipelineLogicError(message) {
1066
+ var _this = _super.call(this, message) || this;
1067
+ _this.name = 'PipelineLogicError';
1068
+ Object.setPrototypeOf(_this, PipelineLogicError.prototype);
1069
+ return _this;
1070
+ }
1071
+ return PipelineLogicError;
1072
+ }(Error));
1073
+
817
1074
  /**
818
1075
  * Tests if given string is valid semantic version
819
1076
  *
@@ -1051,6 +1308,21 @@ function validatePipelineCore(pipeline) {
1051
1308
  }
1052
1309
  };
1053
1310
  try {
1311
+ /*
1312
+ TODO: [๐Ÿง ][๐Ÿ…พ] Should be empty pipeline valid or not
1313
+ // Note: Check that pipeline has some tasks
1314
+ if (pipeline.tasks.length === 0) {
1315
+ throw new PipelineLogicError(
1316
+ spaceTrim(
1317
+ (block) => `
1318
+ Pipeline must have at least one task
1319
+
1320
+ ${block(pipelineIdentification)}
1321
+ `,
1322
+ ),
1323
+ );
1324
+ }
1325
+ */
1054
1326
  // Note: Check each parameter individually
1055
1327
  for (var _d = __values(pipeline.parameters), _e = _d.next(); !_e.done; _e = _d.next()) {
1056
1328
  var parameter = _e.value;
@@ -1211,6 +1483,9 @@ function validatePipelineCore(pipeline) {
1211
1483
  while (unresovedTasks.length > 0) {
1212
1484
  _loop_3();
1213
1485
  }
1486
+ // Note: Check that formfactor is corresponding to the pipeline interface
1487
+ // TODO: !!!!!! Implement this
1488
+ // pipeline.formfactorName
1214
1489
  }
1215
1490
  /**
1216
1491
  * TODO: !! [๐Ÿงžโ€โ™€๏ธ] Do not allow joker + foreach
@@ -1294,183 +1569,6 @@ function extractParameterNames(template) {
1294
1569
  return parameterNames;
1295
1570
  }
1296
1571
 
1297
- /**
1298
- * @@@
1299
- *
1300
- * Note: `$` is used to indicate that this function is not a pure function - it mutates given object
1301
- * Note: This function mutates the object and returns the original (but mutated-deep-freezed) object
1302
- *
1303
- * @returns The same object as the input, but deeply frozen
1304
- * @public exported from `@promptbook/utils`
1305
- */
1306
- function $deepFreeze(objectValue) {
1307
- var e_1, _a;
1308
- var propertyNames = Object.getOwnPropertyNames(objectValue);
1309
- try {
1310
- for (var propertyNames_1 = __values(propertyNames), propertyNames_1_1 = propertyNames_1.next(); !propertyNames_1_1.done; propertyNames_1_1 = propertyNames_1.next()) {
1311
- var propertyName = propertyNames_1_1.value;
1312
- var value = objectValue[propertyName];
1313
- if (value && typeof value === 'object') {
1314
- $deepFreeze(value);
1315
- }
1316
- }
1317
- }
1318
- catch (e_1_1) { e_1 = { error: e_1_1 }; }
1319
- finally {
1320
- try {
1321
- if (propertyNames_1_1 && !propertyNames_1_1.done && (_a = propertyNames_1.return)) _a.call(propertyNames_1);
1322
- }
1323
- finally { if (e_1) throw e_1.error; }
1324
- }
1325
- return Object.freeze(objectValue);
1326
- }
1327
- /**
1328
- * TODO: [๐Ÿง ] Is there a way how to meaningfully test this utility
1329
- */
1330
-
1331
- /**
1332
- * Checks if the value is [๐Ÿš‰] serializable as JSON
1333
- * If not, throws an UnexpectedError with a rich error message and tracking
1334
- *
1335
- * - Almost all primitives are serializable BUT:
1336
- * - `undefined` is not serializable
1337
- * - `NaN` is not serializable
1338
- * - Objects and arrays are serializable if all their properties are serializable
1339
- * - Functions are not serializable
1340
- * - Circular references are not serializable
1341
- * - `Date` objects are not serializable
1342
- * - `Map` and `Set` objects are not serializable
1343
- * - `RegExp` objects are not serializable
1344
- * - `Error` objects are not serializable
1345
- * - `Symbol` objects are not serializable
1346
- * - And much more...
1347
- *
1348
- * @throws UnexpectedError if the value is not serializable as JSON
1349
- * @public exported from `@promptbook/utils`
1350
- */
1351
- function checkSerializableAsJson(name, value) {
1352
- var e_1, _a;
1353
- if (value === undefined) {
1354
- throw new UnexpectedError("".concat(name, " is undefined"));
1355
- }
1356
- else if (value === null) {
1357
- return;
1358
- }
1359
- else if (typeof value === 'boolean') {
1360
- return;
1361
- }
1362
- else if (typeof value === 'number' && !isNaN(value)) {
1363
- return;
1364
- }
1365
- else if (typeof value === 'string') {
1366
- return;
1367
- }
1368
- else if (typeof value === 'symbol') {
1369
- throw new UnexpectedError("".concat(name, " is symbol"));
1370
- }
1371
- else if (typeof value === 'function') {
1372
- throw new UnexpectedError("".concat(name, " is function"));
1373
- }
1374
- else if (typeof value === 'object' && Array.isArray(value)) {
1375
- for (var i = 0; i < value.length; i++) {
1376
- checkSerializableAsJson("".concat(name, "[").concat(i, "]"), value[i]);
1377
- }
1378
- }
1379
- else if (typeof value === 'object') {
1380
- if (value instanceof Date) {
1381
- throw new UnexpectedError(spaceTrim("\n ".concat(name, " is Date\n\n Use `string_date_iso8601` instead\n ")));
1382
- }
1383
- else if (value instanceof Map) {
1384
- throw new UnexpectedError("".concat(name, " is Map"));
1385
- }
1386
- else if (value instanceof Set) {
1387
- throw new UnexpectedError("".concat(name, " is Set"));
1388
- }
1389
- else if (value instanceof RegExp) {
1390
- throw new UnexpectedError("".concat(name, " is RegExp"));
1391
- }
1392
- else if (value instanceof Error) {
1393
- throw new UnexpectedError(spaceTrim("\n ".concat(name, " is unserialized Error\n\n Use function `serializeError`\n ")));
1394
- }
1395
- else {
1396
- try {
1397
- for (var _b = __values(Object.entries(value)), _c = _b.next(); !_c.done; _c = _b.next()) {
1398
- var _d = __read(_c.value, 2), subName = _d[0], subValue = _d[1];
1399
- if (subValue === undefined) {
1400
- // Note: undefined in object is serializable - it is just omited
1401
- continue;
1402
- }
1403
- checkSerializableAsJson("".concat(name, ".").concat(subName), subValue);
1404
- }
1405
- }
1406
- catch (e_1_1) { e_1 = { error: e_1_1 }; }
1407
- finally {
1408
- try {
1409
- if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
1410
- }
1411
- finally { if (e_1) throw e_1.error; }
1412
- }
1413
- try {
1414
- JSON.stringify(value); // <- TODO: [0]
1415
- }
1416
- catch (error) {
1417
- if (!(error instanceof Error)) {
1418
- throw error;
1419
- }
1420
- throw new UnexpectedError(spaceTrim(function (block) { return "\n ".concat(name, " is not serializable\n\n ").concat(block(error.toString()), "\n "); }));
1421
- }
1422
- /*
1423
- TODO: [0] Is there some more elegant way to check circular references?
1424
- const seen = new Set();
1425
- const stack = [{ value }];
1426
- while (stack.length > 0) {
1427
- const { value } = stack.pop()!;
1428
- if (typeof value === 'object' && value !== null) {
1429
- if (seen.has(value)) {
1430
- throw new UnexpectedError(`${name} has circular reference`);
1431
- }
1432
- seen.add(value);
1433
- if (Array.isArray(value)) {
1434
- stack.push(...value.map((value) => ({ value })));
1435
- } else {
1436
- stack.push(...Object.values(value).map((value) => ({ value })));
1437
- }
1438
- }
1439
- }
1440
- */
1441
- return;
1442
- }
1443
- }
1444
- else {
1445
- throw new UnexpectedError("".concat(name, " is unknown"));
1446
- }
1447
- }
1448
- /**
1449
- * TODO: [๐Ÿง ][๐Ÿ›ฃ] More elegant way to tracking than passing `name`
1450
- * TODO: [๐Ÿง ][main] !!! In-memory cache of same values to prevent multiple checks
1451
- * Note: [๐Ÿ ] This is how `checkSerializableAsJson` + `isSerializableAsJson` together can just retun true/false or rich error message
1452
- */
1453
-
1454
- /**
1455
- * @@@
1456
- * @@@
1457
- *
1458
- * Note: This function mutates the object and returns the original (but mutated-deep-freezed) object
1459
- *
1460
- * @param name - Name of the object for debugging purposes
1461
- * @param objectValue - Object to be deeply frozen
1462
- * @returns The same object as the input, but deeply frozen
1463
- * @private this is in comparison to `deepFreeze` a more specific utility and maybe not very good practice to use without specific reason and considerations
1464
- */
1465
- function $asDeeplyFrozenSerializableJson(name, objectValue) {
1466
- checkSerializableAsJson(name, objectValue);
1467
- return $deepFreeze(objectValue);
1468
- }
1469
- /**
1470
- * TODO: [๐Ÿง ][๐Ÿ›ฃ] More elegant way to tracking than passing `name`
1471
- * TODO: [๐Ÿง ] Is there a way how to meaningfully test this utility
1472
- */
1473
-
1474
1572
  /**
1475
1573
  * Unprepare just strips the preparation data of the pipeline
1476
1574
  *
@@ -1488,7 +1586,12 @@ function unpreparePipeline(pipeline) {
1488
1586
  delete taskUnprepared.preparedContent;
1489
1587
  return taskUnprepared;
1490
1588
  });
1491
- return $asDeeplyFrozenSerializableJson('Unprepared PipelineJson', __assign(__assign({}, pipeline), { tasks: tasks, knowledgeSources: knowledgeSources, knowledgePieces: [], personas: personas, preparations: [] }));
1589
+ return exportJson({
1590
+ name: 'pipelineJson',
1591
+ message: "Result of `unpreparePipeline`",
1592
+ order: ORDER_OF_PIPELINE_JSON,
1593
+ value: __assign(__assign({}, pipeline), { tasks: tasks, knowledgeSources: knowledgeSources, knowledgePieces: [], personas: personas, preparations: [] }),
1594
+ });
1492
1595
  }
1493
1596
  /**
1494
1597
  * TODO: [๐Ÿงฟ] Maybe do same process with same granularity and subfinctions as `preparePipeline`
@@ -2050,29 +2153,6 @@ $deepFreeze({
2050
2153
  * Note: [๐Ÿ’ž] Ignore a discrepancy between file name and entity name
2051
2154
  */
2052
2155
 
2053
- /**
2054
- * @@@
2055
- *
2056
- * @public exported from `@promptbook/utils`
2057
- */
2058
- function deepClone(objectValue) {
2059
- return JSON.parse(JSON.stringify(objectValue));
2060
- /*
2061
- TODO: [๐Ÿง ] Is there a better implementation?
2062
- > const propertyNames = Object.getOwnPropertyNames(objectValue);
2063
- > for (const propertyName of propertyNames) {
2064
- > const value = (objectValue as really_any)[propertyName];
2065
- > if (value && typeof value === 'object') {
2066
- > deepClone(value);
2067
- > }
2068
- > }
2069
- > return Object.assign({}, objectValue);
2070
- */
2071
- }
2072
- /**
2073
- * TODO: [๐Ÿง ] Is there a way how to meaningfully test this utility
2074
- */
2075
-
2076
2156
  /**
2077
2157
  * Function `addUsage` will add multiple usages into one
2078
2158
  *
@@ -3598,36 +3678,6 @@ TODO: [๐ŸงŠ] This is how it can look in future
3598
3678
  * [ ] One piece can have multiple sources
3599
3679
  */
3600
3680
 
3601
- /**
3602
- * @@@
3603
- *
3604
- * Note: It is usefull @@@
3605
- *
3606
- * @param pipeline
3607
- * @public exported from `@promptbook/utils`
3608
- */
3609
- function clonePipeline(pipeline) {
3610
- // Note: Not using spread operator (...) because @@@
3611
- var pipelineUrl = pipeline.pipelineUrl, sourceFile = pipeline.sourceFile, title = pipeline.title, bookVersion = pipeline.bookVersion, description = pipeline.description, formfactorName = pipeline.formfactorName, parameters = pipeline.parameters, tasks = pipeline.tasks, knowledgeSources = pipeline.knowledgeSources, knowledgePieces = pipeline.knowledgePieces, personas = pipeline.personas, preparations = pipeline.preparations;
3612
- return {
3613
- pipelineUrl: pipelineUrl,
3614
- sourceFile: sourceFile,
3615
- title: title,
3616
- bookVersion: bookVersion,
3617
- description: description,
3618
- formfactorName: formfactorName,
3619
- parameters: parameters,
3620
- tasks: tasks,
3621
- knowledgeSources: knowledgeSources,
3622
- knowledgePieces: knowledgePieces,
3623
- personas: personas,
3624
- preparations: preparations,
3625
- };
3626
- }
3627
- /**
3628
- * TODO: [๐Ÿ™] Make some standard order of json properties
3629
- */
3630
-
3631
3681
  /**
3632
3682
  * @@@
3633
3683
  *
@@ -3668,6 +3718,7 @@ function prepareTasks(pipeline, tools, options) {
3668
3718
  });
3669
3719
  }
3670
3720
  /**
3721
+ * TODO: [๐Ÿ˜‚] Adding knowledge should be convert to async high-level abstractions, simmilar thing with expectations to sync high-level abstractions
3671
3722
  * TODO: [๐Ÿง ] Add context to each task (if missing)
3672
3723
  * TODO: [๐Ÿง ] What is better name `prepareTask` or `prepareTaskAndParameters`
3673
3724
  * TODO: [โ™จ][main] !!! Prepare index the examples and maybe tasks
@@ -3756,11 +3807,19 @@ function preparePipeline(pipeline, tools, options) {
3756
3807
  case 3:
3757
3808
  tasksPrepared = (_c.sent()).tasksPrepared;
3758
3809
  // ----- /Tasks preparation -----
3810
+ // TODO: [๐Ÿ˜‚] Use here all `AsyncHighLevelAbstraction`
3759
3811
  // Note: Count total usage
3760
3812
  currentPreparation.usage = llmToolsWithUsage.getTotalUsage();
3761
- return [2 /*return*/, $asDeeplyFrozenSerializableJson('Prepared PipelineJson', __assign(__assign({}, clonePipeline(pipeline)), { tasks: __spreadArray([], __read(tasksPrepared), false),
3762
- // <- TODO: [๐Ÿช“] Here should be no need for spreading new array, just ` tasks: tasksPrepared`
3763
- knowledgeSources: knowledgeSourcesPrepared, knowledgePieces: knowledgePiecesPrepared, personas: preparedPersonas, preparations: __spreadArray([], __read(preparations), false) }))];
3813
+ return [2 /*return*/, exportJson({
3814
+ name: 'pipelineJson',
3815
+ message: "Result of `preparePipeline`",
3816
+ order: ORDER_OF_PIPELINE_JSON,
3817
+ value: __assign(__assign({}, pipeline), {
3818
+ // <- TODO: Probbably deeply clone the pipeline because `$exportJson` freezes the subobjects
3819
+ knowledgeSources: knowledgeSourcesPrepared, knowledgePieces: knowledgePiecesPrepared, tasks: __spreadArray([], __read(tasksPrepared), false),
3820
+ // <- TODO: [๐Ÿช“] Here should be no need for spreading new array, just ` tasks: tasksPrepared`
3821
+ personas: preparedPersonas, preparations: __spreadArray([], __read(preparations), false) }),
3822
+ })];
3764
3823
  }
3765
3824
  });
3766
3825
  });
@@ -5320,16 +5379,21 @@ function executePipeline(options) {
5320
5379
  // Note: Wait a short time to prevent race conditions
5321
5380
  _g.sent();
5322
5381
  _g.label = 6;
5323
- case 6: return [2 /*return*/, $asDeeplyFrozenSerializableJson("Unuccessful PipelineExecutorResult (with missing parameter {".concat(parameter.name, "}) PipelineExecutorResult"), {
5324
- isSuccessful: false,
5325
- errors: __spreadArray([
5326
- new PipelineExecutionError("Parameter `{".concat(parameter.name, "}` is required as an input parameter"))
5327
- ], __read(errors), false).map(serializeError),
5328
- warnings: [],
5329
- executionReport: executionReport,
5330
- outputParameters: {},
5331
- usage: ZERO_USAGE,
5332
- preparedPipeline: preparedPipeline,
5382
+ case 6: return [2 /*return*/, exportJson({
5383
+ name: "executionReport",
5384
+ message: "Unuccessful PipelineExecutorResult (with missing parameter {".concat(parameter.name, "}) PipelineExecutorResult"),
5385
+ order: [],
5386
+ value: {
5387
+ isSuccessful: false,
5388
+ errors: __spreadArray([
5389
+ new PipelineExecutionError("Parameter `{".concat(parameter.name, "}` is required as an input parameter"))
5390
+ ], __read(errors), false).map(serializeError),
5391
+ warnings: [],
5392
+ executionReport: executionReport,
5393
+ outputParameters: {},
5394
+ usage: ZERO_USAGE,
5395
+ preparedPipeline: preparedPipeline,
5396
+ },
5333
5397
  })];
5334
5398
  case 7:
5335
5399
  _b = _a.next();
@@ -5368,16 +5432,21 @@ function executePipeline(options) {
5368
5432
  // Note: Wait a short time to prevent race conditions
5369
5433
  _h.sent();
5370
5434
  _h.label = 3;
5371
- 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 "); }), {
5372
- isSuccessful: false,
5373
- errors: __spreadArray([
5374
- 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 "); }))
5375
- ], __read(errors), false).map(serializeError),
5376
- warnings: warnings.map(serializeError),
5377
- executionReport: executionReport,
5378
- outputParameters: {},
5379
- usage: ZERO_USAGE,
5380
- preparedPipeline: preparedPipeline,
5435
+ case 3: return [2 /*return*/, { value: exportJson({
5436
+ name: 'pipelineExecutorResult',
5437
+ message: spaceTrim$1(function (block) { return "\n Unuccessful PipelineExecutorResult (with extra parameter {".concat(parameter.name, "}) PipelineExecutorResult\n\n ").concat(block(pipelineIdentification), "\n "); }),
5438
+ order: [],
5439
+ value: {
5440
+ isSuccessful: false,
5441
+ errors: __spreadArray([
5442
+ 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 "); }))
5443
+ ], __read(errors), false).map(serializeError),
5444
+ warnings: warnings.map(serializeError),
5445
+ executionReport: executionReport,
5446
+ outputParameters: {},
5447
+ usage: ZERO_USAGE,
5448
+ preparedPipeline: preparedPipeline,
5449
+ },
5381
5450
  }) }];
5382
5451
  case 4: return [2 /*return*/];
5383
5452
  }
@@ -5531,14 +5600,19 @@ function executePipeline(options) {
5531
5600
  // Note: Wait a short time to prevent race conditions
5532
5601
  _g.sent();
5533
5602
  _g.label = 27;
5534
- case 27: return [2 /*return*/, $asDeeplyFrozenSerializableJson('Unuccessful PipelineExecutorResult (with misc errors) PipelineExecutorResult', {
5535
- isSuccessful: false,
5536
- errors: __spreadArray([error_1], __read(errors), false).map(serializeError),
5537
- warnings: warnings.map(serializeError),
5538
- usage: usage_1,
5539
- executionReport: executionReport,
5540
- outputParameters: outputParameters_1,
5541
- preparedPipeline: preparedPipeline,
5603
+ case 27: return [2 /*return*/, exportJson({
5604
+ name: 'pipelineExecutorResult',
5605
+ message: "Unuccessful PipelineExecutorResult (with misc errors) PipelineExecutorResult",
5606
+ order: [],
5607
+ value: {
5608
+ isSuccessful: false,
5609
+ errors: __spreadArray([error_1], __read(errors), false).map(serializeError),
5610
+ warnings: warnings.map(serializeError),
5611
+ usage: usage_1,
5612
+ executionReport: executionReport,
5613
+ outputParameters: outputParameters_1,
5614
+ preparedPipeline: preparedPipeline,
5615
+ },
5542
5616
  })];
5543
5617
  case 28:
5544
5618
  usage = addUsage.apply(void 0, __spreadArray([], __read(executionReport.promptExecutions.map(function (_a) {
@@ -5559,14 +5633,19 @@ function executePipeline(options) {
5559
5633
  // Note: Wait a short time to prevent race conditions
5560
5634
  _g.sent();
5561
5635
  _g.label = 30;
5562
- case 30: return [2 /*return*/, $asDeeplyFrozenSerializableJson('Successful PipelineExecutorResult', {
5563
- isSuccessful: true,
5564
- errors: errors.map(serializeError),
5565
- warnings: warnings.map(serializeError),
5566
- usage: usage,
5567
- executionReport: executionReport,
5568
- outputParameters: outputParameters,
5569
- preparedPipeline: preparedPipeline,
5636
+ case 30: return [2 /*return*/, exportJson({
5637
+ name: 'pipelineExecutorResult',
5638
+ message: "Successful PipelineExecutorResult",
5639
+ order: [],
5640
+ value: {
5641
+ isSuccessful: true,
5642
+ errors: errors.map(serializeError),
5643
+ warnings: warnings.map(serializeError),
5644
+ usage: usage,
5645
+ executionReport: executionReport,
5646
+ outputParameters: outputParameters,
5647
+ preparedPipeline: preparedPipeline,
5648
+ },
5570
5649
  })];
5571
5650
  }
5572
5651
  });
@@ -5690,7 +5769,7 @@ var markdownScraperMetadata = $deepFreeze({
5690
5769
  documentationUrl: 'https://github.com/webgptorg/promptbook/discussions/@@',
5691
5770
  isAvilableInBrowser: true,
5692
5771
  requiredExecutables: [],
5693
- }); /* <- TODO: [๐Ÿค›] */
5772
+ }); /* <- Note: [๐Ÿค›] */
5694
5773
  /**
5695
5774
  * Registration of known scraper metadata
5696
5775
  *
@@ -5881,7 +5960,7 @@ var MarkdownScraper = /** @class */ (function () {
5881
5960
  */
5882
5961
  var createMarkdownScraper = Object.assign(function (tools, options) {
5883
5962
  return new MarkdownScraper(tools, options);
5884
- }, markdownScraperMetadata); /* <- TODO: [๐Ÿค›] */
5963
+ }, markdownScraperMetadata); /* <- Note: [๐Ÿค›] */
5885
5964
  /**
5886
5965
  * TODO: [๐ŸŽถ] Naming "constructor" vs "creator" vs "factory"
5887
5966
  */