@promptbook/core 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 +831 -605
  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 +2 -1
  31. package/umd/index.umd.js +831 -604
  32. package/umd/index.umd.js.map +1 -1
  33. package/esm/typings/src/utils/serialization/$asDeeplyFrozenSerializableJson.d.ts +0 -17
package/esm/index.es.js CHANGED
@@ -23,7 +23,7 @@ var BOOK_LANGUAGE_VERSION = '1.0.0';
23
23
  *
24
24
  * @see https://github.com/webgptorg/promptbook
25
25
  */
26
- var PROMPTBOOK_ENGINE_VERSION = '0.78.4';
26
+ var PROMPTBOOK_ENGINE_VERSION = '0.79.0';
27
27
  /**
28
28
  * TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
29
29
  * Note: [💞] Ignore a discrepancy between file name and entity name
@@ -221,6 +221,7 @@ function capitalize(word) {
221
221
  /**
222
222
  * Converts promptbook in JSON format to string format
223
223
  *
224
+ * @deprecated TODO: [🥍][🧠] Backup original files in `PipelineJson` same as in Promptbook.studio
224
225
  * @param pipelineJson Promptbook in JSON format (.book.json)
225
226
  * @returns Promptbook in string format (.book.md)
226
227
  * @public exported from `@promptbook/core`
@@ -582,41 +583,6 @@ var DEFAULT_SCRAPE_CACHE_DIRNAME = './.promptbook/scrape-cache';
582
583
  * @public exported from `@promptbook/core`
583
584
  */
584
585
  var DEFAULT_PIPELINE_COLLECTION_BASE_FILENAME = "index";
585
- /**
586
- * Nonce which is used for replacing things in strings
587
- *
588
- * @private within the repository
589
- */
590
- var REPLACING_NONCE = 'u$k42k%!V2zo34w7Fu#@QUHYPW';
591
- /**
592
- * The names of the parameters that are reserved for special purposes
593
- *
594
- * @public exported from `@promptbook/core`
595
- */
596
- var RESERVED_PARAMETER_NAMES =
597
- /* !!!!!! $asDeeplyFrozenSerializableJson('RESERVED_PARAMETER_NAMES', _____ as const); */ [
598
- 'content',
599
- 'context',
600
- 'knowledge',
601
- 'examples',
602
- 'modelName',
603
- 'currentDate',
604
- // <- TODO: list here all command names
605
- // <- TODO: Add more like 'date', 'modelName',...
606
- // <- TODO: Add [emoji] + instructions ACRY when adding new reserved parameter
607
- ];
608
- /**
609
- * @@@
610
- *
611
- * @private within the repository
612
- */
613
- var RESERVED_PARAMETER_MISSING_VALUE = 'MISSING-' + REPLACING_NONCE;
614
- /**
615
- * @@@
616
- *
617
- * @private within the repository
618
- */
619
- var RESERVED_PARAMETER_RESTRICTED = 'RESTRICTED-' + REPLACING_NONCE;
620
586
  /**
621
587
  * The thresholds for the relative time in the `moment` NPM package.
622
588
  *
@@ -682,45 +648,59 @@ var IS_PIPELINE_LOGIC_VALIDATED = just(
682
648
  // Note: In normal situations, we check the pipeline logic:
683
649
  true);
684
650
  /**
685
- * TODO: Extract `constants.ts` from `config.ts`
686
651
  * Note: [💞] Ignore a discrepancy between file name and entity name
687
652
  * TODO: [🧠][🧜‍♂️] Maybe join remoteUrl and path into single value
688
653
  */
689
654
 
690
655
  /**
691
- * This error indicates that the promptbook in a markdown format cannot be parsed into a valid promptbook object
656
+ * Orders JSON object by keys
692
657
  *
693
- * @public exported from `@promptbook/core`
694
- */
695
- var ParseError = /** @class */ (function (_super) {
696
- __extends(ParseError, _super);
697
- function ParseError(message) {
698
- var _this = _super.call(this, message) || this;
699
- _this.name = 'ParseError';
700
- Object.setPrototypeOf(_this, ParseError.prototype);
701
- return _this;
702
- }
703
- return ParseError;
704
- }(Error));
705
- /**
706
- * TODO: Maybe split `ParseError` and `ApplyError`
658
+ * @returns The same type of object as the input re-ordered
659
+ * @public exported from `@promptbook/utils`
707
660
  */
661
+ function orderJson(options) {
662
+ var value = options.value, order = options.order;
663
+ var orderedValue = __assign(__assign({}, (order === undefined ? {} : Object.fromEntries(order.map(function (key) { return [key, undefined]; })))), value);
664
+ return orderedValue;
665
+ }
708
666
 
709
667
  /**
710
- * This error indicates that the promptbook object has valid syntax (=can be parsed) but contains logical errors (like circular dependencies)
668
+ * Freezes the given object and all its nested objects recursively
711
669
  *
712
- * @public exported from `@promptbook/core`
670
+ * Note: `$` is used to indicate that this function is not a pure function - it mutates given object
671
+ * Note: This function mutates the object and returns the original (but mutated-deep-freezed) object
672
+ *
673
+ * @returns The same object as the input, but deeply frozen
674
+ * @public exported from `@promptbook/utils`
713
675
  */
