@promptbook/markitdown 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 +32 -6
- 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 +37 -10
- 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
|
@@ -3,9 +3,6 @@ import spaceTrim, { spaceTrim as spaceTrim$1 } from 'spacetrim';
|
|
|
3
3
|
import { SHA256 } from 'crypto-js';
|
|
4
4
|
import hexEncoder from 'crypto-js/enc-hex';
|
|
5
5
|
import { basename, join, dirname, isAbsolute } from 'path';
|
|
6
|
-
import parserHtml from 'prettier/parser-html';
|
|
7
|
-
import parserMarkdown from 'prettier/parser-markdown';
|
|
8
|
-
import { format } from 'prettier/standalone';
|
|
9
6
|
import { randomBytes } from 'crypto';
|
|
10
7
|
import { Subject } from 'rxjs';
|
|
11
8
|
import { forTime } from 'waitasecond';
|
|
@@ -27,7 +24,7 @@ const BOOK_LANGUAGE_VERSION = '1.0.0';
|
|
|
27
24
|
* @generated
|
|
28
25
|
* @see https://github.com/webgptorg/promptbook
|
|
29
26
|
*/
|
|
30
|
-
const PROMPTBOOK_ENGINE_VERSION = '0.
|
|
27
|
+
const PROMPTBOOK_ENGINE_VERSION = '0.101.0-1';
|
|
31
28
|
/**
|
|
32
29
|
* TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
|
|
33
30
|
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
@@ -640,6 +637,8 @@ for (let i = 0; i < defaultDiacriticsRemovalMap.length; i++) {
|
|
|
640
637
|
/**
|
|
641
638
|
* Removes diacritic marks (accents) from characters in a string.
|
|
642
639
|
*
|
|
640
|
+
* Note: [🔂] This function is idempotent.
|
|
641
|
+
*
|
|
643
642
|
* @param input The string containing diacritics to be normalized.
|
|
644
643
|
* @returns The string with diacritics removed or normalized.
|
|
645
644
|
* @public exported from `@promptbook/utils`
|
|
@@ -708,6 +707,8 @@ function normalizeToKebabCase(text) {
|
|
|
708
707
|
/**
|
|
709
708
|
* Removes emojis from a string and fix whitespaces
|
|
710
709
|
*
|
|
710
|
+
* Note: [🔂] This function is idempotent.
|
|
711
|
+
*
|
|
711
712
|
* @param text with emojis
|
|
712
713
|
* @returns text without emojis
|
|
713
714
|
* @public exported from `@promptbook/utils`
|
|
@@ -780,6 +781,7 @@ function isValidFilePath(filename) {
|
|
|
780
781
|
/**
|
|
781
782
|
* Tests if given string is valid URL.
|
|
782
783
|
*
|
|
784
|
+
* Note: [🔂] This function is idempotent.
|
|
783
785
|
* Note: Dataurl are considered perfectly valid.
|
|
784
786
|
* Note: There are two similar functions:
|
|
785
787
|
* - `isValidUrl` which tests any URL
|
|
@@ -1039,8 +1041,18 @@ function validatePipelineString(pipelineString) {
|
|
|
1039
1041
|
* @private withing the package because of HUGE size of prettier dependency
|
|
1040
1042
|
*/
|
|
1041
1043
|
function prettifyMarkdown(content) {
|
|
1044
|
+
// In browser/Next.js environments, just return the original content
|
|
1045
|
+
// since prettier parsers are not available and would cause bundling issues
|
|
1046
|
+
if (typeof window !== 'undefined') {
|
|
1047
|
+
return content;
|
|
1048
|
+
}
|
|
1042
1049
|
try {
|
|
1043
|
-
|
|
1050
|
+
// Use dynamic require to avoid static imports that cause bundling issues
|
|
1051
|
+
// This will only work in Node.js environments
|
|
1052
|
+
const prettierStandalone = eval('require')('prettier/standalone');
|
|
1053
|
+
const parserMarkdown = eval('require')('prettier/parser-markdown');
|
|
1054
|
+
const parserHtml = eval('require')('prettier/parser-html');
|
|
1055
|
+
return prettierStandalone.format(content, {
|
|
1044
1056
|
parser: 'markdown',
|
|
1045
1057
|
plugins: [parserMarkdown, parserHtml],
|
|
1046
1058
|
// TODO: DRY - make some import or auto-copy of .prettierrc
|
|
@@ -1068,6 +1080,8 @@ function prettifyMarkdown(content) {
|
|
|
1068
1080
|
/**
|
|
1069
1081
|
* Makes first letter of a string uppercase
|
|
1070
1082
|
*
|
|
1083
|
+
* Note: [🔂] This function is idempotent.
|
|
1084
|
+
*
|
|
1071
1085
|
* @public exported from `@promptbook/utils`
|
|
1072
1086
|
*/
|
|
1073
1087
|
function capitalize(word) {
|
|
@@ -1397,6 +1411,7 @@ function checkSerializableAsJson(options) {
|
|
|
1397
1411
|
/**
|
|
1398
1412
|
* Creates a deep clone of the given object
|
|
1399
1413
|
*
|
|
1414
|
+
* Note: [🔂] This function is idempotent.
|
|
1400
1415
|
* Note: This method only works for objects that are fully serializable to JSON and do not contain functions, Dates, or special types.
|
|
1401
1416
|
*
|
|
1402
1417
|
* @param objectValue The object to clone.
|
|
@@ -2997,7 +3012,7 @@ const LLM_PROVIDER_PROFILES = {
|
|
|
2997
3012
|
};
|
|
2998
3013
|
/**
|
|
2999
3014
|
* TODO: Refactor this - each profile must be alongside the provider definition
|
|
3000
|
-
* TODO: [🕛] Unite `
|
|
3015
|
+
* TODO: [🕛] Unite `AgentBasicInformation`, `ChatParticipant`, `LlmExecutionTools` + `LlmToolsMetadata`
|
|
3001
3016
|
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
3002
3017
|
*/
|
|
3003
3018
|
|
|
@@ -3306,6 +3321,8 @@ function $getGlobalScope() {
|
|
|
3306
3321
|
/**
|
|
3307
3322
|
* Normalizes a text string to SCREAMING_CASE (all uppercase with underscores).
|
|
3308
3323
|
*
|
|
3324
|
+
* Note: [🔂] This function is idempotent.
|
|
3325
|
+
*
|
|
3309
3326
|
* @param text The text string to be converted to SCREAMING_CASE format.
|
|
3310
3327
|
* @returns The normalized text in SCREAMING_CASE format.
|
|
3311
3328
|
* @example 'HELLO_WORLD'
|
|
@@ -3361,6 +3378,8 @@ function normalizeTo_SCREAMING_CASE(text) {
|
|
|
3361
3378
|
/**
|
|
3362
3379
|
* Normalizes a text string to snake_case format.
|
|
3363
3380
|
*
|
|
3381
|
+
* Note: [🔂] This function is idempotent.
|
|
3382
|
+
*
|
|
3364
3383
|
* @param text The text string to be converted to snake_case format.
|
|
3365
3384
|
* @returns The normalized text in snake_case format.
|
|
3366
3385
|
* @example 'hello_world'
|
|
@@ -4921,6 +4940,7 @@ function countCharacters(text) {
|
|
|
4921
4940
|
}
|
|
4922
4941
|
/**
|
|
4923
4942
|
* TODO: [🥴] Implement counting in formats - like JSON, CSV, XML,...
|
|
4943
|
+
* TODO: [🧠][✌️] Make some Promptbook-native token system
|
|
4924
4944
|
*/
|
|
4925
4945
|
|
|
4926
4946
|
/**
|
|
@@ -4955,6 +4975,7 @@ function countLines(text) {
|
|
|
4955
4975
|
}
|
|
4956
4976
|
/**
|
|
4957
4977
|
* TODO: [🥴] Implement counting in formats - like JSON, CSV, XML,...
|
|
4978
|
+
* TODO: [🧠][✌️] Make some Promptbook-native token system
|
|
4958
4979
|
*/
|
|
4959
4980
|
|
|
4960
4981
|
/**
|
|
@@ -4969,6 +4990,7 @@ function countPages(text) {
|
|
|
4969
4990
|
}
|
|
4970
4991
|
/**
|
|
4971
4992
|
* TODO: [🥴] Implement counting in formats - like JSON, CSV, XML,...
|
|
4993
|
+
* TODO: [🧠][✌️] Make some Promptbook-native token system
|
|
4972
4994
|
*/
|
|
4973
4995
|
|
|
4974
4996
|
/**
|
|
@@ -4981,6 +5003,7 @@ function countParagraphs(text) {
|
|
|
4981
5003
|
}
|
|
4982
5004
|
/**
|
|
4983
5005
|
* TODO: [🥴] Implement counting in formats - like JSON, CSV, XML,...
|
|
5006
|
+
* TODO: [🧠][✌️] Make some Promptbook-native token system
|
|
4984
5007
|
*/
|
|
4985
5008
|
|
|
4986
5009
|
/**
|
|
@@ -5001,6 +5024,7 @@ function countSentences(text) {
|
|
|
5001
5024
|
}
|
|
5002
5025
|
/**
|
|
5003
5026
|
* TODO: [🥴] Implement counting in formats - like JSON, CSV, XML,...
|
|
5027
|
+
* TODO: [🧠][✌️] Make some Promptbook-native token system
|
|
5004
5028
|
*/
|
|
5005
5029
|
|
|
5006
5030
|
/**
|
|
@@ -5017,6 +5041,8 @@ function countWords(text) {
|
|
|
5017
5041
|
}
|
|
5018
5042
|
/**
|
|
5019
5043
|
* TODO: [🥴] Implement counting in formats - like JSON, CSV, XML,...
|
|
5044
|
+
* TODO: [🧠][✌️] Make some Promptbook-native token system
|
|
5045
|
+
* TODO: [✌️] `countWords` should be just `splitWords(...).length`, and all other counters should use this pattern as well
|
|
5020
5046
|
*/
|
|
5021
5047
|
|
|
5022
5048
|
/**
|