@promptbook/openai 0.103.0-41 → 0.103.0-43

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 (79) hide show
  1. package/esm/index.es.js +33 -97
  2. package/esm/index.es.js.map +1 -1
  3. package/esm/typings/src/_packages/core.index.d.ts +6 -0
  4. package/esm/typings/src/_packages/node.index.d.ts +0 -2
  5. package/esm/typings/src/_packages/types.index.d.ts +14 -0
  6. package/esm/typings/src/_packages/utils.index.d.ts +2 -0
  7. package/esm/typings/src/book-2.0/agent-source/AgentBasicInformation.d.ts +2 -4
  8. package/esm/typings/src/book-2.0/agent-source/padBook.d.ts +1 -1
  9. package/esm/typings/src/book-2.0/agent-source/string_book.d.ts +1 -0
  10. package/esm/typings/src/book-components/AvatarProfile/AvatarProfile/AvatarProfile.d.ts +1 -1
  11. package/esm/typings/src/book-components/BookEditor/BookEditor.d.ts +1 -1
  12. package/esm/typings/src/book-components/Chat/save/_common/ChatSaveFormatDefinition.d.ts +1 -1
  13. package/esm/typings/src/book-components/Chat/types/ChatParticipant.d.ts +1 -1
  14. package/esm/typings/src/book-components/Qr/BrandedQrCode.d.ts +1 -1
  15. package/esm/typings/src/book-components/Qr/useQrCode.d.ts +1 -1
  16. package/esm/typings/src/cli/cli-commands/_boilerplate.d.ts +1 -1
  17. package/esm/typings/src/cli/cli-commands/about.d.ts +1 -1
  18. package/esm/typings/src/cli/cli-commands/hello.d.ts +1 -1
  19. package/esm/typings/src/cli/cli-commands/list-models.d.ts +1 -1
  20. package/esm/typings/src/cli/cli-commands/list-scrapers.d.ts +1 -1
  21. package/esm/typings/src/cli/cli-commands/login.d.ts +1 -1
  22. package/esm/typings/src/cli/cli-commands/make.d.ts +1 -1
  23. package/esm/typings/src/cli/cli-commands/prettify.d.ts +1 -1
  24. package/esm/typings/src/cli/cli-commands/run.d.ts +1 -1
  25. package/esm/typings/src/cli/cli-commands/start-agents-server.d.ts +1 -1
  26. package/esm/typings/src/cli/cli-commands/start-pipelines-server.d.ts +1 -1
  27. package/esm/typings/src/cli/cli-commands/test-command.d.ts +1 -1
  28. package/esm/typings/src/cli/common/$addGlobalOptionsToCommand.d.ts +1 -1
  29. package/esm/typings/src/collection/agent-collection/AgentCollection.d.ts +14 -12
  30. package/esm/typings/src/collection/agent-collection/constructors/agent-collection-in-supabase/AgentCollectionInSupabase.d.ts +55 -0
  31. package/esm/typings/src/collection/agent-collection/constructors/agent-collection-in-supabase/AgentsDatabaseSchema.d.ts +129 -0
  32. package/esm/typings/src/commands/_common/types/CommandParser.d.ts +1 -1
  33. package/esm/typings/src/config.d.ts +1 -1
  34. package/esm/typings/src/errors/0-index.d.ts +3 -0
  35. package/esm/typings/src/errors/DatabaseError.d.ts +9 -0
  36. package/esm/typings/src/execution/createPipelineExecutor/40-executeAttempts.d.ts +1 -1
  37. package/esm/typings/src/high-level-abstractions/_common/HighLevelAbstraction.d.ts +1 -1
  38. package/esm/typings/src/llm-providers/_common/register/$registeredLlmToolsMessage.d.ts +1 -1
  39. package/esm/typings/src/llm-providers/_common/register/LlmToolsMetadata.d.ts +1 -1
  40. package/esm/typings/src/llm-providers/agent/Agent.d.ts +5 -2
  41. package/esm/typings/src/llm-providers/agent/AgentLlmExecutionTools.d.ts +1 -1
  42. package/esm/typings/src/llm-providers/agent/AgentOptions.d.ts +4 -2
  43. package/esm/typings/src/llm-providers/agent/CreateAgentLlmExecutionToolsOptions.d.ts +2 -2
  44. package/esm/typings/src/llm-providers/agent/createAgentLlmExecutionTools.d.ts +1 -1
  45. package/esm/typings/src/prepare/PrepareAndScrapeOptions.d.ts +1 -0
  46. package/esm/typings/src/remote-server/startAgentServer.d.ts +2 -2
  47. package/esm/typings/src/remote-server/types/RemoteServerOptions.d.ts +0 -19
  48. package/esm/typings/src/storage/env-storage/$EnvStorage.d.ts +1 -1
  49. package/esm/typings/src/transpilers/_common/BookTranspiler.d.ts +5 -1
  50. package/esm/typings/src/transpilers/_common/BookTranspilerOptions.d.ts +1 -1
  51. package/esm/typings/src/transpilers/_common/register/$bookTranspilersRegister.d.ts +1 -1
  52. package/esm/typings/src/transpilers/formatted-book-in-markdown/FormattedBookInMarkdownTranspiler.d.ts +4 -1
  53. package/esm/typings/src/transpilers/formatted-book-in-markdown/register.d.ts +1 -1
  54. package/esm/typings/src/transpilers/openai-sdk/OpenAiSdkTranspiler.d.ts +4 -1
  55. package/esm/typings/src/transpilers/openai-sdk/register.d.ts +1 -1
  56. package/esm/typings/src/utils/color/operators/darken.d.ts +1 -1
  57. package/esm/typings/src/utils/color/operators/grayscale.d.ts +1 -1
  58. package/esm/typings/src/utils/color/operators/lighten.d.ts +1 -1
  59. package/esm/typings/src/utils/color/operators/mixWithColor.d.ts +1 -1
  60. package/esm/typings/src/utils/color/operators/saturate.d.ts +1 -1
  61. package/esm/typings/src/utils/environment/$detectRuntimeEnvironment.d.ts +16 -0
  62. package/esm/typings/src/utils/execCommand/$execCommand.d.ts +1 -1
  63. package/esm/typings/src/utils/execCommand/$execCommands.d.ts +1 -1
  64. package/esm/typings/src/utils/files/$induceBookDownload.d.ts +2 -2
  65. package/esm/typings/src/utils/files/$induceFileDownload.d.ts +2 -2
  66. package/esm/typings/src/utils/files/ObjectUrl.d.ts +1 -1
  67. package/esm/typings/src/utils/misc/aboutPromptbookInformation.d.ts +6 -0
  68. package/esm/typings/src/utils/organization/$side_effect.d.ts +1 -1
  69. package/esm/typings/src/utils/random/$generateBookBoilerplate.d.ts +22 -0
  70. package/esm/typings/src/utils/random/$randomToken.d.ts +1 -0
  71. package/esm/typings/src/utils/serialization/$deepFreeze.d.ts +1 -1
  72. package/esm/typings/src/utils/serialization/serializeToPromptbookJavascript.d.ts +2 -2
  73. package/esm/typings/src/version.d.ts +1 -1
  74. package/package.json +2 -2
  75. package/umd/index.umd.js +33 -97
  76. package/umd/index.umd.js.map +1 -1
  77. package/esm/typings/src/collection/agent-collection/constructors/AgentCollectionInDirectory.d.ts +0 -88
  78. package/esm/typings/src/collection/agent-collection/constructors/AgentCollectionInDirectory.test.d.ts +0 -1
  79. package/esm/typings/src/execution/utils/logLlmCall.d.ts +0 -8
