@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.
Files changed (81) hide show
  1. package/esm/index.es.js +40 -7
  2. package/esm/index.es.js.map +1 -1
  3. package/esm/typings/src/_packages/components.index.d.ts +4 -0
  4. package/esm/typings/src/_packages/core.index.d.ts +4 -2
  5. package/esm/typings/src/_packages/markdown-utils.index.d.ts +14 -0
  6. package/esm/typings/src/_packages/types.index.d.ts +4 -6
  7. package/esm/typings/src/book-2.0/agent-source/AgentBasicInformation.d.ts +21 -0
  8. package/esm/typings/src/book-2.0/{commitments/_misc → agent-source}/AgentModelRequirements.d.ts +1 -1
  9. package/esm/typings/src/book-2.0/{commitments/_misc → agent-source}/AgentSourceParseResult.d.ts +3 -1
  10. package/esm/typings/src/book-2.0/{commitments/_misc → agent-source}/createAgentModelRequirements.d.ts +2 -2
  11. package/esm/typings/src/book-2.0/{commitments/_misc → agent-source}/createAgentModelRequirementsWithCommitments.d.ts +3 -3
  12. package/esm/typings/src/book-2.0/{commitments/_misc → agent-source}/createCommitmentRegex.d.ts +2 -2
  13. package/esm/typings/src/book-2.0/agent-source/extractMetaLinks.d.ts +8 -0
  14. package/esm/typings/src/book-2.0/agent-source/parseAgentSource.d.ts +4 -19
  15. package/esm/typings/src/book-2.0/agent-source/parseAgentSourceWithCommitments.d.ts +9 -0
  16. package/esm/typings/src/book-2.0/commitments/ACTION/ACTION.d.ts +1 -1
  17. package/esm/typings/src/book-2.0/commitments/FORMAT/FORMAT.d.ts +1 -1
  18. package/esm/typings/src/book-2.0/commitments/KNOWLEDGE/KNOWLEDGE.d.ts +1 -1
  19. package/esm/typings/src/book-2.0/commitments/META_IMAGE/META_IMAGE.d.ts +1 -1
  20. package/esm/typings/src/book-2.0/commitments/META_LINK/META_LINK.d.ts +1 -1
  21. package/esm/typings/src/book-2.0/commitments/MODEL/MODEL.d.ts +1 -1
  22. package/esm/typings/src/book-2.0/commitments/NOTE/NOTE.d.ts +1 -1
  23. package/esm/typings/src/book-2.0/commitments/PERSONA/PERSONA.d.ts +1 -1
  24. package/esm/typings/src/book-2.0/commitments/RULE/RULE.d.ts +1 -1
  25. package/esm/typings/src/book-2.0/commitments/SAMPLE/SAMPLE.d.ts +1 -1
  26. package/esm/typings/src/book-2.0/commitments/STYLE/STYLE.d.ts +1 -1
  27. package/esm/typings/src/book-2.0/commitments/_base/BaseCommitmentDefinition.d.ts +1 -1
  28. package/esm/typings/src/book-2.0/commitments/_base/CommitmentDefinition.d.ts +1 -1
  29. package/esm/typings/src/book-2.0/commitments/_base/NotYetImplementedCommitmentDefinition.d.ts +1 -1
  30. package/esm/typings/src/book-2.0/commitments/{_misc → _base}/ParsedCommitment.d.ts +1 -1
  31. package/esm/typings/src/book-2.0/commitments/_base/createEmptyAgentModelRequirements.d.ts +1 -1
  32. package/esm/typings/src/book-2.0/utils/extractAgentMetadata.d.ts +17 -0
  33. package/esm/typings/src/book-2.0/utils/extractProfileImageFromSystemMessage.d.ts +12 -0
  34. package/esm/typings/src/book-2.0/utils/generateGravatarUrl.d.ts +10 -0
  35. package/esm/typings/src/book-2.0/utils/generatePlaceholderAgentProfileImageUrl.d.ts +10 -0
  36. package/esm/typings/src/book-components/AvatarProfile/AvatarChip/AvatarChip.d.ts +1 -1
  37. package/esm/typings/src/book-components/AvatarProfile/AvatarProfile/AvatarProfile.d.ts +2 -8
  38. package/esm/typings/src/book-components/Chat/Chat/ChatProps.d.ts +6 -0
  39. package/esm/typings/src/book-components/Chat/examples/ChatMarkdownDemo.d.ts +16 -0
  40. package/esm/typings/src/book-components/Chat/types/ChatParticipant.d.ts +1 -1
  41. package/esm/typings/src/book-components/Chat/utils/renderMarkdown.d.ts +21 -0
  42. package/esm/typings/src/book-components/Chat/utils/renderMarkdown.test.d.ts +1 -0
  43. package/esm/typings/src/llm-providers/_common/profiles/llmProviderProfiles.d.ts +1 -1
  44. package/esm/typings/src/utils/expectation-counters/countCharacters.d.ts +2 -1
  45. package/esm/typings/src/utils/expectation-counters/countLines.d.ts +2 -1
  46. package/esm/typings/src/utils/expectation-counters/countPages.d.ts +2 -1
  47. package/esm/typings/src/utils/expectation-counters/countParagraphs.d.ts +2 -1
  48. package/esm/typings/src/utils/expectation-counters/countSentences.d.ts +1 -0
  49. package/esm/typings/src/utils/expectation-counters/countWords.d.ts +3 -1
  50. package/esm/typings/src/utils/markdown/escapeMarkdownBlock.d.ts +2 -0
  51. package/esm/typings/src/utils/markdown/humanizeAiText.d.ts +13 -0
  52. package/esm/typings/src/utils/markdown/humanizeAiText.test.d.ts +1 -0
  53. package/esm/typings/src/utils/markdown/humanizeAiTextEllipsis.d.ts +13 -0
  54. package/esm/typings/src/utils/markdown/humanizeAiTextEmdashed.d.ts +13 -0
  55. package/esm/typings/src/utils/markdown/humanizeAiTextQuotes.d.ts +13 -0
  56. package/esm/typings/src/utils/markdown/humanizeAiTextWhitespace.d.ts +13 -0
  57. package/esm/typings/src/utils/markdown/prettifyMarkdown.d.ts +8 -0
  58. package/esm/typings/src/utils/markdown/promptbookifyAiText.d.ts +12 -0
  59. package/esm/typings/src/utils/markdown/promptbookifyAiText.test.d.ts +1 -0
  60. package/esm/typings/src/utils/markdown/removeMarkdownLinks.d.ts +11 -0
  61. package/esm/typings/src/utils/markdown/removeMarkdownLinks.test.d.ts +4 -0
  62. package/esm/typings/src/utils/normalization/capitalize.d.ts +2 -0
  63. package/esm/typings/src/utils/normalization/decapitalize.d.ts +3 -1
  64. package/esm/typings/src/utils/normalization/normalizeTo_SCREAMING_CASE.d.ts +2 -0
  65. package/esm/typings/src/utils/normalization/normalizeTo_snake_case.d.ts +2 -0
  66. package/esm/typings/src/utils/normalization/normalizeWhitespaces.d.ts +2 -0
  67. package/esm/typings/src/utils/normalization/removeDiacritics.d.ts +2 -0
  68. package/esm/typings/src/utils/parseNumber.d.ts +1 -0
  69. package/esm/typings/src/utils/removeEmojis.d.ts +2 -0
  70. package/esm/typings/src/utils/removeQuotes.d.ts +1 -0
  71. package/esm/typings/src/utils/serialization/deepClone.d.ts +1 -0
  72. package/esm/typings/src/utils/trimCodeBlock.d.ts +1 -0
  73. package/esm/typings/src/utils/validators/url/isValidUrl.d.ts +1 -0
  74. package/esm/typings/src/utils/validators/uuid/isValidUuid.d.ts +2 -0
  75. package/esm/typings/src/version.d.ts +1 -1
  76. package/package.json +2 -2
  77. package/umd/index.umd.js +45 -11
  78. package/umd/index.umd.js.map +1 -1
  79. package/esm/typings/src/book-2.0/commitments/_misc/parseAgentSourceWithCommitments.d.ts +0 -24
  80. package/esm/typings/src/book-2.0/utils/profileImageUtils.d.ts +0 -39
  81. /package/esm/typings/src/book-2.0/{commitments/_misc → agent-source}/removeCommentsFromSystemMessage.d.ts +0 -0
