@promptbook/node 0.101.0-0 → 0.101.0-2

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 (39) hide show
  1. package/README.md +49 -1
  2. package/esm/index.es.js +32 -6
  3. package/esm/index.es.js.map +1 -1
  4. package/esm/typings/src/_packages/components.index.d.ts +12 -0
  5. package/esm/typings/src/book-components/Chat/Chat/Chat.d.ts +0 -5
  6. package/esm/typings/src/book-components/Chat/Chat/ChatProps.d.ts +8 -2
  7. package/esm/typings/src/book-components/Chat/Chat/constants.d.ts +8 -0
  8. package/esm/typings/src/book-components/Chat/examples/ChatMarkdownDemo.d.ts +16 -0
  9. package/esm/typings/src/book-components/Chat/utils/renderMarkdown.d.ts +21 -0
  10. package/esm/typings/src/book-components/Chat/utils/renderMarkdown.test.d.ts +1 -0
  11. package/esm/typings/src/book-components/icons/ArrowIcon.d.ts +9 -0
  12. package/esm/typings/src/book-components/icons/ResetIcon.d.ts +6 -0
  13. package/esm/typings/src/book-components/icons/SendIcon.d.ts +8 -0
  14. package/esm/typings/src/book-components/icons/TemplateIcon.d.ts +8 -0
  15. package/esm/typings/src/utils/markdown/escapeMarkdownBlock.d.ts +2 -0
  16. package/esm/typings/src/utils/markdown/humanizeAiText.d.ts +1 -0
  17. package/esm/typings/src/utils/markdown/humanizeAiTextEllipsis.d.ts +1 -0
  18. package/esm/typings/src/utils/markdown/humanizeAiTextEmdashed.d.ts +1 -0
  19. package/esm/typings/src/utils/markdown/humanizeAiTextQuotes.d.ts +1 -0
  20. package/esm/typings/src/utils/markdown/humanizeAiTextWhitespace.d.ts +1 -0
  21. package/esm/typings/src/utils/markdown/prettifyMarkdown.d.ts +8 -0
  22. package/esm/typings/src/utils/markdown/promptbookifyAiText.d.ts +1 -0
  23. package/esm/typings/src/utils/normalization/capitalize.d.ts +2 -0
  24. package/esm/typings/src/utils/normalization/decapitalize.d.ts +3 -1
  25. package/esm/typings/src/utils/normalization/normalizeTo_SCREAMING_CASE.d.ts +2 -0
  26. package/esm/typings/src/utils/normalization/normalizeTo_snake_case.d.ts +2 -0
  27. package/esm/typings/src/utils/normalization/normalizeWhitespaces.d.ts +2 -0
  28. package/esm/typings/src/utils/normalization/removeDiacritics.d.ts +2 -0
  29. package/esm/typings/src/utils/parseNumber.d.ts +1 -0
  30. package/esm/typings/src/utils/removeEmojis.d.ts +2 -0
  31. package/esm/typings/src/utils/removeQuotes.d.ts +1 -0
  32. package/esm/typings/src/utils/serialization/deepClone.d.ts +1 -0
  33. package/esm/typings/src/utils/trimCodeBlock.d.ts +1 -0
  34. package/esm/typings/src/utils/validators/url/isValidUrl.d.ts +1 -0
  35. package/esm/typings/src/utils/validators/uuid/isValidUuid.d.ts +2 -0
  36. package/esm/typings/src/version.d.ts +1 -1
  37. package/package.json +2 -2
  38. package/umd/index.umd.js +37 -10
  39. package/umd/index.umd.js.map +1 -1
@@ -16,6 +16,12 @@ import { LlmChat } from '../book-components/Chat/LlmChat/LlmChat';
16
16
  import type { LlmChatProps } from '../book-components/Chat/LlmChat/LlmChatProps';
17
17
  import type { ChatMessage } from '../book-components/Chat/types/ChatMessage';
