@promptbook/markdown-utils 0.79.0 → 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 (33) hide show
  1. package/README.md +4 -0
  2. package/esm/index.es.js +400 -324
  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 +3 -0
  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/high-level-abstractions/_common/HighLevelAbstraction.d.ts +20 -0
  15. package/esm/typings/src/high-level-abstractions/implicit-formfactor/ImplicitFormfactorHla.d.ts +10 -0
  16. package/esm/typings/src/high-level-abstractions/index.d.ts +44 -0
  17. package/esm/typings/src/high-level-abstractions/quick-chatbot/QuickChatbotHla.d.ts +10 -0
  18. package/esm/typings/src/llm-providers/remote/RemoteLlmExecutionTools.d.ts +1 -1
  19. package/esm/typings/src/llm-providers/remote/startRemoteServer.d.ts +1 -1
  20. package/esm/typings/src/prepare/prepareTasks.d.ts +1 -0
  21. package/esm/typings/src/types/typeAliases.d.ts +1 -1
  22. package/esm/typings/src/utils/normalization/orderJson.d.ts +21 -0
  23. package/esm/typings/src/utils/normalization/orderJson.test.d.ts +4 -0
  24. package/esm/typings/src/utils/organization/keepTypeImported.d.ts +9 -0
  25. package/esm/typings/src/utils/serialization/$deepFreeze.d.ts +1 -1
  26. package/esm/typings/src/utils/serialization/checkSerializableAsJson.d.ts +20 -2
  27. package/esm/typings/src/utils/serialization/deepClone.test.d.ts +1 -0
  28. package/esm/typings/src/utils/serialization/exportJson.d.ts +29 -0
  29. package/esm/typings/src/utils/serialization/isSerializableAsJson.d.ts +2 -1
  30. package/package.json +1 -1
  31. package/umd/index.umd.js +400 -324
  32. package/umd/index.umd.js.map +1 -1
  33. package/esm/typings/src/utils/serialization/$asDeeplyFrozenSerializableJson.d.ts +0 -17
package/umd/index.umd.js CHANGED
@@ -22,7 +22,7 @@
22
22
  *
23
23
  * @see https://github.com/webgptorg/promptbook
24
24
  */
25
- var PROMPTBOOK_ENGINE_VERSION = '0.78.4';
25
+ var PROMPTBOOK_ENGINE_VERSION = '0.79.0';
26
26
  /**
27
27
  * TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
28
28
  * Note: [💞] Ignore a discrepancy between file name and entity name
@@ -358,7 +358,7 @@
358
358
  * TODO: [🏢] Make this logic part of `JsonFormatDefinition` or `isValidJsonString`
359
359
  */
360
360
 
361
- 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"}];
361
+ 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"}];
362
362
 
363
363
  /**
364
364
  * Prettify the html code
@@ -397,6 +397,7 @@
397
397
  /**
398
398
  * Converts promptbook in JSON format to string format
399
399
  *
400
+ * @deprecated TODO: [🥍][🧠] Backup original files in `PipelineJson` same as in Promptbook.studio
400
401
  * @param pipelineJson Promptbook in JSON format (.book.json)
401
402
  * @returns Promptbook in string format (.book.md)
402
403
  * @public exported from `@promptbook/core`
@@ -692,41 +693,6 @@
692
693
  * @public exported from `@promptbook/core`
693
694
  */
694
695
  var DEFAULT_SCRAPE_CACHE_DIRNAME = './.promptbook/scrape-cache';
695
- /**
696
- * Nonce which is used for replacing things in strings
697
- *
698
- * @private within the repository
699
- */
700
- var REPLACING_NONCE = 'u$k42k%!V2zo34w7Fu#@QUHYPW';
701
- /**
702
- * The names of the parameters that are reserved for special purposes
703
- *
704
- * @public exported from `@promptbook/core`
705
- */
706
- var RESERVED_PARAMETER_NAMES =
707
- /* !!!!!! $asDeeplyFrozenSerializableJson('RESERVED_PARAMETER_NAMES', _____ as const); */ [
708
- 'content',
709
- 'context',
710
- 'knowledge',
711
- 'examples',
712
- 'modelName',
713
- 'currentDate',
714
- // <- TODO: list here all command names
715
- // <- TODO: Add more like 'date', 'modelName',...
716
- // <- TODO: Add [emoji] + instructions ACRY when adding new reserved parameter
717
- ];
718
- /**
719
- * @@@
720
- *
721
- * @private within the repository
722
- */
723
- var RESERVED_PARAMETER_MISSING_VALUE = 'MISSING-' + REPLACING_NONCE;
724
- /**
725
- * @@@
726
- *
727
- * @private within the repository
728
- */
729
- var RESERVED_PARAMETER_RESTRICTED = 'RESTRICTED-' + REPLACING_NONCE;
730
696
  // <- TODO: [🧜‍♂️]
731
697
  /**
732
698
  * @@@
@@ -761,26 +727,59 @@
761
727
  // Note: In normal situations, we check the pipeline logic:
762
728
  true);
763
729
  /**
764
- * TODO: Extract `constants.ts` from `config.ts`
765
730
  * Note: [💞] Ignore a discrepancy between file name and entity name
766
731
  * TODO: [🧠][🧜‍♂️] Maybe join remoteUrl and path into single value
767
732
  */
