@promptbook/remote-client 0.103.0-42 → 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.
- package/esm/index.es.js +33 -97
- package/esm/index.es.js.map +1 -1
- package/esm/typings/src/_packages/core.index.d.ts +6 -0
- package/esm/typings/src/_packages/node.index.d.ts +0 -2
- package/esm/typings/src/_packages/types.index.d.ts +14 -0
- package/esm/typings/src/_packages/utils.index.d.ts +2 -0
- package/esm/typings/src/book-2.0/agent-source/AgentBasicInformation.d.ts +2 -4
- package/esm/typings/src/book-2.0/agent-source/padBook.d.ts +1 -1
- package/esm/typings/src/book-2.0/agent-source/string_book.d.ts +1 -0
- package/esm/typings/src/book-components/AvatarProfile/AvatarProfile/AvatarProfile.d.ts +1 -1
- package/esm/typings/src/book-components/BookEditor/BookEditor.d.ts +1 -1
- package/esm/typings/src/book-components/Chat/save/_common/ChatSaveFormatDefinition.d.ts +1 -1
- package/esm/typings/src/book-components/Chat/types/ChatParticipant.d.ts +1 -1
- package/esm/typings/src/book-components/Qr/BrandedQrCode.d.ts +1 -1
- package/esm/typings/src/book-components/Qr/useQrCode.d.ts +1 -1
- package/esm/typings/src/cli/cli-commands/_boilerplate.d.ts +1 -1
- package/esm/typings/src/cli/cli-commands/about.d.ts +1 -1
- package/esm/typings/src/cli/cli-commands/hello.d.ts +1 -1
- package/esm/typings/src/cli/cli-commands/list-models.d.ts +1 -1
- package/esm/typings/src/cli/cli-commands/list-scrapers.d.ts +1 -1
- package/esm/typings/src/cli/cli-commands/login.d.ts +1 -1
- package/esm/typings/src/cli/cli-commands/make.d.ts +1 -1
- package/esm/typings/src/cli/cli-commands/prettify.d.ts +1 -1
- package/esm/typings/src/cli/cli-commands/run.d.ts +1 -1
- package/esm/typings/src/cli/cli-commands/start-agents-server.d.ts +1 -1
- package/esm/typings/src/cli/cli-commands/start-pipelines-server.d.ts +1 -1
- package/esm/typings/src/cli/cli-commands/test-command.d.ts +1 -1
- package/esm/typings/src/cli/common/$addGlobalOptionsToCommand.d.ts +1 -1
- package/esm/typings/src/collection/agent-collection/AgentCollection.d.ts +11 -12
- package/esm/typings/src/collection/agent-collection/constructors/agent-collection-in-supabase/AgentCollectionInSupabase.d.ts +55 -0
- package/esm/typings/src/collection/agent-collection/constructors/agent-collection-in-supabase/AgentsDatabaseSchema.d.ts +129 -0
- package/esm/typings/src/commands/_common/types/CommandParser.d.ts +1 -1
- package/esm/typings/src/config.d.ts +1 -1
- package/esm/typings/src/errors/0-index.d.ts +3 -0
- package/esm/typings/src/errors/DatabaseError.d.ts +9 -0
- package/esm/typings/src/execution/createPipelineExecutor/40-executeAttempts.d.ts +1 -1
- package/esm/typings/src/high-level-abstractions/_common/HighLevelAbstraction.d.ts +1 -1
- package/esm/typings/src/llm-providers/_common/register/$registeredLlmToolsMessage.d.ts +1 -1
- package/esm/typings/src/llm-providers/_common/register/LlmToolsMetadata.d.ts +1 -1
- package/esm/typings/src/llm-providers/agent/Agent.d.ts +5 -2
- package/esm/typings/src/llm-providers/agent/AgentLlmExecutionTools.d.ts +1 -1
- package/esm/typings/src/llm-providers/agent/AgentOptions.d.ts +4 -2
- package/esm/typings/src/llm-providers/agent/CreateAgentLlmExecutionToolsOptions.d.ts +2 -2
- package/esm/typings/src/llm-providers/agent/createAgentLlmExecutionTools.d.ts +1 -1
- package/esm/typings/src/prepare/PrepareAndScrapeOptions.d.ts +1 -0
- package/esm/typings/src/remote-server/startAgentServer.d.ts +2 -2
- package/esm/typings/src/remote-server/types/RemoteServerOptions.d.ts +0 -19
- package/esm/typings/src/storage/env-storage/$EnvStorage.d.ts +1 -1
- package/esm/typings/src/transpilers/_common/BookTranspiler.d.ts +5 -1
- package/esm/typings/src/transpilers/_common/BookTranspilerOptions.d.ts +1 -1
- package/esm/typings/src/transpilers/_common/register/$bookTranspilersRegister.d.ts +1 -1
- package/esm/typings/src/transpilers/formatted-book-in-markdown/FormattedBookInMarkdownTranspiler.d.ts +4 -1
- package/esm/typings/src/transpilers/formatted-book-in-markdown/register.d.ts +1 -1
- package/esm/typings/src/transpilers/openai-sdk/OpenAiSdkTranspiler.d.ts +4 -1
- package/esm/typings/src/transpilers/openai-sdk/register.d.ts +1 -1
- package/esm/typings/src/utils/color/operators/darken.d.ts +1 -1
- package/esm/typings/src/utils/color/operators/grayscale.d.ts +1 -1
- package/esm/typings/src/utils/color/operators/lighten.d.ts +1 -1
- package/esm/typings/src/utils/color/operators/mixWithColor.d.ts +1 -1
- package/esm/typings/src/utils/color/operators/saturate.d.ts +1 -1
- package/esm/typings/src/utils/environment/$detectRuntimeEnvironment.d.ts +16 -0
- package/esm/typings/src/utils/execCommand/$execCommand.d.ts +1 -1
- package/esm/typings/src/utils/execCommand/$execCommands.d.ts +1 -1
- package/esm/typings/src/utils/files/$induceBookDownload.d.ts +2 -2
- package/esm/typings/src/utils/files/$induceFileDownload.d.ts +2 -2
- package/esm/typings/src/utils/files/ObjectUrl.d.ts +1 -1
- package/esm/typings/src/utils/misc/aboutPromptbookInformation.d.ts +6 -0
- package/esm/typings/src/utils/organization/$side_effect.d.ts +1 -1
- package/esm/typings/src/utils/random/$generateBookBoilerplate.d.ts +22 -0
- package/esm/typings/src/utils/random/$randomToken.d.ts +1 -0
- package/esm/typings/src/utils/serialization/$deepFreeze.d.ts +1 -1
- package/esm/typings/src/utils/serialization/serializeToPromptbookJavascript.d.ts +2 -2
- package/esm/typings/src/version.d.ts +1 -1
- package/package.json +2 -2
- package/umd/index.umd.js +33 -97
- package/umd/index.umd.js.map +1 -1
- package/esm/typings/src/collection/agent-collection/constructors/AgentCollectionInDirectory.d.ts +0 -89
- package/esm/typings/src/collection/agent-collection/constructors/AgentCollectionInDirectory.test.d.ts +0 -1
- 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-
|
|
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
|
|
@@ -82,6 +82,19 @@ class CollectionError extends Error {
|
|
|
82
82
|
}
|
|
83
83
|
}
|
|
84
84
|
|
|
85
|
+
/**
|
|
86
|
+
* This error indicates error from the database
|
|
87
|
+
*
|
|
88
|
+
* @public exported from `@promptbook/core`
|
|
89
|
+
*/
|
|
90
|
+
class DatabaseError extends Error {
|
|
91
|
+
constructor(message) {
|
|
92
|
+
super(message);
|
|
93
|
+
this.name = 'DatabaseError';
|
|
94
|
+
Object.setPrototypeOf(this, DatabaseError.prototype);
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
|
|
85
98
|
/**
|
|
86
99
|
* This error type indicates that you try to use a feature that is not available in the current environment
|
|
87
100
|
*
|
|
@@ -223,6 +236,7 @@ class ParseError extends Error {
|
|
|
223
236
|
/**
|
|
224
237
|
* Generates random token
|
|
225
238
|
*
|
|
239
|
+
* Note: `$` is used to indicate that this function is not a pure function - it is not deterministic
|
|
226
240
|
* Note: This function is cryptographically secure (it uses crypto.randomBytes internally)
|
|
227
241
|
*
|
|
228
242
|
* @private internal helper function
|
|
@@ -951,6 +965,23 @@ class Color {
|
|
|
951
965
|
* TODO: Maybe connect with textures
|
|
952
966
|
*/
|
|
953
967
|
|
|
968
|
+
/**
|
|
969
|
+
* Makes color transformer which returns a grayscale version of the color
|
|
970
|
+
*
|
|
971
|
+
* @param amount from 0 to 1
|
|
972
|
+
*
|
|
973
|
+
* @public exported from `@promptbook/color`
|
|
974
|
+
*/
|
|
975
|
+
function grayscale(amount) {
|
|
976
|
+
return ({ red, green, blue, alpha }) => {
|
|
977
|
+
const average = (red + green + blue) / 3;
|
|
978
|
+
red = Math.round(average * amount + red * (1 - amount));
|
|
979
|
+
green = Math.round(average * amount + green * (1 - amount));
|
|
980
|
+
blue = Math.round(average * amount + blue * (1 - amount));
|
|
981
|
+
return Color.fromValues(red, green, blue, alpha);
|
|
982
|
+
};
|
|
983
|
+
}
|
|
984
|
+
|
|
954
985
|
/**
|
|
955
986
|
* Converts HSL values to RGB values
|
|
956
987
|
*
|
|
@@ -1066,102 +1097,6 @@ function lighten(amount) {
|
|
|
1066
1097
|
* TODO: Maybe implement by mix+hsl
|
|
1067
1098
|
*/
|
|
1068
1099
|
|
|
1069
|
-
/**
|
|
1070
|
-
* Calculates distance between two colors
|
|
1071
|
-
*
|
|
1072
|
-
* @param color1 first color
|
|
1073
|
-
* @param color2 second color
|
|
1074
|
-
*
|
|
1075
|
-
* Note: This function is inefficient. Use colorDistanceSquared instead if possible.
|
|
1076
|
-
*
|
|
1077
|
-
* @public exported from `@promptbook/color`
|
|
1078
|
-
*/
|
|
1079
|
-
/**
|
|
1080
|
-
* Calculates distance between two colors without square root
|
|
1081
|
-
*
|
|
1082
|
-
* @param color1 first color
|
|
1083
|
-
* @param color2 second color
|
|
1084
|
-
*
|
|
1085
|
-
* @public exported from `@promptbook/color`
|
|
1086
|
-
*/
|
|
1087
|
-
function colorDistanceSquared(color1, color2) {
|
|
1088
|
-
const rmean = (color1.red + color2.red) / 2;
|
|
1089
|
-
const r = color1.red - color2.red;
|
|
1090
|
-
const g = color1.green - color2.green;
|
|
1091
|
-
const b = color1.blue - color2.blue;
|
|
1092
|
-
const weightR = 2 + rmean / 256;
|
|
1093
|
-
const weightG = 4.0;
|
|
1094
|
-
const weightB = 2 + (255 - rmean) / 256;
|
|
1095
|
-
const distance = weightR * r * r + weightG * g * g + weightB * b * b;
|
|
1096
|
-
return distance;
|
|
1097
|
-
}
|
|
1098
|
-
|
|
1099
|
-
/**
|
|
1100
|
-
* Makes color transformer which finds the nearest color from the given list
|
|
1101
|
-
*
|
|
1102
|
-
* @param colors array of colors to choose from
|
|
1103
|
-
*
|
|
1104
|
-
* @public exported from `@promptbook/color`
|
|
1105
|
-
*/
|
|
1106
|
-
function nearest(...colors) {
|
|
1107
|
-
return (color) => {
|
|
1108
|
-
const distances = colors.map((c) => colorDistanceSquared(c, color));
|
|
1109
|
-
const minDistance = Math.min(...distances);
|
|
1110
|
-
const minIndex = distances.indexOf(minDistance);
|
|
1111
|
-
const nearestColor = colors[minIndex];
|
|
1112
|
-
return nearestColor;
|
|
1113
|
-
};
|
|
1114
|
-
}
|
|
1115
|
-
|
|
1116
|
-
/**
|
|
1117
|
-
* Color transformer which returns the negative color
|
|
1118
|
-
*
|
|
1119
|
-
* @public exported from `@promptbook/color`
|
|
1120
|
-
*/
|
|
1121
|
-
function negative(color) {
|
|
1122
|
-
const r = 255 - color.red;
|
|
1123
|
-
const g = 255 - color.green;
|
|
1124
|
-
const b = 255 - color.blue;
|
|
1125
|
-
return Color.fromValues(r, g, b, color.alpha);
|
|
1126
|
-
}
|
|
1127
|
-
|
|
1128
|
-
/**
|
|
1129
|
-
* Makes color transformer which finds the furthest color from the given list
|
|
1130
|
-
*
|
|
1131
|
-
* @param colors array of colors to choose from
|
|
1132
|
-
*
|
|
1133
|
-
* @public exported from `@promptbook/color`
|
|
1134
|
-
*/
|
|
1135
|
-
function furthest(...colors) {
|
|
1136
|
-
return (color) => {
|
|
1137
|
-
const furthestColor = negative(nearest(...colors.map(negative))(color));
|
|
1138
|
-
return furthestColor;
|
|
1139
|
-
};
|
|
1140
|
-
}
|
|
1141
|
-
/**
|
|
1142
|
-
* Makes color transformer which finds the best text color (black or white) for the given background color
|
|
1143
|
-
*
|
|
1144
|
-
* @public exported from `@promptbook/color`
|
|
1145
|
-
*/
|
|
1146
|
-
furthest(Color.get('white'), Color.from('black'));
|
|
1147
|
-
|
|
1148
|
-
/**
|
|
1149
|
-
* Makes color transformer which returns a grayscale version of the color
|
|
1150
|
-
*
|
|
1151
|
-
* @param amount from 0 to 1
|
|
1152
|
-
*
|
|
1153
|
-
* @public exported from `@promptbook/color`
|
|
1154
|
-
*/
|
|
1155
|
-
function grayscale(amount) {
|
|
1156
|
-
return ({ red, green, blue, alpha }) => {
|
|
1157
|
-
const average = (red + green + blue) / 3;
|
|
1158
|
-
red = Math.round(average * amount + red * (1 - amount));
|
|
1159
|
-
green = Math.round(average * amount + green * (1 - amount));
|
|
1160
|
-
blue = Math.round(average * amount + blue * (1 - amount));
|
|
1161
|
-
return Color.fromValues(red, green, blue, alpha);
|
|
1162
|
-
};
|
|
1163
|
-
}
|
|
1164
|
-
|
|
1165
1100
|
/**
|
|
1166
1101
|
* Makes color transformer which saturate the given color
|
|
1167
1102
|
*
|
|
@@ -1439,6 +1374,7 @@ const PROMPTBOOK_ERRORS = {
|
|
|
1439
1374
|
UnexpectedError,
|
|
1440
1375
|
WrappedError,
|
|
1441
1376
|
NotAllowed,
|
|
1377
|
+
DatabaseError,
|
|
1442
1378
|
// TODO: [🪑]> VersionMismatchError,
|
|
1443
1379
|
};
|
|
1444
1380
|
/**
|