@promptbook/openai 0.103.0-42 → 0.103.0-44

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 (92) hide show
  1. package/README.md +6 -18
  2. package/esm/index.es.js +55 -105
  3. package/esm/index.es.js.map +1 -1
  4. package/esm/typings/src/_packages/core.index.d.ts +6 -0
  5. package/esm/typings/src/_packages/node.index.d.ts +0 -2
  6. package/esm/typings/src/_packages/types.index.d.ts +22 -0
  7. package/esm/typings/src/_packages/utils.index.d.ts +2 -0
  8. package/esm/typings/src/book-2.0/agent-source/AgentBasicInformation.d.ts +2 -4
  9. package/esm/typings/src/book-2.0/agent-source/padBook.d.ts +1 -1
  10. package/esm/typings/src/book-2.0/agent-source/string_book.d.ts +1 -0
  11. package/esm/typings/src/book-components/AvatarProfile/AvatarProfile/AvatarProfile.d.ts +6 -1
  12. package/esm/typings/src/book-components/BookEditor/BookEditor.d.ts +1 -1
  13. package/esm/typings/src/book-components/Chat/save/_common/ChatSaveFormatDefinition.d.ts +1 -1
  14. package/esm/typings/src/book-components/Chat/types/ChatParticipant.d.ts +1 -1
  15. package/esm/typings/src/book-components/Qr/BrandedQrCode.d.ts +1 -1
  16. package/esm/typings/src/book-components/Qr/useQrCode.d.ts +1 -1
  17. package/esm/typings/src/cli/cli-commands/_boilerplate.d.ts +1 -1
  18. package/esm/typings/src/cli/cli-commands/about.d.ts +1 -1
  19. package/esm/typings/src/cli/cli-commands/hello.d.ts +1 -1
  20. package/esm/typings/src/cli/cli-commands/list-models.d.ts +1 -1
  21. package/esm/typings/src/cli/cli-commands/list-scrapers.d.ts +1 -1
  22. package/esm/typings/src/cli/cli-commands/login.d.ts +1 -1
  23. package/esm/typings/src/cli/cli-commands/make.d.ts +1 -1
  24. package/esm/typings/src/cli/cli-commands/prettify.d.ts +1 -1
  25. package/esm/typings/src/cli/cli-commands/run.d.ts +1 -1
  26. package/esm/typings/src/cli/cli-commands/start-agents-server.d.ts +1 -1
  27. package/esm/typings/src/cli/cli-commands/start-pipelines-server.d.ts +1 -1
  28. package/esm/typings/src/cli/cli-commands/test-command.d.ts +1 -1
  29. package/esm/typings/src/cli/common/$addGlobalOptionsToCommand.d.ts +1 -1
  30. package/esm/typings/src/collection/agent-collection/AgentCollection.d.ts +2 -29
  31. package/esm/typings/src/collection/agent-collection/constructors/agent-collection-in-supabase/AgentCollectionInSupabase.d.ts +107 -0
  32. package/esm/typings/src/collection/agent-collection/constructors/agent-collection-in-supabase/AgentsDatabaseSchema.d.ts +129 -0
  33. package/esm/typings/src/commands/_common/types/CommandParser.d.ts +1 -1
  34. package/esm/typings/src/config.d.ts +1 -1
  35. package/esm/typings/src/errors/0-index.d.ts +3 -0
  36. package/esm/typings/src/errors/DatabaseError.d.ts +12 -0
  37. package/esm/typings/src/execution/createPipelineExecutor/40-executeAttempts.d.ts +1 -1
  38. package/esm/typings/src/high-level-abstractions/_common/HighLevelAbstraction.d.ts +1 -1
  39. package/esm/typings/src/llm-providers/_common/register/$registeredLlmToolsMessage.d.ts +1 -1
  40. package/esm/typings/src/llm-providers/_common/register/LlmToolsMetadata.d.ts +1 -1
  41. package/esm/typings/src/llm-providers/_multiple/getSingleLlmExecutionTools.d.ts +1 -0
  42. package/esm/typings/src/llm-providers/_multiple/joinLlmExecutionTools.d.ts +1 -0
  43. package/esm/typings/src/llm-providers/agent/Agent.d.ts +5 -2
  44. package/esm/typings/src/llm-providers/agent/AgentLlmExecutionTools.d.ts +1 -1
  45. package/esm/typings/src/llm-providers/agent/AgentOptions.d.ts +4 -2
  46. package/esm/typings/src/llm-providers/agent/CreateAgentLlmExecutionToolsOptions.d.ts +4 -3
  47. package/esm/typings/src/llm-providers/agent/createAgentLlmExecutionTools.d.ts +1 -1
  48. package/esm/typings/src/llm-providers/anthropic-claude/anthropic-claude-models.d.ts +1 -1
  49. package/esm/typings/src/llm-providers/google/google-models.d.ts +1 -1
  50. package/esm/typings/src/llm-providers/openai/openai-models.d.ts +1 -1
  51. package/esm/typings/src/prepare/PrepareAndScrapeOptions.d.ts +1 -0
  52. package/esm/typings/src/remote-server/startAgentServer.d.ts +2 -2
  53. package/esm/typings/src/remote-server/types/RemoteServerOptions.d.ts +0 -19
  54. package/esm/typings/src/storage/env-storage/$EnvStorage.d.ts +1 -1
  55. package/esm/typings/src/transpilers/_common/BookTranspiler.d.ts +5 -1
  56. package/esm/typings/src/transpilers/_common/BookTranspilerOptions.d.ts +1 -1
  57. package/esm/typings/src/transpilers/_common/register/$bookTranspilersRegister.d.ts +1 -1
  58. package/esm/typings/src/transpilers/formatted-book-in-markdown/FormattedBookInMarkdownTranspiler.d.ts +4 -1
  59. package/esm/typings/src/transpilers/formatted-book-in-markdown/register.d.ts +1 -1
  60. package/esm/typings/src/transpilers/openai-sdk/OpenAiSdkTranspiler.d.ts +4 -1
  61. package/esm/typings/src/transpilers/openai-sdk/register.d.ts +1 -1
  62. package/esm/typings/src/types/typeAliases.d.ts +19 -1
  63. package/esm/typings/src/utils/color/$randomColor.d.ts +1 -0
  64. package/esm/typings/src/utils/color/operators/darken.d.ts +1 -1
  65. package/esm/typings/src/utils/color/operators/grayscale.d.ts +1 -1
  66. package/esm/typings/src/utils/color/operators/lighten.d.ts +1 -1
  67. package/esm/typings/src/utils/color/operators/mixWithColor.d.ts +1 -1
  68. package/esm/typings/src/utils/color/operators/saturate.d.ts +1 -1
  69. package/esm/typings/src/utils/environment/$detectRuntimeEnvironment.d.ts +16 -0
  70. package/esm/typings/src/utils/execCommand/$execCommand.d.ts +1 -1
  71. package/esm/typings/src/utils/execCommand/$execCommands.d.ts +1 -1
  72. package/esm/typings/src/utils/files/$induceBookDownload.d.ts +2 -2
  73. package/esm/typings/src/utils/files/$induceFileDownload.d.ts +2 -2
  74. package/esm/typings/src/utils/files/ObjectUrl.d.ts +1 -1
  75. package/esm/typings/src/utils/misc/aboutPromptbookInformation.d.ts +6 -0
  76. package/esm/typings/src/utils/organization/$side_effect.d.ts +1 -1
  77. package/esm/typings/src/utils/random/$generateBookBoilerplate.d.ts +25 -0
  78. package/esm/typings/src/utils/random/$randomAgentPersona.d.ts +9 -0
  79. package/esm/typings/src/utils/random/$randomFullnameWithColor.d.ts +13 -0
  80. package/esm/typings/src/utils/random/$randomItem.d.ts +9 -0
  81. package/esm/typings/src/utils/random/$randomSeed.d.ts +3 -0
  82. package/esm/typings/src/utils/random/$randomToken.d.ts +2 -0
  83. package/esm/typings/src/utils/serialization/$deepFreeze.d.ts +1 -1
  84. package/esm/typings/src/utils/serialization/serializeToPromptbookJavascript.d.ts +2 -2
  85. package/esm/typings/src/version.d.ts +1 -1
  86. package/package.json +2 -2
  87. package/umd/index.umd.js +55 -105
  88. package/umd/index.umd.js.map +1 -1
  89. package/esm/typings/src/collection/agent-collection/constructors/AgentCollectionInDirectory.d.ts +0 -89
  90. package/esm/typings/src/collection/agent-collection/constructors/AgentCollectionInDirectory.test.d.ts +0 -1
  91. package/esm/typings/src/commands/_common/parseCommand.test.d.ts +0 -1
  92. package/esm/typings/src/execution/utils/logLlmCall.d.ts +0 -8