768
733
 
769
734
  /**
770
- * This error indicates that the promptbook object has valid syntax (=can be parsed) but contains logical errors (like circular dependencies)
735
+ * Orders JSON object by keys
771
736
  *
772
- * @public exported from `@promptbook/core`
737
+ * @returns The same type of object as the input re-ordered
738
+ * @public exported from `@promptbook/utils`
773
739
  */
774
- var PipelineLogicError = /** @class */ (function (_super) {
775
- __extends(PipelineLogicError, _super);
776
- function PipelineLogicError(message) {
777
- var _this = _super.call(this, message) || this;
778
- _this.name = 'PipelineLogicError';
779
- Object.setPrototypeOf(_this, PipelineLogicError.prototype);
780
- return _this;
740
+ function orderJson(options) {
741
+ var value = options.value, order = options.order;
742
+ var orderedValue = __assign(__assign({}, (order === undefined ? {} : Object.fromEntries(order.map(function (key) { return [key, undefined]; })))), value);
743
+ return orderedValue;
744
+ }
745
+
746
+ /**
747
+ * Freezes the given object and all its nested objects recursively
748
+ *
749
+ * Note: `$` is used to indicate that this function is not a pure function - it mutates given object
750
+ * Note: This function mutates the object and returns the original (but mutated-deep-freezed) object
751
+ *
752
+ * @returns The same object as the input, but deeply frozen
753
+ * @public exported from `@promptbook/utils`
754
+ */
755
+ function $deepFreeze(objectValue) {
756
+ var e_1, _a;
757
+ if (Array.isArray(objectValue)) {
758
+ return Object.freeze(objectValue.map(function (item) { return $deepFreeze(item); }));
781
759
  }
782
- return PipelineLogicError;
783
- }(Error));
760
+ var propertyNames = Object.getOwnPropertyNames(objectValue);
761
+ try {
762
+ for (var propertyNames_1 = __values(propertyNames), propertyNames_1_1 = propertyNames_1.next(); !propertyNames_1_1.done; propertyNames_1_1 = propertyNames_1.next()) {
763
+ var propertyName = propertyNames_1_1.value;
764
+ var value = objectValue[propertyName];
765
+ if (value && typeof value === 'object') {
766
+ $deepFreeze(value);
767
+ }
768
+ }
769
+ }
770
+ catch (e_1_1) { e_1 = { error: e_1_1 }; }
771
+ finally {
772
+ try {
773
+ if (propertyNames_1_1 && !propertyNames_1_1.done && (_a = propertyNames_1.return)) _a.call(propertyNames_1);
774
+ }
775
+ finally { if (e_1) throw e_1.error; }
776
+ }
777
+ Object.freeze(objectValue);
778
+ return objectValue;
779
+ }
780
+ /**
781
+ * TODO: [🧠] Is there a way how to meaningfully test this utility
782
+ */
784
783
 
785
784
  /**
786
785
  * Make error report URL for the given error
@@ -816,6 +815,264 @@
816
815
  return UnexpectedError;
817
816
  }(Error));
818
817
 
818
+ /**
819
+ * Checks if the value is [🚉] serializable as JSON
820
+ * If not, throws an UnexpectedError with a rich error message and tracking
821
+ *
822
+ * - Almost all primitives are serializable BUT:
823
+ * - `undefined` is not serializable
824
+ * - `NaN` is not serializable
825
+ * - Objects and arrays are serializable if all their properties are serializable
826
+ * - Functions are not serializable
827
+ * - Circular references are not serializable
828
+ * - `Date` objects are not serializable
829
+ * - `Map` and `Set` objects are not serializable
830
+ * - `RegExp` objects are not serializable
831
+ * - `Error` objects are not serializable
832
+ * - `Symbol` objects are not serializable
833
+ * - And much more...
834
+ *
835
+ * @throws UnexpectedError if the value is not serializable as JSON
836
+ * @public exported from `@promptbook/utils`
837
+ */
838
+ function checkSerializableAsJson(options) {
839
+ var e_1, _a;
840
+ var value = options.value, name = options.name, message = options.message;
841
+ if (value === undefined) {
842
+ throw new UnexpectedError("".concat(name, " is undefined"));
843
+ }
844
+ else if (value === null) {
845
+ return;
846
+ }
847
+ else if (typeof value === 'boolean') {
848
+ return;
849
+ }
850
+ else if (typeof value === 'number' && !isNaN(value)) {
851
+ return;
852
+ }
853
+ else if (typeof value === 'string') {
854
+ return;
855
+ }
856
+ else if (typeof value === 'symbol') {
857
+ throw new UnexpectedError("".concat(name, " is symbol"));
858
+ }
859
+ else if (typeof value === 'function') {
860
+ throw new UnexpectedError("".concat(name, " is function"));
861
+ }
862
+ else if (typeof value === 'object' && Array.isArray(value)) {
863
+ for (var i = 0; i < value.length; i++) {
864
+ checkSerializableAsJson({ name: "".concat(name, "[").concat(i, "]"), value: value[i], message: message });
865
+ }
866
+ }
867
+ else if (typeof value === 'object') {
868
+ if (value instanceof Date) {
869
+ throw new UnexpectedError(spaceTrim__default["default"](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 "); }));
870
+ }
871
+ else if (value instanceof Map) {
872
+ throw new UnexpectedError("".concat(name, " is Map"));
873
+ }
874
+ else if (value instanceof Set) {
875
+ throw new UnexpectedError("".concat(name, " is Set"));
876
+ }
877
+ else if (value instanceof RegExp) {
878
+ throw new UnexpectedError("".concat(name, " is RegExp"));
879
+ }
880
+ else if (value instanceof Error) {
881
+ throw new UnexpectedError(spaceTrim__default["default"](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 "); }));
882
+ }
883
+ else {
884
+ try {
885
+ for (var _b = __values(Object.entries(value)), _c = _b.next(); !_c.done; _c = _b.next()) {
886
+ var _d = __read(_c.value, 2), subName = _d[0], subValue = _d[1];
887
+ if (subValue === undefined) {
888
+ // Note: undefined in object is serializable - it is just omited
889
+ continue;
890
+ }
891
+ checkSerializableAsJson({ name: "".concat(name, ".").concat(subName), value: subValue, message: message });
892
+ }
893
+ }
894
+ catch (e_1_1) { e_1 = { error: e_1_1 }; }
895
+ finally {
896
+ try {
897
+ if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
898
+ }
899
+ finally { if (e_1) throw e_1.error; }
900
+ }
901
+ try {
902
+ JSON.stringify(value); // <- TODO: [0]
903
+ }
904
+ catch (error) {
905
+ if (!(error instanceof Error)) {
906
+ throw error;
907
+ }
908
+ throw new UnexpectedError(spaceTrim__default["default"](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 "); }));
909
+ }
910
+ /*
911
+ TODO: [0] Is there some more elegant way to check circular references?
912
+ const seen = new Set();
913
+ const stack = [{ value }];
914
+ while (stack.length > 0) {
915
+ const { value } = stack.pop()!;
916
+ if (typeof value === 'object' && value !== null) {
917
+ if (seen.has(value)) {
918
+ throw new UnexpectedError(`${name} has circular reference`);
919
+ }
920
+ seen.add(value);
921
+ if (Array.isArray(value)) {
922
+ stack.push(...value.map((value) => ({ value })));
923
+ } else {
924
+ stack.push(...Object.values(value).map((value) => ({ value })));
925
+ }
926
+ }
927
+ }
928
+ */
929
+ return;
930
+ }
931
+ }
932
+ else {
933
+ throw new UnexpectedError(spaceTrim__default["default"](function (block) { return "\n `".concat(name, "` is unknown type\n\n Additional message for `").concat(name, "`:\n ").concat(block(message || '(nothing)'), "\n "); }));
934
+ }
935
+ }
936
+ /**
937
+ * TODO: Can be return type more type-safe? like `asserts options.value is JsonValue`
938
+ * TODO: [🧠][main] !!! In-memory cache of same values to prevent multiple checks
939
+ * Note: [🐠] This is how `checkSerializableAsJson` + `isSerializableAsJson` together can just retun true/false or rich error message
940
+ */
941
+
942
+ /**
943
+ * @@@
944
+ *
945
+ * @public exported from `@promptbook/utils`
946
+ */
947
+ function deepClone(objectValue) {
948
+ return JSON.parse(JSON.stringify(objectValue));
949
+ /*
950
+ !!!!!!!!
951
+ TODO: [🧠] Is there a better implementation?
952
+ > const propertyNames = Object.getOwnPropertyNames(objectValue);
953
+ > for (const propertyName of propertyNames) {
954
+ > const value = (objectValue as really_any)[propertyName];
955
+ > if (value && typeof value === 'object') {
956
+ > deepClone(value);
957
+ > }
958
+ > }
959
+ > return Object.assign({}, objectValue);
960
+ */
961
+ }
962
+ /**
963
+ * TODO: [🧠] Is there a way how to meaningfully test this utility
964
+ */
965
+
966
+ /**
967
+ * Utility to export a JSON object from a function
968
+ *
969
+ * 1) Checks if the value is serializable as JSON
970
+ * 2) Makes a deep clone of the object
971
+ * 2) Orders the object properties
972
+ * 2) Deeply freezes the cloned object
973
+ *
974
+ * Note: This function does not mutates the given object
975
+ *
976
+ * @returns The same type of object as the input but read-only and re-ordered
977
+ * @public exported from `@promptbook/utils`
978
+ */
979
+ function exportJson(options) {
980
+ var name = options.name, value = options.value, order = options.order, message = options.message;
981
+ checkSerializableAsJson({ name: name, value: value, message: message });
982
+ var orderedValue =
983
+ // TODO: Fix error "Type instantiation is excessively deep and possibly infinite."
984
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment
985
+ // @ts-ignore
986
+ order === undefined
987
+ ? deepClone(value)
988
+ : orderJson({
989
+ value: value,
990
+ // <- Note: checkSerializableAsJson asserts that the value is serializable as JSON
991
+ order: order,
992
+ });
993
+ $deepFreeze(orderedValue);
994
+ return orderedValue;
995
+ }
996
+ /**
997
+ * TODO: [🧠] Is there a way how to meaningfully test this utility
998
+ */
999
+
1000
+ /**
1001
+ * Order of keys in the pipeline JSON
1002
+ *
1003
+ * @public exported from `@promptbook/core`
1004
+ */
1005
+ var ORDER_OF_PIPELINE_JSON = [
1006
+ 'title',
1007
+ 'pipelineUrl',
1008
+ 'bookVersion',
1009
+ 'description',
1010
+ 'formfactorName',
1011
+ 'parameters',
1012
+ 'tasks',
1013
+ 'personas',
1014
+ 'preparations',
1015
+ 'knowledgeSources',
1016
+ 'knowledgePieces',
1017
+ ];
1018
+ /**
1019
+ * Nonce which is used for replacing things in strings
1020
+ *
1021
+ * @private within the repository
1022
+ */
1023
+ var REPLACING_NONCE = 'u$k42k%!V2zo34w7Fu#@QUHYPW';
1024
+ /**
1025
+ * @@@
1026
+ *
1027
+ * @private within the repository
1028
+ */
1029
+ var RESERVED_PARAMETER_MISSING_VALUE = 'MISSING-' + REPLACING_NONCE;
1030
+ /**
1031
+ * @@@
1032
+ *
1033
+ * @private within the repository
1034
+ */
1035
+ var RESERVED_PARAMETER_RESTRICTED = 'RESTRICTED-' + REPLACING_NONCE;
1036
+ /**
1037
+ * The names of the parameters that are reserved for special purposes
1038
+ *
1039
+ * @public exported from `@promptbook/core`
1040
+ */
1041
+ var RESERVED_PARAMETER_NAMES = exportJson({
1042
+ name: 'RESERVED_PARAMETER_NAMES',
1043
+ message: "The names of the parameters that are reserved for special purposes",
1044
+ value: [
1045
+ 'content',
1046
+ 'context',
1047
+ 'knowledge',
1048
+ 'examples',
1049
+ 'modelName',
1050
+ 'currentDate',
1051
+ // <- TODO: list here all command names
1052
+ // <- TODO: Add more like 'date', 'modelName',...
1053
+ // <- TODO: Add [emoji] + instructions ACRY when adding new reserved parameter
1054
+ ],
1055
+ });
1056
+ /**
1057
+ * Note: [💞] Ignore a discrepancy between file name and entity name
1058
+ */
1059
+
1060
+ /**
1061
+ * This error indicates that the promptbook object has valid syntax (=can be parsed) but contains logical errors (like circular dependencies)
1062
+ *
1063
+ * @public exported from `@promptbook/core`
1064
+ */
1065
+ var PipelineLogicError = /** @class */ (function (_super) {
1066
+ __extends(PipelineLogicError, _super);
1067
+ function PipelineLogicError(message) {
1068
+ var _this = _super.call(this, message) || this;
1069
+ _this.name = 'PipelineLogicError';
1070
+ Object.setPrototypeOf(_this, PipelineLogicError.prototype);
1071
+ return _this;
1072
+ }
1073
+ return PipelineLogicError;
1074
+ }(Error));
1075
+
819
1076
  /**
820
1077
  * Tests if given string is valid semantic version
821
1078
  *
@@ -1053,6 +1310,21 @@
1053
1310
  }
1054
1311
  };
1055
1312
  try {
1313
+ /*
1314
+ TODO: [🧠][🅾] Should be empty pipeline valid or not
1315
+ // Note: Check that pipeline has some tasks
1316
+ if (pipeline.tasks.length === 0) {
1317
+ throw new PipelineLogicError(
1318
+ spaceTrim(
1319
+ (block) => `
1320
+ Pipeline must have at least one task
1321
+
1322
+ ${block(pipelineIdentification)}
1323
+ `,
1324
+ ),
1325
+ );
1326
+ }
1327
+ */
1056
1328
  // Note: Check each parameter individually
1057
1329
  for (var _d = __values(pipeline.parameters), _e = _d.next(); !_e.done; _e = _d.next()) {
1058
1330
  var parameter = _e.value;
@@ -1213,6 +1485,9 @@
1213
1485
  while (unresovedTasks.length > 0) {
1214
1486
  _loop_3();
1215
1487
  }
1488
+ // Note: Check that formfactor is corresponding to the pipeline interface
1489
+ // TODO: !!!!!! Implement this
1490
+ // pipeline.formfactorName
1216
1491
  }
1217
1492
  /**
1218
1493
  * TODO: !! [🧞‍♀️] Do not allow joker + foreach
@@ -1296,186 +1571,6 @@
1296
1571
  return parameterNames;
1297
1572
  }
1298
1573
 
1299
- /**
1300
- * @@@
1301
- *
1302
- * Note: `$` is used to indicate that this function is not a pure function - it mutates given object
1303
- * Note: This function mutates the object and returns the original (but mutated-deep-freezed) object
1304
- *
1305
- * @returns The same object as the input, but deeply frozen
1306
- * @public exported from `@promptbook/utils`
1307
- */
1308
- function $deepFreeze(objectValue) {
1309
- var e_1, _a;
1310
- if (Array.isArray(objectValue)) {
1311
- return Object.freeze(objectValue.map(function (item) { return $deepFreeze(item); }));
1312
- }
1313
- var propertyNames = Object.getOwnPropertyNames(objectValue);
1314
- try {
1315
- for (var propertyNames_1 = __values(propertyNames), propertyNames_1_1 = propertyNames_1.next(); !propertyNames_1_1.done; propertyNames_1_1 = propertyNames_1.next()) {
1316
- var propertyName = propertyNames_1_1.value;
1317
- var value = objectValue[propertyName];
1318
- if (value && typeof value === 'object') {
1319
- $deepFreeze(value);
1320
- }
1321
- }
1322
- }
1323
- catch (e_1_1) { e_1 = { error: e_1_1 }; }
1324
- finally {
1325
- try {
1326
- if (propertyNames_1_1 && !propertyNames_1_1.done && (_a = propertyNames_1.return)) _a.call(propertyNames_1);
1327
- }
1328
- finally { if (e_1) throw e_1.error; }
1329
- }
1330
- return Object.freeze(objectValue);
1331
- }
1332
- /**
1333
- * TODO: [🧠] Is there a way how to meaningfully test this utility
1334
- */
1335
-
1336
- /**
1337
- * Checks if the value is [🚉] serializable as JSON
1338
- * If not, throws an UnexpectedError with a rich error message and tracking
1339
- *
1340
- * - Almost all primitives are serializable BUT:
1341
- * - `undefined` is not serializable
1342
- * - `NaN` is not serializable
1343
- * - Objects and arrays are serializable if all their properties are serializable
1344
- * - Functions are not serializable
1345
- * - Circular references are not serializable
1346
- * - `Date` objects are not serializable
1347
- * - `Map` and `Set` objects are not serializable
1348
- * - `RegExp` objects are not serializable
1349
- * - `Error` objects are not serializable
1350
- * - `Symbol` objects are not serializable
1351
- * - And much more...
1352
- *
1353
- * @throws UnexpectedError if the value is not serializable as JSON
1354
- * @public exported from `@promptbook/utils`
1355
- */
1356
- function checkSerializableAsJson(name, value) {
1357
- var e_1, _a;
1358
- if (value === undefined) {
1359
- throw new UnexpectedError("".concat(name, " is undefined"));
1360
- }
1361
- else if (value === null) {
1362
- return;
1363
- }
1364
- else if (typeof value === 'boolean') {
1365
- return;
1366
- }
1367
- else if (typeof value === 'number' && !isNaN(value)) {
1368
- return;
1369
- }
1370
- else if (typeof value === 'string') {
1371
- return;
1372
- }
1373
- else if (typeof value === 'symbol') {
1374
- throw new UnexpectedError("".concat(name, " is symbol"));
1375
- }
1376
- else if (typeof value === 'function') {
1377
- throw new UnexpectedError("".concat(name, " is function"));
1378
- }
1379
- else if (typeof value === 'object' && Array.isArray(value)) {
1380
- for (var i = 0; i < value.length; i++) {
1381
- checkSerializableAsJson("".concat(name, "[").concat(i, "]"), value[i]);
1382
- }
1383
- }
1384
- else if (typeof value === 'object') {
1385
- if (value instanceof Date) {
1386
- throw new UnexpectedError(spaceTrim__default["default"]("\n ".concat(name, " is Date\n\n Use `string_date_iso8601` instead\n ")));
1387
- }
1388
- else if (value instanceof Map) {
1389
- throw new UnexpectedError("".concat(name, " is Map"));
1390
- }
1391
- else if (value instanceof Set) {
1392
- throw new UnexpectedError("".concat(name, " is Set"));
1393
- }
1394
- else if (value instanceof RegExp) {
1395
- throw new UnexpectedError("".concat(name, " is RegExp"));
1396
- }
1397
- else if (value instanceof Error) {
1398
- throw new UnexpectedError(spaceTrim__default["default"]("\n ".concat(name, " is unserialized Error\n\n Use function `serializeError`\n ")));
1399
- }
1400
- else {
1401
- try {
1402
- for (var _b = __values(Object.entries(value)), _c = _b.next(); !_c.done; _c = _b.next()) {
1403
- var _d = __read(_c.value, 2), subName = _d[0], subValue = _d[1];
1404
- if (subValue === undefined) {
1405
- // Note: undefined in object is serializable - it is just omited
1406
- continue;
1407
- }
1408
- checkSerializableAsJson("".concat(name, ".").concat(subName), subValue);
1409
- }
1410
- }
1411
- catch (e_1_1) { e_1 = { error: e_1_1 }; }
1412
- finally {
1413
- try {
1414
- if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
1415
- }
1416
- finally { if (e_1) throw e_1.error; }
1417
- }
1418
- try {
1419
- JSON.stringify(value); // <- TODO: [0]
1420
- }
1421
- catch (error) {
1422
- if (!(error instanceof Error)) {
1423
- throw error;
1424
- }
1425
- throw new UnexpectedError(spaceTrim__default["default"](function (block) { return "\n ".concat(name, " is not serializable\n\n ").concat(block(error.toString()), "\n "); }));
1426
- }
1427
- /*
1428
- TODO: [0] Is there some more elegant way to check circular references?
1429
- const seen = new Set();
1430
- const stack = [{ value }];
1431
- while (stack.length > 0) {
1432
- const { value } = stack.pop()!;
1433
- if (typeof value === 'object' && value !== null) {
1434
- if (seen.has(value)) {
1435
- throw new UnexpectedError(`${name} has circular reference`);
1436
- }
1437
- seen.add(value);
1438
- if (Array.isArray(value)) {
1439
- stack.push(...value.map((value) => ({ value })));
1440
- } else {
1441
- stack.push(...Object.values(value).map((value) => ({ value })));
1442
- }
1443
- }
1444
- }
1445
- */
1446
- return;
1447
- }
1448
- }
1449
- else {
1450
- throw new UnexpectedError("".concat(name, " is unknown"));
1451
- }
1452
- }
1453
- /**
1454
- * TODO: [🧠][🛣] More elegant way to tracking than passing `name`
1455
- * TODO: [🧠][main] !!! In-memory cache of same values to prevent multiple checks
1456
- * Note: [🐠] This is how `checkSerializableAsJson` + `isSerializableAsJson` together can just retun true/false or rich error message
1457
- */
1458
-
1459
- /**
1460
- * @@@
1461
- * @@@
1462
- *
1463
- * Note: This function mutates the object and returns the original (but mutated-deep-freezed) object
1464
- *
1465
- * @param name - Name of the object for debugging purposes
1466
- * @param objectValue - Object to be deeply frozen
1467
- * @returns The same object as the input, but deeply frozen
1468
- * @private this is in comparison to `deepFreeze` a more specific utility and maybe not very good practice to use without specific reason and considerations
1469
- */
1470
- function $asDeeplyFrozenSerializableJson(name, objectValue) {
1471
- checkSerializableAsJson(name, objectValue);
1472
- return $deepFreeze(objectValue);
1473
- }
1474
- /**
1475
- * TODO: [🧠][🛣] More elegant way to tracking than passing `name`
1476
- * TODO: [🧠] Is there a way how to meaningfully test this utility
1477
- */
1478
-
1479
1574
  /**
1480
1575
  * Unprepare just strips the preparation data of the pipeline
1481
1576
  *
@@ -1493,7 +1588,12 @@
1493
1588
  delete taskUnprepared.preparedContent;
1494
1589
  return taskUnprepared;
1495
1590
  });
1496
- return $asDeeplyFrozenSerializableJson('Unprepared PipelineJson', __assign(__assign({}, pipeline), { tasks: tasks, knowledgeSources: knowledgeSources, knowledgePieces: [], personas: personas, preparations: [] }));
1591
+ return exportJson({
1592
+ name: 'pipelineJson',
1593
+ message: "Result of `unpreparePipeline`",
1594
+ order: ORDER_OF_PIPELINE_JSON,
1595
+ value: __assign(__assign({}, pipeline), { tasks: tasks, knowledgeSources: knowledgeSources, knowledgePieces: [], personas: personas, preparations: [] }),
1596
+ });
1497
1597
  }
1498
1598
  /**
1499
1599
  * TODO: [🧿] Maybe do same process with same granularity and subfinctions as `preparePipeline`
@@ -2055,29 +2155,6 @@
2055
2155
  * Note: [💞] Ignore a discrepancy between file name and entity name
2056
2156
  */
2057
2157
 
2058
- /**
2059
- * @@@
2060
- *
2061
- * @public exported from `@promptbook/utils`
2062
- */
2063
- function deepClone(objectValue) {
2064
- return JSON.parse(JSON.stringify(objectValue));
2065
- /*
2066
- TODO: [🧠] Is there a better implementation?
2067
- > const propertyNames = Object.getOwnPropertyNames(objectValue);
2068
- > for (const propertyName of propertyNames) {
2069
- > const value = (objectValue as really_any)[propertyName];
2070
- > if (value && typeof value === 'object') {
2071
- > deepClone(value);
2072
- > }
2073
- > }
2074
- > return Object.assign({}, objectValue);
2075
- */
2076
- }
2077
- /**
2078
- * TODO: [🧠] Is there a way how to meaningfully test this utility
2079
- */
2080
-
2081
2158
  /**
2082
2159
  * Function `addUsage` will add multiple usages into one
2083
2160
  *
@@ -3603,36 +3680,6 @@
3603
3680
  * [ ] One piece can have multiple sources
3604
3681
  */
3605
3682
 
3606
- /**
3607
- * @@@
3608
- *
3609
- * Note: It is usefull @@@
3610
- *
3611
- * @param pipeline
3612
- * @public exported from `@promptbook/utils`
3613
- */
3614
- function clonePipeline(pipeline) {
3615
- // Note: Not using spread operator (...) because @@@
3616
- 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;
3617
- return {
3618
- pipelineUrl: pipelineUrl,
3619
- sourceFile: sourceFile,
3620
- title: title,
3621
- bookVersion: bookVersion,
3622
- description: description,
3623
- formfactorName: formfactorName,
3624
- parameters: parameters,
3625
- tasks: tasks,
3626
- knowledgeSources: knowledgeSources,
3627
- knowledgePieces: knowledgePieces,
3628
- personas: personas,
3629
- preparations: preparations,
3630
- };
3631
- }
3632
- /**
3633
- * TODO: [🍙] Make some standard order of json properties
3634
- */
3635
-
3636
3683
  /**
3637
3684
  * @@@
3638
3685
  *
@@ -3673,6 +3720,7 @@
3673
3720
  });
3674
3721
  }
3675
3722
  /**
3723
+ * TODO: [😂] Adding knowledge should be convert to async high-level abstractions, simmilar thing with expectations to sync high-level abstractions
3676
3724
  * TODO: [🧠] Add context to each task (if missing)
3677
3725
  * TODO: [🧠] What is better name `prepareTask` or `prepareTaskAndParameters`
3678
3726
  * TODO: [♨][main] !!! Prepare index the examples and maybe tasks
@@ -3761,11 +3809,19 @@
3761
3809
  case 3:
3762
3810
  tasksPrepared = (_c.sent()).tasksPrepared;
3763
3811
  // ----- /Tasks preparation -----
3812
+ // TODO: [😂] Use here all `AsyncHighLevelAbstraction`
3764
3813
  // Note: Count total usage
3765
3814
  currentPreparation.usage = llmToolsWithUsage.getTotalUsage();
3766
- return [2 /*return*/, $asDeeplyFrozenSerializableJson('Prepared PipelineJson', __assign(__assign({}, clonePipeline(pipeline)), { tasks: __spreadArray([], __read(tasksPrepared), false),
3767
- // <- TODO: [🪓] Here should be no need for spreading new array, just ` tasks: tasksPrepared`
3768
- knowledgeSources: knowledgeSourcesPrepared, knowledgePieces: knowledgePiecesPrepared, personas: preparedPersonas, preparations: __spreadArray([], __read(preparations), false) }))];
3815
+ return [2 /*return*/, exportJson({
3816
+ name: 'pipelineJson',
3817
+ message: "Result of `preparePipeline`",
3818
+ order: ORDER_OF_PIPELINE_JSON,
3819
+ value: __assign(__assign({}, pipeline), {
3820
+ // <- TODO: Probbably deeply clone the pipeline because `$exportJson` freezes the subobjects
3821
+ knowledgeSources: knowledgeSourcesPrepared, knowledgePieces: knowledgePiecesPrepared, tasks: __spreadArray([], __read(tasksPrepared), false),
3822
+ // <- TODO: [🪓] Here should be no need for spreading new array, just ` tasks: tasksPrepared`
3823
+ personas: preparedPersonas, preparations: __spreadArray([], __read(preparations), false) }),
3824
+ })];
3769
3825
  }
3770
3826
  });
3771
3827
  });
@@ -5325,16 +5381,21 @@
5325
5381
  // Note: Wait a short time to prevent race conditions
5326
5382
  _g.sent();
5327
5383
  _g.label = 6;
5328
- case 6: return [2 /*return*/, $asDeeplyFrozenSerializableJson("Unuccessful PipelineExecutorResult (with missing parameter {".concat(parameter.name, "}) PipelineExecutorResult"), {
5329
- isSuccessful: false,
5330
- errors: __spreadArray([
5331
- new PipelineExecutionError("Parameter `{".concat(parameter.name, "}` is required as an input parameter"))
5332
- ], __read(errors), false).map(serializeError),
5333
- warnings: [],
5334
- executionReport: executionReport,
5335
- outputParameters: {},
5336
- usage: ZERO_USAGE,
5337
- preparedPipeline: preparedPipeline,
5384
+ case 6: return [2 /*return*/, exportJson({
5385
+ name: "executionReport",
5386
+ message: "Unuccessful PipelineExecutorResult (with missing parameter {".concat(parameter.name, "}) PipelineExecutorResult"),
5387
+ order: [],
5388
+ value: {
5389
+ isSuccessful: false,
5390
+ errors: __spreadArray([
5391
+ new PipelineExecutionError("Parameter `{".concat(parameter.name, "}` is required as an input parameter"))
5392
+ ], __read(errors), false).map(serializeError),
5393
+ warnings: [],
5394
+ executionReport: executionReport,
5395
+ outputParameters: {},
5396
+ usage: ZERO_USAGE,
5397
+ preparedPipeline: preparedPipeline,
5398
+ },
5338
5399
  })];
5339
5400
  case 7:
5340
5401
  _b = _a.next();
@@ -5373,16 +5434,21 @@
5373
5434
  // Note: Wait a short time to prevent race conditions
5374
5435
  _h.sent();
5375
5436
  _h.label = 3;
5376
- case 3: return [2 /*return*/, { value: $asDeeplyFrozenSerializableJson(spaceTrim.spaceTrim(function (block) { return "\n Unuccessful PipelineExecutorResult (with extra parameter {".concat(parameter.name, "}) PipelineExecutorResult\n\n ").concat(block(pipelineIdentification), "\n "); }), {
5377
- isSuccessful: false,
5378
- errors: __spreadArray([
5379
- new PipelineExecutionError(spaceTrim.spaceTrim(function (block) { return "\n Parameter `{".concat(parameter.name, "}` is passed as input parameter but it is not input\n\n ").concat(block(pipelineIdentification), "\n "); }))
5380
- ], __read(errors), false).map(serializeError),
5381
- warnings: warnings.map(serializeError),
5382
- executionReport: executionReport,
5383
- outputParameters: {},
5384
- usage: ZERO_USAGE,
5385
- preparedPipeline: preparedPipeline,
5437
+ case 3: return [2 /*return*/, { value: exportJson({
5438
+ name: 'pipelineExecutorResult',
5439
+ message: spaceTrim.spaceTrim(function (block) { return "\n Unuccessful PipelineExecutorResult (with extra parameter {".concat(parameter.name, "}) PipelineExecutorResult\n\n ").concat(block(pipelineIdentification), "\n "); }),
5440
+ order: [],
5441
+ value: {
5442
+ isSuccessful: false,
5443
+ errors: __spreadArray([
5444
+ new PipelineExecutionError(spaceTrim.spaceTrim(function (block) { return "\n Parameter `{".concat(parameter.name, "}` is passed as input parameter but it is not input\n\n ").concat(block(pipelineIdentification), "\n "); }))
5445
+ ], __read(errors), false).map(serializeError),
5446
+ warnings: warnings.map(serializeError),
5447
+ executionReport: executionReport,
5448
+ outputParameters: {},
5449
+ usage: ZERO_USAGE,
5450
+ preparedPipeline: preparedPipeline,
5451
+ },
5386
5452
  }) }];
5387
5453
  case 4: return [2 /*return*/];
5388
5454
  }
@@ -5536,14 +5602,19 @@
5536
5602
  // Note: Wait a short time to prevent race conditions
5537
5603
  _g.sent();
5538
5604
  _g.label = 27;
5539
- case 27: return [2 /*return*/, $asDeeplyFrozenSerializableJson('Unuccessful PipelineExecutorResult (with misc errors) PipelineExecutorResult', {
5540
- isSuccessful: false,
5541
- errors: __spreadArray([error_1], __read(errors), false).map(serializeError),
5542
- warnings: warnings.map(serializeError),
5543
- usage: usage_1,
5544
- executionReport: executionReport,
5545
- outputParameters: outputParameters_1,
5546
- preparedPipeline: preparedPipeline,
5605
+ case 27: return [2 /*return*/, exportJson({
5606
+ name: 'pipelineExecutorResult',
5607
+ message: "Unuccessful PipelineExecutorResult (with misc errors) PipelineExecutorResult",
5608
+ order: [],
5609
+ value: {
5610
+ isSuccessful: false,
5611
+ errors: __spreadArray([error_1], __read(errors), false).map(serializeError),
5612
+ warnings: warnings.map(serializeError),
5613
+ usage: usage_1,
5614
+ executionReport: executionReport,
5615
+ outputParameters: outputParameters_1,
5616
+ preparedPipeline: preparedPipeline,
5617
+ },
5547
5618
  })];
5548
5619
  case 28:
5549
5620
  usage = addUsage.apply(void 0, __spreadArray([], __read(executionReport.promptExecutions.map(function (_a) {
@@ -5564,14 +5635,19 @@
5564
5635
  // Note: Wait a short time to prevent race conditions
5565
5636
  _g.sent();
5566
5637
  _g.label = 30;
5567
- case 30: return [2 /*return*/, $asDeeplyFrozenSerializableJson('Successful PipelineExecutorResult', {
5568
- isSuccessful: true,
5569
- errors: errors.map(serializeError),
5570
- warnings: warnings.map(serializeError),
5571
- usage: usage,
5572
- executionReport: executionReport,
5573
- outputParameters: outputParameters,
5574
- preparedPipeline: preparedPipeline,
5638
+ case 30: return [2 /*return*/, exportJson({
5639
+ name: 'pipelineExecutorResult',
5640
+ message: "Successful PipelineExecutorResult",
5641
+ order: [],
5642
+ value: {
5643
+ isSuccessful: true,
5644
+ errors: errors.map(serializeError),
5645
+ warnings: warnings.map(serializeError),
5646
+ usage: usage,
5647
+ executionReport: executionReport,
5648
+ outputParameters: outputParameters,
5649
+ preparedPipeline: preparedPipeline,
5650
+ },
5575
5651
  })];
5576
5652
  }
5577
5653
  });
@@ -5695,7 +5771,7 @@
5695
5771
  documentationUrl: 'https://github.com/webgptorg/promptbook/discussions/@@',
5696
5772
  isAvilableInBrowser: true,
5697
5773
  requiredExecutables: [],
5698
- }); /* <- TODO: [🤛] */
5774
+ }); /* <- Note: [🤛] */
5699
5775
  /**
5700
5776
  * Registration of known scraper metadata
5701
5777
  *
@@ -5886,7 +5962,7 @@
5886
5962
  */
5887
5963
  var createMarkdownScraper = Object.assign(function (tools, options) {
5888
5964
  return new MarkdownScraper(tools, options);
5889
- }, markdownScraperMetadata); /* <- TODO: [🤛] */
5965
+ }, markdownScraperMetadata); /* <- Note: [🤛] */
5890
5966
  /**
5891
5967
  * TODO: [🎶] Naming "constructor" vs "creator" vs "factory"
5892
5968
  */