@@ -0,0 +1,13 @@
1
+ import { string_markdown } from '../../types/typeAliases';
2
+ /**
3
+ * Change ellipsis character to three dots `…` -> `...`
4
+ *
5
+ * Note: [🔂] This function is idempotent.
6
+ * Tip: If you want to do the full cleanup, look for `humanizeAiText` exported `@promptbook/markdown-utils`
7
+ *
8
+ * @public exported from `@promptbook/markdown-utils`
9
+ */
10
+ export declare function humanizeAiTextEllipsis(aiText: string_markdown): string_markdown;
11
+ /**
12
+ * Note: [🏂] This function is not tested by itself but together with other cleanup functions with `humanizeAiText`
13
+ */
@@ -0,0 +1,13 @@
1
+ import { string_markdown } from '../../types/typeAliases';
2
+ /**
3
+ * Change em-dashes to regular dashes `—` -> `-`
4
+ *
5
+ * Note: [🔂] This function is idempotent.
6
+ * Tip: If you want to do the full cleanup, look for `humanizeAiText` exported `@promptbook/markdown-utils`
7
+ *
8
+ * @public exported from `@promptbook/markdown-utils`
9
+ */
10
+ export declare function humanizeAiTextEmdashed(aiText: string_markdown): string_markdown;
11
+ /**
12
+ * Note: [🏂] This function is not tested by itself but together with other cleanup functions with `humanizeAiText`
13
+ */
@@ -0,0 +1,13 @@
1
+ import { string_markdown } from '../../types/typeAliases';
2
+ /**
3
+ * Change smart quotes to regular quotes
4
+ *
5
+ * Note: [🔂] This function is idempotent.
6
+ * Tip: If you want to do the full cleanup, look for `humanizeAiText` exported `@promptbook/markdown-utils`
7
+ *
8
+ * @public exported from `@promptbook/markdown-utils`
9
+ */
10
+ export declare function humanizeAiTextQuotes(aiText: string_markdown): string_markdown;
11
+ /**
12
+ * Note: [🏂] This function is not tested by itself but together with other cleanup functions with `humanizeAiText`
13
+ */
@@ -0,0 +1,13 @@
1
+ import { string_markdown } from '../../types/typeAliases';
2
+ /**
3
+ * Change unprintable hard spaces to regular spaces
4
+ *
5
+ * Note: [🔂] This function is idempotent.
6
+ * Tip: If you want to do the full cleanup, look for `humanizeAiText` exported `@promptbook/markdown-utils`
7
+ *
8
+ * @public exported from `@promptbook/markdown-utils`
9
+ */
10
+ export declare function humanizeAiTextWhitespace(aiText: string_markdown): string_markdown;
11
+ /**
12
+ * Note: [🏂] This function is not tested by itself but together with other cleanup functions with `humanizeAiText`
13
+ */
@@ -7,3 +7,11 @@ import type { string_html } from '../../types/typeAliases';
7
7
  * @private withing the package because of HUGE size of prettier dependency