package/umd/index.umd.js CHANGED
@@ -18,14 +18,14 @@
18
18
  * @generated
19
19
  * @see https://github.com/webgptorg/book
20
20
  */
21
- const BOOK_LANGUAGE_VERSION = '1.0.0';
21
+ const BOOK_LANGUAGE_VERSION = '2.0.0';
22
22
  /**
23
23
  * The version of the Promptbook engine
24
24
  *
25
25
  * @generated
26
26
  * @see https://github.com/webgptorg/promptbook
27
27
  */
28
- const PROMPTBOOK_ENGINE_VERSION = '0.103.0-42';
28
+ const PROMPTBOOK_ENGINE_VERSION = '0.103.0-44';
29
29
  /**
30
30
  * TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
31
31
  * Note: [💞] Ignore a discrepancy between file name and entity name
@@ -110,6 +110,7 @@
110
110
  /**
111
111
  * Generates random token
112
112
  *
113
+ * Note: `$` is used to indicate that this function is not a pure function - it is not deterministic
113
114
  * Note: This function is cryptographically secure (it uses crypto.randomBytes internally)
114
115
  *
115
116
  * @private internal helper function
@@ -119,6 +120,7 @@
119
120
  return crypto.randomBytes(randomness).toString('hex');
120
121
  }
121
122
  /**
123
+ * TODO: [🤶] Maybe export through `@promptbook/utils` or `@promptbook/random` package
122
124
  * TODO: Maybe use nanoid instead https://github.com/ai/nanoid
123
125
  */