18
18
  import type { ChatParticipant } from '../book-components/Chat/types/ChatParticipant';
19
+ import { renderMarkdown } from '../book-components/Chat/utils/renderMarkdown';
20
+ import { isMarkdownContent } from '../book-components/Chat/utils/renderMarkdown';
21
+ import { ArrowIcon } from '../book-components/icons/ArrowIcon';
22
+ import { ResetIcon } from '../book-components/icons/ResetIcon';
23
+ import { SendIcon } from '../book-components/icons/SendIcon';
24
+ import { TemplateIcon } from '../book-components/icons/TemplateIcon';
19
25
  export { BOOK_LANGUAGE_VERSION, PROMPTBOOK_ENGINE_VERSION };
20
26
  export type { AvatarChipProps };
21
27
  export { AvatarChip };
@@ -34,3 +40,9 @@ export { LlmChat };
34
40
  export type { LlmChatProps };
35
41
  export type { ChatMessage };
36
42
  export type { ChatParticipant };
43
+ export { renderMarkdown };
44
+ export { isMarkdownContent };
45
+ export { ArrowIcon };
46
+ export { ResetIcon };
47
+ export { SendIcon };
48
+ export { TemplateIcon };
@@ -1,9 +1,4 @@
1
1
  import type { ChatProps } from './ChatProps';
2
- /**
3
- * @deprecated use `isComplete` instead
4
- * @private util of `<Chat />`
5
- */
6
- export declare const LOADING_INTERACTIVE_IMAGE = "Loading...";
7
2
  /**
8
3
  * Renders a chat with messages and input for new messages
9
4
  *
@@ -23,10 +23,16 @@ export type ChatProps = {
23
23
  * Called when user sends a message
24
24
  *
25
25
  * Note: You must handle the message yourself and add it to the `messages` array
26
+ *
27
+ * - When set, the send textarea and button will be shown
28
+ * - When undefined, the chat has no input and is read-only showing only the messages
26
29
  */
27
- onMessage(messageContent: string): Promisable<void>;
30
+ onMessage?(messageContent: string): Promisable<void>;
28
31
  /**
29
- * Optional callback, when set, button for resetting chat will be shown
32
+ * Optional callback
33
+ *
34
+ * - When set, button for resetting chat will be shown
35
+ * - When undefined, no reset button will be shown
30
36
  */
31
37
  onReset?(): Promisable<void>;
32
38
  /**
@@ -0,0 +1,8 @@
1
+ /**
2
+ * @deprecated use `isComplete` instead
3
+ * @private util of `<Chat />`
4
+ */
5
+ export declare const LOADING_INTERACTIVE_IMAGE = "Loading...";
6
+ /**
7
+ * Note: [💞] Ignore a discrepancy between file name and entity name
8
+ */
@@ -0,0 +1,16 @@
1
+ /**
2
+ * Demo component showing Chat with markdown rendering capabilities
3
+ *
4
+ * This example demonstrates various markdown features supported by the Chat component:
5
+ * - Headers
6
+ * - Bold and italic text
7
+ * - Code blocks and inline code
8
+ * - Lists (ordered and unordered)
9
+ * - Links
10
+ * - Blockquotes
11
+ * - Tables
12
+ * - Strikethrough text
13
+ *
14
+ * @private temporary for testing purposes
15
+ */
16
+ export declare function ChatMarkdownDemo(): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,21 @@
1
+ import type { string_html, string_markdown } from '../../../types/typeAliases';
2
+ /**
3
+ * Convert markdown content to HTML for display in chat messages
4
+ *
5
+ * @param markdown - The markdown content to convert
6
+ * @returns HTML string ready for rendering
7
+ *
8
+ * @public exported from `@promptbook/components`
9
+ * <- TODO: [🧠] Maybe export from `@promptbook/markdown-utils`
10
+ */
11
+ export declare function renderMarkdown(markdown: string_markdown): string_html;
12
+ /**
13
+ * Check if content appears to be markdown (contains markdown syntax)
14
+ *
15
+ * @param content - Content to check
16
+ * @returns true if content appears to contain markdown syntax
17
+ *
18
+ * @public exported from `@promptbook/components`
19
+ * <- TODO: [🧠] Maybe export from `@promptbook/markdown-utils`
20
+ */
21
+ export declare function isMarkdownContent(content: string): boolean;
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Shows simple arrow icon pointing up or down
3
+ *
4
+ * @public exported from `@promptbook/components`
5
+ */
6
+ export declare const ArrowIcon: ({ direction, size }: {
7
+ direction: string;
8
+ size: number;
9
+ }) => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Shows simple reset icon
3
+ *
4
+ * @public exported from `@promptbook/components`
5
+ */
6
+ export declare const ResetIcon: () => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Shows simple send icon
3
+ *
4
+ * @public exported from `@promptbook/components`
5
+ */
6
+ export declare const SendIcon: ({ size }: {
7
+ size: number;
8
+ }) => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Shows simple template icon
3
+ *
4
+ * @public exported from `@promptbook/components`
5
+ */
6
+ export declare const TemplateIcon: ({ size }: {
7
+ size: number;
8
+ }) => import("react/jsx-runtime").JSX.Element;
@@ -3,6 +3,8 @@ import type { string_markdown_text } from '../../types/typeAliases';
3
3
  * Function escapeMarkdownBlock will escape markdown block if needed
