@promptbook/node 0.104.0-0 → 0.104.0-10
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 +43 -42
- package/esm/index.es.js.map +1 -1
- package/esm/typings/servers.d.ts +8 -0
- package/esm/typings/src/_packages/core.index.d.ts +2 -0
- package/esm/typings/src/_packages/types.index.d.ts +10 -2
- package/esm/typings/src/book-2.0/agent-source/AgentBasicInformation.d.ts +6 -1
- package/esm/typings/src/book-2.0/agent-source/createAgentModelRequirements.d.ts +6 -6
- package/esm/typings/src/book-2.0/agent-source/createAgentModelRequirementsWithCommitments.closed.test.d.ts +1 -0
- package/esm/typings/src/book-2.0/utils/generatePlaceholderAgentProfileImageUrl.d.ts +3 -3
- package/esm/typings/src/book-components/Chat/Chat/ChatMessageItem.d.ts +5 -1
- package/esm/typings/src/book-components/Chat/Chat/ChatProps.d.ts +5 -0
- package/esm/typings/src/book-components/Chat/CodeBlock/CodeBlock.d.ts +13 -0
- package/esm/typings/src/book-components/Chat/MarkdownContent/MarkdownContent.d.ts +1 -0
- package/esm/typings/src/book-components/Chat/types/ChatMessage.d.ts +7 -11
- package/esm/typings/src/book-components/_common/Dropdown/Dropdown.d.ts +2 -2
- package/esm/typings/src/book-components/_common/MenuHoisting/MenuHoistingContext.d.ts +56 -0
- package/esm/typings/src/collection/agent-collection/constructors/agent-collection-in-supabase/AgentCollectionInSupabase.d.ts +21 -11
- package/esm/typings/src/collection/agent-collection/constructors/agent-collection-in-supabase/AgentsDatabaseSchema.d.ts +80 -14
- package/esm/typings/src/commitments/DICTIONARY/DICTIONARY.d.ts +46 -0
- package/esm/typings/src/commitments/index.d.ts +2 -1
- package/esm/typings/src/llm-providers/_multiple/MultipleLlmExecutionTools.d.ts +6 -2
- package/esm/typings/src/llm-providers/agent/AgentLlmExecutionTools.d.ts +1 -1
- package/esm/typings/src/llm-providers/ollama/OllamaExecutionTools.d.ts +1 -1
- package/esm/typings/src/llm-providers/openai/createOpenAiCompatibleExecutionTools.d.ts +1 -1
- package/esm/typings/src/llm-providers/remote/RemoteLlmExecutionTools.d.ts +1 -0
- package/esm/typings/src/types/Message.d.ts +49 -0
- package/esm/typings/src/types/ModelRequirements.d.ts +38 -14
- package/esm/typings/src/types/typeAliases.d.ts +23 -1
- package/esm/typings/src/utils/color/utils/colorToDataUrl.d.ts +2 -1
- package/esm/typings/src/utils/environment/$detectRuntimeEnvironment.d.ts +4 -4
- package/esm/typings/src/utils/environment/$isRunningInBrowser.d.ts +1 -1
- package/esm/typings/src/utils/environment/$isRunningInJest.d.ts +1 -1
- package/esm/typings/src/utils/environment/$isRunningInNode.d.ts +1 -1
- package/esm/typings/src/utils/environment/$isRunningInWebWorker.d.ts +1 -1
- package/esm/typings/src/utils/markdown/extractAllBlocksFromMarkdown.d.ts +2 -2
- package/esm/typings/src/utils/markdown/extractOneBlockFromMarkdown.d.ts +2 -2
- package/esm/typings/src/utils/random/$randomBase58.d.ts +12 -0
- package/esm/typings/src/version.d.ts +1 -1
- package/package.json +2 -2
- package/umd/index.umd.js +47 -46
- package/umd/index.umd.js.map +1 -1
- package/esm/typings/src/book-2.0/utils/generateGravatarUrl.d.ts +0 -10
package/esm/index.es.js
CHANGED
|
@@ -28,7 +28,7 @@ const BOOK_LANGUAGE_VERSION = '2.0.0';
|
|
|
28
28
|
* @generated
|
|
29
29
|
* @see https://github.com/webgptorg/promptbook
|
|
30
30
|
*/
|
|
31
|
-
const PROMPTBOOK_ENGINE_VERSION = '0.104.0-
|
|
31
|
+
const PROMPTBOOK_ENGINE_VERSION = '0.104.0-10';
|
|
32
32
|
/**
|
|
33
33
|
* TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
|
|
34
34
|
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
@@ -4039,6 +4039,12 @@ class MultipleLlmExecutionTools {
|
|
|
4039
4039
|
callEmbeddingModel(prompt) {
|
|
4040
4040
|
return this.callCommonModel(prompt);
|
|
4041
4041
|
}
|
|
4042
|
+
/**
|
|
4043
|
+
* Calls the best available embedding model
|
|
4044
|
+
*/
|
|
4045
|
+
callImageGenerationModel(prompt) {
|
|
4046
|
+
return this.callCommonModel(prompt);
|
|
4047
|
+
}
|
|
4042
4048
|
// <- Note: [🤖]
|
|
4043
4049
|
/**
|
|
4044
4050
|
* Calls the best available model
|
|
@@ -4065,6 +4071,11 @@ class MultipleLlmExecutionTools {
|
|
|
4065
4071
|
continue llm;
|
|
4066
4072
|
}
|
|
4067
4073
|
return await llmExecutionTools.callEmbeddingModel(prompt);
|
|
4074
|
+
case 'IMAGE_GENERATION':
|
|
4075
|
+
if (llmExecutionTools.callImageGenerationModel === undefined) {
|
|
4076
|
+
continue llm;
|
|
4077
|
+
}
|
|
4078
|
+
return await llmExecutionTools.callImageGenerationModel(prompt);
|
|
4068
4079
|
// <- case [🤖]:
|
|
4069
4080
|
default:
|
|
4070
4081
|
throw new UnexpectedError(`Unknown model variant "${prompt.modelRequirements.modelVariant}" in ${llmExecutionTools.title}`);
|
|
@@ -4968,8 +4979,9 @@ async function executeAttempts(options) {
|
|
|
4968
4979
|
$ongoingTaskResult.$resultString = $ongoingTaskResult.$completionResult.content;
|
|
4969
4980
|
break variant;
|
|
4970
4981
|
case 'EMBEDDING':
|
|
4982
|
+
case 'IMAGE_GENERATION':
|
|
4971
4983
|
throw new PipelineExecutionError(spaceTrim$1((block) => `
|
|
4972
|
-
|
|
4984
|
+
${modelRequirements.modelVariant} model can not be used in pipeline
|
|
4973
4985
|
|
|
4974
4986
|
This should be catched during parsing
|
|
4975
4987
|
|
|
@@ -6194,6 +6206,15 @@ function countUsage(llmTools) {
|
|
|
6194
6206
|
return promptResult;
|
|
6195
6207
|
};
|
|
6196
6208
|
}
|
|
6209
|
+
if (llmTools.callImageGenerationModel !== undefined) {
|
|
6210
|
+
proxyTools.callImageGenerationModel = async (prompt) => {
|
|
6211
|
+
// console.info('[🚕] callImageGenerationModel through countTotalUsage');
|
|
6212
|
+
const promptResult = await llmTools.callImageGenerationModel(prompt);
|
|
6213
|
+
totalUsage = addUsage(totalUsage, promptResult.usage);
|
|
6214
|
+
spending.next(promptResult.usage);
|
|
6215
|
+
return promptResult;
|
|
6216
|
+
};
|
|
6217
|
+
}
|
|
6197
6218
|
// <- Note: [🤖]
|
|
6198
6219
|
return proxyTools;
|
|
6199
6220
|
}
|
|
@@ -8925,11 +8946,7 @@ const modelCommandParser = {
|
|
|
8925
8946
|
// TODO: [🚜] DRY
|
|
8926
8947
|
if ($taskJson.modelRequirements[command.key] !== undefined) {
|
|
8927
8948
|
if ($taskJson.modelRequirements[command.key] === command.value) {
|
|
8928
|
-
console.warn(`Multiple commands \`MODEL ${{
|
|
8929
|
-
modelName: 'NAME',
|
|
8930
|
-
modelVariant: 'VARIANT',
|
|
8931
|
-
maxTokens: '???',
|
|
8932
|
-
}[command.key]} ${command.value}\` in the task "${$taskJson.title || $taskJson.name}"`);
|
|
8949
|
+
console.warn(`Multiple commands \`MODEL ${command.key} ${command.value}\` in the task "${$taskJson.title || $taskJson.name}"`);
|
|
8933
8950
|
// <- TODO: [🏮] Some standard way how to transform errors into warnings and how to handle non-critical fails during the tasks
|
|
8934
8951
|
}
|
|
8935
8952
|
else {
|
|
@@ -10811,13 +10828,14 @@ async function compilePipeline(pipelineString, tools, options) {
|
|
|
10811
10828
|
*
|
|
10812
10829
|
* @public exported from `@promptbook/utils`
|
|
10813
10830
|
*/
|
|
10814
|
-
|
|
10831
|
+
function $isRunningInNode() {
|
|
10815
10832
|
try {
|
|
10816
|
-
return
|
|
10817
|
-
}
|
|
10833
|
+
return typeof process !== 'undefined' && process.versions != null && process.versions.node != null;
|
|
10834
|
+
}
|
|
10835
|
+
catch (e) {
|
|
10818
10836
|
return false;
|
|
10819
10837
|
}
|
|
10820
|
-
|
|
10838
|
+
}
|
|
10821
10839
|
/**
|
|
10822
10840
|
* TODO: [🎺]
|
|
10823
10841
|
*/
|
|
@@ -11378,7 +11396,7 @@ function $registeredLlmToolsMessage() {
|
|
|
11378
11396
|
${i + 1}) **${title}** \`${className}\` from \`${packageName}\`
|
|
11379
11397
|
${morePieces.join('; ')}
|
|
11380
11398
|
`);
|
|
11381
|
-
if ($isRunningInNode) {
|
|
11399
|
+
if ($isRunningInNode()) {
|
|
11382
11400
|
if (isInstalled && isFullyConfigured) {
|
|
11383
11401
|
providerMessage = colors.green(providerMessage);
|
|
11384
11402
|
}
|
|
@@ -11482,13 +11500,14 @@ async function $provideLlmToolsConfigurationFromEnv() {
|
|
|
11482
11500
|
*
|
|
11483
11501
|
* @public exported from `@promptbook/utils`
|
|
11484
11502
|
*/
|
|
11485
|
-
|
|
11503
|
+
function $isRunningInBrowser() {
|
|
11486
11504
|
try {
|
|
11487
|
-
return
|
|
11488
|
-
}
|
|
11505
|
+
return typeof window !== 'undefined' && typeof window.document !== 'undefined';
|
|
11506
|
+
}
|
|
11507
|
+
catch (e) {
|
|
11489
11508
|
return false;
|
|
11490
11509
|
}
|
|
11491
|
-
|
|
11510
|
+
}
|
|
11492
11511
|
/**
|
|
11493
11512
|
* TODO: [🎺]
|
|
11494
11513
|
*/
|
|
@@ -11500,17 +11519,17 @@ const $isRunningInBrowser = new Function(`
|
|
|
11500
11519
|
*
|
|
11501
11520
|
* @public exported from `@promptbook/utils`
|
|
11502
11521
|
*/
|
|
11503
|
-
|
|
11522
|
+
function $isRunningInWebWorker() {
|
|
11504
11523
|
try {
|
|
11505
|
-
|
|
11506
|
-
|
|
11507
|
-
|
|
11508
|
-
|
|
11509
|
-
|
|
11510
|
-
|
|
11524
|
+
// Note: Check for importScripts which is specific to workers
|
|
11525
|
+
// and not available in the main browser thread
|
|
11526
|
+
return (typeof self !== 'undefined' &&
|
|
11527
|
+
typeof self.importScripts === 'function');
|
|
11528
|
+
}
|
|
11529
|
+
catch (e) {
|
|
11511
11530
|
return false;
|
|
11512
11531
|
}
|
|
11513
|
-
|
|
11532
|
+
}
|
|
11514
11533
|
/**
|
|
11515
11534
|
* TODO: [🎺]
|
|
11516
11535
|
*/
|
|
@@ -11665,24 +11684,6 @@ async function $provideScrapersForNode(tools, options) {
|
|
|
11665
11684
|
* Note: [🟢] Code in this file should never be never released in packages that could be imported into browser environment
|
|
11666
11685
|
*/
|
|
11667
11686
|
|
|
11668
|
-
/**
|
|
11669
|
-
* Detects if the code is running in jest environment
|
|
11670
|
-
*
|
|
11671
|
-
* Note: `$` is used to indicate that this function is not a pure function - it looks at the global object to determine the environment
|
|
11672
|
-
*
|
|
11673
|
-
* @public exported from `@promptbook/utils`
|
|
11674
|
-
*/
|
|
11675
|
-
new Function(`
|
|
11676
|
-
try {
|
|
11677
|
-
return process.env.JEST_WORKER_ID !== undefined;
|
|
11678
|
-
} catch (e) {
|
|
11679
|
-
return false;
|
|
11680
|
-
}
|
|
11681
|
-
`);
|
|
11682
|
-
/**
|
|
11683
|
-
* TODO: [🎺]
|
|
11684
|
-
*/
|
|
11685
|
-
|
|
11686
11687
|
/**
|
|
11687
11688
|
* Makes first letter of a string lowercase
|
|
11688
11689
|
*
|