@promptbook/markdown-utils 0.104.0-9 → 0.105.0-0
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 +36 -27
- package/esm/index.es.js.map +1 -1
- package/esm/typings/src/_packages/components.index.d.ts +0 -6
- package/esm/typings/src/_packages/core.index.d.ts +10 -6
- package/esm/typings/src/_packages/types.index.d.ts +8 -0
- package/esm/typings/src/_packages/utils.index.d.ts +2 -0
- package/esm/typings/src/book-2.0/agent-source/AgentBasicInformation.d.ts +24 -0
- package/esm/typings/src/book-2.0/agent-source/AgentModelRequirements.d.ts +16 -2
- package/esm/typings/src/book-2.0/agent-source/createAgentModelRequirements.tools.test.d.ts +1 -0
- package/esm/typings/src/book-2.0/utils/generatePlaceholderAgentProfileImageUrl.d.ts +1 -1
- package/esm/typings/src/book-components/Chat/save/_common/string_chat_format_name.d.ts +1 -1
- package/esm/typings/src/book-components/Chat/types/ChatMessage.d.ts +23 -3
- package/esm/typings/src/book-components/_common/Dropdown/Dropdown.d.ts +5 -1
- package/esm/typings/src/book-components/_common/HamburgerMenu/HamburgerMenu.d.ts +5 -1
- package/esm/typings/src/book-components/icons/AboutIcon.d.ts +5 -1
- package/esm/typings/src/book-components/icons/AttachmentIcon.d.ts +6 -2
- package/esm/typings/src/book-components/icons/CameraIcon.d.ts +6 -2
- package/esm/typings/src/book-components/icons/DownloadIcon.d.ts +5 -1
- package/esm/typings/src/book-components/icons/MenuIcon.d.ts +5 -1
- package/esm/typings/src/book-components/icons/SaveIcon.d.ts +6 -2
- package/esm/typings/src/collection/agent-collection/AgentCollection.d.ts +1 -1
- package/esm/typings/src/collection/agent-collection/constructors/agent-collection-in-supabase/AgentCollectionInSupabase.d.ts +9 -7
- package/esm/typings/src/commands/_common/types/Command.d.ts +1 -1
- package/esm/typings/src/commitments/IMPORT/IMPORT.d.ts +34 -0
- package/esm/typings/src/commitments/META/META_DESCRIPTION.d.ts +41 -0
- package/esm/typings/src/commitments/USE_SEARCH_ENGINE/USE_SEARCH_ENGINE.d.ts +2 -2
- package/esm/typings/src/commitments/_base/BookCommitment.d.ts +1 -1
- package/esm/typings/src/commitments/index.d.ts +2 -1
- package/esm/typings/src/config.d.ts +14 -1
- package/esm/typings/src/errors/utils/deserializeError.d.ts +1 -1
- package/esm/typings/src/execution/PromptResult.d.ts +24 -1
- package/esm/typings/src/formfactors/_common/FormfactorDefinition.d.ts +1 -1
- package/esm/typings/src/llm-providers/_common/register/$provideLlmToolsForTestingAndScriptsAndPlayground.d.ts +1 -1
- package/esm/typings/src/llm-providers/_common/register/$provideLlmToolsForWizardOrCli.d.ts +1 -1
- package/esm/typings/src/llm-providers/_common/utils/count-total-usage/LlmExecutionToolsWithTotalUsage.d.ts +1 -1
- package/esm/typings/src/llm-providers/_common/utils/count-total-usage/countUsage.d.ts +8 -4
- package/esm/typings/src/llm-providers/_common/utils/count-total-usage/limitTotalUsage.d.ts +1 -1
- package/esm/typings/src/llm-providers/_multiple/getSingleLlmExecutionTools.d.ts +1 -1
- package/esm/typings/src/llm-providers/_multiple/joinLlmExecutionTools.d.ts +12 -8
- package/esm/typings/src/llm-providers/agent/Agent.d.ts +7 -1
- package/esm/typings/src/llm-providers/agent/AgentLlmExecutionTools.d.ts +1 -1
- package/esm/typings/src/llm-providers/openai/OpenAiCompatibleExecutionToolsOptions.d.ts +5 -0
- package/esm/typings/src/llm-providers/openai/utils/mapToolsToOpenAi.d.ts +8 -0
- package/esm/typings/src/remote-server/ui/ServerApp.d.ts +5 -1
- package/esm/typings/src/scrapers/_common/utils/promptbookFetch.test.d.ts +1 -0
- package/esm/typings/src/search-engines/SearchEngine.d.ts +9 -0
- package/esm/typings/src/search-engines/SearchResult.d.ts +18 -0
- package/esm/typings/src/search-engines/bing/BingSearchEngine.d.ts +15 -0
- package/esm/typings/src/search-engines/dummy/DummySearchEngine.d.ts +15 -0
- package/esm/typings/src/types/LlmToolDefinition.d.ts +27 -0
- package/esm/typings/src/types/ModelRequirements.d.ts +13 -0
- package/esm/typings/src/types/Prompt.d.ts +13 -0
- package/esm/typings/src/types/typeAliasEmoji.d.ts +2 -2
- package/esm/typings/src/utils/misc/parseNumber.d.ts +1 -1
- package/esm/typings/src/utils/random/$randomAgentPersona.d.ts +7 -2
- package/esm/typings/src/utils/random/$randomItem.d.ts +1 -1
- package/esm/typings/src/utils/random/$randomSeed.d.ts +1 -1
- package/esm/typings/src/utils/validators/url/isValidAgentUrl.d.ts +16 -0
- package/esm/typings/src/utils/validators/url/isValidAgentUrl.test.d.ts +1 -0
- package/esm/typings/src/utils/validators/url/isValidPipelineUrl.d.ts +2 -1
- package/esm/typings/src/utils/validators/url/isValidUrl.d.ts +4 -3
- package/esm/typings/src/version.d.ts +1 -1
- package/package.json +1 -1
- package/umd/index.umd.js +36 -27
- package/umd/index.umd.js.map +1 -1
- package/esm/typings/servers.d.ts +0 -50
|
@@ -1,9 +1,14 @@
|
|
|
1
|
+
import type { string_persona_description } from '../../types/typeAliases';
|
|
1
2
|
/**
|
|
2
|
-
*
|
|
3
|
+
* Generates a random agent persona description.
|
|
3
4
|
*
|
|
5
|
+
* This function selects a random personality profile from a predefined pool
|
|
6
|
+
* of common AI agent characteristics (e.g., friendly, professional, creative).
|
|
7
|
+
*
|
|
8
|
+
* @returns A string describing the agent's persona
|
|
4
9
|
* @private internal helper function
|
|
5
10
|
*/
|
|
6
|
-
export declare function $randomAgentPersona():
|
|
11
|
+
export declare function $randomAgentPersona(): string_persona_description;
|
|
7
12
|
/**
|
|
8
13
|
* TODO: [🤶] Maybe export through `@promptbook/utils` or `@promptbook/random` package
|
|
9
14
|
*/
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { string_agent_url } from '../../../types/typeAliases';
|
|
2
|
+
import type { really_unknown } from '../../organization/really_unknown';
|
|
3
|
+
/**
|
|
4
|
+
* Tests if given string is valid agent URL
|
|
5
|
+
*
|
|
6
|
+
* Note: There are few similar functions:
|
|
7
|
+
* - `isValidUrl` which tests any URL
|
|
8
|
+
* - `isValidAgentUrl` *(this one)* which tests just agent URL
|
|
9
|
+
* - `isValidPipelineUrl` which tests just pipeline URL
|
|
10
|
+
*
|
|
11
|
+
* @public exported from `@promptbook/utils`
|
|
12
|
+
*/
|
|
13
|
+
export declare function isValidAgentUrl(url: really_unknown): url is string_agent_url;
|
|
14
|
+
/**
|
|
15
|
+
* TODO: [🐠] Maybe more info why the URL is invalid
|
|
16
|
+
*/
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -3,8 +3,9 @@ import type { really_unknown } from '../../organization/really_unknown';
|
|
|
3
3
|
/**
|
|
4
4
|
* Tests if given string is valid pipeline URL URL.
|
|
5
5
|
*
|
|
6
|
-
* Note: There are
|
|
6
|
+
* Note: There are few similar functions:
|
|
7
7
|
* - `isValidUrl` which tests any URL
|
|
8
|
+
* - `isValidAgentUrl` which tests just agent URL
|
|
8
9
|
* - `isValidPipelineUrl` *(this one)* which tests just pipeline URL
|
|
9
10
|
*
|
|
10
11
|
* @public exported from `@promptbook/utils`
|
|
@@ -5,9 +5,10 @@ import type { really_unknown } from '../../organization/really_unknown';
|
|
|
5
5
|
*
|
|
6
6
|
* Note: [🔂] This function is idempotent.
|
|
7
7
|
* Note: Dataurl are considered perfectly valid.
|
|
8
|
-
* Note: There are
|
|
9
|
-
* - `isValidUrl` which tests any URL
|
|
10
|
-
* - `
|
|
8
|
+
* Note: There are few similar functions:
|
|
9
|
+
* - `isValidUrl` *(this one)* which tests any URL
|
|
10
|
+
* - `isValidAgentUrl` which tests just agent URL
|
|
11
|
+
* - `isValidPipelineUrl` which tests just pipeline URL
|
|
11
12
|
*
|
|
12
13
|
* @public exported from `@promptbook/utils`
|
|
13
14
|
*/
|
|
@@ -15,7 +15,7 @@ export declare const BOOK_LANGUAGE_VERSION: string_semantic_version;
|
|
|
15
15
|
export declare const PROMPTBOOK_ENGINE_VERSION: string_promptbook_version;
|
|
16
16
|
/**
|
|
17
17
|
* Represents the version string of the Promptbook engine.
|
|
18
|
-
* It follows semantic versioning (e.g., `0.104.0
|
|
18
|
+
* It follows semantic versioning (e.g., `0.104.0`).
|
|
19
19
|
*
|
|
20
20
|
* @generated
|
|
21
21
|
*/
|
package/package.json
CHANGED
package/umd/index.umd.js
CHANGED
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
* @generated
|
|
25
25
|
* @see https://github.com/webgptorg/promptbook
|
|
26
26
|
*/
|
|
27
|
-
const PROMPTBOOK_ENGINE_VERSION = '0.
|
|
27
|
+
const PROMPTBOOK_ENGINE_VERSION = '0.105.0-0';
|
|
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
|
|
@@ -1562,9 +1562,10 @@
|
|
|
1562
1562
|
*
|
|
1563
1563
|
* Note: [🔂] This function is idempotent.
|
|
1564
1564
|
* Note: Dataurl are considered perfectly valid.
|
|
1565
|
-
* Note: There are
|
|
1566
|
-
* - `isValidUrl` which tests any URL
|
|
1567
|
-
* - `
|
|
1565
|
+
* Note: There are few similar functions:
|
|
1566
|
+
* - `isValidUrl` *(this one)* which tests any URL
|
|
1567
|
+
* - `isValidAgentUrl` which tests just agent URL
|
|
1568
|
+
* - `isValidPipelineUrl` which tests just pipeline URL
|
|
1568
1569
|
*
|
|
1569
1570
|
* @public exported from `@promptbook/utils`
|
|
1570
1571
|
*/
|
|
@@ -2132,8 +2133,9 @@
|
|
|
2132
2133
|
/**
|
|
2133
2134
|
* Tests if given string is valid pipeline URL URL.
|
|
2134
2135
|
*
|
|
2135
|
-
* Note: There are
|
|
2136
|
+
* Note: There are few similar functions:
|
|
2136
2137
|
* - `isValidUrl` which tests any URL
|
|
2138
|
+
* - `isValidAgentUrl` which tests just agent URL
|
|
2137
2139
|
* - `isValidPipelineUrl` *(this one)* which tests just pipeline URL
|
|
2138
2140
|
*
|
|
2139
2141
|
* @public exported from `@promptbook/utils`
|
|
@@ -3084,7 +3086,7 @@
|
|
|
3084
3086
|
*
|
|
3085
3087
|
* @public exported from `@promptbook/utils`
|
|
3086
3088
|
*/
|
|
3087
|
-
function deserializeError(error) {
|
|
3089
|
+
function deserializeError(error, isStackAddedToMessage = true) {
|
|
3088
3090
|
const { name, stack, id } = error; // Added id
|
|
3089
3091
|
let { message } = error;
|
|
3090
3092
|
let ErrorClass = ALL_ERRORS[error.name];
|
|
@@ -3092,7 +3094,7 @@
|
|
|
3092
3094
|
ErrorClass = Error;
|
|
3093
3095
|
message = `${name}: ${message}`;
|
|
3094
3096
|
}
|
|
3095
|
-
if (stack !== undefined && stack !== '') {
|
|
3097
|
+
if (isStackAddedToMessage && stack !== undefined && stack !== '') {
|
|
3096
3098
|
message = spaceTrim__default["default"]((block) => `
|
|
3097
3099
|
${block(message)}
|
|
3098
3100
|
|
|
@@ -3428,7 +3430,7 @@
|
|
|
3428
3430
|
tasks.push(task);
|
|
3429
3431
|
runningTasks.push(task);
|
|
3430
3432
|
/* not await */ Promise.resolve(task).then(() => {
|
|
3431
|
-
runningTasks = runningTasks.filter((
|
|
3433
|
+
runningTasks = runningTasks.filter((runningTask) => runningTask !== task);
|
|
3432
3434
|
});
|
|
3433
3435
|
if (maxParallelCount < runningTasks.length) {
|
|
3434
3436
|
await Promise.race(runningTasks);
|
|
@@ -3485,10 +3487,14 @@
|
|
|
3485
3487
|
}
|
|
3486
3488
|
|
|
3487
3489
|
/**
|
|
3488
|
-
* Intercepts LLM tools and counts total usage of the tools
|
|
3490
|
+
* Intercepts LLM tools and counts total usage of the tools.
|
|
3491
|
+
*
|
|
3492
|
+
* This function wraps the provided `LlmExecutionTools` with a proxy that tracks the cumulative
|
|
3493
|
+
* usage (tokens, cost, etc.) across all model calls. It provides a way to monitor spending
|
|
3494
|
+
* in real-time through an observable.
|
|
3489
3495
|
*
|
|
3490
|
-
* @param llmTools LLM tools to be intercepted
|
|
3491
|
-
* @returns
|
|
3496
|
+
* @param llmTools - The LLM tools to be intercepted and tracked
|
|
3497
|
+
* @returns An augmented version of the tools that includes usage tracking capabilities
|
|
3492
3498
|
* @public exported from `@promptbook/core`
|
|
3493
3499
|
*/
|
|
3494
3500
|
function countUsage(llmTools) {
|
|
@@ -3563,7 +3569,7 @@
|
|
|
3563
3569
|
* TODO: [🧠] Is there some meaningfull way how to test this util
|
|
3564
3570
|
* TODO: [🧠][🌯] Maybe a way how to hide ability to `get totalUsage`
|
|
3565
3571
|
* > const [llmToolsWithUsage,getUsage] = countTotalUsage(llmTools);
|
|
3566
|
-
* TODO: [👷♂️]
|
|
3572
|
+
* TODO: [👷♂️] Write a comprehensive manual explaining the construction and usage of LLM tools in the Promptbook ecosystem
|
|
3567
3573
|
*/
|
|
3568
3574
|
|
|
3569
3575
|
/**
|
|
@@ -3753,17 +3759,21 @@
|
|
|
3753
3759
|
*/
|
|
3754
3760
|
|
|
3755
3761
|
/**
|
|
3756
|
-
* Joins multiple LLM Execution Tools into one
|
|
3762
|
+
* Joins multiple LLM Execution Tools into one.
|
|
3757
3763
|
*
|
|
3758
|
-
*
|
|
3764
|
+
* This function takes a list of `LlmExecutionTools` and returns a single unified
|
|
3765
|
+
* `MultipleLlmExecutionTools` object. It provides failover and aggregation logic:
|
|
3759
3766
|
*
|
|
3760
|
-
*
|
|
3761
|
-
*
|
|
3762
|
-
* 2
|
|
3763
|
-
* 3
|
|
3767
|
+
* 1. **Failover**: When a model call is made, it tries providers in the order they were provided.
|
|
3768
|
+
* If the first provider doesn't support the requested model or fails, it tries the next one.
|
|
3769
|
+
* 2. **Aggregation**: `listModels` returns a combined list of all models available from all providers.
|
|
3770
|
+
* 3. **Empty case**: If no tools are provided, it logs a warning (as Promptbook requires LLMs to function).
|
|
3764
3771
|
*
|
|
3772
|
+
* @param title - A descriptive title for this collection of joined tools
|
|
3773
|
+
* @param llmExecutionTools - An array of execution tools to be joined
|
|
3774
|
+
* @returns A single unified execution tool wrapper
|
|
3765
3775
|
*
|
|
3766
|
-
* Tip: You don't have to use this function directly, just pass an array of LlmExecutionTools to the `ExecutionTools
|
|
3776
|
+
* Tip: You don't have to use this function directly, just pass an array of LlmExecutionTools to the `ExecutionTools`.
|
|
3767
3777
|
*
|
|
3768
3778
|
* @public exported from `@promptbook/core`
|
|
3769
3779
|
*/
|
|
@@ -3803,7 +3813,7 @@
|
|
|
3803
3813
|
}
|
|
3804
3814
|
/**
|
|
3805
3815
|
* TODO: [🙆] `getSingleLlmExecutionTools` vs `joinLlmExecutionTools` - explain difference or pick one
|
|
3806
|
-
* TODO: [👷♂️]
|
|
3816
|
+
* TODO: [👷♂️] Write a comprehensive manual about how to construct and use LLM execution tools in Promptbook
|
|
3807
3817
|
*/
|
|
3808
3818
|
|
|
3809
3819
|
/**
|
|
@@ -3820,7 +3830,7 @@
|
|
|
3820
3830
|
}
|
|
3821
3831
|
/**
|
|
3822
3832
|
* TODO: [🙆] `getSingleLlmExecutionTools` vs `joinLlmExecutionTools` - explain difference or pick one
|
|
3823
|
-
* TODO: [👷♂️]
|
|
3833
|
+
* TODO: [👷♂️] Write a comprehensive manual about how to construct and use LLM execution tools in Promptbook
|
|
3824
3834
|
*/
|
|
3825
3835
|
|
|
3826
3836
|
/**
|
|
@@ -4390,8 +4400,8 @@
|
|
|
4390
4400
|
*/
|
|
4391
4401
|
function removeDiacritics(input) {
|
|
4392
4402
|
/*eslint no-control-regex: "off"*/
|
|
4393
|
-
return input.replace(/[^\u0000-\u007E]/g, (
|
|
4394
|
-
return DIACRITIC_VARIANTS_LETTERS[
|
|
4403
|
+
return input.replace(/[^\u0000-\u007E]/g, (character) => {
|
|
4404
|
+
return DIACRITIC_VARIANTS_LETTERS[character] || character;
|
|
4395
4405
|
});
|
|
4396
4406
|
}
|
|
4397
4407
|
/**
|
|
@@ -4620,7 +4630,6 @@
|
|
|
4620
4630
|
* @public exported from `@promptbook/core`
|
|
4621
4631
|
*/
|
|
4622
4632
|
async function makeKnowledgeSourceHandler(knowledgeSource, tools, options) {
|
|
4623
|
-
// console.log('!! makeKnowledgeSourceHandler', knowledgeSource);
|
|
4624
4633
|
var _a;
|
|
4625
4634
|
const { fetch = promptbookFetch } = tools;
|
|
4626
4635
|
const { knowledgeSourceContent } = knowledgeSource;
|
|
@@ -6590,7 +6599,7 @@
|
|
|
6590
6599
|
const taskEmbeddingResult = await llmTools.callEmbeddingModel(taskEmbeddingPrompt);
|
|
6591
6600
|
const knowledgePiecesWithRelevance = preparedPipeline.knowledgePieces.map((knowledgePiece) => {
|
|
6592
6601
|
const { index } = knowledgePiece;
|
|
6593
|
-
const knowledgePieceIndex = index.find((
|
|
6602
|
+
const knowledgePieceIndex = index.find((knowledgePieceIndex) => knowledgePieceIndex.modelName === firstKnowledgeIndex.modelName);
|
|
6594
6603
|
// <- TODO: Do not use just first knowledge piece and first index to determine embedding model
|
|
6595
6604
|
if (knowledgePieceIndex === undefined) {
|
|
6596
6605
|
return {
|
|
@@ -7038,7 +7047,7 @@
|
|
|
7038
7047
|
resovedParameterNames = [...resovedParameterNames, currentTask.resultingParameterName];
|
|
7039
7048
|
})
|
|
7040
7049
|
.then(() => {
|
|
7041
|
-
resolving = resolving.filter((
|
|
7050
|
+
resolving = resolving.filter((workItem) => workItem !== work);
|
|
7042
7051
|
});
|
|
7043
7052
|
// <- Note: Errors are catched here [3]
|
|
7044
7053
|
// TODO: BUT if in multiple tasks are errors, only the first one is catched so maybe we should catch errors here and save them to errors array here
|
|
@@ -7204,7 +7213,7 @@
|
|
|
7204
7213
|
// Calculate and update tldr based on pipeline progress
|
|
7205
7214
|
const cv = newOngoingResult;
|
|
7206
7215
|
// Calculate progress based on parameters resolved vs total parameters
|
|
7207
|
-
const totalParameters = pipeline.parameters.filter((
|
|
7216
|
+
const totalParameters = pipeline.parameters.filter((parameter) => !parameter.isInput).length;
|
|
7208
7217
|
let resolvedParameters = 0;
|
|
7209
7218
|
let currentTaskTitle = '';
|
|
7210
7219
|
// Get the resolved parameters from output parameters
|