8
8
  */
9
9
  export declare function prettifyMarkdown<TContent extends string_html>(content: TContent): TContent;
10
+ /**
11
+ * Async version of prettifyMarkdown using dynamic imports
12
+ *
13
+ * @param content raw html code
14
+ * @returns formatted html code
15
+ * @private withing the package because of HUGE size of prettier dependency
16
+ */
17
+ export declare function prettifyMarkdownAsync<TContent extends string_html>(content: TContent): Promise<TContent>;
@@ -0,0 +1,12 @@
1
+ import { string_markdown } from '../../types/typeAliases';
2
+ /**
3
+ * Function `promptbookifyAiText` will slightly modify the text so we know it was processed by Promptbook
4
+ *
5
+ * @public exported from `@promptbook/markdown-utils`
6
+ */
7
+ export declare function promptbookifyAiText(text: string_markdown): string_markdown;
8
+ /**
9
+ * TODO: !!!!! Make the function idempotent and add "Note: [🔂] This function is idempotent."
10
+ * TODO: [🅾️]!!! Use this across the project where AI text is involved
11
+ * TODO: [🧠][✌️] Make some Promptbook-native token system
12
+ */
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Removes Markdown link tags from a string.
3
+ *
4
+ * @param {string} str - The string to remove Markdown tags from.
5
+ * @returns {string} The input string with all Markdown tags removed.
6
+ * @public exported from `@promptbook/markdown-utils`
7
+ */
8
+ export declare function removeMarkdownLinks(str: string): string;
9
+ /**
10
+ * @see https://chat.openai.com/chat/bb7c3a5b-fe9c-4ccc-9057-f47e0fd66489
11
+ */
@@ -0,0 +1,4 @@
1
+ export {};
2
+ /**
3
+ * @see https://chat.openai.com/chat/bb7c3a5b-fe9c-4ccc-9057-f47e0fd66489
4
+ */
@@ -1,6 +1,8 @@
1
1
  /**
2
2
  * Makes first letter of a string uppercase
3
3
  *
4
+ * Note: [🔂] This function is idempotent.
5
+ *
4
6
  * @public exported from `@promptbook/utils`
5
7
  */
