@promptbook/markdown-utils 0.101.0-20 β 0.101.0-21
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 +47 -79
- package/esm/index.es.js.map +1 -1
- package/esm/typings/src/book-2.0/commitments/ACTION/ACTION.d.ts +0 -12
- package/esm/typings/src/book-2.0/commitments/DELETE/DELETE.d.ts +0 -24
- package/esm/typings/src/book-2.0/commitments/FORMAT/FORMAT.d.ts +0 -12
- package/esm/typings/src/book-2.0/commitments/GOAL/GOAL.d.ts +0 -12
- package/esm/typings/src/book-2.0/commitments/KNOWLEDGE/KNOWLEDGE.d.ts +0 -6
- package/esm/typings/src/book-2.0/commitments/MEMORY/MEMORY.d.ts +0 -12
- package/esm/typings/src/book-2.0/commitments/MESSAGE/MESSAGE.d.ts +0 -12
- package/esm/typings/src/book-2.0/commitments/META/META.d.ts +0 -6
- package/esm/typings/src/book-2.0/commitments/META_IMAGE/META_IMAGE.d.ts +0 -6
- package/esm/typings/src/book-2.0/commitments/META_LINK/META_LINK.d.ts +0 -6
- package/esm/typings/src/book-2.0/commitments/MODEL/MODEL.d.ts +0 -12
- package/esm/typings/src/book-2.0/commitments/NOTE/NOTE.d.ts +0 -24
- package/esm/typings/src/book-2.0/commitments/PERSONA/PERSONA.d.ts +0 -12
- package/esm/typings/src/book-2.0/commitments/RULE/RULE.d.ts +0 -12
- package/esm/typings/src/book-2.0/commitments/SAMPLE/SAMPLE.d.ts +0 -12
- package/esm/typings/src/book-2.0/commitments/SCENARIO/SCENARIO.d.ts +0 -12
- package/esm/typings/src/book-2.0/commitments/STYLE/STYLE.d.ts +0 -12
- package/esm/typings/src/book-2.0/commitments/_base/createEmptyAgentModelRequirements.d.ts +1 -1
- package/esm/typings/src/book-components/AvatarProfile/AvatarChip/AvatarChip.d.ts +3 -0
- package/esm/typings/src/book-components/AvatarProfile/AvatarProfile/AvatarProfile.d.ts +3 -0
- package/esm/typings/src/book-components/BookEditor/BookEditor.d.ts +3 -0
- package/esm/typings/src/book-components/BookEditor/BookEditorInner.d.ts +2 -16
- package/esm/typings/src/book-components/Chat/Chat/ChatProps.d.ts +3 -0
- package/esm/typings/src/execution/PromptResult.d.ts +2 -4
- package/esm/typings/src/llm-providers/_multiple/MultipleLlmExecutionTools.d.ts +2 -5
- package/esm/typings/src/llm-providers/agent/AgentLlmExecutionTools.d.ts +6 -2
- package/esm/typings/src/llm-providers/anthropic-claude/AnthropicClaudeExecutionTools.d.ts +3 -8
- package/esm/typings/src/llm-providers/azure-openai/AzureOpenAiExecutionTools.d.ts +4 -5
- package/esm/typings/src/llm-providers/mocked/MockedEchoLlmExecutionTools.d.ts +2 -5
- package/esm/typings/src/llm-providers/mocked/MockedFackedLlmExecutionTools.d.ts +2 -0
- package/esm/typings/src/llm-providers/mocked/test/joker.test.d.ts +4 -0
- package/esm/typings/src/llm-providers/mocked/test/mocked-chat.test.d.ts +5 -0
- package/esm/typings/src/llm-providers/mocked/test/mocked-completion.test.d.ts +4 -0
- package/esm/typings/src/llm-providers/ollama/OllamaExecutionTools.d.ts +3 -3
- package/esm/typings/src/llm-providers/openai/OpenAiCompatibleExecutionTools.d.ts +1 -0
- package/esm/typings/src/llm-providers/openai/OpenAiExecutionTools.d.ts +3 -8
- package/esm/typings/src/llm-providers/remote/RemoteLlmExecutionTools.d.ts +5 -14
- package/esm/typings/src/scripting/_test/postprocessing.test.d.ts +1 -0
- package/esm/typings/src/utils/markdown/humanizeAiText.d.ts +0 -1
- package/esm/typings/src/utils/markdown/promptbookifyAiText.d.ts +2 -2
- package/esm/typings/src/version.d.ts +1 -1
- package/package.json +1 -1
- package/umd/index.umd.js +47 -79
- package/umd/index.umd.js.map +1 -1
- package/esm/typings/src/book-components/Chat/examples/ChatMarkdownDemo.d.ts +0 -16
- package/esm/typings/src/expectations/drafts/isDomainNameFree.d.ts +0 -10
- package/esm/typings/src/expectations/drafts/isGithubNameFree.d.ts +0 -10
- package/esm/typings/src/llm-providers/_common/profiles/llmProviderProfiles.d.ts +0 -81
- /package/esm/typings/src/{llm-providers/_common/profiles/test/llmProviderProfiles.test.d.ts β cli/test/ptbk.test.d.ts} +0 -0
package/esm/index.es.js
CHANGED
|
@@ -23,7 +23,7 @@ const BOOK_LANGUAGE_VERSION = '1.0.0';
|
|
|
23
23
|
* @generated
|
|
24
24
|
* @see https://github.com/webgptorg/promptbook
|
|
25
25
|
*/
|
|
26
|
-
const PROMPTBOOK_ENGINE_VERSION = '0.101.0-
|
|
26
|
+
const PROMPTBOOK_ENGINE_VERSION = '0.101.0-21';
|
|
27
27
|
/**
|
|
28
28
|
* TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
|
|
29
29
|
* Note: [π] Ignore a discrepancy between file name and entity name
|
|
@@ -2645,75 +2645,13 @@ function arrayableToArray(input) {
|
|
|
2645
2645
|
}
|
|
2646
2646
|
|
|
2647
2647
|
/**
|
|
2648
|
-
*
|
|
2649
|
-
* These profiles represent each provider as a virtual persona in chat interfaces
|
|
2650
|
-
*
|
|
2651
|
-
* @private !!!!
|
|
2648
|
+
* Profile for Multiple providers aggregation
|
|
2652
2649
|
*/
|
|
2653
|
-
const
|
|
2654
|
-
|
|
2655
|
-
|
|
2656
|
-
|
|
2657
|
-
color: '#10a37f', // OpenAI's signature green
|
|
2658
|
-
// Note: avatarSrc could be added when we have provider logos available
|
|
2659
|
-
},
|
|
2660
|
-
ANTHROPIC: {
|
|
2661
|
-
name: 'ANTHROPIC',
|
|
2662
|
-
fullname: 'Anthropic Claude',
|
|
2663
|
-
color: '#d97706', // Anthropic's orange/amber color
|
|
2664
|
-
},
|
|
2665
|
-
AZURE_OPENAI: {
|
|
2666
|
-
name: 'AZURE_OPENAI',
|
|
2667
|
-
fullname: 'Azure OpenAI',
|
|
2668
|
-
color: '#0078d4', // Microsoft Azure blue
|
|
2669
|
-
},
|
|
2670
|
-
GOOGLE: {
|
|
2671
|
-
name: 'GOOGLE',
|
|
2672
|
-
fullname: 'Google Gemini',
|
|
2673
|
-
color: '#4285f4', // Google blue
|
|
2674
|
-
},
|
|
2675
|
-
DEEPSEEK: {
|
|
2676
|
-
name: 'DEEPSEEK',
|
|
2677
|
-
fullname: 'DeepSeek',
|
|
2678
|
-
color: '#7c3aed', // Purple color for DeepSeek
|
|
2679
|
-
},
|
|
2680
|
-
OLLAMA: {
|
|
2681
|
-
name: 'OLLAMA',
|
|
2682
|
-
fullname: 'Ollama',
|
|
2683
|
-
color: '#059669', // Emerald green for local models
|
|
2684
|
-
},
|
|
2685
|
-
REMOTE: {
|
|
2686
|
-
name: 'REMOTE',
|
|
2687
|
-
fullname: 'Remote Server',
|
|
2688
|
-
color: '#6b7280', // Gray for remote/proxy connections
|
|
2689
|
-
},
|
|
2690
|
-
MOCKED_ECHO: {
|
|
2691
|
-
name: 'MOCKED_ECHO',
|
|
2692
|
-
fullname: 'Echo (Test)',
|
|
2693
|
-
color: '#8b5cf6', // Purple for test/mock tools
|
|
2694
|
-
},
|
|
2695
|
-
MOCKED_FAKE: {
|
|
2696
|
-
name: 'MOCKED_FAKE',
|
|
2697
|
-
fullname: 'Fake LLM (Test)',
|
|
2698
|
-
color: '#ec4899', // Pink for fake/test tools
|
|
2699
|
-
},
|
|
2700
|
-
VERCEL: {
|
|
2701
|
-
name: 'VERCEL',
|
|
2702
|
-
fullname: 'Vercel AI',
|
|
2703
|
-
color: '#000000', // Vercel's black
|
|
2704
|
-
},
|
|
2705
|
-
MULTIPLE: {
|
|
2706
|
-
name: 'MULTIPLE',
|
|
2707
|
-
fullname: 'Multiple Providers',
|
|
2708
|
-
color: '#6366f1', // Indigo for combined/multiple providers
|
|
2709
|
-
},
|
|
2650
|
+
const MULTIPLE_PROVIDER_PROFILE = {
|
|
2651
|
+
name: 'MULTIPLE',
|
|
2652
|
+
fullname: 'Multiple Providers',
|
|
2653
|
+
color: '#6366f1',
|
|
2710
2654
|
};
|
|
2711
|
-
/**
|
|
2712
|
-
* TODO: Refactor this - each profile must be alongside the provider definition
|
|
2713
|
-
* TODO: [π] Unite `AgentBasicInformation`, `ChatParticipant`, `LlmExecutionTools` + `LlmToolsMetadata`
|
|
2714
|
-
* Note: [π] Ignore a discrepancy between file name and entity name
|
|
2715
|
-
*/
|
|
2716
|
-
|
|
2717
2655
|
/**
|
|
2718
2656
|
* Multiple LLM Execution Tools is a proxy server that uses multiple execution tools internally and exposes the executor interface externally.
|
|
2719
2657
|
*
|
|
@@ -2749,7 +2687,7 @@ class MultipleLlmExecutionTools {
|
|
|
2749
2687
|
`);
|
|
2750
2688
|
}
|
|
2751
2689
|
get profile() {
|
|
2752
|
-
return
|
|
2690
|
+
return MULTIPLE_PROVIDER_PROFILE;
|
|
2753
2691
|
}
|
|
2754
2692
|
/**
|
|
2755
2693
|
* Check the configuration of all execution tools
|
|
@@ -6892,27 +6830,57 @@ function humanizeAiText(aiText) {
|
|
|
6892
6830
|
}
|
|
6893
6831
|
/**
|
|
6894
6832
|
* TODO: [π§ ] Maybe this should be exported from `@promptbook/utils` not `@promptbook/markdown-utils`
|
|
6895
|
-
* TODO: [π
ΎοΈ] !!! Use this across the project where AI text is involved
|
|
6896
6833
|
*/
|
|
6897
6834
|
|
|
6835
|
+
/**
|
|
6836
|
+
* @private
|
|
6837
|
+
*/
|
|
6838
|
+
const PROMPTBOOK_PSEUDOTOKEN_SUBSTITUTION = {
|
|
6839
|
+
'a ': 'a ',
|
|
6840
|
+
'the ': 'the ',
|
|
6841
|
+
'is ': 'is ',
|
|
6842
|
+
'or ': 'or ',
|
|
6843
|
+
'be ': 'be ',
|
|
6844
|
+
};
|
|
6898
6845
|
/**
|
|
6899
6846
|
* Function `promptbookifyAiText` will slightly modify the text so we know it was processed by Promptbook
|
|
6900
6847
|
*
|
|
6848
|
+
* Note: [π] This function is idempotent.
|
|
6849
|
+
*
|
|
6901
6850
|
* @public exported from `@promptbook/markdown-utils`
|
|
6902
6851
|
*/
|
|
6903
6852
|
function promptbookifyAiText(text) {
|
|
6904
|
-
|
|
6905
|
-
|
|
6906
|
-
const
|
|
6907
|
-
|
|
6908
|
-
|
|
6853
|
+
const textLength = text.length;
|
|
6854
|
+
let currentToken = '';
|
|
6855
|
+
const textTokens = [
|
|
6856
|
+
/* <- TODO: [βοΈ] Create `splitToPromptbookTokens` */
|
|
6857
|
+
];
|
|
6858
|
+
for (let textPosition = 0; textPosition < textLength; textPosition++) {
|
|
6859
|
+
const currentCharacter = text[textPosition];
|
|
6860
|
+
if (currentToken.endsWith(' ') && currentCharacter !== ' ') {
|
|
6861
|
+
textTokens.push(currentToken);
|
|
6862
|
+
currentToken = '';
|
|
6863
|
+
}
|
|
6864
|
+
currentToken += currentCharacter;
|
|
6865
|
+
}
|
|
6866
|
+
if (currentToken.length > 0) {
|
|
6867
|
+
textTokens.push(currentToken);
|
|
6868
|
+
}
|
|
6869
|
+
// [βοΈ] <- End of `splitToPromptbookTokens`
|
|
6870
|
+
const promptbookifiedTextTokens = [];
|
|
6871
|
+
for (let i = 0; i < textTokens.length; i++) {
|
|
6872
|
+
const token = textTokens[i];
|
|
6873
|
+
const tokenSubstitute = PROMPTBOOK_PSEUDOTOKEN_SUBSTITUTION[token];
|
|
6874
|
+
if (tokenSubstitute !== undefined) {
|
|
6875
|
+
promptbookifiedTextTokens.push(tokenSubstitute);
|
|
6876
|
+
}
|
|
6877
|
+
else {
|
|
6878
|
+
promptbookifiedTextTokens.push(token);
|
|
6879
|
+
}
|
|
6909
6880
|
}
|
|
6910
|
-
|
|
6911
|
-
return promptbookifiedText;
|
|
6881
|
+
return promptbookifiedTextTokens.join('');
|
|
6912
6882
|
}
|
|
6913
6883
|
/**
|
|
6914
|
-
* TODO: !!!!! Make the function idempotent and add "Note: [π] This function is idempotent."
|
|
6915
|
-
* TODO: [π
ΎοΈ]!!! Use this across the project where AI text is involved
|
|
6916
6884
|
* TODO: [π§ ][βοΈ] Make some Promptbook-native token system
|
|
6917
6885
|
*/
|
|
6918
6886
|
|