4
4
  * It is useful when you want have block in block
5
5
  *
6
+ * Note: [🔂] This function is idempotent.
7
+ *
6
8
  * @public exported from `@promptbook/markdown-utils`
7
9
  */
8
10
  export declare function escapeMarkdownBlock(value: string_markdown_text): string_markdown_text;
@@ -2,6 +2,7 @@ import { string_markdown } from '../../types/typeAliases';
2
2
  /**
3
3
  * Function `humanizeAiText` will remove traces of AI text generation artifacts
4
4
  *
5
+ * Note: [🔂] This function is idempotent.
5
6
  * Tip: If you want more control, look for other functions for example `humanizeAiTextEmdashed` exported `@promptbook/markdown-utils`
6
7
  *
7
8
  * @public exported from `@promptbook/markdown-utils`
@@ -2,6 +2,7 @@ import { string_markdown } from '../../types/typeAliases';
2
2
  /**
3
3
  * Change ellipsis character to three dots `…` -> `...`
4
4
  *
5
+ * Note: [🔂] This function is idempotent.
5
6
  * Tip: If you want to do the full cleanup, look for `humanizeAiText` exported `@promptbook/markdown-utils`
6
7
  *
7
8
  * @public exported from `@promptbook/markdown-utils`
@@ -2,6 +2,7 @@ import { string_markdown } from '../../types/typeAliases';
2
2
  /**
3
3
  * Change em-dashes to regular dashes `—` -> `-`
4
4
  *
5
+ * Note: [🔂] This function is idempotent.
5
6
  * Tip: If you want to do the full cleanup, look for `humanizeAiText` exported `@promptbook/markdown-utils`
6
7
  *
7
8
  * @public exported from `@promptbook/markdown-utils`
@@ -2,6 +2,7 @@ import { string_markdown } from '../../types/typeAliases';
2
2
  /**
3
3
  * Change smart quotes to regular quotes
4
4
  *
5
+ * Note: [🔂] This function is idempotent.
5
6
  * Tip: If you want to do the full cleanup, look for `humanizeAiText` exported `@promptbook/markdown-utils`
6
7
  *
7
8
  * @public exported from `@promptbook/markdown-utils`
@@ -2,6 +2,7 @@ import { string_markdown } from '../../types/typeAliases';
2
2
  /**
3
3
  * Change unprintable hard spaces to regular spaces
4
4
  *
5
+ * Note: [🔂] This function is idempotent.
5
6
  * Tip: If you want to do the full cleanup, look for `humanizeAiText` exported `@promptbook/markdown-utils`
6
7
  *
7
8
  * @public exported from `@promptbook/markdown-utils`
@@ -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>;
@@ -6,6 +6,7 @@ import { string_markdown } from '../../types/typeAliases';
6
6
  */
