@promptbook/website-crawler 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.
- package/README.md +6 -18
- package/esm/index.es.js +47 -114
- 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 +22 -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 +6 -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 +2 -29
- package/esm/typings/src/collection/agent-collection/constructors/agent-collection-in-supabase/AgentCollectionInSupabase.d.ts +107 -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 +12 -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/_multiple/getSingleLlmExecutionTools.d.ts +1 -0
- package/esm/typings/src/llm-providers/_multiple/joinLlmExecutionTools.d.ts +1 -0
- 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 +4 -3
- package/esm/typings/src/llm-providers/agent/createAgentLlmExecutionTools.d.ts +1 -1
- package/esm/typings/src/llm-providers/anthropic-claude/anthropic-claude-models.d.ts +1 -1
- package/esm/typings/src/llm-providers/google/google-models.d.ts +1 -1
- package/esm/typings/src/llm-providers/openai/openai-models.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/types/typeAliases.d.ts +19 -1
- package/esm/typings/src/utils/color/$randomColor.d.ts +1 -0
- 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 +25 -0
- package/esm/typings/src/utils/random/$randomAgentPersona.d.ts +9 -0
- package/esm/typings/src/utils/random/$randomFullnameWithColor.d.ts +13 -0
- package/esm/typings/src/utils/random/$randomItem.d.ts +9 -0
- package/esm/typings/src/utils/random/$randomSeed.d.ts +3 -0
- package/esm/typings/src/utils/random/$randomToken.d.ts +2 -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 +47 -114
- 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/commands/_common/parseCommand.test.d.ts +0 -1
- package/esm/typings/src/execution/utils/logLlmCall.d.ts +0 -8
package/umd/index.umd.js
CHANGED
|
@@ -17,14 +17,14 @@
|
|
|
17
17
|
* @generated
|
|
18
18
|
* @see https://github.com/webgptorg/book
|
|
19
19
|
*/
|
|
20
|
-
const BOOK_LANGUAGE_VERSION = '
|
|
20
|
+
const BOOK_LANGUAGE_VERSION = '2.0.0';
|
|
21
21
|
/**
|
|
22
22
|
* The version of the Promptbook engine
|
|
23
23
|
*
|
|
24
24
|
* @generated
|
|
25
25
|
* @see https://github.com/webgptorg/promptbook
|
|
26
26
|
*/
|
|
27
|
-
const PROMPTBOOK_ENGINE_VERSION = '0.103.0-
|
|
27
|
+
const PROMPTBOOK_ENGINE_VERSION = '0.103.0-44';
|
|
28
28
|
/**
|
|
29
29
|
* TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
|
|
30
30
|
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
@@ -732,6 +732,23 @@
|
|
|
732
732
|
* TODO: Maybe connect with textures
|
|
733
733
|
*/
|
|
734
734
|
|
|
735
|
+
/**
|
|
736
|
+
* Makes color transformer which returns a grayscale version of the color
|
|
737
|
+
*
|
|
738
|
+
* @param amount from 0 to 1
|
|
739
|
+
*
|
|
740
|
+
* @public exported from `@promptbook/color`
|
|
741
|
+
*/
|
|
742
|
+
function grayscale(amount) {
|
|
743
|
+
return ({ red, green, blue, alpha }) => {
|
|
744
|
+
const average = (red + green + blue) / 3;
|
|
745
|
+
red = Math.round(average * amount + red * (1 - amount));
|
|
746
|
+
green = Math.round(average * amount + green * (1 - amount));
|
|
747
|
+
blue = Math.round(average * amount + blue * (1 - amount));
|
|
748
|
+
return Color.fromValues(red, green, blue, alpha);
|
|
749
|
+
};
|
|
750
|
+
}
|
|
751
|
+
|
|
735
752
|
/**
|
|
736
753
|
* Converts HSL values to RGB values
|
|
737
754
|
*
|
|
@@ -847,102 +864,6 @@
|
|
|
847
864
|
* TODO: Maybe implement by mix+hsl
|
|
848
865
|
*/
|
|
849
866
|
|
|
850
|
-
/**
|
|
851
|
-
* Calculates distance between two colors
|
|
852
|
-
*
|
|
853
|
-
* @param color1 first color
|
|
854
|
-
* @param color2 second color
|
|
855
|
-
*
|
|
856
|
-
* Note: This function is inefficient. Use colorDistanceSquared instead if possible.
|
|
857
|
-
*
|
|
858
|
-
* @public exported from `@promptbook/color`
|
|
859
|
-
*/
|
|
860
|
-
/**
|
|
861
|
-
* Calculates distance between two colors without square root
|
|
862
|
-
*
|
|
863
|
-
* @param color1 first color
|
|
864
|
-
* @param color2 second color
|
|
865
|
-
*
|
|
866
|
-
* @public exported from `@promptbook/color`
|
|
867
|
-
*/
|
|
868
|
-
function colorDistanceSquared(color1, color2) {
|
|
869
|
-
const rmean = (color1.red + color2.red) / 2;
|
|
870
|
-
const r = color1.red - color2.red;
|
|
871
|
-
const g = color1.green - color2.green;
|
|
872
|
-
const b = color1.blue - color2.blue;
|
|
873
|
-
const weightR = 2 + rmean / 256;
|
|
874
|
-
const weightG = 4.0;
|
|
875
|
-
const weightB = 2 + (255 - rmean) / 256;
|
|
876
|
-
const distance = weightR * r * r + weightG * g * g + weightB * b * b;
|
|
877
|
-
return distance;
|
|
878
|
-
}
|
|
879
|
-
|
|
880
|
-
/**
|
|
881
|
-
* Makes color transformer which finds the nearest color from the given list
|
|
882
|
-
*
|
|
883
|
-
* @param colors array of colors to choose from
|
|
884
|
-
*
|
|
885
|
-
* @public exported from `@promptbook/color`
|
|
886
|
-
*/
|
|
887
|
-
function nearest(...colors) {
|
|
888
|
-
return (color) => {
|
|
889
|
-
const distances = colors.map((c) => colorDistanceSquared(c, color));
|
|
890
|
-
const minDistance = Math.min(...distances);
|
|
891
|
-
const minIndex = distances.indexOf(minDistance);
|
|
892
|
-
const nearestColor = colors[minIndex];
|
|
893
|
-
return nearestColor;
|
|
894
|
-
};
|
|
895
|
-
}
|
|
896
|
-
|
|
897
|
-
/**
|
|
898
|
-
* Color transformer which returns the negative color
|
|
899
|
-
*
|
|
900
|
-
* @public exported from `@promptbook/color`
|
|
901
|
-
*/
|
|
902
|
-
function negative(color) {
|
|
903
|
-
const r = 255 - color.red;
|
|
904
|
-
const g = 255 - color.green;
|
|
905
|
-
const b = 255 - color.blue;
|
|
906
|
-
return Color.fromValues(r, g, b, color.alpha);
|
|
907
|
-
}
|
|
908
|
-
|
|
909
|
-
/**
|
|
910
|
-
* Makes color transformer which finds the furthest color from the given list
|
|
911
|
-
*
|
|
912
|
-
* @param colors array of colors to choose from
|
|
913
|
-
*
|
|
914
|
-
* @public exported from `@promptbook/color`
|
|
915
|
-
*/
|
|
916
|
-
function furthest(...colors) {
|
|
917
|
-
return (color) => {
|
|
918
|
-
const furthestColor = negative(nearest(...colors.map(negative))(color));
|
|
919
|
-
return furthestColor;
|
|
920
|
-
};
|
|
921
|
-
}
|
|
922
|
-
/**
|
|
923
|
-
* Makes color transformer which finds the best text color (black or white) for the given background color
|
|
924
|
-
*
|
|
925
|
-
* @public exported from `@promptbook/color`
|
|
926
|
-
*/
|
|
927
|
-
furthest(Color.get('white'), Color.from('black'));
|
|
928
|
-
|
|
929
|
-
/**
|
|
930
|
-
* Makes color transformer which returns a grayscale version of the color
|
|
931
|
-
*
|
|
932
|
-
* @param amount from 0 to 1
|
|
933
|
-
*
|
|
934
|
-
* @public exported from `@promptbook/color`
|
|
935
|
-
*/
|
|
936
|
-
function grayscale(amount) {
|
|
937
|
-
return ({ red, green, blue, alpha }) => {
|
|
938
|
-
const average = (red + green + blue) / 3;
|
|
939
|
-
red = Math.round(average * amount + red * (1 - amount));
|
|
940
|
-
green = Math.round(average * amount + green * (1 - amount));
|
|
941
|
-
blue = Math.round(average * amount + blue * (1 - amount));
|
|
942
|
-
return Color.fromValues(red, green, blue, alpha);
|
|
943
|
-
};
|
|
944
|
-
}
|
|
945
|
-
|
|
946
867
|
/**
|
|
947
868
|
* Makes color transformer which saturate the given color
|
|
948
869
|
*
|
|
@@ -3179,6 +3100,7 @@
|
|
|
3179
3100
|
/**
|
|
3180
3101
|
* Generates random token
|
|
3181
3102
|
*
|
|
3103
|
+
* Note: `$` is used to indicate that this function is not a pure function - it is not deterministic
|
|
3182
3104
|
* Note: This function is cryptographically secure (it uses crypto.randomBytes internally)
|
|
3183
3105
|
*
|
|
3184
3106
|
* @private internal helper function
|
|
@@ -3188,6 +3110,7 @@
|
|
|
3188
3110
|
return crypto.randomBytes(randomness).toString('hex');
|
|
3189
3111
|
}
|
|
3190
3112
|
/**
|
|
3113
|
+
* TODO: [🤶] Maybe export through `@promptbook/utils` or `@promptbook/random` package
|
|
3191
3114
|
* TODO: Maybe use nanoid instead https://github.com/ai/nanoid
|
|
3192
3115
|
*/
|
|
3193
3116
|
|
|
@@ -3306,6 +3229,22 @@
|
|
|
3306
3229
|
}
|
|
3307
3230
|
}
|
|
3308
3231
|
|
|
3232
|
+
/**
|
|
3233
|
+
* This error indicates error from the database
|
|
3234
|
+
*
|
|
3235
|
+
* @public exported from `@promptbook/core`
|
|
3236
|
+
*/
|
|
3237
|
+
class DatabaseError extends Error {
|
|
3238
|
+
constructor(message) {
|
|
3239
|
+
super(message);
|
|
3240
|
+
this.name = 'DatabaseError';
|
|
3241
|
+
Object.setPrototypeOf(this, DatabaseError.prototype);
|
|
3242
|
+
}
|
|
3243
|
+
}
|
|
3244
|
+
/**
|
|
3245
|
+
* TODO: !!!! Explain that NotFoundError (!!! and other specific errors) has priority over DatabaseError in some contexts
|
|
3246
|
+
*/
|
|
3247
|
+
|
|
3309
3248
|
/**
|
|
3310
3249
|
* This error occurs when some expectation is not met in the execution of the pipeline
|
|
3311
3250
|
*
|
|
@@ -3386,6 +3325,7 @@
|
|
|
3386
3325
|
UnexpectedError,
|
|
3387
3326
|
WrappedError,
|
|
3388
3327
|
NotAllowed,
|
|
3328
|
+
DatabaseError,
|
|
3389
3329
|
// TODO: [🪑]> VersionMismatchError,
|
|
3390
3330
|
};
|
|
3391
3331
|
/**
|
|
@@ -4222,6 +4162,7 @@
|
|
|
4222
4162
|
return new MultipleLlmExecutionTools(title || 'Multiple LLM Providers joined by `joinLlmExecutionTools`', ...llmExecutionTools);
|
|
4223
4163
|
}
|
|
4224
4164
|
/**
|
|
4165
|
+
* TODO: [🙆] `getSingleLlmExecutionTools` vs `joinLlmExecutionTools` - explain difference or pick one
|
|
4225
4166
|
* TODO: [👷♂️] @@@ Manual about construction of llmTools
|
|
4226
4167
|
*/
|
|
4227
4168
|
|
|
@@ -4238,6 +4179,7 @@
|
|
|
4238
4179
|
return llmTools;
|
|
4239
4180
|
}
|
|
4240
4181
|
/**
|
|
4182
|
+
* TODO: [🙆] `getSingleLlmExecutionTools` vs `joinLlmExecutionTools` - explain difference or pick one
|
|
4241
4183
|
* TODO: [👷♂️] @@@ Manual about construction of llmTools
|
|
4242
4184
|
*/
|
|
4243
4185
|
|
|
@@ -5704,18 +5646,6 @@
|
|
|
5704
5646
|
return replacedTemplates;
|
|
5705
5647
|
}
|
|
5706
5648
|
|
|
5707
|
-
/**
|
|
5708
|
-
* Logs an LLM call with the given report.
|
|
5709
|
-
*
|
|
5710
|
-
* @private internal utility of `createPipelineExecutor`
|
|
5711
|
-
*/
|
|
5712
|
-
function logLlmCall(logLlmCall, report) {
|
|
5713
|
-
logLlmCall({
|
|
5714
|
-
modelName: 'model' /* <- TODO: How to get model name from the report */,
|
|
5715
|
-
report,
|
|
5716
|
-
});
|
|
5717
|
-
}
|
|
5718
|
-
|
|
5719
5649
|
/**
|
|
5720
5650
|
* Extracts all code blocks from markdown.
|
|
5721
5651
|
*
|
|
@@ -6061,7 +5991,7 @@
|
|
|
6061
5991
|
*/
|
|
6062
5992
|
async function executeAttempts(options) {
|
|
6063
5993
|
const { jokerParameterNames, priority, maxAttempts, // <- Note: [💂]
|
|
6064
|
-
preparedContent, parameters, task, preparedPipeline, tools, $executionReport, pipelineIdentification, maxExecutionAttempts, onProgress, logLlmCall
|
|
5994
|
+
preparedContent, parameters, task, preparedPipeline, tools, $executionReport, pipelineIdentification, maxExecutionAttempts, onProgress, logLlmCall, } = options;
|
|
6065
5995
|
const $ongoingTaskResult = {
|
|
6066
5996
|
$result: null,
|
|
6067
5997
|
$resultString: null,
|
|
@@ -6323,8 +6253,11 @@
|
|
|
6323
6253
|
: serializeError($ongoingTaskResult.$expectError),
|
|
6324
6254
|
};
|
|
6325
6255
|
$executionReport.promptExecutions.push(executionPromptReport);
|
|
6326
|
-
if (logLlmCall
|
|
6327
|
-
logLlmCall(
|
|
6256
|
+
if (logLlmCall) {
|
|
6257
|
+
logLlmCall({
|
|
6258
|
+
modelName: 'model' /* <- TODO: How to get model name from the report */,
|
|
6259
|
+
report: executionPromptReport,
|
|
6260
|
+
});
|
|
6328
6261
|
}
|
|
6329
6262
|
}
|
|
6330
6263
|
}
|
|
@@ -6598,7 +6531,7 @@
|
|
|
6598
6531
|
},
|
|
6599
6532
|
content: task.content,
|
|
6600
6533
|
parameters,
|
|
6601
|
-
};
|
|
6534
|
+
}; /* <- Note: [🤛] */
|
|
6602
6535
|
const taskEmbeddingResult = await llmTools.callEmbeddingModel(taskEmbeddingPrompt);
|
|
6603
6536
|
const knowledgePiecesWithRelevance = preparedPipeline.knowledgePieces.map((knowledgePiece) => {
|
|
6604
6537
|
const { index } = knowledgePiece;
|