@promptbook/wizard 0.100.4-0 → 0.101.0-1
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 +40 -7
- package/esm/index.es.js.map +1 -1
- package/esm/typings/src/_packages/components.index.d.ts +4 -0
- package/esm/typings/src/_packages/core.index.d.ts +4 -2
- package/esm/typings/src/_packages/markdown-utils.index.d.ts +14 -0
- package/esm/typings/src/_packages/types.index.d.ts +4 -6
- package/esm/typings/src/book-2.0/agent-source/AgentBasicInformation.d.ts +21 -0
- package/esm/typings/src/book-2.0/{commitments/_misc → agent-source}/AgentModelRequirements.d.ts +1 -1
- package/esm/typings/src/book-2.0/{commitments/_misc → agent-source}/AgentSourceParseResult.d.ts +3 -1
- package/esm/typings/src/book-2.0/{commitments/_misc → agent-source}/createAgentModelRequirements.d.ts +2 -2
- package/esm/typings/src/book-2.0/{commitments/_misc → agent-source}/createAgentModelRequirementsWithCommitments.d.ts +3 -3
- package/esm/typings/src/book-2.0/{commitments/_misc → agent-source}/createCommitmentRegex.d.ts +2 -2
- package/esm/typings/src/book-2.0/agent-source/extractMetaLinks.d.ts +8 -0
- package/esm/typings/src/book-2.0/agent-source/parseAgentSource.d.ts +4 -19
- package/esm/typings/src/book-2.0/agent-source/parseAgentSourceWithCommitments.d.ts +9 -0
- package/esm/typings/src/book-2.0/commitments/ACTION/ACTION.d.ts +1 -1
- package/esm/typings/src/book-2.0/commitments/FORMAT/FORMAT.d.ts +1 -1
- package/esm/typings/src/book-2.0/commitments/KNOWLEDGE/KNOWLEDGE.d.ts +1 -1
- package/esm/typings/src/book-2.0/commitments/META_IMAGE/META_IMAGE.d.ts +1 -1
- package/esm/typings/src/book-2.0/commitments/META_LINK/META_LINK.d.ts +1 -1
- package/esm/typings/src/book-2.0/commitments/MODEL/MODEL.d.ts +1 -1
- package/esm/typings/src/book-2.0/commitments/NOTE/NOTE.d.ts +1 -1
- package/esm/typings/src/book-2.0/commitments/PERSONA/PERSONA.d.ts +1 -1
- package/esm/typings/src/book-2.0/commitments/RULE/RULE.d.ts +1 -1
- package/esm/typings/src/book-2.0/commitments/SAMPLE/SAMPLE.d.ts +1 -1
- package/esm/typings/src/book-2.0/commitments/STYLE/STYLE.d.ts +1 -1
- package/esm/typings/src/book-2.0/commitments/_base/BaseCommitmentDefinition.d.ts +1 -1
- package/esm/typings/src/book-2.0/commitments/_base/CommitmentDefinition.d.ts +1 -1
- package/esm/typings/src/book-2.0/commitments/_base/NotYetImplementedCommitmentDefinition.d.ts +1 -1
- package/esm/typings/src/book-2.0/commitments/{_misc → _base}/ParsedCommitment.d.ts +1 -1
- package/esm/typings/src/book-2.0/commitments/_base/createEmptyAgentModelRequirements.d.ts +1 -1
- package/esm/typings/src/book-2.0/utils/extractAgentMetadata.d.ts +17 -0
- package/esm/typings/src/book-2.0/utils/extractProfileImageFromSystemMessage.d.ts +12 -0
- package/esm/typings/src/book-2.0/utils/generateGravatarUrl.d.ts +10 -0
- package/esm/typings/src/book-2.0/utils/generatePlaceholderAgentProfileImageUrl.d.ts +10 -0
- package/esm/typings/src/book-components/AvatarProfile/AvatarChip/AvatarChip.d.ts +1 -1
- package/esm/typings/src/book-components/AvatarProfile/AvatarProfile/AvatarProfile.d.ts +2 -8
- package/esm/typings/src/book-components/Chat/Chat/ChatProps.d.ts +6 -0
- package/esm/typings/src/book-components/Chat/examples/ChatMarkdownDemo.d.ts +16 -0
- package/esm/typings/src/book-components/Chat/types/ChatParticipant.d.ts +1 -1
- package/esm/typings/src/book-components/Chat/utils/renderMarkdown.d.ts +21 -0
- package/esm/typings/src/book-components/Chat/utils/renderMarkdown.test.d.ts +1 -0
- package/esm/typings/src/llm-providers/_common/profiles/llmProviderProfiles.d.ts +1 -1
- package/esm/typings/src/utils/expectation-counters/countCharacters.d.ts +2 -1
- package/esm/typings/src/utils/expectation-counters/countLines.d.ts +2 -1
- package/esm/typings/src/utils/expectation-counters/countPages.d.ts +2 -1
- package/esm/typings/src/utils/expectation-counters/countParagraphs.d.ts +2 -1
- package/esm/typings/src/utils/expectation-counters/countSentences.d.ts +1 -0
- package/esm/typings/src/utils/expectation-counters/countWords.d.ts +3 -1
- package/esm/typings/src/utils/markdown/escapeMarkdownBlock.d.ts +2 -0
- package/esm/typings/src/utils/markdown/humanizeAiText.d.ts +13 -0
- package/esm/typings/src/utils/markdown/humanizeAiText.test.d.ts +1 -0
- package/esm/typings/src/utils/markdown/humanizeAiTextEllipsis.d.ts +13 -0
- package/esm/typings/src/utils/markdown/humanizeAiTextEmdashed.d.ts +13 -0
- package/esm/typings/src/utils/markdown/humanizeAiTextQuotes.d.ts +13 -0
- package/esm/typings/src/utils/markdown/humanizeAiTextWhitespace.d.ts +13 -0
- package/esm/typings/src/utils/markdown/prettifyMarkdown.d.ts +8 -0
- package/esm/typings/src/utils/markdown/promptbookifyAiText.d.ts +12 -0
- package/esm/typings/src/utils/markdown/promptbookifyAiText.test.d.ts +1 -0
- package/esm/typings/src/utils/markdown/removeMarkdownLinks.d.ts +11 -0
- package/esm/typings/src/utils/markdown/removeMarkdownLinks.test.d.ts +4 -0
- package/esm/typings/src/utils/normalization/capitalize.d.ts +2 -0
- package/esm/typings/src/utils/normalization/decapitalize.d.ts +3 -1
- package/esm/typings/src/utils/normalization/normalizeTo_SCREAMING_CASE.d.ts +2 -0
- package/esm/typings/src/utils/normalization/normalizeTo_snake_case.d.ts +2 -0
- package/esm/typings/src/utils/normalization/normalizeWhitespaces.d.ts +2 -0
- package/esm/typings/src/utils/normalization/removeDiacritics.d.ts +2 -0
- package/esm/typings/src/utils/parseNumber.d.ts +1 -0
- package/esm/typings/src/utils/removeEmojis.d.ts +2 -0
- package/esm/typings/src/utils/removeQuotes.d.ts +1 -0
- package/esm/typings/src/utils/serialization/deepClone.d.ts +1 -0
- package/esm/typings/src/utils/trimCodeBlock.d.ts +1 -0
- package/esm/typings/src/utils/validators/url/isValidUrl.d.ts +1 -0
- package/esm/typings/src/utils/validators/uuid/isValidUuid.d.ts +2 -0
- package/esm/typings/src/version.d.ts +1 -1
- package/package.json +2 -2
- package/umd/index.umd.js +45 -11
- package/umd/index.umd.js.map +1 -1
- package/esm/typings/src/book-2.0/commitments/_misc/parseAgentSourceWithCommitments.d.ts +0 -24
- package/esm/typings/src/book-2.0/utils/profileImageUtils.d.ts +0 -39
- /package/esm/typings/src/book-2.0/{commitments/_misc → agent-source}/removeCommentsFromSystemMessage.d.ts +0 -0
package/esm/index.es.js
CHANGED
@@ -12,9 +12,6 @@ import { forTime } from 'waitasecond';
|
|
12
12
|
import { SHA256 } from 'crypto-js';
|
13
13
|
import hexEncoder from 'crypto-js/enc-hex';
|
14
14
|
import { basename, join, dirname, isAbsolute, relative } from 'path';
|
15
|
-
import parserHtml from 'prettier/parser-html';
|
16
|
-
import parserMarkdown from 'prettier/parser-markdown';
|
17
|
-
import { format } from 'prettier/standalone';
|
18
15
|
import { Subject } from 'rxjs';
|
19
16
|
import sha256 from 'crypto-js/sha256';
|
20
17
|
import { lookup, extension } from 'mime-types';
|
@@ -39,7 +36,7 @@ const BOOK_LANGUAGE_VERSION = '1.0.0';
|
|
39
36
|
* @generated
|
40
37
|
* @see https://github.com/webgptorg/promptbook
|
41
38
|
*/
|
42
|
-
const PROMPTBOOK_ENGINE_VERSION = '0.
|
39
|
+
const PROMPTBOOK_ENGINE_VERSION = '0.101.0-1';
|
43
40
|
/**
|
44
41
|
* TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
|
45
42
|
* Note: [💞] Ignore a discrepancy between file name and entity name
|
@@ -647,6 +644,7 @@ function checkSerializableAsJson(options) {
|
|
647
644
|
/**
|
648
645
|
* Creates a deep clone of the given object
|
649
646
|
*
|
647
|
+
* Note: [🔂] This function is idempotent.
|
650
648
|
* Note: This method only works for objects that are fully serializable to JSON and do not contain functions, Dates, or special types.
|
651
649
|
*
|
652
650
|
* @param objectValue The object to clone.
|
@@ -831,6 +829,8 @@ function $getGlobalScope() {
|
|
831
829
|
/**
|
832
830
|
* Normalizes a text string to SCREAMING_CASE (all uppercase with underscores).
|
833
831
|
*
|
832
|
+
* Note: [🔂] This function is idempotent.
|
833
|
+
*
|
834
834
|
* @param text The text string to be converted to SCREAMING_CASE format.
|
835
835
|
* @returns The normalized text in SCREAMING_CASE format.
|
836
836
|
* @example 'HELLO_WORLD'
|
@@ -886,6 +886,8 @@ function normalizeTo_SCREAMING_CASE(text) {
|
|
886
886
|
/**
|
887
887
|
* Normalizes a text string to snake_case format.
|
888
888
|
*
|
889
|
+
* Note: [🔂] This function is idempotent.
|
890
|
+
*
|
889
891
|
* @param text The text string to be converted to snake_case format.
|
890
892
|
* @returns The normalized text in snake_case format.
|
891
893
|
* @example 'hello_world'
|
@@ -1401,13 +1403,14 @@ const LLM_PROVIDER_PROFILES = {
|
|
1401
1403
|
};
|
1402
1404
|
/**
|
1403
1405
|
* TODO: Refactor this - each profile must be alongside the provider definition
|
1404
|
-
* TODO: [🕛] Unite `
|
1406
|
+
* TODO: [🕛] Unite `AgentBasicInformation`, `ChatParticipant`, `LlmExecutionTools` + `LlmToolsMetadata`
|
1405
1407
|
* Note: [💞] Ignore a discrepancy between file name and entity name
|
1406
1408
|
*/
|
1407
1409
|
|
1408
1410
|
/**
|
1409
1411
|
* Tests if given string is valid URL.
|
1410
1412
|
*
|
1413
|
+
* Note: [🔂] This function is idempotent.
|
1411
1414
|
* Note: Dataurl are considered perfectly valid.
|
1412
1415
|
* Note: There are two similar functions:
|
1413
1416
|
* - `isValidUrl` which tests any URL
|
@@ -1975,6 +1978,7 @@ function countCharacters(text) {
|
|
1975
1978
|
}
|
1976
1979
|
/**
|
1977
1980
|
* TODO: [🥴] Implement counting in formats - like JSON, CSV, XML,...
|
1981
|
+
* TODO: [🧠][✌️] Make some Promptbook-native token system
|
1978
1982
|
*/
|
1979
1983
|
|
1980
1984
|
/**
|
@@ -2009,6 +2013,7 @@ function countLines(text) {
|
|
2009
2013
|
}
|
2010
2014
|
/**
|
2011
2015
|
* TODO: [🥴] Implement counting in formats - like JSON, CSV, XML,...
|
2016
|
+
* TODO: [🧠][✌️] Make some Promptbook-native token system
|
2012
2017
|
*/
|
2013
2018
|
|
2014
2019
|
/**
|
@@ -2023,6 +2028,7 @@ function countPages(text) {
|
|
2023
2028
|
}
|
2024
2029
|
/**
|
2025
2030
|
* TODO: [🥴] Implement counting in formats - like JSON, CSV, XML,...
|
2031
|
+
* TODO: [🧠][✌️] Make some Promptbook-native token system
|
2026
2032
|
*/
|
2027
2033
|
|
2028
2034
|
/**
|
@@ -2035,6 +2041,7 @@ function countParagraphs(text) {
|
|
2035
2041
|
}
|
2036
2042
|
/**
|
2037
2043
|
* TODO: [🥴] Implement counting in formats - like JSON, CSV, XML,...
|
2044
|
+
* TODO: [🧠][✌️] Make some Promptbook-native token system
|
2038
2045
|
*/
|
2039
2046
|
|
2040
2047
|
/**
|
@@ -2055,6 +2062,7 @@ function countSentences(text) {
|
|
2055
2062
|
}
|
2056
2063
|
/**
|
2057
2064
|
* TODO: [🥴] Implement counting in formats - like JSON, CSV, XML,...
|
2065
|
+
* TODO: [🧠][✌️] Make some Promptbook-native token system
|
2058
2066
|
*/
|
2059
2067
|
|
2060
2068
|
const defaultDiacriticsRemovalMap = [
|
@@ -2304,6 +2312,8 @@ for (let i = 0; i < defaultDiacriticsRemovalMap.length; i++) {
|
|
2304
2312
|
/**
|
2305
2313
|
* Removes diacritic marks (accents) from characters in a string.
|
2306
2314
|
*
|
2315
|
+
* Note: [🔂] This function is idempotent.
|
2316
|
+
*
|
2307
2317
|
* @param input The string containing diacritics to be normalized.
|
2308
2318
|
* @returns The string with diacritics removed or normalized.
|
2309
2319
|
* @public exported from `@promptbook/utils`
|
@@ -2332,6 +2342,8 @@ function countWords(text) {
|
|
2332
2342
|
}
|
2333
2343
|
/**
|
2334
2344
|
* TODO: [🥴] Implement counting in formats - like JSON, CSV, XML,...
|
2345
|
+
* TODO: [🧠][✌️] Make some Promptbook-native token system
|
2346
|
+
* TODO: [✌️] `countWords` should be just `splitWords(...).length`, and all other counters should use this pattern as well
|
2335
2347
|
*/
|
2336
2348
|
|
2337
2349
|
/**
|
@@ -6203,6 +6215,8 @@ function normalizeToKebabCase(text) {
|
|
6203
6215
|
/**
|
6204
6216
|
* Removes emojis from a string and fix whitespaces
|
6205
6217
|
*
|
6218
|
+
* Note: [🔂] This function is idempotent.
|
6219
|
+
*
|
6206
6220
|
* @param text with emojis
|
6207
6221
|
* @returns text without emojis
|
6208
6222
|
* @public exported from `@promptbook/utils`
|
@@ -6454,8 +6468,18 @@ function validatePipelineString(pipelineString) {
|
|
6454
6468
|
* @private withing the package because of HUGE size of prettier dependency
|
6455
6469
|
*/
|
6456
6470
|
function prettifyMarkdown(content) {
|
6471
|
+
// In browser/Next.js environments, just return the original content
|
6472
|
+
// since prettier parsers are not available and would cause bundling issues
|
6473
|
+
if (typeof window !== 'undefined') {
|
6474
|
+
return content;
|
6475
|
+
}
|
6457
6476
|
try {
|
6458
|
-
|
6477
|
+
// Use dynamic require to avoid static imports that cause bundling issues
|
6478
|
+
// This will only work in Node.js environments
|
6479
|
+
const prettierStandalone = eval('require')('prettier/standalone');
|
6480
|
+
const parserMarkdown = eval('require')('prettier/parser-markdown');
|
6481
|
+
const parserHtml = eval('require')('prettier/parser-html');
|
6482
|
+
return prettierStandalone.format(content, {
|
6459
6483
|
parser: 'markdown',
|
6460
6484
|
plugins: [parserMarkdown, parserHtml],
|
6461
6485
|
// TODO: DRY - make some import or auto-copy of .prettierrc
|
@@ -6483,6 +6507,8 @@ function prettifyMarkdown(content) {
|
|
6483
6507
|
/**
|
6484
6508
|
* Makes first letter of a string uppercase
|
6485
6509
|
*
|
6510
|
+
* Note: [🔂] This function is idempotent.
|
6511
|
+
*
|
6486
6512
|
* @public exported from `@promptbook/utils`
|
6487
6513
|
*/
|
6488
6514
|
function capitalize(word) {
|
@@ -13034,7 +13060,9 @@ function normalizeTo_camelCase(text, _isFirstLetterCapital = false) {
|
|
13034
13060
|
*/
|
13035
13061
|
|
13036
13062
|
/**
|
13037
|
-
* Makes first letter of a string
|
13063
|
+
* Makes first letter of a string lowercase
|
13064
|
+
*
|
13065
|
+
* Note: [🔂] This function is idempotent.
|
13038
13066
|
*
|
13039
13067
|
* @public exported from `@promptbook/utils`
|
13040
13068
|
*/
|
@@ -13104,6 +13132,8 @@ function normalizeTo_PascalCase(text) {
|
|
13104
13132
|
/**
|
13105
13133
|
* Take every whitespace (space, new line, tab) and replace it with a single space
|
13106
13134
|
*
|
13135
|
+
* Note: [🔂] This function is idempotent.
|
13136
|
+
*
|
13107
13137
|
* @public exported from `@promptbook/utils`
|
13108
13138
|
*/
|
13109
13139
|
function normalizeWhitespaces(sentence) {
|
@@ -13113,6 +13143,7 @@ function normalizeWhitespaces(sentence) {
|
|
13113
13143
|
/**
|
13114
13144
|
* Function parseNumber will parse number from string
|
13115
13145
|
*
|
13146
|
+
* Note: [🔂] This function is idempotent.
|
13116
13147
|
* Unlike Number.parseInt, Number.parseFloat it will never ever result in NaN
|
13117
13148
|
* Note: it also works only with decimal numbers
|
13118
13149
|
*
|
@@ -13181,6 +13212,7 @@ function parseNumber(value) {
|
|
13181
13212
|
/**
|
13182
13213
|
* Removes quotes from a string
|
13183
13214
|
*
|
13215
|
+
* Note: [🔂] This function is idempotent.
|
13184
13216
|
* Tip: This is very useful for post-processing of the result of the LLM model
|
13185
13217
|
* Note: This function removes only the same quotes from the beginning and the end of the string
|
13186
13218
|
* Note: There are two similar functions:
|
@@ -13204,6 +13236,7 @@ function removeQuotes(text) {
|
|
13204
13236
|
/**
|
13205
13237
|
* Function trimCodeBlock will trim starting and ending code block from the string if it is present.
|
13206
13238
|
*
|
13239
|
+
* Note: [🔂] This function is idempotent.
|
13207
13240
|
* Note: This is useful for post-processing of the result of the chat LLM model
|
13208
13241
|
* when the model wraps the result in the (markdown) code block.
|
13209
13242
|
*
|