6
8
  export declare function capitalize(word: string): string;
@@ -1,5 +1,7 @@
1
1
  /**
2
- * Makes first letter of a string uppercase
2
+ * Makes first letter of a string lowercase
3
+ *
4
+ * Note: [🔂] This function is idempotent.
3
5
  *
4
6
  * @public exported from `@promptbook/utils`
5
7
  */
@@ -9,6 +9,8 @@ export type string_SCREAMING_CASE = string;
9
9
  /**
10
10
  * Normalizes a text string to SCREAMING_CASE (all uppercase with underscores).
11
11
  *
12
+ * Note: [🔂] This function is idempotent.
13
+ *
12
14
  * @param text The text string to be converted to SCREAMING_CASE format.
13
15
  * @returns The normalized text in SCREAMING_CASE format.
14
16
  * @example 'HELLO_WORLD'
@@ -8,6 +8,8 @@ export type string_snake_case = string;
8
8
  /**
9
9
  * Normalizes a text string to snake_case format.
10
10
  *
11
+ * Note: [🔂] This function is idempotent.
12
+ *
11
13
  * @param text The text string to be converted to snake_case format.
12
14
  * @returns The normalized text in snake_case format.
13
15
  * @example 'hello_world'
@@ -1,6 +1,8 @@
1
1
  /**
2
2
  * Take every whitespace (space, new line, tab) and replace it with a single space
3
3
  *
4
+ * Note: [🔂] This function is idempotent.
5
+ *
4
6
  * @public exported from `@promptbook/utils`
5
7
  */
6
8
  export declare function normalizeWhitespaces(sentence: string): string;