124
126
 
@@ -906,6 +908,23 @@
906
908
  * TODO: Maybe connect with textures
907
909
  */
908
910
 
911
+ /**
912
+ * Makes color transformer which returns a grayscale version of the color
913
+ *
914
+ * @param amount from 0 to 1
915
+ *
916
+ * @public exported from `@promptbook/color`
917
+ */
918
+ function grayscale(amount) {
919
+ return ({ red, green, blue, alpha }) => {
920
+ const average = (red + green + blue) / 3;
921
+ red = Math.round(average * amount + red * (1 - amount));
922
+ green = Math.round(average * amount + green * (1 - amount));
923
+ blue = Math.round(average * amount + blue * (1 - amount));
924
+ return Color.fromValues(red, green, blue, alpha);
925
+ };
926
+ }
927
+
909
928
  /**
910
929
  * Converts HSL values to RGB values
911
930
  *
@@ -1021,102 +1040,6 @@
1021
1040
  * TODO: Maybe implement by mix+hsl
1022
1041
  */
1023
1042
 
1024
- /**
1025
- * Calculates distance between two colors
1026
- *
1027
- * @param color1 first color
1028
- * @param color2 second color
1029
- *
1030
- * Note: This function is inefficient. Use colorDistanceSquared instead if possible.
1031
- *
1032
- * @public exported from `@promptbook/color`
1033
- */
1034
- /**
1035
- * Calculates distance between two colors without square root
1036
- *
1037
- * @param color1 first color
1038
- * @param color2 second color
1039
- *
1040
- * @public exported from `@promptbook/color`
1041
- */
1042
- function colorDistanceSquared(color1, color2) {
1043
- const rmean = (color1.red + color2.red) / 2;
1044
- const r = color1.red - color2.red;
1045
- const g = color1.green - color2.green;
1046
- const b = color1.blue - color2.blue;
1047
- const weightR = 2 + rmean / 256;
1048
- const weightG = 4.0;
1049
- const weightB = 2 + (255 - rmean) / 256;
1050
- const distance = weightR * r * r + weightG * g * g + weightB * b * b;
1051
- return distance;
1052
- }
1053
-
1054
- /**
1055
- * Makes color transformer which finds the nearest color from the given list
1056
- *
1057
- * @param colors array of colors to choose from
1058
- *
1059
- * @public exported from `@promptbook/color`
1060
- */
1061
- function nearest(...colors) {
1062
- return (color) => {
1063
- const distances = colors.map((c) => colorDistanceSquared(c, color));
1064
- const minDistance = Math.min(...distances);
1065
- const minIndex = distances.indexOf(minDistance);
1066
- const nearestColor = colors[minIndex];
1067
- return nearestColor;
1068
- };
1069
- }
1070
-
1071
- /**
1072
- * Color transformer which returns the negative color
1073
- *
1074
- * @public exported from `@promptbook/color`
1075
- */
1076
- function negative(color) {
1077
- const r = 255 - color.red;
1078
- const g = 255 - color.green;
1079
- const b = 255 - color.blue;
1080
- return Color.fromValues(r, g, b, color.alpha);
1081
- }
1082
-
1083
- /**
1084
- * Makes color transformer which finds the furthest color from the given list
1085
- *
1086
- * @param colors array of colors to choose from
1087
- *
1088
- * @public exported from `@promptbook/color`
1089
- */
1090
- function furthest(...colors) {
1091
- return (color) => {
1092
- const furthestColor = negative(nearest(...colors.map(negative))(color));
1093
- return furthestColor;
1094
- };
1095
- }
1096
- /**
1097
- * Makes color transformer which finds the best text color (black or white) for the given background color
1098
- *
1099
- * @public exported from `@promptbook/color`
1100
- */
1101
- furthest(Color.get('white'), Color.from('black'));
1102
-
1103
- /**
1104
- * Makes color transformer which returns a grayscale version of the color
1105
- *
1106
- * @param amount from 0 to 1
1107
- *
1108
- * @public exported from `@promptbook/color`
1109
- */
1110
- function grayscale(amount) {
1111
- return ({ red, green, blue, alpha }) => {
1112
- const average = (red + green + blue) / 3;
1113
- red = Math.round(average * amount + red * (1 - amount));
1114
- green = Math.round(average * amount + green * (1 - amount));
1115
- blue = Math.round(average * amount + blue * (1 - amount));
1116
- return Color.fromValues(red, green, blue, alpha);
1117
- };
1118
- }
1119
-
1120
1043
  /**
1121
1044
  * Makes color transformer which saturate the given color
1122
1045
  *
@@ -2252,7 +2175,7 @@
2252
2175
  /**
2253
2176
  * List of available OpenAI models with pricing
2254
2177
  *
2255
- * Note: Synced with official API docs at 2025-08-20
2178
+ * Note: Synced with official API docs at 2025-11-19
2256
2179
  *
2257
2180
  * @see https://platform.openai.com/docs/models/
2258
2181
  * @see https://openai.com/api/pricing/
@@ -2262,11 +2185,21 @@
2262
2185
  name: 'OPENAI_MODELS',
2263
2186
  value: [
2264
2187
  /**/