package/esm/index.es.js CHANGED
@@ -20,7 +20,7 @@ const BOOK_LANGUAGE_VERSION = '1.0.0';
20
20
  * @generated
21
21
  * @see https://github.com/webgptorg/promptbook
22
22
  */
23
- const PROMPTBOOK_ENGINE_VERSION = '0.103.0-41';
23
+ const PROMPTBOOK_ENGINE_VERSION = '0.103.0-43';
24
24
  /**
25
25
  * TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
26
26
  * Note: [💞] Ignore a discrepancy between file name and entity name
@@ -105,6 +105,7 @@ class NotYetImplementedError extends Error {
105
105
  /**
106
106
  * Generates random token
107
107
  *
108
+ * Note: `$` is used to indicate that this function is not a pure function - it is not deterministic
108
109
  * Note: This function is cryptographically secure (it uses crypto.randomBytes internally)
109
110
  *
110
111
  * @private internal helper function
@@ -901,6 +902,23 @@ class Color {
901
902
  * TODO: Maybe connect with textures
902
903
  */
903
904
 
905
+ /**
906
+ * Makes color transformer which returns a grayscale version of the color
907
+ *
908
+ * @param amount from 0 to 1
909
+ *
910
+ * @public exported from `@promptbook/color`
911
+ */
912
+ function grayscale(amount) {
913
+ return ({ red, green, blue, alpha }) => {
914
+ const average = (red + green + blue) / 3;
915
+ red = Math.round(average * amount + red * (1 - amount));
916
+ green = Math.round(average * amount + green * (1 - amount));
917
+ blue = Math.round(average * amount + blue * (1 - amount));
918
+ return Color.fromValues(red, green, blue, alpha);
919
+ };
920
+ }
921
+
904
922
  /**
905
923
  * Converts HSL values to RGB values
906
924
  *
@@ -1016,102 +1034,6 @@ function lighten(amount) {
1016
1034
  * TODO: Maybe implement by mix+hsl
1017
1035
  */