714
- var PipelineLogicError = /** @class */ (function (_super) {
715
- __extends(PipelineLogicError, _super);
716
- function PipelineLogicError(message) {
717
- var _this = _super.call(this, message) || this;
718
- _this.name = 'PipelineLogicError';
719
- Object.setPrototypeOf(_this, PipelineLogicError.prototype);
720
- return _this;
676
+ function $deepFreeze(objectValue) {
677
+ var e_1, _a;
678
+ if (Array.isArray(objectValue)) {
679
+ return Object.freeze(objectValue.map(function (item) { return $deepFreeze(item); }));
721
680
  }
722
- return PipelineLogicError;
723
- }(Error));
681
+ var propertyNames = Object.getOwnPropertyNames(objectValue);
682
+ try {
683
+ for (var propertyNames_1 = __values(propertyNames), propertyNames_1_1 = propertyNames_1.next(); !propertyNames_1_1.done; propertyNames_1_1 = propertyNames_1.next()) {
684
+ var propertyName = propertyNames_1_1.value;
685
+ var value = objectValue[propertyName];
686
+ if (value && typeof value === 'object') {
687
+ $deepFreeze(value);
688
+ }
689
+ }
690
+ }
691
+ catch (e_1_1) { e_1 = { error: e_1_1 }; }
692
+ finally {
693
+ try {
694
+ if (propertyNames_1_1 && !propertyNames_1_1.done && (_a = propertyNames_1.return)) _a.call(propertyNames_1);
695
+ }
696
+ finally { if (e_1) throw e_1.error; }
697
+ }
698
+ Object.freeze(objectValue);
699
+ return objectValue;
700
+ }
701
+ /**
702
+ * TODO: [🧠] Is there a way how to meaningfully test this utility
703
+ */
724
704
 
725
705
  /**
726
706
  * Make error report URL for the given error
@@ -756,6 +736,283 @@ var UnexpectedError = /** @class */ (function (_super) {
756
736
  return UnexpectedError;
757
737
  }(Error));
758
738
 
739
+ /**
740
+ * Checks if the value is [🚉] serializable as JSON
741
+ * If not, throws an UnexpectedError with a rich error message and tracking
742
+ *
743
+ * - Almost all primitives are serializable BUT:
744
+ * - `undefined` is not serializable
745
+ * - `NaN` is not serializable
746
+ * - Objects and arrays are serializable if all their properties are serializable
747
+ * - Functions are not serializable
748
+ * - Circular references are not serializable
749
+ * - `Date` objects are not serializable
750
+ * - `Map` and `Set` objects are not serializable
751
+ * - `RegExp` objects are not serializable
752
+ * - `Error` objects are not serializable
753
+ * - `Symbol` objects are not serializable
754
+ * - And much more...
755
+ *
756
+ * @throws UnexpectedError if the value is not serializable as JSON
757
+ * @public exported from `@promptbook/utils`
758
+ */
759
+ function checkSerializableAsJson(options) {
760
+ var e_1, _a;
761
+ var value = options.value, name = options.name, message = options.message;
762
+ if (value === undefined) {
763
+ throw new UnexpectedError("".concat(name, " is undefined"));
764
+ }
765
+ else if (value === null) {
766
+ return;
767
+ }
768
+ else if (typeof value === 'boolean') {
769
+ return;
770
+ }
771
+ else if (typeof value === 'number' && !isNaN(value)) {
772
+ return;
773
+ }
774
+ else if (typeof value === 'string') {
775
+ return;
776
+ }
777
+ else if (typeof value === 'symbol') {
778
+ throw new UnexpectedError("".concat(name, " is symbol"));
779
+ }
780
+ else if (typeof value === 'function') {
781
+ throw new UnexpectedError("".concat(name, " is function"));
782
+ }
783
+ else if (typeof value === 'object' && Array.isArray(value)) {
784
+ for (var i = 0; i < value.length; i++) {
785
+ checkSerializableAsJson({ name: "".concat(name, "[").concat(i, "]"), value: value[i], message: message });
786
+ }
787
+ }
788
+ else if (typeof value === 'object') {
789
+ if (value instanceof Date) {
790
+ 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 "); }));
791
+ }
792
+ else if (value instanceof Map) {
793
+ throw new UnexpectedError("".concat(name, " is Map"));
794
+ }
795
+ else if (value instanceof Set) {
796
+ throw new UnexpectedError("".concat(name, " is Set"));
797
+ }
798
+ else if (value instanceof RegExp) {
799
+ throw new UnexpectedError("".concat(name, " is RegExp"));
800
+ }
801
+ else if (value instanceof Error) {
802
+ 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 "); }));
803
+ }
804
+ else {
805
+ try {
806
+ for (var _b = __values(Object.entries(value)), _c = _b.next(); !_c.done; _c = _b.next()) {
807
+ var _d = __read(_c.value, 2), subName = _d[0], subValue = _d[1];
808
+ if (subValue === undefined) {
809
+ // Note: undefined in object is serializable - it is just omited
810
+ continue;
811
+ }
812
+ checkSerializableAsJson({ name: "".concat(name, ".").concat(subName), value: subValue, message: message });
813
+ }
814
+ }
815
+ catch (e_1_1) { e_1 = { error: e_1_1 }; }
816
+ finally {
817
+ try {
818
+ if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
819
+ }
820
+ finally { if (e_1) throw e_1.error; }
821
+ }
822
+ try {
823
+ JSON.stringify(value); // <- TODO: [0]
824
+ }
825
+ catch (error) {
826
+ if (!(error instanceof Error)) {
827
+ throw error;
828
+ }
829
+ 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 "); }));
830
+ }
831
+ /*
832
+ TODO: [0] Is there some more elegant way to check circular references?
833
+ const seen = new Set();
834
+ const stack = [{ value }];
835
+ while (stack.length > 0) {
836
+ const { value } = stack.pop()!;
837
+ if (typeof value === 'object' && value !== null) {
838
+ if (seen.has(value)) {
839
+ throw new UnexpectedError(`${name} has circular reference`);
840
+ }
841
+ seen.add(value);
842
+ if (Array.isArray(value)) {
843
+ stack.push(...value.map((value) => ({ value })));
844
+ } else {
845
+ stack.push(...Object.values(value).map((value) => ({ value })));
846
+ }
847
+ }
848
+ }
849
+ */
850
+ return;
851
+ }
852
+ }
853
+ else {
854
+ 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 "); }));
855
+ }
856
+ }
857
+ /**
858
+ * TODO: Can be return type more type-safe? like `asserts options.value is JsonValue`
859
+ * TODO: [🧠][main] !!! In-memory cache of same values to prevent multiple checks
860
+ * Note: [🐠] This is how `checkSerializableAsJson` + `isSerializableAsJson` together can just retun true/false or rich error message
861
+ */
862
+
863
+ /**
864
+ * @@@
865
+ *
866
+ * @public exported from `@promptbook/utils`
867
+ */
868
+ function deepClone(objectValue) {
869
+ return JSON.parse(JSON.stringify(objectValue));
870
+ /*
871
+ !!!!!!!!
872
+ TODO: [🧠] Is there a better implementation?
873
+ > const propertyNames = Object.getOwnPropertyNames(objectValue);
874
+ > for (const propertyName of propertyNames) {
875
+ > const value = (objectValue as really_any)[propertyName];
876
+ > if (value && typeof value === 'object') {
877
+ > deepClone(value);
878
+ > }
879
+ > }
880
+ > return Object.assign({}, objectValue);
881
+ */
882
+ }
883
+ /**
884
+ * TODO: [🧠] Is there a way how to meaningfully test this utility
885
+ */
886
+
887
+ /**
888
+ * Utility to export a JSON object from a function
889
+ *
890
+ * 1) Checks if the value is serializable as JSON
891
+ * 2) Makes a deep clone of the object
892
+ * 2) Orders the object properties
893
+ * 2) Deeply freezes the cloned object
894
+ *
895
+ * Note: This function does not mutates the given object
896
+ *
897
+ * @returns The same type of object as the input but read-only and re-ordered
898
+ * @public exported from `@promptbook/utils`
899
+ */
900
+ function exportJson(options) {
901
+ var name = options.name, value = options.value, order = options.order, message = options.message;
902
+ checkSerializableAsJson({ name: name, value: value, message: message });
903
+ var orderedValue =
904
+ // TODO: Fix error "Type instantiation is excessively deep and possibly infinite."
905
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment
906
+ // @ts-ignore
907
+ order === undefined
908
+ ? deepClone(value)
909
+ : orderJson({
910
+ value: value,
911
+ // <- Note: checkSerializableAsJson asserts that the value is serializable as JSON
912
+ order: order,
913
+ });
914
+ $deepFreeze(orderedValue);
915
+ return orderedValue;
916
+ }
917
+ /**
918
+ * TODO: [🧠] Is there a way how to meaningfully test this utility
919
+ */
920
+
921
+ /**
922
+ * Order of keys in the pipeline JSON
923
+ *
924
+ * @public exported from `@promptbook/core`
925
+ */
926
+ var ORDER_OF_PIPELINE_JSON = [
927
+ 'title',
928
+ 'pipelineUrl',
929
+ 'bookVersion',
930
+ 'description',
931
+ 'formfactorName',
932
+ 'parameters',
933
+ 'tasks',
934
+ 'personas',
935
+ 'preparations',
936
+ 'knowledgeSources',
937
+ 'knowledgePieces',
938
+ ];
939
+ /**
940
+ * Nonce which is used for replacing things in strings
941
+ *
942
+ * @private within the repository
943
+ */
944
+ var REPLACING_NONCE = 'u$k42k%!V2zo34w7Fu#@QUHYPW';
945
+ /**
946
+ * @@@
947
+ *
948
+ * @private within the repository
949
+ */
950
+ var RESERVED_PARAMETER_MISSING_VALUE = 'MISSING-' + REPLACING_NONCE;
951
+ /**
952
+ * @@@
953
+ *
954
+ * @private within the repository
955
+ */
956
+ var RESERVED_PARAMETER_RESTRICTED = 'RESTRICTED-' + REPLACING_NONCE;
957
+ /**
958
+ * The names of the parameters that are reserved for special purposes
959
+ *
960
+ * @public exported from `@promptbook/core`
961
+ */
962
+ var RESERVED_PARAMETER_NAMES = exportJson({
963
+ name: 'RESERVED_PARAMETER_NAMES',
964
+ message: "The names of the parameters that are reserved for special purposes",
965
+ value: [
966
+ 'content',
967
+ 'context',
968
+ 'knowledge',
969
+ 'examples',
970
+ 'modelName',
971
+ 'currentDate',
972
+ // <- TODO: list here all command names
973
+ // <- TODO: Add more like 'date', 'modelName',...
974
+ // <- TODO: Add [emoji] + instructions ACRY when adding new reserved parameter
975
+ ],
976
+ });
977
+ /**
978
+ * Note: [💞] Ignore a discrepancy between file name and entity name
979
+ */
980
+
981
+ /**
982
+ * This error indicates that the promptbook in a markdown format cannot be parsed into a valid promptbook object
983
+ *
984
+ * @public exported from `@promptbook/core`
985
+ */
986
+ var ParseError = /** @class */ (function (_super) {
987
+ __extends(ParseError, _super);
988
+ function ParseError(message) {
989
+ var _this = _super.call(this, message) || this;
990
+ _this.name = 'ParseError';
991
+ Object.setPrototypeOf(_this, ParseError.prototype);
992
+ return _this;
993
+ }
994
+ return ParseError;
995
+ }(Error));
996
+ /**
997
+ * TODO: Maybe split `ParseError` and `ApplyError`
998
+ */
999
+
1000
+ /**
1001
+ * This error indicates that the promptbook object has valid syntax (=can be parsed) but contains logical errors (like circular dependencies)
1002
+ *
1003
+ * @public exported from `@promptbook/core`
1004
+ */
1005
+ var PipelineLogicError = /** @class */ (function (_super) {
1006
+ __extends(PipelineLogicError, _super);
1007
+ function PipelineLogicError(message) {
1008
+ var _this = _super.call(this, message) || this;
1009
+ _this.name = 'PipelineLogicError';
1010
+ Object.setPrototypeOf(_this, PipelineLogicError.prototype);
1011
+ return _this;
1012
+ }
1013
+ return PipelineLogicError;
1014
+ }(Error));
1015
+
759
1016
  /**
760
1017
  * Tests if given string is valid semantic version
761
1018
  *
@@ -993,6 +1250,21 @@ function validatePipelineCore(pipeline) {
993
1250
  }
994
1251
  };
995
1252
  try {
1253
+ /*
1254
+ TODO: [🧠][🅾] Should be empty pipeline valid or not
1255
+ // Note: Check that pipeline has some tasks
1256
+ if (pipeline.tasks.length === 0) {
1257
+ throw new PipelineLogicError(
1258
+ spaceTrim(
1259
+ (block) => `
1260
+ Pipeline must have at least one task
1261
+
1262
+ ${block(pipelineIdentification)}
1263
+ `,
1264
+ ),
1265
+ );
1266
+ }
1267
+ */
996
1268
  // Note: Check each parameter individually
997
1269
  for (var _d = __values(pipeline.parameters), _e = _d.next(); !_e.done; _e = _d.next()) {
998
1270
  var parameter = _e.value;
@@ -1153,6 +1425,9 @@ function validatePipelineCore(pipeline) {
1153
1425
  while (unresovedTasks.length > 0) {
1154
1426
  _loop_3();
1155
1427
  }
1428
+ // Note: Check that formfactor is corresponding to the pipeline interface
1429
+ // TODO: !!!!!! Implement this
1430
+ // pipeline.formfactorName
1156
1431
  }
1157
1432
  /**
1158
1433
  * TODO: !! [🧞‍♀️] Do not allow joker + foreach
@@ -1186,235 +1461,55 @@ var NotFoundError = /** @class */ (function (_super) {
1186
1461
  function NotFoundError(message) {
1187
1462
  var _this = _super.call(this, message) || this;
1188
1463
  _this.name = 'NotFoundError';
1189
- Object.setPrototypeOf(_this, NotFoundError.prototype);
1190
- return _this;
1191
- }
1192
- return NotFoundError;
1193
- }(Error));
1194
-
1195
- /**
1196
- * This error indicates errors in referencing promptbooks between each other
1197
- *
1198
- * @public exported from `@promptbook/core`
1199
- */
1200
- var PipelineUrlError = /** @class */ (function (_super) {
1201
- __extends(PipelineUrlError, _super);
1202
- function PipelineUrlError(message) {
1203
- var _this = _super.call(this, message) || this;
1204
- _this.name = 'PipelineUrlError';
1205
- Object.setPrototypeOf(_this, PipelineUrlError.prototype);
1206
- return _this;
1207
- }
1208
- return PipelineUrlError;
1209
- }(Error));
1210
-
1211
- /**
1212
- * Parses the task and returns the list of all parameter names
1213
- *
1214
- * @param template the string template with parameters in {curly} braces
1215
- * @returns the list of parameter names
1216
- * @public exported from `@promptbook/utils`
1217
- */
1218
- function extractParameterNames(template) {
1219
- var e_1, _a;
1220
- var matches = template.matchAll(/{\w+}/g);
1221
- var parameterNames = new Set();
1222
- try {
1223
- for (var matches_1 = __values(matches), matches_1_1 = matches_1.next(); !matches_1_1.done; matches_1_1 = matches_1.next()) {
1224
- var match = matches_1_1.value;
1225
- var parameterName = match[0].slice(1, -1);
1226
- parameterNames.add(parameterName);
1227
- }
1228
- }
1229
- catch (e_1_1) { e_1 = { error: e_1_1 }; }
1230
- finally {
1231
- try {
1232
- if (matches_1_1 && !matches_1_1.done && (_a = matches_1.return)) _a.call(matches_1);
1233
- }
1234
- finally { if (e_1) throw e_1.error; }
1235
- }
1236
- return parameterNames;
1237
- }
1238
-
1239
- /**
1240
- * @@@
1241
- *
1242
- * Note: `$` is used to indicate that this function is not a pure function - it mutates given object
1243
- * Note: This function mutates the object and returns the original (but mutated-deep-freezed) object
1244
- *
1245
- * @returns The same object as the input, but deeply frozen
1246
- * @public exported from `@promptbook/utils`
1247
- */
1248
- function $deepFreeze(objectValue) {
1249
- var e_1, _a;
1250
- if (Array.isArray(objectValue)) {
1251
- return Object.freeze(objectValue.map(function (item) { return $deepFreeze(item); }));
1252
- }
1253
- var propertyNames = Object.getOwnPropertyNames(objectValue);
1254
- try {
1255
- for (var propertyNames_1 = __values(propertyNames), propertyNames_1_1 = propertyNames_1.next(); !propertyNames_1_1.done; propertyNames_1_1 = propertyNames_1.next()) {
1256
- var propertyName = propertyNames_1_1.value;
1257
- var value = objectValue[propertyName];
1258
- if (value && typeof value === 'object') {
1259
- $deepFreeze(value);
1260
- }
1261
- }
1262
- }
1263
- catch (e_1_1) { e_1 = { error: e_1_1 }; }
1264
- finally {
1265
- try {
1266
- if (propertyNames_1_1 && !propertyNames_1_1.done && (_a = propertyNames_1.return)) _a.call(propertyNames_1);
1267
- }
1268
- finally { if (e_1) throw e_1.error; }
1269
- }
1270
- return Object.freeze(objectValue);
1271
- }
1272
- /**
1273
- * TODO: [🧠] Is there a way how to meaningfully test this utility
1274
- */
1275
-
1276
- /**
1277
- * Checks if the value is [🚉] serializable as JSON
1278
- * If not, throws an UnexpectedError with a rich error message and tracking
1279
- *
1280
- * - Almost all primitives are serializable BUT:
1281
- * - `undefined` is not serializable
1282
- * - `NaN` is not serializable
1283
- * - Objects and arrays are serializable if all their properties are serializable
1284
- * - Functions are not serializable
1285
- * - Circular references are not serializable
1286
- * - `Date` objects are not serializable
1287
- * - `Map` and `Set` objects are not serializable
1288
- * - `RegExp` objects are not serializable
1289
- * - `Error` objects are not serializable
1290
- * - `Symbol` objects are not serializable
1291
- * - And much more...
1292
- *
1293
- * @throws UnexpectedError if the value is not serializable as JSON
1294
- * @public exported from `@promptbook/utils`
1295
- */
1296
- function checkSerializableAsJson(name, value) {
1297
- var e_1, _a;
1298
- if (value === undefined) {
1299
- throw new UnexpectedError("".concat(name, " is undefined"));
1300
- }
1301
- else if (value === null) {
1302
- return;
1303
- }
1304
- else if (typeof value === 'boolean') {
1305
- return;
1306
- }
1307
- else if (typeof value === 'number' && !isNaN(value)) {
1308
- return;
1309
- }
1310
- else if (typeof value === 'string') {
1311
- return;
1312
- }
1313
- else if (typeof value === 'symbol') {
1314
- throw new UnexpectedError("".concat(name, " is symbol"));
1315
- }
1316
- else if (typeof value === 'function') {
1317
- throw new UnexpectedError("".concat(name, " is function"));
1318
- }
1319
- else if (typeof value === 'object' && Array.isArray(value)) {
1320
- for (var i = 0; i < value.length; i++) {
1321
- checkSerializableAsJson("".concat(name, "[").concat(i, "]"), value[i]);
1322
- }
1323
- }
1324
- else if (typeof value === 'object') {
1325
- if (value instanceof Date) {
1326
- throw new UnexpectedError(spaceTrim("\n ".concat(name, " is Date\n\n Use `string_date_iso8601` instead\n ")));
1327
- }
1328
- else if (value instanceof Map) {
1329
- throw new UnexpectedError("".concat(name, " is Map"));
1330
- }
1331
- else if (value instanceof Set) {
1332
- throw new UnexpectedError("".concat(name, " is Set"));
1333
- }
1334
- else if (value instanceof RegExp) {
1335
- throw new UnexpectedError("".concat(name, " is RegExp"));
1336
- }
1337
- else if (value instanceof Error) {
1338
- throw new UnexpectedError(spaceTrim("\n ".concat(name, " is unserialized Error\n\n Use function `serializeError`\n ")));
1339
- }
1340
- else {
1341
- try {
1342
- for (var _b = __values(Object.entries(value)), _c = _b.next(); !_c.done; _c = _b.next()) {
1343
- var _d = __read(_c.value, 2), subName = _d[0], subValue = _d[1];
1344
- if (subValue === undefined) {
1345
- // Note: undefined in object is serializable - it is just omited
1346
- continue;
1347
- }
1348
- checkSerializableAsJson("".concat(name, ".").concat(subName), subValue);
1349
- }
1350
- }
1351
- catch (e_1_1) { e_1 = { error: e_1_1 }; }
1352
- finally {
1353
- try {
1354
- if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
1355
- }
1356
- finally { if (e_1) throw e_1.error; }
1357
- }
1358
- try {
1359
- JSON.stringify(value); // <- TODO: [0]
1360
- }
1361
- catch (error) {
1362
- if (!(error instanceof Error)) {
1363
- throw error;
1364
- }
1365
- throw new UnexpectedError(spaceTrim(function (block) { return "\n ".concat(name, " is not serializable\n\n ").concat(block(error.toString()), "\n "); }));
1366
- }
1367
- /*
1368
- TODO: [0] Is there some more elegant way to check circular references?
1369
- const seen = new Set();
1370
- const stack = [{ value }];
1371
- while (stack.length > 0) {
1372
- const { value } = stack.pop()!;
1373
- if (typeof value === 'object' && value !== null) {
1374
- if (seen.has(value)) {
1375
- throw new UnexpectedError(`${name} has circular reference`);
1376
- }
1377
- seen.add(value);
1378
- if (Array.isArray(value)) {
1379
- stack.push(...value.map((value) => ({ value })));
1380
- } else {
1381
- stack.push(...Object.values(value).map((value) => ({ value })));
1382
- }
1383
- }
1384
- }
1385
- */
1386
- return;
1387
- }
1388
- }
1389
- else {
1390
- throw new UnexpectedError("".concat(name, " is unknown"));
1464
+ Object.setPrototypeOf(_this, NotFoundError.prototype);
1465
+ return _this;
1391
1466
  }
1392
- }
1467
+ return NotFoundError;
1468
+ }(Error));
1469
+
1393
1470
  /**
1394
- * TODO: [🧠][🛣] More elegant way to tracking than passing `name`
1395
- * TODO: [🧠][main] !!! In-memory cache of same values to prevent multiple checks
1396
- * Note: [🐠] This is how `checkSerializableAsJson` + `isSerializableAsJson` together can just retun true/false or rich error message
1471
+ * This error indicates errors in referencing promptbooks between each other
1472
+ *
1473
+ * @public exported from `@promptbook/core`
1397
1474
  */