@@ -1,6 +1,8 @@
1
1
  /**
2
2
  * Removes diacritic marks (accents) from characters in a string.
3
3
  *
4
+ * Note: [🔂] This function is idempotent.
5
+ *
4
6
  * @param input The string containing diacritics to be normalized.
5
7
  * @returns The string with diacritics removed or normalized.
6
8
  * @public exported from `@promptbook/utils`
@@ -1,6 +1,7 @@
1
1
  /**
2
2
  * Function parseNumber will parse number from string
3
3
  *
4
+ * Note: [🔂] This function is idempotent.
4
5
  * Unlike Number.parseInt, Number.parseFloat it will never ever result in NaN
5
6
  * Note: it also works only with decimal numbers
6
7
  *
@@ -1,6 +1,8 @@
1
1
  /**
2
2
  * Removes emojis from a string and fix whitespaces
3
3
  *
4
+ * Note: [🔂] This function is idempotent.
5
+ *
4
6
  * @param text with emojis
5
7
  * @returns text without emojis
6
8
  * @public exported from `@promptbook/utils`
@@ -1,6 +1,7 @@
1
1
  /**
2
2
  * Removes quotes from a string
3
3
  *
4
+ * Note: [🔂] This function is idempotent.
4
5
  * Tip: This is very useful for post-processing of the result of the LLM model
5
6
  * Note: This function removes only the same quotes from the beginning and the end of the string
6
7
  * Note: There are two similar functions:
@@ -2,6 +2,7 @@ import type { WritableDeep } from 'type-fest';
2
2
  /**
3
3
  * Creates a deep clone of the given object
4
4
  *
5
+ * Note: [🔂] This function is idempotent.
5
6
  * Note: This method only works for objects that are fully serializable to JSON and do not contain functions, Dates, or special types.
6
7
  *
7
8
  * @param objectValue The object to clone.
@@ -1,6 +1,7 @@
1
1
  /**
2
2
  * Function trimCodeBlock will trim starting and ending code block from the string if it is present.
3
3
  *
4
+ * Note: [🔂] This function is idempotent.
4
5
  * Note: This is useful for post-processing of the result of the chat LLM model
5
6
  * when the model wraps the result in the (markdown) code block.
6
7
  *
@@ -3,6 +3,7 @@ import type { really_unknown } from '../../organization/really_unknown';
3
3
  /**
4
4
  * Tests if given string is valid URL.
5
5
  *
6
+ * Note: [🔂] This function is idempotent.
6
7
  * Note: Dataurl are considered perfectly valid.
7
8
  * Note: There are two similar functions:
8
9
  * - `isValidUrl` which tests any URL
@@ -3,6 +3,8 @@ import type { really_unknown } from '../../organization/really_unknown';
3
3
  /**
4
4
  * Checks if value is valid uuid
5
5
  *
6
+ * Note: [🔂] This function is idempotent.
7
+ *
6
8
  * @public exported from `@promptbook/utils`
7
9
  */
8
10
  export declare function isValidUuid(value: really_unknown): value is string_uuid;