1018
1036
 
1019
- /**
1020
- * Calculates distance between two colors
1021
- *
1022
- * @param color1 first color
1023
- * @param color2 second color
1024
- *
1025
- * Note: This function is inefficient. Use colorDistanceSquared instead if possible.
1026
- *
1027
- * @public exported from `@promptbook/color`
1028
- */
1029
- /**
1030
- * Calculates distance between two colors without square root
1031
- *
1032
- * @param color1 first color
1033
- * @param color2 second color
1034
- *
1035
- * @public exported from `@promptbook/color`
1036
- */
1037
- function colorDistanceSquared(color1, color2) {
1038
- const rmean = (color1.red + color2.red) / 2;
1039
- const r = color1.red - color2.red;
1040
- const g = color1.green - color2.green;
1041
- const b = color1.blue - color2.blue;
1042
- const weightR = 2 + rmean / 256;
1043
- const weightG = 4.0;
1044
- const weightB = 2 + (255 - rmean) / 256;
1045
- const distance = weightR * r * r + weightG * g * g + weightB * b * b;
1046
- return distance;
1047
- }
1048
-
1049
- /**
1050
- * Makes color transformer which finds the nearest color from the given list
1051
- *
1052
- * @param colors array of colors to choose from
1053
- *
1054
- * @public exported from `@promptbook/color`
1055
- */
1056
- function nearest(...colors) {
1057
- return (color) => {
1058
- const distances = colors.map((c) => colorDistanceSquared(c, color));
1059
- const minDistance = Math.min(...distances);
1060
- const minIndex = distances.indexOf(minDistance);
1061
- const nearestColor = colors[minIndex];
1062
- return nearestColor;
1063
- };
1064
- }
1065
-
1066
- /**
1067
- * Color transformer which returns the negative color
1068
- *
1069
- * @public exported from `@promptbook/color`
1070
- */
1071
- function negative(color) {
1072
- const r = 255 - color.red;
1073
- const g = 255 - color.green;
1074
- const b = 255 - color.blue;
1075
- return Color.fromValues(r, g, b, color.alpha);
1076
- }
1077
-
1078
- /**
1079
- * Makes color transformer which finds the furthest color from the given list
1080
- *
1081
- * @param colors array of colors to choose from
1082
- *
1083
- * @public exported from `@promptbook/color`
1084
- */
1085
- function furthest(...colors) {
1086
- return (color) => {
1087
- const furthestColor = negative(nearest(...colors.map(negative))(color));
1088
- return furthestColor;
1089
- };
1090
- }
1091
- /**
1092
- * Makes color transformer which finds the best text color (black or white) for the given background color
1093
- *
1094
- * @public exported from `@promptbook/color`
1095
- */
1096
- furthest(Color.get('white'), Color.from('black'));
1097
-
1098
- /**
1099
- * Makes color transformer which returns a grayscale version of the color
1100
- *
1101
- * @param amount from 0 to 1
1102
- *
1103
- * @public exported from `@promptbook/color`
1104
- */
1105
- function grayscale(amount) {
1106
- return ({ red, green, blue, alpha }) => {
1107
- const average = (red + green + blue) / 3;
1108
- red = Math.round(average * amount + red * (1 - amount));
1109
- green = Math.round(average * amount + green * (1 - amount));
1110
- blue = Math.round(average * amount + blue * (1 - amount));
1111
- return Color.fromValues(red, green, blue, alpha);
1112
- };
1113
- }
1114
-
1115
1037
  /**
1116
1038
  * Makes color transformer which saturate the given color
1117
1039
  *
@@ -3995,6 +3917,19 @@ class CollectionError extends Error {
3995
3917
  }
3996
3918
  }
3997
3919
 
3920
+ /**
3921
+ * This error indicates error from the database
3922
+ *
3923
+ * @public exported from `@promptbook/core`
3924
+ */
3925
+ class DatabaseError extends Error {
3926
+ constructor(message) {
3927
+ super(message);
3928
+ this.name = 'DatabaseError';
3929
+ Object.setPrototypeOf(this, DatabaseError.prototype);
3930
+ }
3931
+ }
3932
+
3998
3933
  /**
3999
3934
  * This error type indicates that you try to use a feature that is not available in the current environment
4000
3935
  *
@@ -4148,6 +4083,7 @@ const PROMPTBOOK_ERRORS = {
4148
4083
  UnexpectedError,
4149
4084
  WrappedError,
4150
4085
  NotAllowed,
4086
+ DatabaseError,
4151
4087
  // TODO: [🪑]> VersionMismatchError,
4152
4088
  };
4153
4089
  /**