1475
+ var PipelineUrlError = /** @class */ (function (_super) {
1476
+ __extends(PipelineUrlError, _super);
1477
+ function PipelineUrlError(message) {
1478
+ var _this = _super.call(this, message) || this;
1479
+ _this.name = 'PipelineUrlError';
1480
+ Object.setPrototypeOf(_this, PipelineUrlError.prototype);
1481
+ return _this;
1482
+ }
1483
+ return PipelineUrlError;
1484
+ }(Error));
1398
1485
 
1399
1486
  /**
1400
- * @@@
1401
- * @@@
1402
- *
1403
- * Note: This function mutates the object and returns the original (but mutated-deep-freezed) object
1487
+ * Parses the task and returns the list of all parameter names
1404
1488
  *
1405
- * @param name - Name of the object for debugging purposes
1406
- * @param objectValue - Object to be deeply frozen
1407
- * @returns The same object as the input, but deeply frozen
1408
- * @private this is in comparison to `deepFreeze` a more specific utility and maybe not very good practice to use without specific reason and considerations
1489
+ * @param template the string template with parameters in {curly} braces
1490
+ * @returns the list of parameter names
1491
+ * @public exported from `@promptbook/utils`
1409
1492
  */
1410
- function $asDeeplyFrozenSerializableJson(name, objectValue) {
1411
- checkSerializableAsJson(name, objectValue);
1412
- return $deepFreeze(objectValue);
1493
+ function extractParameterNames(template) {
1494
+ var e_1, _a;
1495
+ var matches = template.matchAll(/{\w+}/g);
1496
+ var parameterNames = new Set();
1497
+ try {
1498
+ for (var matches_1 = __values(matches), matches_1_1 = matches_1.next(); !matches_1_1.done; matches_1_1 = matches_1.next()) {
1499
+ var match = matches_1_1.value;
1500
+ var parameterName = match[0].slice(1, -1);
1501
+ parameterNames.add(parameterName);
1502
+ }
1503
+ }
1504
+ catch (e_1_1) { e_1 = { error: e_1_1 }; }
1505
+ finally {
1506
+ try {
1507
+ if (matches_1_1 && !matches_1_1.done && (_a = matches_1.return)) _a.call(matches_1);
1508
+ }
1509
+ finally { if (e_1) throw e_1.error; }
1510
+ }
1511
+ return parameterNames;
1413
1512
  }
1414
- /**
1415
- * TODO: [🧠][🛣] More elegant way to tracking than passing `name`
1416
- * TODO: [🧠] Is there a way how to meaningfully test this utility
1417
- */
1418
1513
 
1419
1514
  /**
1420
1515
  * Unprepare just strips the preparation data of the pipeline
@@ -1433,7 +1528,12 @@ function unpreparePipeline(pipeline) {
1433
1528
  delete taskUnprepared.preparedContent;
1434
1529
  return taskUnprepared;
1435
1530
  });
1436
- return $asDeeplyFrozenSerializableJson('Unprepared PipelineJson', __assign(__assign({}, pipeline), { tasks: tasks, knowledgeSources: knowledgeSources, knowledgePieces: [], personas: personas, preparations: [] }));
1531
+ return exportJson({
1532
+ name: 'pipelineJson',
1533
+ message: "Result of `unpreparePipeline`",
1534
+ order: ORDER_OF_PIPELINE_JSON,
1535
+ value: __assign(__assign({}, pipeline), { tasks: tasks, knowledgeSources: knowledgeSources, knowledgePieces: [], personas: personas, preparations: [] }),
1536
+ });
1437
1537
  }
1438
1538
  /**
1439
1539
  * TODO: [🧿] Maybe do same process with same granularity and subfinctions as `preparePipeline`
@@ -1896,29 +1996,6 @@ var UNCERTAIN_USAGE = $deepFreeze({
1896
1996
  * Note: [💞] Ignore a discrepancy between file name and entity name
1897
1997
  */
1898
1998
 
1899
- /**
1900
- * @@@
1901
- *
1902
- * @public exported from `@promptbook/utils`
1903
- */
1904
- function deepClone(objectValue) {
1905
- return JSON.parse(JSON.stringify(objectValue));
1906
- /*
1907
- TODO: [🧠] Is there a better implementation?
1908
- > const propertyNames = Object.getOwnPropertyNames(objectValue);
1909
- > for (const propertyName of propertyNames) {
1910
- > const value = (objectValue as really_any)[propertyName];
1911
- > if (value && typeof value === 'object') {
1912
- > deepClone(value);
1913
- > }
1914
- > }
1915
- > return Object.assign({}, objectValue);
1916
- */
1917
- }
1918
- /**
1919
- * TODO: [🧠] Is there a way how to meaningfully test this utility
1920
- */
1921
-
1922
1999
  /**
1923
2000
  * Function `addUsage` will add multiple usages into one
1924
2001
  *
@@ -2386,7 +2463,7 @@ function joinLlmExecutionTools() {
2386
2463
  * TODO: [👷‍♂️] @@@ Manual about construction of llmTools
2387
2464
  */
2388
2465
 
2389
- 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"}];
2466
+ 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"}];
2390
2467
 
2391
2468
  /**
2392
2469
  * This error indicates problems parsing the format value
@@ -4658,16 +4735,21 @@ function executePipeline(options) {
4658
4735
  // Note: Wait a short time to prevent race conditions
4659
4736
  _g.sent();
4660
4737
  _g.label = 6;
4661
- case 6: return [2 /*return*/, $asDeeplyFrozenSerializableJson("Unuccessful PipelineExecutorResult (with missing parameter {".concat(parameter.name, "}) PipelineExecutorResult"), {
4662
- isSuccessful: false,
4663
- errors: __spreadArray([
4664
- new PipelineExecutionError("Parameter `{".concat(parameter.name, "}` is required as an input parameter"))
4665
- ], __read(errors), false).map(serializeError),
4666
- warnings: [],
4667
- executionReport: executionReport,
4668
- outputParameters: {},
4669
- usage: ZERO_USAGE,
4670
- preparedPipeline: preparedPipeline,
4738
+ case 6: return [2 /*return*/, exportJson({
4739
+ name: "executionReport",
4740
+ message: "Unuccessful PipelineExecutorResult (with missing parameter {".concat(parameter.name, "}) PipelineExecutorResult"),
4741
+ order: [],
4742
+ value: {
4743
+ isSuccessful: false,
4744
+ errors: __spreadArray([
4745
+ new PipelineExecutionError("Parameter `{".concat(parameter.name, "}` is required as an input parameter"))
4746
+ ], __read(errors), false).map(serializeError),
4747
+ warnings: [],
4748
+ executionReport: executionReport,
4749
+ outputParameters: {},
4750
+ usage: ZERO_USAGE,
4751
+ preparedPipeline: preparedPipeline,
4752
+ },
4671
4753
  })];
4672
4754
  case 7:
4673
4755
  _b = _a.next();
@@ -4706,16 +4788,21 @@ function executePipeline(options) {
4706
4788
  // Note: Wait a short time to prevent race conditions
4707
4789
  _h.sent();
4708
4790
  _h.label = 3;
4709
- 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 "); }), {
4710
- isSuccessful: false,
4711
- errors: __spreadArray([
4712
- 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 "); }))
4713
- ], __read(errors), false).map(serializeError),
4714
- warnings: warnings.map(serializeError),
4715
- executionReport: executionReport,
4716
- outputParameters: {},
4717
- usage: ZERO_USAGE,
4718
- preparedPipeline: preparedPipeline,
4791
+ case 3: return [2 /*return*/, { value: exportJson({
4792
+ name: 'pipelineExecutorResult',
4793
+ message: spaceTrim$1(function (block) { return "\n Unuccessful PipelineExecutorResult (with extra parameter {".concat(parameter.name, "}) PipelineExecutorResult\n\n ").concat(block(pipelineIdentification), "\n "); }),
4794
+ order: [],
4795
+ value: {
4796
+ isSuccessful: false,
4797
+ errors: __spreadArray([
4798
+ 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 "); }))
4799
+ ], __read(errors), false).map(serializeError),
4800
+ warnings: warnings.map(serializeError),
4801
+ executionReport: executionReport,
4802
+ outputParameters: {},
4803
+ usage: ZERO_USAGE,
4804
+ preparedPipeline: preparedPipeline,
4805
+ },
4719
4806
  }) }];
4720
4807
  case 4: return [2 /*return*/];
4721
4808
  }
@@ -4869,14 +4956,19 @@ function executePipeline(options) {
4869
4956
  // Note: Wait a short time to prevent race conditions
4870
4957
  _g.sent();
4871
4958
  _g.label = 27;
4872
- case 27: return [2 /*return*/, $asDeeplyFrozenSerializableJson('Unuccessful PipelineExecutorResult (with misc errors) PipelineExecutorResult', {
4873
- isSuccessful: false,
4874
- errors: __spreadArray([error_1], __read(errors), false).map(serializeError),
4875
- warnings: warnings.map(serializeError),
4876
- usage: usage_1,
4877
- executionReport: executionReport,
4878
- outputParameters: outputParameters_1,
4879
- preparedPipeline: preparedPipeline,
4959
+ case 27: return [2 /*return*/, exportJson({
4960
+ name: 'pipelineExecutorResult',
4961
+ message: "Unuccessful PipelineExecutorResult (with misc errors) PipelineExecutorResult",
4962
+ order: [],
4963
+ value: {
4964
+ isSuccessful: false,
4965
+ errors: __spreadArray([error_1], __read(errors), false).map(serializeError),
4966
+ warnings: warnings.map(serializeError),
4967
+ usage: usage_1,
4968
+ executionReport: executionReport,
4969
+ outputParameters: outputParameters_1,
4970
+ preparedPipeline: preparedPipeline,
4971
+ },
4880
4972
  })];
4881
4973
  case 28:
4882
4974
  usage = addUsage.apply(void 0, __spreadArray([], __read(executionReport.promptExecutions.map(function (_a) {
@@ -4897,14 +4989,19 @@ function executePipeline(options) {
4897
4989
  // Note: Wait a short time to prevent race conditions
4898
4990
  _g.sent();
4899
4991
  _g.label = 30;
4900
- case 30: return [2 /*return*/, $asDeeplyFrozenSerializableJson('Successful PipelineExecutorResult', {
4901
- isSuccessful: true,
4902
- errors: errors.map(serializeError),
4903
- warnings: warnings.map(serializeError),
4904
- usage: usage,
4905
- executionReport: executionReport,
4906
- outputParameters: outputParameters,
4907
- preparedPipeline: preparedPipeline,
4992
+ case 30: return [2 /*return*/, exportJson({
4993
+ name: 'pipelineExecutorResult',
4994
+ message: "Successful PipelineExecutorResult",
4995
+ order: [],
4996
+ value: {
4997
+ isSuccessful: true,
4998
+ errors: errors.map(serializeError),
4999
+ warnings: warnings.map(serializeError),
5000
+ usage: usage,
5001
+ executionReport: executionReport,
5002
+ outputParameters: outputParameters,
5003
+ preparedPipeline: preparedPipeline,
5004
+ },
4908
5005
  })];
4909
5006
  }
4910
5007
  });
@@ -5775,36 +5872,6 @@ TODO: [🧊] This is how it can look in future
5775
5872
  * [ ] One piece can have multiple sources
5776
5873
  */
5777
5874
 
5778
- /**
5779
- * @@@
5780
- *
5781
- * Note: It is usefull @@@
5782
- *
5783
- * @param pipeline
5784
- * @public exported from `@promptbook/utils`
5785
- */
5786
- function clonePipeline(pipeline) {
5787
- // Note: Not using spread operator (...) because @@@
5788
- 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;
5789
- return {
5790
- pipelineUrl: pipelineUrl,
5791
- sourceFile: sourceFile,
5792
- title: title,
5793
- bookVersion: bookVersion,
5794
- description: description,
5795
- formfactorName: formfactorName,
5796
- parameters: parameters,
5797
- tasks: tasks,
5798
- knowledgeSources: knowledgeSources,
5799
- knowledgePieces: knowledgePieces,
5800
- personas: personas,
5801
- preparations: preparations,
5802
- };
5803
- }
5804
- /**
5805
- * TODO: [🍙] Make some standard order of json properties
5806
- */
5807
-
5808
5875
  /**
5809
5876
  * @@@
5810
5877
  *
@@ -5845,6 +5912,7 @@ function prepareTasks(pipeline, tools, options) {
5845
5912
  });
5846
5913
  }
5847
5914
  /**
5915
+ * TODO: [😂] Adding knowledge should be convert to async high-level abstractions, simmilar thing with expectations to sync high-level abstractions
5848
5916
  * TODO: [🧠] Add context to each task (if missing)
5849
5917
  * TODO: [🧠] What is better name `prepareTask` or `prepareTaskAndParameters`
5850
5918
  * TODO: [♨][main] !!! Prepare index the examples and maybe tasks
@@ -5892,191 +5960,72 @@ function preparePipeline(pipeline, tools, options) {
5892
5960
  usage: ZERO_USAGE,
5893
5961
  };
5894
5962
  preparations = [
5895
- // ...preparations
5896
- // <- TODO: [🧊]
5897
- currentPreparation,
5898
- ];
5899
- preparedPersonas = new Array(personas.length);
5900
- return [4 /*yield*/, forEachAsync(personas, { maxParallelCount: maxParallelCount /* <- TODO: [🪂] When there are subtasks, this maximul limit can be broken */ }, function (persona, index) { return __awaiter(_this, void 0, void 0, function () {
5901
- var modelRequirements, preparedPersona;
5902
- return __generator(this, function (_a) {
5903
- switch (_a.label) {
5904
- case 0: return [4 /*yield*/, preparePersona(persona.description, __assign(__assign({}, tools), { llm: llmToolsWithUsage }), {
5905
- rootDirname: rootDirname,
5906
- maxParallelCount: maxParallelCount /* <- TODO: [🪂] */,
5907
- isVerbose: isVerbose,
5908
- })];
5909
- case 1:
5910
- modelRequirements = _a.sent();
5911
- preparedPersona = __assign(__assign({}, persona), { modelRequirements: modelRequirements, preparationIds: [/* TODO: [🧊] -> */ currentPreparation.id] });
5912
- preparedPersonas[index] = preparedPersona;
5913
- return [2 /*return*/];
5914
- }
5915
- });
5916
- }); })];
5917
- case 1:
5918
- _c.sent();
5919
- knowledgeSourcesPrepared = knowledgeSources.map(function (source) { return (__assign(__assign({}, source), { preparationIds: [/* TODO: [🧊] -> */ currentPreparation.id] })); });
5920
- return [4 /*yield*/, prepareKnowledgePieces(knowledgeSources /* <- TODO: [🧊] {knowledgeSources, knowledgePieces} */, __assign(__assign({}, tools), { llm: llmToolsWithUsage }), __assign(__assign({}, options), { rootDirname: rootDirname, maxParallelCount: maxParallelCount /* <- TODO: [🪂] */, isVerbose: isVerbose }))];
5921
- case 2:
5922
- partialknowledgePiecesPrepared = _c.sent();
5923
- knowledgePiecesPrepared = partialknowledgePiecesPrepared.map(function (piece) { return (__assign(__assign({}, piece), { preparationIds: [/* TODO: [🧊] -> */ currentPreparation.id] })); });
5924
- return [4 /*yield*/, prepareTasks({
5925
- parameters: parameters,
5926
- tasks: tasks,
5927
- knowledgePiecesCount: knowledgePiecesPrepared.length,
5928
- }, __assign(__assign({}, tools), { llm: llmToolsWithUsage }), {
5929
- rootDirname: rootDirname,
5930
- maxParallelCount: maxParallelCount /* <- TODO: [🪂] */,
5931
- isVerbose: isVerbose,
5932
- })];
5933
- case 3:
5934
- tasksPrepared = (_c.sent()).tasksPrepared;
5935
- // ----- /Tasks preparation -----
5936
- // Note: Count total usage
5937
- currentPreparation.usage = llmToolsWithUsage.getTotalUsage();
5938
- return [2 /*return*/, $asDeeplyFrozenSerializableJson('Prepared PipelineJson', __assign(__assign({}, clonePipeline(pipeline)), { tasks: __spreadArray([], __read(tasksPrepared), false),
5939
- // <- TODO: [🪓] Here should be no need for spreading new array, just ` tasks: tasksPrepared`
5940
- knowledgeSources: knowledgeSourcesPrepared, knowledgePieces: knowledgePiecesPrepared, personas: preparedPersonas, preparations: __spreadArray([], __read(preparations), false) }))];
5941
- }
5942
- });
5943
- });
5944
- }
5945
- /**
5946
- * TODO: Write tests for `preparePipeline`
5947
- * TODO: [🏏] Leverage the batch API and build queues @see https://platform.openai.com/docs/guides/batch
5948
- * TODO: [🧊] In future one preparation can take data from previous preparation and save tokens and time
5949
- * TODO: [🛠] Actions, instruments (and maybe knowledge) => Functions and tools
5950
- * TODO: [🧠][♏] Maybe if expecting JSON (In Anthropic Claude and other models without non-json) and its not specified in prompt content, append the instructions
5951
- * @see https://docs.anthropic.com/en/docs/test-and-evaluate/strengthen-guardrails/increase-consistency#specify-the-desired-output-format
5952
- */
5953
-
5954
- /**
5955
- * @@@
5956
- *
5957
- * @deprecated https://github.com/webgptorg/promptbook/pull/186
5958
- * @see https://github.com/webgptorg/promptbook/discussions/171
5959
- *
5960
- * @public exported from `@promptbook/core`
5961
- */
5962
- function getPipelineInterface(pipeline) {
5963
- var e_1, _a, e_2, _b;
5964
- var pipelineInterface = {
5965
- inputParameters: [],
5966
- outputParameters: [],
5967
- };
5968
- try {
5969
- for (var _c = __values(pipeline.parameters), _d = _c.next(); !_d.done; _d = _c.next()) {
5970
- var parameter = _d.value;
5971
- var isInput = parameter.isInput, isOutput = parameter.isOutput;
5972
- if (isInput) {
5973
- pipelineInterface.inputParameters.push(deepClone(parameter));
5974
- }
5975
- if (isOutput) {
5976
- pipelineInterface.outputParameters.push(deepClone(parameter));
5977
- }
5978
- }
5979
- }
5980
- catch (e_1_1) { e_1 = { error: e_1_1 }; }
5981
- finally {
5982
- try {
5983
- if (_d && !_d.done && (_a = _c.return)) _a.call(_c);
5984
- }
5985
- finally { if (e_1) throw e_1.error; }
5986
- }
5987
- try {
5988
- for (var _e = __values(['inputParameters', 'outputParameters']), _f = _e.next(); !_f.done; _f = _e.next()) {
5989
- var key = _f.value;
5990
- pipelineInterface[key].sort(function (_a, _b) {
5991
- var name1 = _a.name;
5992
- var name2 = _b.name;
5993
- return name1.localeCompare(name2);
5994
- });
5995
- }
5996
- }
5997
- catch (e_2_1) { e_2 = { error: e_2_1 }; }
5998
- finally {
5999
- try {
6000
- if (_f && !_f.done && (_b = _e.return)) _b.call(_e);
6001
- }
6002
- finally { if (e_2) throw e_2.error; }
6003
- }
6004
- return $deepFreeze(pipelineInterface);
6005
- }
6006
-
6007
- /**
6008
- * @@@
6009
- *
6010
- * @deprecated https://github.com/webgptorg/promptbook/pull/186
6011
- * @see https://github.com/webgptorg/promptbook/discussions/171
6012
- *
6013
- * @public exported from `@promptbook/core`
6014
- */
6015
- function isPipelineInterfacesEqual(pipelineInterface1, pipelineInterface2) {
6016
- var e_1, _a, e_2, _b;
6017
- try {
6018
- for (var _c = __values(['inputParameters', 'outputParameters']), _d = _c.next(); !_d.done; _d = _c.next()) {
6019
- var whichParameters = _d.value;
6020
- var parameters1 = pipelineInterface1[whichParameters]; // <- Note: `isPipelineInterfacesEqual` is just temporary solution, no need to fix this
6021
- var parameters2 = pipelineInterface2[whichParameters];
6022
- if (parameters1.length !== parameters2.length) {
6023
- return false;
6024
- }
6025
- var _loop_1 = function (parameter) {
6026
- var matchingParameter = parameters2.find(function (_a) {
6027
- var name = _a.name;
6028
- return name === parameter.name;
6029
- });
6030
- if (!matchingParameter) {
6031
- return { value: false };
6032
- }
6033
- // Note: Do not compare description, it is not relevant for compatibility
6034
- if (matchingParameter.isInput !== parameter.isInput) {
6035
- return { value: false };
6036
- }
6037
- if (matchingParameter.isOutput !== parameter.isOutput) {
6038
- return { value: false };
6039
- }
6040
- };
6041
- try {
6042
- for (var parameters1_1 = (e_2 = void 0, __values(parameters1)), parameters1_1_1 = parameters1_1.next(); !parameters1_1_1.done; parameters1_1_1 = parameters1_1.next()) {
6043
- var parameter = parameters1_1_1.value;
6044
- var state_1 = _loop_1(parameter);
6045
- if (typeof state_1 === "object")
6046
- return state_1.value;
6047
- }
6048
- }
6049
- catch (e_2_1) { e_2 = { error: e_2_1 }; }
6050
- finally {
6051
- try {
6052
- if (parameters1_1_1 && !parameters1_1_1.done && (_b = parameters1_1.return)) _b.call(parameters1_1);
6053
- }
6054
- finally { if (e_2) throw e_2.error; }
5963
+ // ...preparations
5964
+ // <- TODO: [🧊]
5965
+ currentPreparation,
5966
+ ];
5967
+ preparedPersonas = new Array(personas.length);
5968
+ return [4 /*yield*/, forEachAsync(personas, { maxParallelCount: maxParallelCount /* <- TODO: [🪂] When there are subtasks, this maximul limit can be broken */ }, function (persona, index) { return __awaiter(_this, void 0, void 0, function () {
5969
+ var modelRequirements, preparedPersona;
5970
+ return __generator(this, function (_a) {
5971
+ switch (_a.label) {
5972
+ case 0: return [4 /*yield*/, preparePersona(persona.description, __assign(__assign({}, tools), { llm: llmToolsWithUsage }), {
5973
+ rootDirname: rootDirname,
5974
+ maxParallelCount: maxParallelCount /* <- TODO: [🪂] */,
5975
+ isVerbose: isVerbose,
5976
+ })];
5977
+ case 1:
5978
+ modelRequirements = _a.sent();
5979
+ preparedPersona = __assign(__assign({}, persona), { modelRequirements: modelRequirements, preparationIds: [/* TODO: [🧊] -> */ currentPreparation.id] });
5980
+ preparedPersonas[index] = preparedPersona;
5981
+ return [2 /*return*/];
5982
+ }
5983
+ });
5984
+ }); })];
5985
+ case 1:
5986
+ _c.sent();
5987
+ knowledgeSourcesPrepared = knowledgeSources.map(function (source) { return (__assign(__assign({}, source), { preparationIds: [/* TODO: [🧊] -> */ currentPreparation.id] })); });
5988
+ return [4 /*yield*/, prepareKnowledgePieces(knowledgeSources /* <- TODO: [🧊] {knowledgeSources, knowledgePieces} */, __assign(__assign({}, tools), { llm: llmToolsWithUsage }), __assign(__assign({}, options), { rootDirname: rootDirname, maxParallelCount: maxParallelCount /* <- TODO: [🪂] */, isVerbose: isVerbose }))];
5989
+ case 2:
5990
+ partialknowledgePiecesPrepared = _c.sent();
5991
+ knowledgePiecesPrepared = partialknowledgePiecesPrepared.map(function (piece) { return (__assign(__assign({}, piece), { preparationIds: [/* TODO: [🧊] -> */ currentPreparation.id] })); });
5992
+ return [4 /*yield*/, prepareTasks({
5993
+ parameters: parameters,
5994
+ tasks: tasks,
5995
+ knowledgePiecesCount: knowledgePiecesPrepared.length,
5996
+ }, __assign(__assign({}, tools), { llm: llmToolsWithUsage }), {
5997
+ rootDirname: rootDirname,
5998
+ maxParallelCount: maxParallelCount /* <- TODO: [🪂] */,
5999
+ isVerbose: isVerbose,
6000
+ })];
6001
+ case 3:
6002
+ tasksPrepared = (_c.sent()).tasksPrepared;
6003
+ // ----- /Tasks preparation -----
6004
+ // TODO: [😂] Use here all `AsyncHighLevelAbstraction`
6005
+ // Note: Count total usage
6006
+ currentPreparation.usage = llmToolsWithUsage.getTotalUsage();
6007
+ return [2 /*return*/, exportJson({
6008
+ name: 'pipelineJson',
6009
+ message: "Result of `preparePipeline`",
6010
+ order: ORDER_OF_PIPELINE_JSON,
6011
+ value: __assign(__assign({}, pipeline), {
6012
+ // <- TODO: Probbably deeply clone the pipeline because `$exportJson` freezes the subobjects
6013
+ knowledgeSources: knowledgeSourcesPrepared, knowledgePieces: knowledgePiecesPrepared, tasks: __spreadArray([], __read(tasksPrepared), false),
6014
+ // <- TODO: [🪓] Here should be no need for spreading new array, just ` tasks: tasksPrepared`
6015
+ personas: preparedPersonas, preparations: __spreadArray([], __read(preparations), false) }),
6016
+ })];
6055
6017
  }
6056
- }
6057
- }
6058
- catch (e_1_1) { e_1 = { error: e_1_1 }; }
6059
- finally {
6060
- try {
6061
- if (_d && !_d.done && (_a = _c.return)) _a.call(_c);
6062
- }
6063
- finally { if (e_1) throw e_1.error; }
6064
- }
6065
- return true;
6018
+ });
6019
+ });
6066
6020
  }
6067
-
6068
6021
  /**
6069
- * @@@
6070
- *
6071
- * @deprecated https://github.com/webgptorg/promptbook/pull/186
6072
- * @see https://github.com/webgptorg/promptbook/discussions/171
6073
- *
6074
- * @public exported from `@promptbook/core`
6022
+ * TODO: Write tests for `preparePipeline`
6023
+ * TODO: [🏏] Leverage the batch API and build queues @see https://platform.openai.com/docs/guides/batch
6024
+ * TODO: [🧊] In future one preparation can take data from previous preparation and save tokens and time
6025
+ * TODO: [🛠] Actions, instruments (and maybe knowledge) => Functions and tools
6026
+ * TODO: [🧠][♏] Maybe if expecting JSON (In Anthropic Claude and other models without non-json) and its not specified in prompt content, append the instructions
6027
+ * @see https://docs.anthropic.com/en/docs/test-and-evaluate/strengthen-guardrails/increase-consistency#specify-the-desired-output-format
6075
6028
  */
6076
- function isPipelineImplementingInterface(options) {
6077
- var pipeline = options.pipeline, pipelineInterface = options.pipelineInterface;
6078
- return isPipelineInterfacesEqual(getPipelineInterface(pipeline), pipelineInterface);
6079
- }
6080
6029
 
6081
6030
  /**
6082
6031
  * All available task types
@@ -6328,7 +6277,8 @@ var sectionCommandParser = {
6328
6277
  expectResultingParameterName();
6329
6278
  var parameter = $pipelineJson.parameters.find(function (param) { return param.name === $taskJson.resultingParameterName; });
6330
6279
  if (parameter === undefined) {
6331
- throw new ParseError("Can not find parameter {".concat($taskJson.resultingParameterName, "} to assign example value on it"));
6280
+ // TODO: !!!!!! Change to logic error for higher level abstractions to work
6281
+ throw new ParseError("Parameter `{".concat($taskJson.resultingParameterName, "}` is not defined so can not define example value of it"));
6332
6282
  }
6333
6283
  parameter.exampleValues = parameter.exampleValues || [];
6334
6284
  parameter.exampleValues.push($taskJson.content);
@@ -8452,6 +8402,295 @@ function parseCommandVariant(input) {
8452
8402
  return null;
8453
8403
  }
8454
8404
 
8405
+ /**
8406
+ * @@@
8407
+ *
8408
+ * @deprecated https://github.com/webgptorg/promptbook/pull/186
8409
+ * @see https://github.com/webgptorg/promptbook/discussions/171
8410
+ *
8411
+ * @public exported from `@promptbook/core`
8412
+ */
8413
+ function getPipelineInterface(pipeline) {
8414
+ var e_1, _a, e_2, _b;
8415
+ var pipelineInterface = {
8416
+ inputParameters: [],
8417
+ outputParameters: [],
8418
+ };
8419
+ try {
8420
+ for (var _c = __values(pipeline.parameters), _d = _c.next(); !_d.done; _d = _c.next()) {
8421
+ var parameter = _d.value;
8422
+ var isInput = parameter.isInput, isOutput = parameter.isOutput;
8423
+ if (isInput) {
8424
+ pipelineInterface.inputParameters.push(deepClone(parameter));
8425
+ }
8426
+ if (isOutput) {
8427
+ pipelineInterface.outputParameters.push(deepClone(parameter));
8428
+ }
8429
+ }
8430
+ }
8431
+ catch (e_1_1) { e_1 = { error: e_1_1 }; }
8432
+ finally {
8433
+ try {
8434
+ if (_d && !_d.done && (_a = _c.return)) _a.call(_c);
8435
+ }
8436
+ finally { if (e_1) throw e_1.error; }
8437
+ }
8438
+ try {
8439
+ for (var _e = __values(['inputParameters', 'outputParameters']), _f = _e.next(); !_f.done; _f = _e.next()) {
8440
+ var key = _f.value;
8441
+ pipelineInterface[key].sort(function (_a, _b) {
8442
+ var name1 = _a.name;
8443
+ var name2 = _b.name;
8444
+ return name1.localeCompare(name2);
8445
+ });
8446
+ }
8447
+ }
8448
+ catch (e_2_1) { e_2 = { error: e_2_1 }; }
8449
+ finally {
8450
+ try {
8451
+ if (_f && !_f.done && (_b = _e.return)) _b.call(_e);
8452
+ }
8453
+ finally { if (e_2) throw e_2.error; }
8454
+ }
8455
+ return exportJson({
8456
+ name: "pipelineInterface",
8457
+ message: "Result of `getPipelineInterface`",
8458
+ order: ['inputParameters', 'outputParameters'],
8459
+ value: pipelineInterface,
8460
+ });
8461
+ }
8462
+
8463
+ /**
8464
+ * @@@
8465
+ *
8466
+ * @deprecated https://github.com/webgptorg/promptbook/pull/186
8467
+ * @see https://github.com/webgptorg/promptbook/discussions/171
8468
+ *
8469
+ * @public exported from `@promptbook/core`
8470
+ */
8471
+ function isPipelineInterfacesEqual(pipelineInterface1, pipelineInterface2) {
8472
+ var e_1, _a, e_2, _b;
8473
+ try {
8474
+ for (var _c = __values(['inputParameters', 'outputParameters']), _d = _c.next(); !_d.done; _d = _c.next()) {
8475
+ var whichParameters = _d.value;
8476
+ var parameters1 = pipelineInterface1[whichParameters]; // <- Note: `isPipelineInterfacesEqual` is just temporary solution, no need to fix this
8477
+ var parameters2 = pipelineInterface2[whichParameters];
8478
+ if (parameters1.length !== parameters2.length) {
8479
+ return false;
8480
+ }
8481
+ var _loop_1 = function (parameter) {
8482
+ var matchingParameter = parameters2.find(function (_a) {
8483
+ var name = _a.name;
8484
+ return name === parameter.name;
8485
+ });
8486
+ if (!matchingParameter) {
8487
+ return { value: false };
8488
+ }
8489
+ // Note: Do not compare description, it is not relevant for compatibility
8490
+ if (matchingParameter.isInput !== parameter.isInput) {
8491
+ return { value: false };
8492
+ }
8493
+ if (matchingParameter.isOutput !== parameter.isOutput) {
8494
+ return { value: false };
8495
+ }
8496
+ };
8497
+ try {
8498
+ for (var parameters1_1 = (e_2 = void 0, __values(parameters1)), parameters1_1_1 = parameters1_1.next(); !parameters1_1_1.done; parameters1_1_1 = parameters1_1.next()) {
8499
+ var parameter = parameters1_1_1.value;
8500
+ var state_1 = _loop_1(parameter);
8501
+ if (typeof state_1 === "object")
8502
+ return state_1.value;
8503
+ }
8504
+ }
8505
+ catch (e_2_1) { e_2 = { error: e_2_1 }; }
8506
+ finally {
8507
+ try {
8508
+ if (parameters1_1_1 && !parameters1_1_1.done && (_b = parameters1_1.return)) _b.call(parameters1_1);
8509
+ }
8510
+ finally { if (e_2) throw e_2.error; }
8511
+ }
8512
+ }
8513
+ }
8514
+ catch (e_1_1) { e_1 = { error: e_1_1 }; }
8515
+ finally {
8516
+ try {
8517
+ if (_d && !_d.done && (_a = _c.return)) _a.call(_c);
8518
+ }
8519
+ finally { if (e_1) throw e_1.error; }
8520
+ }
8521
+ return true;
8522
+ }
8523
+
8524
+ /**
8525
+ * @@@
8526
+ *
8527
+ * @deprecated https://github.com/webgptorg/promptbook/pull/186
8528
+ * @see https://github.com/webgptorg/promptbook/discussions/171
8529
+ *
8530
+ * @public exported from `@promptbook/core`
8531
+ */
8532
+ function isPipelineImplementingInterface(options) {
8533
+ var pipeline = options.pipeline, pipelineInterface = options.pipelineInterface;
8534
+ return isPipelineInterfacesEqual(getPipelineInterface(pipeline), pipelineInterface);
8535
+ }
8536
+
8537
+ /**
8538
+ * Set formfactor based on the pipeline interface e
8539
+ *
8540
+ * @private
8541
+ */
8542
+ var ImplicitFormfactorHla = {
8543
+ type: 'SYNC',
8544
+ $applyToPipelineJson: function ($pipelineJson) {
8545
+ var e_1, _a;
8546
+ if ($pipelineJson.formfactorName !== undefined) {
8547
+ // Note: When formfactor is already set, do nothing
8548
+ return;
8549
+ }
8550
+ try {
8551
+ for (var _b = __values(FORMFACTOR_DEFINITIONS.filter(function (_a) {
8552
+ var name = _a.name;
8553
+ return name !== 'GENERIC';
8554
+ })), _c = _b.next(); !_c.done; _c = _b.next()) {
8555
+ var formfactorDefinition = _c.value;
8556
+ // <- Note: [♓️][💩] This is the order of the formfactors, make some explicit priority
8557
+ var name_1 = formfactorDefinition.name, pipelineInterface = formfactorDefinition.pipelineInterface;
8558
+ var isCompatible = isPipelineImplementingInterface({
8559
+ pipeline: __assign({ formfactorName: name_1 }, $pipelineJson),
8560
+ pipelineInterface: pipelineInterface,
8561
+ });
8562
+ /*/
8563
+ console.log({
8564
+ subject: `${$pipelineJson.title} implements ${name}`,
8565
+ pipelineTitle: $pipelineJson.title,
8566
+ formfactorName: name,
8567
+ isCompatible,
8568
+ formfactorInterface: pipelineInterface,
8569
+ pipelineInterface: getPipelineInterface($pipelineJson as PipelineJson),
8570
+ });
8571
+ /**/
8572
+ if (isCompatible) {
8573
+ $pipelineJson.formfactorName = name_1;
8574
+ return;
8575
+ }
8576
+ }
8577
+ }
8578
+ catch (e_1_1) { e_1 = { error: e_1_1 }; }
8579
+ finally {
8580
+ try {
8581
+ if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
8582
+ }
8583
+ finally { if (e_1) throw e_1.error; }
8584
+ }
8585
+ },
8586
+ };
8587
+
8588
+ /**
8589
+ * Allow to define chatbot with no need to write full interface
8590
+ *
8591
+ * @private
8592
+ */
8593
+ var QuickChatbotHla = {
8594
+ type: 'SYNC',
8595
+ $applyToPipelineJson: function ($pipelineJson) {
8596
+ if ($pipelineJson.tasks.length !== 0) {
8597
+ // Note: When there are already tasks, do nothing
8598
+ return;
8599
+ }
8600
+ if ($pipelineJson.parameters.length !== 0) {
8601
+ // Note: When there are already parameters, do nothing
8602
+ return;
8603
+ }
8604
+ if ($pipelineJson.personas.length === 0) {
8605
+ // Note: When no personas defined, do nothing
8606
+ return;
8607
+ }
8608
+ var personaName = $pipelineJson.personas[0].name;
8609
+ $pipelineJson.formfactorName = 'CHATBOT';
8610
+ $pipelineJson.parameters.push({
8611
+ name: 'previousTitle',
8612
+ description: 'Previous title of the conversation',
8613
+ isInput: true,
8614
+ isOutput: false,
8615
+ }, {
8616
+ name: 'previousConversationSummary',
8617
+ description: 'Previous conversation summary',
8618
+ isInput: true,
8619
+ isOutput: false,
8620
+ }, {
8621
+ name: 'userMessage',
8622
+ description: 'User message',
8623
+ isInput: true,
8624
+ isOutput: false,
8625
+ }, {
8626
+ name: 'title',
8627
+ description: 'Title of the conversation',
8628
+ isInput: false,
8629
+ isOutput: true,
8630
+ }, {
8631
+ name: 'conversationSummary',
8632
+ description: 'Summary of the conversation',
8633
+ isInput: false,
8634
+ isOutput: true,
8635
+ }, {
8636
+ name: 'chatbotResponse',
8637
+ description: 'Chatbot response',
8638
+ isInput: false,
8639
+ isOutput: true,
8640
+ exampleValues: ['Hello, I am a Pavol`s virtual avatar. How can I help you?'],
8641
+ });
8642
+ // TODO: !!!!!! spaceTrim
8643
+ $pipelineJson.tasks.push({
8644
+ taskType: 'PROMPT_TASK',
8645
+ name: 'create-an-answer',
8646
+ title: 'Create an answer',
8647
+ content: 'Write a response to the user message:\n\n**Question from user**\n\n> {userMessage}\n\n**Previous conversation**\n\n> {previousConversationSummary}',
8648
+ resultingParameterName: 'chatbotResponse',
8649
+ personaName: personaName,
8650
+ dependentParameterNames: ['userMessage', 'previousConversationSummary' /* !!!!!!, 'knowledge'*/],
8651
+ // !!!!!! preparedContent: '{content}\n\n## Knowledge\n\n{knowledge}',
8652
+ }, {
8653
+ taskType: 'PROMPT_TASK',
8654
+ name: 'summarize-the-conversation',
8655
+ title: 'Summarize the conversation',
8656
+ content: 'Summarize the conversation in a few words:\n\n## Rules\n\n- Summarise the text of the conversation in a few words\n- Convert the text to its basic idea\n- Imagine you are writing the headline or subject line of an email\n- Respond with a few words of summary only\n\n## Conversation\n\n**User:**\n\n> {userMessage}\n\n**You:**\n\n> {chatbotResponse}',
8657
+ resultingParameterName: 'conversationSummary',
8658
+ personaName: personaName,
8659
+ expectations: {
8660
+ words: {
8661
+ min: 1,
8662
+ max: 10,
8663
+ },
8664
+ },
8665
+ dependentParameterNames: ['userMessage', 'chatbotResponse' /* !!!!!!, 'knowledge'*/],
8666
+ // !!!!!! preparedContent: '{content}\n\n## Knowledge\n\n{knowledge}',
8667
+ }, {
8668
+ taskType: 'SIMPLE_TASK',
8669
+ name: 'title',
8670
+ title: 'Title',
8671
+ content: '{conversationSummary}',
8672
+ resultingParameterName: 'title',
8673
+ dependentParameterNames: ['conversationSummary' /* !!!!!!, 'knowledge'*/],
8674
+ // !!!!!! preparedContent: '{content}\n\n## Knowledge\n\n{knowledge}',
8675
+ });
8676
+ },
8677
+ };
8678
+
8679
+ /**
8680
+ * All high-level abstractions
8681
+ *
8682
+ * @private internal index of `pipelineStringToJsonSync` (= used for sync) and `preparePipeline` (= used for async)
8683
+ */
8684
+ var HIGH_LEVEL_ABSTRACTIONS = [
8685
+ ImplicitFormfactorHla,
8686
+ QuickChatbotHla,
8687
+ // <- Note: [♓️][💩] This is the order of the application of high-level abstractions application on pipeline JSON
8688
+ ];
8689
+ /**
8690
+ * TODO: Test that all sync high-level abstractions are before async high-level abstractions
8691
+ * Note: [💞] Ignore a discrepancy between file name and entity name
8692
+ */
8693
+
8455
8694
  /**
8456
8695
  * Supported script languages
8457
8696
  *
@@ -8826,7 +9065,7 @@ function pipelineStringToJsonSync(pipelineString) {
8826
9065
  }
8827
9066
  try {
8828
9067
  commandParser.$applyToPipelineJson(command, $pipelineJson);
8829
- // <- Note: [🦦] Its strange that this assertion must be here, [🦦][4] should do this assertion implicitelly
9068
+ // <- Note: [🦦] Its strange that this assertion must be here, [🦦][4] should do this assertion implicitly
8830
9069
  }
8831
9070
  catch (error) {
8832
9071
  if (!(error instanceof ParseError)) {
@@ -8883,10 +9122,10 @@ function pipelineStringToJsonSync(pipelineString) {
8883
9122
  return nameWithSuffix;
8884
9123
  };
8885
9124
  var _loop_2 = function (section) {
8886
- var e_7, _o, e_8, _p;
9125
+ var e_7, _q, e_8, _r;
8887
9126
  // TODO: Parse section's description (the content out of the codeblock and lists)
8888
9127
  var listItems_2 = extractAllListItemsFromMarkdown(section.content);
8889
- var _q = extractOneBlockFromMarkdown(section.content), language = _q.language, content = _q.content;
9128
+ var _s = extractOneBlockFromMarkdown(section.content), language = _s.language, content = _s.content;
8890
9129
  // TODO: [🎾][1] DRY description
8891
9130
  var description_1 = section.content;
8892
9131
  // Note: Remove codeblocks - TODO: [🎾]
@@ -8934,7 +9173,7 @@ function pipelineStringToJsonSync(pipelineString) {
8934
9173
  }
8935
9174
  try {
8936
9175
  commandParser.$applyToTaskJson(
8937
- // <- Note: [🦦] Its strange that this assertion must be here, [🦦][4] should do this assertion implicitelly
9176
+ // <- Note: [🦦] Its strange that this assertion must be here, [🦦][4] should do this assertion implicitly
8938
9177
  command, $taskJson, $pipelineJson);
8939
9178
  }
8940
9179
  catch (error) {
@@ -8951,14 +9190,14 @@ function pipelineStringToJsonSync(pipelineString) {
8951
9190
  try {
8952
9191
  // TODO [♓️] List commands and before apply order them to achieve order-agnostic commands
8953
9192
  for (var commands_1 = (e_7 = void 0, __values(commands)), commands_1_1 = commands_1.next(); !commands_1_1.done; commands_1_1 = commands_1.next()) {
8954
- var _r = commands_1_1.value, listItem = _r.listItem, command = _r.command;
9193
+ var _t = commands_1_1.value, listItem = _t.listItem, command = _t.command;
8955
9194
  _loop_4(listItem, command);
8956
9195
  }
8957
9196
  }
8958
9197
  catch (e_7_1) { e_7 = { error: e_7_1 }; }
8959
9198
  finally {
8960
9199
  try {
8961
- if (commands_1_1 && !commands_1_1.done && (_o = commands_1.return)) _o.call(commands_1);
9200
+ if (commands_1_1 && !commands_1_1.done && (_q = commands_1.return)) _q.call(commands_1);
8962
9201
  }
8963
9202
  finally { if (e_7) throw e_7.error; }
8964
9203
  }
@@ -8974,8 +9213,8 @@ function pipelineStringToJsonSync(pipelineString) {
8974
9213
  }
8975
9214
  $taskJson.dependentParameterNames = Array.from(extractParameterNamesFromTask($taskJson));
8976
9215
  try {
8977
- for (var _s = (e_8 = void 0, __values($taskJson.dependentParameterNames)), _t = _s.next(); !_t.done; _t = _s.next()) {
8978
- var parameterName = _t.value;
9216
+ for (var _u = (e_8 = void 0, __values($taskJson.dependentParameterNames)), _v = _u.next(); !_v.done; _v = _u.next()) {
9217
+ var parameterName = _v.value;
8979
9218
  // TODO: [🧠] This definition should be made first in the task
8980
9219
  defineParam({
8981
9220
  parameterName: parameterName,
@@ -8989,7 +9228,7 @@ function pipelineStringToJsonSync(pipelineString) {
8989
9228
  catch (e_8_1) { e_8 = { error: e_8_1 }; }
8990
9229
  finally {
8991
9230
  try {
8992
- if (_t && !_t.done && (_p = _s.return)) _p.call(_s);
9231
+ if (_v && !_v.done && (_r = _u.return)) _r.call(_u);
8993
9232
  }
8994
9233
  finally { if (e_8) throw e_8.error; }
8995
9234
  }
@@ -9120,53 +9359,39 @@ function pipelineStringToJsonSync(pipelineString) {
9120
9359
  });
9121
9360
  try {
9122
9361
  // =============================================================
9123
- // Note: 9️⃣ Implicit and default formfactor
9124
- for (var FORMFACTOR_DEFINITIONS_1 = __values(FORMFACTOR_DEFINITIONS), FORMFACTOR_DEFINITIONS_1_1 = FORMFACTOR_DEFINITIONS_1.next(); !FORMFACTOR_DEFINITIONS_1_1.done; FORMFACTOR_DEFINITIONS_1_1 = FORMFACTOR_DEFINITIONS_1.next()) {
9125
- var formfactorDefinition = FORMFACTOR_DEFINITIONS_1_1.value;
9126
- // <- Note: [♓️][💩] This is the order of the formfactors, make some explicit priority
9127
- var name_2 = formfactorDefinition.name, pipelineInterface = formfactorDefinition.pipelineInterface;
9128
- // Note: Skip GENERIC formfactor, it will be used as a fallback if no other formfactor is compatible
9129
- if (name_2 === 'GENERIC') {
9130
- continue;
9131
- }
9132
- var isCompatible = isPipelineImplementingInterface({
9133
- pipeline: __assign({ formfactorName: name_2 }, $pipelineJson),
9134
- pipelineInterface: pipelineInterface,
9135
- });
9136
- /*/
9137
- console.log({
9138
- subject: `${$pipelineJson.title} implements ${name}`,
9139
- pipelineTitle: $pipelineJson.title,
9140
- formfactorName: name,
9141
- isCompatible,
9142
- formfactorInterface: pipelineInterface,
9143
- pipelineInterface: getPipelineInterface($pipelineJson as PipelineJson),
9144
- });
9145
- /**/
9146
- if (isCompatible) {
9147
- $pipelineJson.formfactorName = name_2;
9148
- break;
9149
- }
9362
+ // Note: 9️⃣ Apply sync high-level abstractions
9363
+ for (var _o = __values(HIGH_LEVEL_ABSTRACTIONS.filter(function (_a) {
9364
+ var type = _a.type;
9365
+ return type === 'SYNC';
9366
+ })), _p = _o.next(); !_p.done; _p = _o.next()) {
9367
+ var highLevelAbstraction = _p.value;
9368
+ highLevelAbstraction.$applyToPipelineJson($pipelineJson);
9150
9369
  }
9151
9370
  }