@@ -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.100.3-0`).
18
+ * It follows semantic versioning (e.g., `0.101.0-0`).
19
19
  *
20
20
  * @generated
21
21
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@promptbook/wizard",
3
- "version": "0.100.4-0",
3
+ "version": "0.101.0-1",
4
4
  "description": "Promptbook: Run AI apps in plain human language across multiple models and platforms",
5
5
  "private": false,
6
6
  "sideEffects": false,
@@ -95,7 +95,7 @@
95
95
  "module": "./esm/index.es.js",
96
96
  "typings": "./esm/typings/src/_packages/wizard.index.d.ts",
97
97
  "peerDependencies": {
98
- "@promptbook/core": "0.100.4-0"
98
+ "@promptbook/core": "0.101.0-1"
99
99
  },
100
100
  "dependencies": {
101
101
  "@ai-sdk/deepseek": "0.1.6",
package/umd/index.umd.js CHANGED
@@ -1,8 +1,8 @@
1
1
  (function (global, factory) {
2
- typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('spacetrim'), require('crypto'), require('socket.io-client'), require('@anthropic-ai/sdk'), require('bottleneck'), require('colors'), require('@azure/openai'), require('openai'), require('fs/promises'), require('child_process'), require('waitasecond'), require('crypto-js'), require('crypto-js/enc-hex'), require('path'), require('prettier/parser-html'), require('prettier/parser-markdown'), require('prettier/standalone'), require('rxjs'), require('crypto-js/sha256'), require('mime-types'), require('papaparse'), require('@mozilla/readability'), require('jsdom'), require('showdown'), require('dotenv'), require('jszip')) :
3
- typeof define === 'function' && define.amd ? define(['exports', 'spacetrim', 'crypto', 'socket.io-client', '@anthropic-ai/sdk', 'bottleneck', 'colors', '@azure/openai', 'openai', 'fs/promises', 'child_process', 'waitasecond', 'crypto-js', 'crypto-js/enc-hex', 'path', 'prettier/parser-html', 'prettier/parser-markdown', 'prettier/standalone', 'rxjs', 'crypto-js/sha256', 'mime-types', 'papaparse', '@mozilla/readability', 'jsdom', 'showdown', 'dotenv', 'jszip'], factory) :
4
- (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global["promptbook-wizard"] = {}, global.spaceTrim, global.crypto, global.socket_ioClient, global.Anthropic, global.Bottleneck, global.colors, global.openai, global.OpenAI, global.promises, global.child_process, global.waitasecond, global.cryptoJs, global.hexEncoder, global.path, global.parserHtml, global.parserMarkdown, global.standalone, global.rxjs, global.sha256, global.mimeTypes, global.papaparse, global.readability, global.jsdom, global.showdown, global.dotenv, global.JSZip));
5
- })(this, (function (exports, spaceTrim, crypto, socket_ioClient, Anthropic, Bottleneck, colors, openai, OpenAI, promises, child_process, waitasecond, cryptoJs, hexEncoder, path, parserHtml, parserMarkdown, standalone, rxjs, sha256, mimeTypes, papaparse, readability, jsdom, showdown, dotenv, JSZip) { 'use strict';
2
+ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('spacetrim'), require('crypto'), require('socket.io-client'), require('@anthropic-ai/sdk'), require('bottleneck'), require('colors'), require('@azure/openai'), require('openai'), require('fs/promises'), require('child_process'), require('waitasecond'), require('crypto-js'), require('crypto-js/enc-hex'), require('path'), require('rxjs'), require('crypto-js/sha256'), require('mime-types'), require('papaparse'), require('@mozilla/readability'), require('jsdom'), require('showdown'), require('dotenv'), require('jszip')) :
3
+ typeof define === 'function' && define.amd ? define(['exports', 'spacetrim', 'crypto', 'socket.io-client', '@anthropic-ai/sdk', 'bottleneck', 'colors', '@azure/openai', 'openai', 'fs/promises', 'child_process', 'waitasecond', 'crypto-js', 'crypto-js/enc-hex', 'path', 'rxjs', 'crypto-js/sha256', 'mime-types', 'papaparse', '@mozilla/readability', 'jsdom', 'showdown', 'dotenv', 'jszip'], factory) :
4
+ (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global["promptbook-wizard"] = {}, global.spaceTrim, global.crypto, global.socket_ioClient, global.Anthropic, global.Bottleneck, global.colors, global.openai, global.OpenAI, global.promises, global.child_process, global.waitasecond, global.cryptoJs, global.hexEncoder, global.path, global.rxjs, global.sha256, global.mimeTypes, global.papaparse, global.readability, global.jsdom, global.showdown, global.dotenv, global.JSZip));
5
+ })(this, (function (exports, spaceTrim, crypto, socket_ioClient, Anthropic, Bottleneck, colors, openai, OpenAI, promises, child_process, waitasecond, cryptoJs, hexEncoder, path, rxjs, sha256, mimeTypes, papaparse, readability, jsdom, showdown, dotenv, JSZip) { 'use strict';
6
6
 
7
7
  function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
8
8
 
@@ -30,8 +30,6 @@
30
30
  var colors__default = /*#__PURE__*/_interopDefaultLegacy(colors);
31
31
  var OpenAI__default = /*#__PURE__*/_interopDefaultLegacy(OpenAI);
32
32
  var hexEncoder__default = /*#__PURE__*/_interopDefaultLegacy(hexEncoder);
33
- var parserHtml__default = /*#__PURE__*/_interopDefaultLegacy(parserHtml);
34
- var parserMarkdown__default = /*#__PURE__*/_interopDefaultLegacy(parserMarkdown);
35
33
  var sha256__default = /*#__PURE__*/_interopDefaultLegacy(sha256);
36
34
  var dotenv__namespace = /*#__PURE__*/_interopNamespace(dotenv);
37
35
  var JSZip__default = /*#__PURE__*/_interopDefaultLegacy(JSZip);
@@ -50,7 +48,7 @@
50
48
  * @generated
51
49
  * @see https://github.com/webgptorg/promptbook
52
50
  */
53
- const PROMPTBOOK_ENGINE_VERSION = '0.100.4-0';
51
+ const PROMPTBOOK_ENGINE_VERSION = '0.101.0-1';
54
52
  /**
55
53
  * TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
56
54
  * Note: [💞] Ignore a discrepancy between file name and entity name
@@ -658,6 +656,7 @@
658
656
  /**
659
657
  * Creates a deep clone of the given object
660
658
  *
659
+ * Note: [🔂] This function is idempotent.
661
660
  * Note: This method only works for objects that are fully serializable to JSON and do not contain functions, Dates, or special types.
662
661
  *
663
662
  * @param objectValue The object to clone.
@@ -842,6 +841,8 @@
842
841
  /**
843
842
  * Normalizes a text string to SCREAMING_CASE (all uppercase with underscores).
844
843
  *
844
+ * Note: [🔂] This function is idempotent.
845
+ *
845
846
  * @param text The text string to be converted to SCREAMING_CASE format.
846
847
  * @returns The normalized text in SCREAMING_CASE format.
847
848
  * @example 'HELLO_WORLD'
@@ -897,6 +898,8 @@
897
898
  /**
898
899
  * Normalizes a text string to snake_case format.
899
900
  *
901
+ * Note: [🔂] This function is idempotent.
902
+ *
900
903
  * @param text The text string to be converted to snake_case format.
901
904
  * @returns The normalized text in snake_case format.
902
905
  * @example 'hello_world'
@@ -1412,13 +1415,14 @@
1412
1415
  };
1413
1416
  /**
1414
1417
  * TODO: Refactor this - each profile must be alongside the provider definition
1415
- * TODO: [🕛] Unite `AvatarProfileProps`, `ChatParticipant`, `LlmExecutionTools` + `LlmToolsMetadata`
1418
+ * TODO: [🕛] Unite `AgentBasicInformation`, `ChatParticipant`, `LlmExecutionTools` + `LlmToolsMetadata`
1416
1419
  * Note: [💞] Ignore a discrepancy between file name and entity name
1417
1420
  */
1418
1421
 
1419
1422
  /**
1420
1423
  * Tests if given string is valid URL.
1421
1424
  *
1425
+ * Note: [🔂] This function is idempotent.
1422
1426
  * Note: Dataurl are considered perfectly valid.
1423
1427
  * Note: There are two similar functions:
1424
1428
  * - `isValidUrl` which tests any URL
@@ -1986,6 +1990,7 @@
1986
1990
  }
1987
1991
  /**
1988
1992
  * TODO: [🥴] Implement counting in formats - like JSON, CSV, XML,...
1993
+ * TODO: [🧠][✌️] Make some Promptbook-native token system
1989
1994
  */
1990
1995
 
1991
1996
  /**
@@ -2020,6 +2025,7 @@
2020
2025
  }
2021
2026
  /**
2022
2027
  * TODO: [🥴] Implement counting in formats - like JSON, CSV, XML,...
2028
+ * TODO: [🧠][✌️] Make some Promptbook-native token system
2023
2029
  */
2024
2030
 
2025
2031
  /**
@@ -2034,6 +2040,7 @@
2034
2040
  }
2035
2041
  /**
2036
2042
  * TODO: [🥴] Implement counting in formats - like JSON, CSV, XML,...
2043
+ * TODO: [🧠][✌️] Make some Promptbook-native token system
2037
2044
  */
2038
2045
 
2039
2046
  /**
@@ -2046,6 +2053,7 @@
2046
2053
  }
2047
2054
  /**
2048
2055
  * TODO: [🥴] Implement counting in formats - like JSON, CSV, XML,...
2056
+ * TODO: [🧠][✌️] Make some Promptbook-native token system
2049
2057
  */
2050
2058
 
2051
2059
  /**
@@ -2066,6 +2074,7 @@
2066
2074
  }
2067
2075
  /**
2068
2076
  * TODO: [🥴] Implement counting in formats - like JSON, CSV, XML,...
2077
+ * TODO: [🧠][✌️] Make some Promptbook-native token system
2069
2078
  */
2070
2079
 
2071
2080
  const defaultDiacriticsRemovalMap = [
@@ -2315,6 +2324,8 @@
2315
2324
  /**
2316
2325
  * Removes diacritic marks (accents) from characters in a string.
2317
2326
  *
2327
+ * Note: [🔂] This function is idempotent.
2328
+ *
2318
2329
  * @param input The string containing diacritics to be normalized.
2319
2330
  * @returns The string with diacritics removed or normalized.
2320
2331
  * @public exported from `@promptbook/utils`
@@ -2343,6 +2354,8 @@
2343
2354
  }
2344
2355
  /**
2345
2356
  * TODO: [🥴] Implement counting in formats - like JSON, CSV, XML,...
2357
+ * TODO: [🧠][✌️] Make some Promptbook-native token system
2358
+ * TODO: [✌️] `countWords` should be just `splitWords(...).length`, and all other counters should use this pattern as well
2346
2359
  */
2347
2360
 
2348
2361
  /**
@@ -6214,6 +6227,8 @@
6214
6227
  /**
6215
6228
  * Removes emojis from a string and fix whitespaces
6216
6229
  *
6230
+ * Note: [🔂] This function is idempotent.
6231
+ *
6217
6232
  * @param text with emojis
6218
6233
  * @returns text without emojis
6219
6234
  * @public exported from `@promptbook/utils`
@@ -6465,10 +6480,20 @@
6465
6480
  * @private withing the package because of HUGE size of prettier dependency
6466
6481
  */
6467
6482
  function prettifyMarkdown(content) {
6483
+ // In browser/Next.js environments, just return the original content
6484
+ // since prettier parsers are not available and would cause bundling issues
6485
+ if (typeof window !== 'undefined') {
6486
+ return content;
6487
+ }
6468
6488
  try {
6469
- return standalone.format(content, {
6489
+ // Use dynamic require to avoid static imports that cause bundling issues
6490
+ // This will only work in Node.js environments
6491
+ const prettierStandalone = eval('require')('prettier/standalone');
6492
+ const parserMarkdown = eval('require')('prettier/parser-markdown');
6493
+ const parserHtml = eval('require')('prettier/parser-html');
6494
+ return prettierStandalone.format(content, {
6470
6495
  parser: 'markdown',
6471
- plugins: [parserMarkdown__default["default"], parserHtml__default["default"]],
6496
+ plugins: [parserMarkdown, parserHtml],
6472
6497
  // TODO: DRY - make some import or auto-copy of .prettierrc
6473
6498
  endOfLine: 'lf',
6474
6499
  tabWidth: 4,
@@ -6494,6 +6519,8 @@
6494
6519
  /**
6495
6520
  * Makes first letter of a string uppercase
6496
6521
  *
6522
+ * Note: [🔂] This function is idempotent.
6523
+ *
6497
6524
  * @public exported from `@promptbook/utils`
6498
6525
  */
6499
6526
  function capitalize(word) {
@@ -13045,7 +13072,9 @@
13045
13072
  */
13046
13073
 
13047
13074
  /**
13048
- * Makes first letter of a string uppercase
13075
+ * Makes first letter of a string lowercase
13076
+ *
13077
+ * Note: [🔂] This function is idempotent.
13049
13078
  *
13050
13079
  * @public exported from `@promptbook/utils`
13051
13080
  */
@@ -13115,6 +13144,8 @@
13115
13144
  /**
13116
13145
  * Take every whitespace (space, new line, tab) and replace it with a single space
13117
13146
  *
13147
+ * Note: [🔂] This function is idempotent.
13148
+ *
13118
13149
  * @public exported from `@promptbook/utils`
13119
13150
  */
13120
13151
  function normalizeWhitespaces(sentence) {
@@ -13124,6 +13155,7 @@
13124
13155
  /**
13125
13156
  * Function parseNumber will parse number from string
13126
13157
  *
13158
+ * Note: [🔂] This function is idempotent.
13127
13159
  * Unlike Number.parseInt, Number.parseFloat it will never ever result in NaN
13128
13160
  * Note: it also works only with decimal numbers
13129
13161
  *
@@ -13192,6 +13224,7 @@
13192
13224
  /**
13193
13225
  * Removes quotes from a string
13194
13226
  *
13227
+ * Note: [🔂] This function is idempotent.
13195
13228
  * Tip: This is very useful for post-processing of the result of the LLM model
13196
13229
  * Note: This function removes only the same quotes from the beginning and the end of the string
13197
13230
  * Note: There are two similar functions:
@@ -13215,6 +13248,7 @@
13215
13248
  /**
13216
13249
  * Function trimCodeBlock will trim starting and ending code block from the string if it is present.
13217
13250
  *
13251
+ * Note: [🔂] This function is idempotent.
13218
13252
  * Note: This is useful for post-processing of the result of the chat LLM model
13219
13253
  * when the model wraps the result in the (markdown) code block.
13220
13254
  *