2188
+ {
2189
+ modelVariant: 'CHAT',
2190
+ modelTitle: 'gpt-5.1',
2191
+ modelName: 'gpt-5.1',
2192
+ modelDescription: 'The best model for coding and agentic tasks with configurable reasoning effort.',
2193
+ pricing: {
2194
+ prompt: pricing(`$1.25 / 1M tokens`),
2195
+ output: pricing(`$10.00 / 1M tokens`),
2196
+ },
2197
+ },
2265
2198
  {
2266
2199
  modelVariant: 'CHAT',
2267
2200
  modelTitle: 'gpt-5',
2268
2201
  modelName: 'gpt-5',
2269
- modelDescription: "OpenAI's most advanced language model with unprecedented reasoning capabilities and 200K context window. Features revolutionary improvements in complex problem-solving, scientific reasoning, and creative tasks. Demonstrates human-level performance across diverse domains with enhanced safety measures and alignment. Represents the next generation of AI with superior understanding, nuanced responses, and advanced multimodal capabilities.",
2202
+ modelDescription: "OpenAI's most advanced language model with unprecedented reasoning capabilities and 200K context window. Features revolutionary improvements in complex problem-solving, scientific reasoning, and creative tasks. Demonstrates human-level performance across diverse domains with enhanced safety measures and alignment. Represents the next generation of AI with superior understanding, nuanced responses, and advanced multimodal capabilities. DEPRECATED: Use gpt-5.1 instead.",
2270
2203
  pricing: {
2271
2204
  prompt: pricing(`$1.25 / 1M tokens`),
2272
2205
  output: pricing(`$10.00 / 1M tokens`),
@@ -3827,11 +3760,11 @@
3827
3760
  if (!this.isCreatingNewAssistantsAllowed) {
3828
3761
  throw new NotAllowed(`Creating new assistants is not allowed. Set \`isCreatingNewAssistantsAllowed: true\` in options to enable this feature.`);
3829
3762
  }
3830
- await this.playground();
3763
+ // await this.playground();
3831
3764
  const { name, instructions } = options;
3832
3765
  const client = await this.getClient();
3833
- /*
3834
- TODO: !!!
3766
+ /*/
3767
+ //TODO: !!!
3835
3768
  async function downloadFile(url: string, folder = './tmp'): Promise<string> {
3836
3769
  const filename = path.basename(url.split('?')[0]);
3837
3770
  const filepath = path.join(folder, filename);
@@ -3875,8 +3808,8 @@
3875
3808
  const file = await uploadFileToOpenAI(filepath);
3876
3809
  uploadedFiles.push(file.id);
3877
3810
  }
3878
- */
3879
- alert('!!!! Creating new OpenAI assistant');
3811
+ /**/
3812
+ // alert('!!!! Creating new OpenAI assistant');
3880
3813
  // 3️⃣ Create assistant with uploaded files
3881
3814
  const assistant = await client.beta.assistants.create({
3882
3815
  name,
@@ -4000,6 +3933,22 @@
4000
3933
  }
4001
3934
  }
4002
3935
 
3936
+ /**
3937
+ * This error indicates error from the database
3938
+ *
3939
+ * @public exported from `@promptbook/core`
3940
+ */
3941
+ class DatabaseError extends Error {
3942
+ constructor(message) {
3943
+ super(message);
3944
+ this.name = 'DatabaseError';
3945
+ Object.setPrototypeOf(this, DatabaseError.prototype);
3946
+ }
3947
+ }
3948
+ /**
3949
+ * TODO: !!!! Explain that NotFoundError (!!! and other specific errors) has priority over DatabaseError in some contexts
3950
+ */
3951
+
4003
3952
  /**
4004
3953
  * This error type indicates that you try to use a feature that is not available in the current environment
4005
3954
  *
@@ -4153,6 +4102,7 @@
4153
4102
  UnexpectedError,
4154
4103
  WrappedError,
4155
4104
  NotAllowed,
4105
+ DatabaseError,
4156
4106
  // TODO: [🪑]> VersionMismatchError,
4157
4107
  };
4158
4108
  /**