9152
9371
  catch (e_6_1) { e_6 = { error: e_6_1 }; }
9153
9372
  finally {
9154
9373
  try {
9155
- if (FORMFACTOR_DEFINITIONS_1_1 && !FORMFACTOR_DEFINITIONS_1_1.done && (_f = FORMFACTOR_DEFINITIONS_1.return)) _f.call(FORMFACTOR_DEFINITIONS_1);
9374
+ if (_p && !_p.done && (_f = _o.return)) _f.call(_o);
9156
9375
  }
9157
9376
  finally { if (e_6) throw e_6.error; }
9158
9377
  }
9378
+ // =============================================================
9379
+ // Note: 🔟 Default formfactor
9159
9380
  // Note: [🔆] If formfactor is still not set, set it to 'GENERIC'
9160
9381
  if ($pipelineJson.formfactorName === undefined) {
9161
9382
  $pipelineJson.formfactorName = 'GENERIC';
9162
9383
  }
9163
9384
  // =============================================================
9164
9385
  // TODO: [🍙] Maybe do reorder of `$pipelineJson` here
9165
- return $asDeeplyFrozenSerializableJson('pipelineJson', __assign({ title: DEFAULT_TITLE, pipelineUrl: undefined, bookVersion: undefined, description: undefined, formfactorName: 'GENERIC',
9166
- // <- Note: [🔆] Setting `formfactorName` is redundant to satisfy the typescript
9167
- parameters: [], tasks: [], knowledgeSources: [], knowledgePieces: [], personas: [], preparations: [] }, $pipelineJson));
9386
+ return exportJson({
9387
+ name: 'pipelineJson',
9388
+ message: "Result of `pipelineStringToJsonSync`",
9389
+ order: ORDER_OF_PIPELINE_JSON,
9390
+ value: __assign({ formfactorName: 'GENERIC' }, $pipelineJson),
9391
+ });
9168
9392
  }