7
7
  export declare function promptbookifyAiText(text: string_markdown): string_markdown;
8
8
  /**
9
+ * TODO: !!!!! Make the function idempotent and add "Note: [🔂] This function is idempotent."
9
10
  * TODO: [🅾️]!!! Use this across the project where AI text is involved
10
11
  * TODO: [🧠][✌️] Make some Promptbook-native token system
11
12
  */
@@ -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.4-0`).
18
+ * It follows semantic versioning (e.g., `0.101.0-1`).
19
19
  *
20
20
  * @generated
21
21
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@promptbook/node",
3
- "version": "0.101.0-0",
3
+ "version": "0.101.0-2",
4
4
  "description": "Promptbook: Run AI apps in plain human language across multiple models and platforms",
5
5
  "private": false,
6
6
  "sideEffects": false,
@@ -93,7 +93,7 @@
93
93
  "module": "./esm/index.es.js",
94
94
  "typings": "./esm/typings/src/_packages/node.index.d.ts",
95
95
  "peerDependencies": {
96
- "@promptbook/core": "0.101.0-0"
96
+ "@promptbook/core": "0.101.0-2"
97
97
  },
98
98
  "dependencies": {
99
99
  "colors": "1.4.0",
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('colors'), require('fs/promises'), require('path'), require('spacetrim'), require('jszip'), require('prettier/parser-html'), require('prettier/parser-markdown'), require('prettier/standalone'), require('crypto'), require('rxjs'), require('waitasecond'), require('papaparse'), require('crypto-js/enc-hex'), require('crypto-js/sha256'), require('crypto-js'), require('mime-types'), require('child_process'), require('dotenv')) :
3
- typeof define === 'function' && define.amd ? define(['exports', 'colors', 'fs/promises', 'path', 'spacetrim', 'jszip', 'prettier/parser-html', 'prettier/parser-markdown', 'prettier/standalone', 'crypto', 'rxjs', 'waitasecond', 'papaparse', 'crypto-js/enc-hex', 'crypto-js/sha256', 'crypto-js', 'mime-types', 'child_process', 'dotenv'], factory) :
4
- (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global["promptbook-node"] = {}, global.colors, global.promises, global.path, global.spaceTrim, global.JSZip, global.parserHtml, global.parserMarkdown, global.standalone, global.crypto, global.rxjs, global.waitasecond, global.papaparse, global.hexEncoder, global.sha256, global.cryptoJs, global.mimeTypes, global.child_process, global.dotenv));
5
- })(this, (function (exports, colors, promises, path, spaceTrim, JSZip, parserHtml, parserMarkdown, standalone, crypto, rxjs, waitasecond, papaparse, hexEncoder, sha256, cryptoJs, mimeTypes, child_process, dotenv) { 'use strict';
2
+ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('colors'), require('fs/promises'), require('path'), require('spacetrim'), require('jszip'), require('crypto'), require('rxjs'), require('waitasecond'), require('papaparse'), require('crypto-js/enc-hex'), require('crypto-js/sha256'), require('crypto-js'), require('mime-types'), require('child_process'), require('dotenv')) :
3
+ typeof define === 'function' && define.amd ? define(['exports', 'colors', 'fs/promises', 'path', 'spacetrim', 'jszip', 'crypto', 'rxjs', 'waitasecond', 'papaparse', 'crypto-js/enc-hex', 'crypto-js/sha256', 'crypto-js', 'mime-types', 'child_process', 'dotenv'], factory) :
4
+ (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global["promptbook-node"] = {}, global.colors, global.promises, global.path, global.spaceTrim, global.JSZip, global.crypto, global.rxjs, global.waitasecond, global.papaparse, global.hexEncoder, global.sha256, global.cryptoJs, global.mimeTypes, global.child_process, global.dotenv));
5
+ })(this, (function (exports, colors, promises, path, spaceTrim, JSZip, crypto, rxjs, waitasecond, papaparse, hexEncoder, sha256, cryptoJs, mimeTypes, child_process, dotenv) { 'use strict';
6
6
 
7
7
  function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
8
8
 
@@ -27,8 +27,6 @@
27
27
  var colors__default = /*#__PURE__*/_interopDefaultLegacy(colors);
28
28
  var spaceTrim__default = /*#__PURE__*/_interopDefaultLegacy(spaceTrim);
29
29
  var JSZip__default = /*#__PURE__*/_interopDefaultLegacy(JSZip);
30
- var parserHtml__default = /*#__PURE__*/_interopDefaultLegacy(parserHtml);
31
- var parserMarkdown__default = /*#__PURE__*/_interopDefaultLegacy(parserMarkdown);
32
30
  var hexEncoder__default = /*#__PURE__*/_interopDefaultLegacy(hexEncoder);
33
31
  var sha256__default = /*#__PURE__*/_interopDefaultLegacy(sha256);
34
32
  var dotenv__namespace = /*#__PURE__*/_interopNamespace(dotenv);
@@ -47,7 +45,7 @@
47
45
  * @generated
48
46
  * @see https://github.com/webgptorg/promptbook
49
47
  */
50
- const PROMPTBOOK_ENGINE_VERSION = '0.101.0-0';
48
+ const PROMPTBOOK_ENGINE_VERSION = '0.101.0-2';
51
49
  /**
52
50
  * TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
53
51
  * Note: [💞] Ignore a discrepancy between file name and entity name
@@ -611,6 +609,7 @@
611
609
  /**
612
610
  * Creates a deep clone of the given object
613
611
  *
612
+ * Note: [🔂] This function is idempotent.
614
613
  * Note: This method only works for objects that are fully serializable to JSON and do not contain functions, Dates, or special types.
615
614
  *
616
615
  * @param objectValue The object to clone.
@@ -805,6 +804,7 @@
805
804
  /**
806
805
  * Tests if given string is valid URL.
807
806
  *
807
+ * Note: [🔂] This function is idempotent.
808
808
  * Note: Dataurl are considered perfectly valid.
809
809
  * Note: There are two similar functions:
810
810
  * - `isValidUrl` which tests any URL
@@ -1315,10 +1315,20 @@
1315
1315
  * @private withing the package because of HUGE size of prettier dependency
1316
1316
  */
1317
1317
  function prettifyMarkdown(content) {
1318
+ // In browser/Next.js environments, just return the original content
1319
+ // since prettier parsers are not available and would cause bundling issues
1320
+ if (typeof window !== 'undefined') {
1321
+ return content;
1322
+ }
1318
1323
  try {
1319
- return standalone.format(content, {
1324
+ // Use dynamic require to avoid static imports that cause bundling issues
1325
+ // This will only work in Node.js environments
1326
+ const prettierStandalone = eval('require')('prettier/standalone');
1327
+ const parserMarkdown = eval('require')('prettier/parser-markdown');
1328
+ const parserHtml = eval('require')('prettier/parser-html');
1329
+ return prettierStandalone.format(content, {
1320
1330
  parser: 'markdown',
1321
- plugins: [parserMarkdown__default["default"], parserHtml__default["default"]],
1331
+ plugins: [parserMarkdown, parserHtml],
1322
1332
  // TODO: DRY - make some import or auto-copy of .prettierrc
1323
1333
  endOfLine: 'lf',
1324
1334
  tabWidth: 4,
@@ -1344,6 +1354,8 @@
1344
1354
  /**
1345
1355
  * Makes first letter of a string uppercase
1346
1356
  *
1357
+ * Note: [🔂] This function is idempotent.
1358
+ *
1347
1359
  * @public exported from `@promptbook/utils`
1348
1360
  */
1349
1361
  function capitalize(word) {
@@ -3847,6 +3859,8 @@
3847
3859
  /**
3848
3860
  * Removes diacritic marks (accents) from characters in a string.
3849
3861
  *
3862
+ * Note: [🔂] This function is idempotent.
3863
+ *
3850
3864
  * @param input The string containing diacritics to be normalized.
3851
3865
  * @returns The string with diacritics removed or normalized.
3852
3866
  * @public exported from `@promptbook/utils`
@@ -5376,6 +5390,8 @@
5376
5390
  /**
5377
5391
  * Normalizes a text string to SCREAMING_CASE (all uppercase with underscores).
5378
5392
  *
5393
+ * Note: [🔂] This function is idempotent.
5394
+ *
5379
5395
  * @param text The text string to be converted to SCREAMING_CASE format.
5380
5396
  * @returns The normalized text in SCREAMING_CASE format.
5381
5397
  * @example 'HELLO_WORLD'
@@ -5431,6 +5447,8 @@
5431
5447
  /**
5432
5448
  * Normalizes a text string to snake_case format.
5433
5449
  *
5450
+ * Note: [🔂] This function is idempotent.
5451
+ *
5434
5452
  * @param text The text string to be converted to snake_case format.
5435
5453
  * @returns The normalized text in snake_case format.
5436
5454
  * @example 'hello_world'
@@ -5741,6 +5759,8 @@
5741
5759
  /**
5742
5760
  * Removes emojis from a string and fix whitespaces
5743
5761
  *
5762
+ * Note: [🔂] This function is idempotent.
5763
+ *
5744
5764
  * @param text with emojis
5745
5765
  * @returns text without emojis
5746
5766
  * @public exported from `@promptbook/utils`
@@ -6830,6 +6850,7 @@
6830
6850
  /**
6831
6851
  * Function parseNumber will parse number from string
6832
6852
  *
6853
+ * Note: [🔂] This function is idempotent.
6833
6854
  * Unlike Number.parseInt, Number.parseFloat it will never ever result in NaN
6834
6855
  * Note: it also works only with decimal numbers
6835
6856
  *
@@ -7092,6 +7113,7 @@
7092
7113
  /**
7093
7114
  * Removes quotes from a string
7094
7115
  *
7116
+ * Note: [🔂] This function is idempotent.
7095
7117
  * Tip: This is very useful for post-processing of the result of the LLM model
7096
7118
  * Note: This function removes only the same quotes from the beginning and the end of the string
7097
7119
  * Note: There are two similar functions:
@@ -10714,7 +10736,9 @@
10714
10736
  */
10715
10737
 
10716
10738
  /**
10717
- * Makes first letter of a string uppercase
10739
+ * Makes first letter of a string lowercase
10740
+ *
10741
+ * Note: [🔂] This function is idempotent.
10718
10742
  *
10719
10743
  * @public exported from `@promptbook/utils`
10720
10744
  */
@@ -10784,6 +10808,8 @@
10784
10808
  /**
10785
10809
  * Take every whitespace (space, new line, tab) and replace it with a single space
10786
10810
  *
10811
+ * Note: [🔂] This function is idempotent.
10812
+ *
10787
10813
  * @public exported from `@promptbook/utils`
10788
10814
  */
10789
10815
  function normalizeWhitespaces(sentence) {
@@ -10827,6 +10853,7 @@
10827
10853
  /**
10828
10854
  * Function trimCodeBlock will trim starting and ending code block from the string if it is present.
10829
10855
  *
10856
+ * Note: [🔂] This function is idempotent.
10830
10857
  * Note: This is useful for post-processing of the result of the chat LLM model
10831
10858
  * when the model wraps the result in the (markdown) code block.
10832
10859
  *