9169
9393
  /**
9394
+ * TODO: [🧠] Maybe more things here can be refactored as high-level abstractions
9170
9395
  * TODO: [main] !!!! Warn if used only sync version
9171
9396
  * TODO: [🚞] Report here line/column of error
9172
9397
  * TODO: Use spaceTrim more effectively
@@ -9210,7 +9435,7 @@ function pipelineStringToJson(pipelineString, tools, options) {
9210
9435
  pipelineJson = _a.sent();
9211
9436
  _a.label = 2;
9212
9437
  case 2:
9213
- // Note: No need to use `$asDeeplyFrozenSerializableJson` because `pipelineStringToJsonSync` and `preparePipeline` already do that
9438
+ // Note: No need to use `$exportJson` because `pipelineStringToJsonSync` and `preparePipeline` already do that
9214
9439
  return [2 /*return*/, pipelineJson];
9215
9440
  }
9216
9441
  });
@@ -9464,6 +9689,7 @@ function renamePipelineParameter(options) {
9464
9689
  return renamedPipeline;
9465
9690
  }
9466
9691
 
9692
+ // <- TODO: !!!!!!! Auto convert to type `import { ... } from 'type-fest';`
9467
9693
  /**
9468
9694
  * Tests if the value is [🚉] serializable as JSON
9469
9695
  *
@@ -9485,7 +9711,7 @@ function renamePipelineParameter(options) {
9485
9711
  */
9486
9712
  function isSerializableAsJson(value) {
9487
9713
  try {
9488
- checkSerializableAsJson('', value);
9714
+ checkSerializableAsJson({ value: value });
9489
9715
  return true;
9490
9716
  }
9491
9717
  catch (error) {
@@ -10700,7 +10926,7 @@ var legacyDocumentScraperMetadata = $deepFreeze({
10700
10926
  'LibreOffice',
10701
10927
  // <- TODO: [🧠] Should be 'LibreOffice' here, its dependency of dependency
10702
10928
  ],
10703
- }); /* <- TODO: [🤛] */
10929
+ }); /* <- Note: [🤛] */
10704
10930
  /**
10705
10931
  * Registration of known scraper metadata
10706
10932
  *
@@ -10727,7 +10953,7 @@ var documentScraperMetadata = $deepFreeze({
10727
10953
  documentationUrl: 'https://github.com/webgptorg/promptbook/discussions/@@',
10728
10954
  isAvilableInBrowser: false,
10729
10955
  requiredExecutables: ['Pandoc'],
10730
- }); /* <- TODO: [🤛] */
10956
+ }); /* <- Note: [🤛] */
10731
10957
  /**
10732
10958
  * Registration of known scraper metadata
10733
10959
  *
@@ -10754,7 +10980,7 @@ var markdownScraperMetadata = $deepFreeze({
10754
10980
  documentationUrl: 'https://github.com/webgptorg/promptbook/discussions/@@',
10755
10981
  isAvilableInBrowser: true,
10756
10982
  requiredExecutables: [],
10757
- }); /* <- TODO: [🤛] */
10983
+ }); /* <- Note: [🤛] */
10758
10984
  /**
10759
10985
  * Registration of known scraper metadata
10760
10986
  *
@@ -10781,7 +11007,7 @@ var pdfScraperMetadata = $deepFreeze({
10781
11007
  documentationUrl: 'https://github.com/webgptorg/promptbook/discussions/@@',
10782
11008
  isAvilableInBrowser: true,
10783
11009
  requiredExecutables: [],
10784
- }); /* <- TODO: [🤛] */
11010
+ }); /* <- Note: [🤛] */
10785
11011
  /**
10786
11012
  * Registration of known scraper metadata
10787
11013
  *
@@ -10808,7 +11034,7 @@ var websiteScraperMetadata = $deepFreeze({
10808
11034
  documentationUrl: 'https://github.com/webgptorg/promptbook/discussions/@@',
10809
11035
  isAvilableInBrowser: false,
10810
11036
  requiredExecutables: [],
10811
- }); /* <- TODO: [🤛] */
11037
+ }); /* <- Note: [🤛] */
10812
11038
  /**
10813
11039
  * Registration of known scraper metadata
10814
11040
  *
@@ -10903,5 +11129,5 @@ var PrefixStorage = /** @class */ (function () {
10903
11129
  return PrefixStorage;
10904
11130
  }());
10905
11131
 
10906
- export { $llmToolsMetadataRegister, $llmToolsRegister, $scrapersMetadataRegister, $scrapersRegister, ADMIN_EMAIL, ADMIN_GITHUB_NAME, AbstractFormatError, BOOK_LANGUAGE_VERSION, BlackholeStorage, BoilerplateError, BoilerplateFormfactorDefinition, CLAIM, CallbackInterfaceTools, ChatbotFormfactorDefinition, CollectionError, CsvFormatDefinition, CsvFormatError, DEFAULT_BOOKS_DIRNAME, DEFAULT_CSV_SETTINGS, DEFAULT_EXECUTIONS_CACHE_DIRNAME, DEFAULT_INTERMEDIATE_FILES_STRATEGY, DEFAULT_IS_AUTO_INSTALLED, DEFAULT_IS_VERBOSE, DEFAULT_MAX_EXECUTION_ATTEMPTS, DEFAULT_MAX_KNOWLEDGE_SOURCES_SCRAPING_DEPTH, DEFAULT_MAX_KNOWLEDGE_SOURCES_SCRAPING_TOTAL, DEFAULT_MAX_PARALLEL_COUNT, DEFAULT_PIPELINE_COLLECTION_BASE_FILENAME, DEFAULT_REMOTE_URL, DEFAULT_REMOTE_URL_PATH, DEFAULT_SCRAPE_CACHE_DIRNAME, DEFAULT_TITLE, EXPECTATION_UNITS, EnvironmentMismatchError, ExecutionReportStringOptionsDefaults, ExpectError, FORMFACTOR_DEFINITIONS, GENERIC_PIPELINE_INTERFACE, GeneratorFormfactorDefinition, GenericFormfactorDefinition, KnowledgeScrapeError, LOGO_DARK_SRC, LOGO_LIGHT_SRC, LimitReachedError, MANDATORY_CSV_SETTINGS, MAX_FILENAME_LENGTH, MODEL_VARIANTS, MatcherFormfactorDefinition, MemoryStorage, MissingToolsError, MultipleLlmExecutionTools, NAME, NonTaskSectionTypes, NotFoundError, NotYetImplementedError, PROMPTBOOK_ENGINE_VERSION, PROMPTBOOK_ERRORS, ParseError, PipelineExecutionError, PipelineLogicError, PipelineUrlError, PrefixStorage, RESERVED_PARAMETER_NAMES, SET_IS_VERBOSE, SectionTypes, SheetsFormfactorDefinition, TaskTypes, TextFormatDefinition, TranslatorFormfactorDefinition, UNCERTAIN_USAGE, UnexpectedError, ZERO_USAGE, _AnthropicClaudeMetadataRegistration, _AzureOpenAiMetadataRegistration, _DocumentScraperMetadataRegistration, _GoogleMetadataRegistration, _LegacyDocumentScraperMetadataRegistration, _MarkdownScraperMetadataRegistration, _OpenAiAssistantMetadataRegistration, _OpenAiMetadataRegistration, _PdfScraperMetadataRegistration, _WebsiteScraperMetadataRegistration, addUsage, assertsExecutionSuccessful, cacheLlmTools, collectionToJson, countTotalUsage, createCollectionFromJson, createCollectionFromPromise, createCollectionFromUrl, createLlmToolsFromConfiguration, createPipelineExecutor, createSubcollection, embeddingVectorToString, executionReportJsonToString, extractParameterNamesFromTask, getPipelineInterface, isPassingExpectations, isPipelineImplementingInterface, isPipelineInterfacesEqual, isPipelinePrepared, joinLlmExecutionTools, limitTotalUsage, makeKnowledgeSourceHandler, pipelineJsonToString, pipelineStringToJson, pipelineStringToJsonSync, prepareKnowledgePieces, preparePersona, preparePipeline, prepareTasks, prettifyPipelineString, removePipelineCommand, renamePipelineParameter, stringifyPipelineJson, unpreparePipeline, usageToHuman, usageToWorktime, validatePipeline };
11132
+ export { $llmToolsMetadataRegister, $llmToolsRegister, $scrapersMetadataRegister, $scrapersRegister, ADMIN_EMAIL, ADMIN_GITHUB_NAME, AbstractFormatError, BOOK_LANGUAGE_VERSION, BlackholeStorage, BoilerplateError, BoilerplateFormfactorDefinition, CLAIM, CallbackInterfaceTools, ChatbotFormfactorDefinition, CollectionError, CsvFormatDefinition, CsvFormatError, DEFAULT_BOOKS_DIRNAME, DEFAULT_CSV_SETTINGS, DEFAULT_EXECUTIONS_CACHE_DIRNAME, DEFAULT_INTERMEDIATE_FILES_STRATEGY, DEFAULT_IS_AUTO_INSTALLED, DEFAULT_IS_VERBOSE, DEFAULT_MAX_EXECUTION_ATTEMPTS, DEFAULT_MAX_KNOWLEDGE_SOURCES_SCRAPING_DEPTH, DEFAULT_MAX_KNOWLEDGE_SOURCES_SCRAPING_TOTAL, DEFAULT_MAX_PARALLEL_COUNT, DEFAULT_PIPELINE_COLLECTION_BASE_FILENAME, DEFAULT_REMOTE_URL, DEFAULT_REMOTE_URL_PATH, DEFAULT_SCRAPE_CACHE_DIRNAME, DEFAULT_TITLE, EXPECTATION_UNITS, EnvironmentMismatchError, ExecutionReportStringOptionsDefaults, ExpectError, FORMFACTOR_DEFINITIONS, GENERIC_PIPELINE_INTERFACE, GeneratorFormfactorDefinition, GenericFormfactorDefinition, KnowledgeScrapeError, LOGO_DARK_SRC, LOGO_LIGHT_SRC, LimitReachedError, MANDATORY_CSV_SETTINGS, MAX_FILENAME_LENGTH, MODEL_VARIANTS, MatcherFormfactorDefinition, MemoryStorage, MissingToolsError, MultipleLlmExecutionTools, NAME, NonTaskSectionTypes, NotFoundError, NotYetImplementedError, ORDER_OF_PIPELINE_JSON, PROMPTBOOK_ENGINE_VERSION, PROMPTBOOK_ERRORS, ParseError, PipelineExecutionError, PipelineLogicError, PipelineUrlError, PrefixStorage, RESERVED_PARAMETER_NAMES, SET_IS_VERBOSE, SectionTypes, SheetsFormfactorDefinition, TaskTypes, TextFormatDefinition, TranslatorFormfactorDefinition, UNCERTAIN_USAGE, UnexpectedError, ZERO_USAGE, _AnthropicClaudeMetadataRegistration, _AzureOpenAiMetadataRegistration, _DocumentScraperMetadataRegistration, _GoogleMetadataRegistration, _LegacyDocumentScraperMetadataRegistration, _MarkdownScraperMetadataRegistration, _OpenAiAssistantMetadataRegistration, _OpenAiMetadataRegistration, _PdfScraperMetadataRegistration, _WebsiteScraperMetadataRegistration, addUsage, assertsExecutionSuccessful, cacheLlmTools, collectionToJson, countTotalUsage, createCollectionFromJson, createCollectionFromPromise, createCollectionFromUrl, createLlmToolsFromConfiguration, createPipelineExecutor, createSubcollection, embeddingVectorToString, executionReportJsonToString, extractParameterNamesFromTask, getPipelineInterface, isPassingExpectations, isPipelineImplementingInterface, isPipelineInterfacesEqual, isPipelinePrepared, joinLlmExecutionTools, limitTotalUsage, makeKnowledgeSourceHandler, pipelineJsonToString, pipelineStringToJson, pipelineStringToJsonSync, prepareKnowledgePieces, preparePersona, preparePipeline, prepareTasks, prettifyPipelineString, removePipelineCommand, renamePipelineParameter, stringifyPipelineJson, unpreparePipeline, usageToHuman, usageToWorktime, validatePipeline };
10907
11133
  //# sourceMappingURL=index.es.js.map