@promptbook/fake-llm 0.102.0-0 → 0.102.0-10

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 (117) hide show
  1. package/esm/index.es.js +58 -88
  2. package/esm/index.es.js.map +1 -1
  3. package/esm/typings/books/index.d.ts +81 -0
  4. package/esm/typings/src/_packages/components.index.d.ts +42 -22
  5. package/esm/typings/src/_packages/markdown-utils.index.d.ts +4 -0
  6. package/esm/typings/src/_packages/types.index.d.ts +18 -14
  7. package/esm/typings/src/_packages/utils.index.d.ts +12 -14
  8. package/esm/typings/src/book-2.0/agent-source/createAgentModelRequirements.d.ts +1 -1
  9. package/esm/typings/src/book-2.0/utils/generateGravatarUrl.d.ts +1 -1
  10. package/esm/typings/src/book-2.0/utils/generatePlaceholderAgentProfileImageUrl.d.ts +1 -1
  11. package/esm/typings/src/book-components/BookEditor/BookEditor.d.ts +1 -1
  12. package/esm/typings/src/book-components/BookEditor/BookEditorInner.d.ts +1 -1
  13. package/esm/typings/src/book-components/Chat/Chat/Chat.d.ts +1 -5
  14. package/esm/typings/src/book-components/Chat/Chat/ChatMessageItem.d.ts +35 -0
  15. package/esm/typings/src/book-components/Chat/Chat/ChatProps.d.ts +29 -7
  16. package/esm/typings/src/book-components/Chat/Chat/constants.d.ts +7 -0
  17. package/esm/typings/src/book-components/Chat/LlmChat/LlmChatProps.d.ts +19 -1
  18. package/esm/typings/src/book-components/{AvatarProfile/AvatarProfile → Chat/MockedChat}/MockedChat.d.ts +26 -9
  19. package/esm/typings/src/book-components/Chat/MockedChat/constants.d.ts +42 -0
  20. package/esm/typings/src/book-components/Chat/save/_common/ChatSaveFormatDefinition.d.ts +13 -0
  21. package/esm/typings/src/book-components/Chat/save/_common/getChatSaveFormatDefinitions.d.ts +8 -0
  22. package/esm/typings/src/book-components/Chat/save/_common/string_chat_format_name.d.ts +6 -0
  23. package/esm/typings/src/book-components/Chat/save/html/htmlSaveFormatDefinition.d.ts +12 -0
  24. package/esm/typings/src/book-components/Chat/save/index.d.ts +39 -0
  25. package/esm/typings/src/book-components/Chat/save/json/jsonSaveFormatDefinition.d.ts +12 -0
  26. package/esm/typings/src/book-components/Chat/save/markdown/mdSaveFormatDefinition.d.ts +12 -0
  27. package/esm/typings/src/book-components/Chat/save/pdf/pdfSaveFormatDefinition.d.ts +12 -0
  28. package/esm/typings/src/book-components/Chat/save/text/txtSaveFormatDefinition.d.ts +12 -0
  29. package/esm/typings/src/book-components/Chat/types/ChatMessage.d.ts +31 -5
  30. package/esm/typings/src/book-components/Chat/types/ChatParticipant.d.ts +3 -3
  31. package/esm/typings/src/book-components/Chat/utils/exportChatHistory.d.ts +3 -0
  32. package/esm/typings/src/book-components/icons/AttachmentIcon.d.ts +11 -0
  33. package/esm/typings/src/book-components/icons/CloseIcon.d.ts +11 -0
  34. package/esm/typings/src/execution/LlmExecutionToolsConstructor.d.ts +1 -1
  35. package/esm/typings/src/execution/execution-report/countWorkingDuration.d.ts +1 -1
  36. package/esm/typings/src/llm-providers/_common/register/$llmToolsMetadataRegister.d.ts +1 -1
  37. package/esm/typings/src/llm-providers/_common/register/$llmToolsRegister.d.ts +1 -1
  38. package/esm/typings/src/llm-providers/_common/register/$registeredLlmToolsMessage.d.ts +1 -2
  39. package/esm/typings/src/llm-providers/_common/register/LlmToolsConfiguration.d.ts +1 -1
  40. package/esm/typings/src/llm-providers/_common/register/LlmToolsMetadata.d.ts +1 -1
  41. package/esm/typings/src/llm-providers/_multiple/joinLlmExecutionTools.d.ts +1 -1
  42. package/esm/typings/src/llm-providers/agent/register-configuration.d.ts +1 -1
  43. package/esm/typings/src/llm-providers/agent/register-constructor.d.ts +1 -1
  44. package/esm/typings/src/llm-providers/anthropic-claude/register-configuration.d.ts +1 -1
  45. package/esm/typings/src/llm-providers/anthropic-claude/register-constructor.d.ts +1 -1
  46. package/esm/typings/src/llm-providers/azure-openai/register-configuration.d.ts +1 -1
  47. package/esm/typings/src/llm-providers/azure-openai/register-constructor.d.ts +1 -1
  48. package/esm/typings/src/llm-providers/deepseek/register-configuration.d.ts +1 -1
  49. package/esm/typings/src/llm-providers/deepseek/register-constructor.d.ts +1 -1
  50. package/esm/typings/src/llm-providers/google/register-configuration.d.ts +1 -1
  51. package/esm/typings/src/llm-providers/google/register-constructor.d.ts +1 -1
  52. package/esm/typings/src/llm-providers/ollama/register-configuration.d.ts +1 -1
  53. package/esm/typings/src/llm-providers/ollama/register-constructor.d.ts +1 -1
  54. package/esm/typings/src/llm-providers/openai/OpenAiAssistantExecutionTools.d.ts +1 -3
  55. package/esm/typings/src/llm-providers/openai/OpenAiCompatibleExecutionTools.d.ts +5 -5
  56. package/esm/typings/src/llm-providers/openai/register-configuration.d.ts +1 -1
  57. package/esm/typings/src/llm-providers/openai/register-constructor.d.ts +1 -1
  58. package/esm/typings/src/remote-server/types/RemoteServerOptions.d.ts +6 -0
  59. package/esm/typings/src/remote-server/ui/ServerApp.d.ts +13 -0
  60. package/esm/typings/src/remote-server/ui/renderServerIndexHtml.d.ts +7 -0
  61. package/esm/typings/src/remote-server/ui/types.d.ts +16 -0
  62. package/esm/typings/src/scrapers/_boilerplate/register-constructor.d.ts +1 -1
  63. package/esm/typings/src/scrapers/_boilerplate/register-metadata.d.ts +1 -1
  64. package/esm/typings/src/scrapers/_common/register/$scrapersMetadataRegister.d.ts +1 -1
  65. package/esm/typings/src/scrapers/_common/register/$scrapersRegister.d.ts +1 -1
  66. package/esm/typings/src/scrapers/_common/register/ScraperAndConverterMetadata.d.ts +2 -4
  67. package/esm/typings/src/scrapers/_common/register/ScraperConstructor.d.ts +1 -1
  68. package/esm/typings/src/scrapers/document/register-constructor.d.ts +1 -1
  69. package/esm/typings/src/scrapers/document/register-metadata.d.ts +1 -1
  70. package/esm/typings/src/scrapers/document-legacy/register-constructor.d.ts +1 -1
  71. package/esm/typings/src/scrapers/document-legacy/register-metadata.d.ts +1 -1
  72. package/esm/typings/src/scrapers/markdown/register-constructor.d.ts +1 -1
  73. package/esm/typings/src/scrapers/markdown/register-metadata.d.ts +1 -1
  74. package/esm/typings/src/scrapers/markitdown/register-constructor.d.ts +1 -1
  75. package/esm/typings/src/scrapers/markitdown/register-metadata.d.ts +1 -1
  76. package/esm/typings/src/scrapers/pdf/register-constructor.d.ts +1 -1
  77. package/esm/typings/src/scrapers/pdf/register-metadata.d.ts +1 -1
  78. package/esm/typings/src/scrapers/website/register-constructor.d.ts +1 -1
  79. package/esm/typings/src/scrapers/website/register-metadata.d.ts +1 -1
  80. package/esm/typings/src/scripting/javascript/postprocessing-functions.d.ts +6 -6
  81. package/esm/typings/src/types/Prompt.d.ts +5 -0
  82. package/esm/typings/src/utils/markdown/createMarkdownChart.d.ts +1 -1
  83. package/esm/typings/src/utils/markdown/humanizeAiText.d.ts +1 -1
  84. package/esm/typings/src/utils/markdown/humanizeAiTextEllipsis.d.ts +1 -1
  85. package/esm/typings/src/utils/markdown/humanizeAiTextEmdashed.d.ts +1 -1
  86. package/esm/typings/src/utils/markdown/humanizeAiTextQuotes.d.ts +1 -1
  87. package/esm/typings/src/utils/markdown/humanizeAiTextWhitespace.d.ts +1 -1
  88. package/esm/typings/src/utils/markdown/prettifyMarkdown.d.ts +2 -0
  89. package/esm/typings/src/utils/markdown/promptbookifyAiText.d.ts +1 -1
  90. package/esm/typings/src/utils/{trimCodeBlock.d.ts → markdown/trimCodeBlock.d.ts} +1 -1
  91. package/esm/typings/src/utils/{trimEndOfCodeBlock.d.ts → markdown/trimEndOfCodeBlock.d.ts} +1 -1
  92. package/esm/typings/src/utils/{$Register.d.ts → misc/$Register.d.ts} +2 -2
  93. package/esm/typings/src/utils/{$getCurrentDate.d.ts → misc/$getCurrentDate.d.ts} +1 -1
  94. package/esm/typings/src/utils/{arrayableToArray.d.ts → misc/arrayableToArray.d.ts} +1 -1
  95. package/esm/typings/src/utils/misc/debounce.d.ts +5 -0
  96. package/esm/typings/src/utils/{emojis.d.ts → misc/emojis.d.ts} +1 -1
  97. package/esm/typings/src/utils/misc/injectCssModuleIntoShadowRoot.d.ts +20 -0
  98. package/esm/typings/src/version.d.ts +1 -1
  99. package/package.json +2 -2
  100. package/umd/index.umd.js +58 -88
  101. package/umd/index.umd.js.map +1 -1
  102. package/esm/typings/src/book-components/AvatarProfile/AvatarProfile/index.d.ts +0 -3
  103. package/esm/typings/src/book-components/BookEditor/injectCssModuleIntoShadowRoot.d.ts +0 -11
  104. package/esm/typings/src/book-components/Chat/utils/savePlugins.d.ts +0 -55
  105. /package/esm/typings/src/{utils/arrayableToArray.test.d.ts → book-2.0/agent-source/createAgentModelRequirementsWithCommitments.delete.test.d.ts} +0 -0
  106. /package/esm/typings/src/utils/{trimCodeBlock.test.d.ts → markdown/trimCodeBlock.test.d.ts} +0 -0
  107. /package/esm/typings/src/utils/{trimEndOfCodeBlock.test.d.ts → markdown/trimEndOfCodeBlock.test.d.ts} +0 -0
  108. /package/esm/typings/src/utils/{FromtoItems.d.ts → misc/FromtoItems.d.ts} +0 -0
  109. /package/esm/typings/src/utils/{markdown/prettifyMarkdown.test.d.ts → misc/arrayableToArray.test.d.ts} +0 -0
  110. /package/esm/typings/src/utils/{parseNumber.d.ts → misc/parseNumber.d.ts} +0 -0
  111. /package/esm/typings/src/utils/{parseNumber.test.d.ts → misc/parseNumber.test.d.ts} +0 -0
  112. /package/esm/typings/src/utils/{removeEmojis.d.ts → normalization/removeEmojis.d.ts} +0 -0
  113. /package/esm/typings/src/utils/{removeEmojis.test.d.ts → normalization/removeEmojis.test.d.ts} +0 -0
  114. /package/esm/typings/src/utils/{removeQuotes.d.ts → normalization/removeQuotes.d.ts} +0 -0
  115. /package/esm/typings/src/utils/{removeQuotes.test.d.ts → normalization/removeQuotes.test.d.ts} +0 -0
  116. /package/esm/typings/src/utils/{unwrapResult.d.ts → normalization/unwrapResult.d.ts} +0 -0
  117. /package/esm/typings/src/utils/{unwrapResult.test.d.ts → normalization/unwrapResult.test.d.ts} +0 -0
@@ -1,4 +1,4 @@
1
- import type { Registration } from '../../utils/$Register';
1
+ import type { Registration } from '../../utils/misc/$Register';
2
2
  /**
3
3
  * Metadata of the scraper
4
4
  *
@@ -1,22 +1,22 @@
1
1
  import spaceTrim from 'spacetrim';
2
2
  import { extractBlock } from '../../postprocessing/utils/extractBlock';
3
3
  import { prettifyMarkdown } from '../../utils/markdown/prettifyMarkdown';
4
+ import { trimCodeBlock } from '../../utils/markdown/trimCodeBlock';
5
+ import { trimEndOfCodeBlock } from '../../utils/markdown/trimEndOfCodeBlock';
4
6
  import { capitalize } from '../../utils/normalization/capitalize';
5
7
  import { decapitalize } from '../../utils/normalization/decapitalize';
6
8
  import { nameToUriPart } from '../../utils/normalization/nameToUriPart';
7
9
  import { nameToUriParts } from '../../utils/normalization/nameToUriParts';
8
10
  import { normalizeToKebabCase } from '../../utils/normalization/normalize-to-kebab-case';
11
+ import { normalizeTo_camelCase } from '../../utils/normalization/normalizeTo_camelCase';
9
12
  import { normalizeTo_PascalCase } from '../../utils/normalization/normalizeTo_PascalCase';
10
13
  import { normalizeTo_SCREAMING_CASE } from '../../utils/normalization/normalizeTo_SCREAMING_CASE';
11
- import { normalizeTo_camelCase } from '../../utils/normalization/normalizeTo_camelCase';
12
14
  import { normalizeTo_snake_case } from '../../utils/normalization/normalizeTo_snake_case';
13
15
  import { normalizeWhitespaces } from '../../utils/normalization/normalizeWhitespaces';
14
16
  import { removeDiacritics } from '../../utils/normalization/removeDiacritics';
15
- import { removeEmojis } from '../../utils/removeEmojis';
16
- import { removeQuotes } from '../../utils/removeQuotes';
17
- import { trimCodeBlock } from '../../utils/trimCodeBlock';
18
- import { trimEndOfCodeBlock } from '../../utils/trimEndOfCodeBlock';
19
- import { unwrapResult } from '../../utils/unwrapResult';
17
+ import { removeEmojis } from '../../utils/normalization/removeEmojis';
18
+ import { removeQuotes } from '../../utils/normalization/removeQuotes';
19
+ import { unwrapResult } from '../../utils/normalization/unwrapResult';
20
20
  /**
21
21
  * Collection of utility functions that can be used for post-processing model outputs.
22
22
  * These functions help transform, extract, or format the raw model responses.
@@ -1,4 +1,5 @@
1
1
  import type { FormatCommand } from '../commands/FORMAT/FormatCommand';
2
+ import type { ChatMessage } from '../book-components/Chat/types/ChatMessage';
2
3
  import type { Expectations } from '../pipeline/PipelineJson/Expectations';
3
4
  import type { ChatModelRequirements } from './ModelRequirements';
4
5
  import type { CompletionModelRequirements } from './ModelRequirements';
@@ -38,6 +39,10 @@ export type ChatPrompt = CommonPrompt & {
38
39
  * Requirements for chat model
39
40
  */
40
41
  modelRequirements: ChatModelRequirements;
42
+ /**
43
+ * Optional chat thread (history of previous messages)
44
+ */
45
+ thread?: ChatMessage[];
41
46
  };
42
47
  /**
43
48
  * Embedding prompt
@@ -1,5 +1,5 @@
1
1
  import type { string_markdown } from '../../types/typeAliases';
2
- import type { FromtoItems } from '../FromtoItems';
2
+ import type { FromtoItems } from '../misc/FromtoItems';
3
3
  /**
4
4
  * Options for `CreateMarkdownChartOptions`
5
5
  */
@@ -1,4 +1,4 @@
1
- import { string_markdown } from '../../types/typeAliases';
1
+ import type { string_markdown } from '../../types/typeAliases';
2
2
  /**
3
3
  * Function `humanizeAiText` will remove traces of AI text generation artifacts
4
4
  *
@@ -1,4 +1,4 @@
1
- import { string_markdown } from '../../types/typeAliases';
1
+ import type { string_markdown } from '../../types/typeAliases';
2
2
  /**
3
3
  * Change ellipsis character to three dots `…` -> `...`
4
4
  *
@@ -1,4 +1,4 @@
1
- import { string_markdown } from '../../types/typeAliases';
1
+ import type { string_markdown } from '../../types/typeAliases';
2
2
  /**
3
3
  * Change em-dashes to regular dashes `—` -> `-`
4
4
  *
@@ -1,4 +1,4 @@
1
- import { string_markdown } from '../../types/typeAliases';
1
+ import type { string_markdown } from '../../types/typeAliases';
2
2
  /**
3
3
  * Change smart quotes to regular quotes
4
4
  *
@@ -1,4 +1,4 @@
1
- import { string_markdown } from '../../types/typeAliases';
1
+ import type { string_markdown } from '../../types/typeAliases';
2
2
  /**
3
3
  * Change unprintable hard spaces to regular spaces
4
4
  *
@@ -5,6 +5,7 @@ import type { string_html } from '../../types/typeAliases';
5
5
  * @param content raw html code
6
6
  * @returns formatted html code
7
7
  * @private withing the package because of HUGE size of prettier dependency
8
+ * @deprecated Prettier removed from Promptbook due to package size
8
9
  */
9
10
  export declare function prettifyMarkdown<TContent extends string_html>(content: TContent): TContent;
10
11
  /**
@@ -13,5 +14,6 @@ export declare function prettifyMarkdown<TContent extends string_html>(content:
13
14
  * @param content raw html code
14
15
  * @returns formatted html code
15
16
  * @private withing the package because of HUGE size of prettier dependency
17
+ * @deprecated Prettier removed from Promptbook due to package size
16
18
  */
17
19
  export declare function prettifyMarkdownAsync<TContent extends string_html>(content: TContent): Promise<TContent>;
@@ -1,4 +1,4 @@
1
- import { string_markdown } from '../../types/typeAliases';
1
+ import type { string_markdown } from '../../types/typeAliases';
2
2
  /**
3
3
  * Function `promptbookifyAiText` will slightly modify the text so we know it was processed by Promptbook
4
4
  *
@@ -5,6 +5,6 @@
5
5
  * Note: This is useful for post-processing of the result of the chat LLM model
6
6
  * when the model wraps the result in the (markdown) code block.
7
7
  *
8
- * @public exported from `@promptbook/utils`
8
+ * @public exported from `@promptbook/markdown-utils`
9
9
  */
10
10
  export declare function trimCodeBlock(value: string): string;
@@ -4,6 +4,6 @@
4
4
  * Note: This is useful for post-processing of the result of the completion LLM model
5
5
  * if you want to start code block in the prompt but you don't want to end it in the result.
6
6
  *
7
- * @public exported from `@promptbook/utils`
7
+ * @public exported from `@promptbook/markdown-utils`
8
8
  */
9
9
  export declare function trimEndOfCodeBlock(value: string): string;
@@ -1,6 +1,6 @@
1
1
  import { type IDestroyable } from 'destroyable';
2
- import type { string_name } from '../types/typeAliases';
3
- import type { TODO_string } from './organization/TODO_string';
2
+ import type { string_name } from '../../types/typeAliases';
3
+ import type { TODO_string } from '../organization/TODO_string';
4
4
  /**
5
5
  * Represents an entity in a global registry.
6
6
  * Contains identifying information about the package and class.
@@ -1,4 +1,4 @@
1
- import type { string_date_iso8601 } from '../types/typeAliases';
1
+ import type { string_date_iso8601 } from '../../types/typeAliases';
2
2
  /**
3
3
  * Simple wrapper `new Date().toISOString()`
4
4
  *
@@ -1,4 +1,4 @@
1
- import type { Arrayable } from '../types/Arrayable';
1
+ import type { Arrayable } from '../../types/Arrayable';
2
2
  /**
3
3
  * Takes an item or an array of items and returns an array of items
4
4
  *
@@ -0,0 +1,5 @@
1
+ import type { TODO_any } from '../organization/TODO_any';
2
+ /**
3
+ * @public exported from `@promptbook/utils`
4
+ */
5
+ export declare function debounce<T extends (...args: TODO_any[]) => void>(fn: T, delay: number): (...args: Parameters<T>) => void;
@@ -1,4 +1,4 @@
1
- import type { string_char_emoji } from '../types/typeAliasEmoji';
1
+ import type { string_char_emoji } from '../../types/typeAliasEmoji';
2
2
  /**
3
3
  * All possible emoji chars like "🍆", "🍡", "🍤"...
4
4
  * Note: this will be needed to update annually - now updated at 2022-01-19
@@ -0,0 +1,20 @@
1
+ import type { string_css_class } from '../../types/typeAliases';
2
+ export type InjectCssModuleIntoShadowRootOptions = {
3
+ /**
4
+ * The shadow root where the styles should be injected
5
+ */
6
+ shadowRoot: ShadowRoot;
7
+ /**
8
+ * The imported CSS module styles object
9
+ */
10
+ styles: Record<string_css_class, string_css_class>;
11
+ };
12
+ /**
13
+ * Inject the CSS module rules (derived from imported `styles`) into the provided shadow root.
14
+ * This allows CSS modules (which are normally emitted into the document head) to be
15
+ * available inside the component's shadow DOM.
16
+ *
17
+ * @public exported from `@promptbook/components`
18
+ * <- TODO: [🧠] Make `@promptbook/components-utils`
19
+ */
20
+ export declare function injectCssModuleIntoShadowRoot(options: InjectCssModuleIntoShadowRootOptions): void;
@@ -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.101.0`).
18
+ * It follows semantic versioning (e.g., `0.102.0-9`).
19
19
  *
20
20
  * @generated
21
21
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@promptbook/fake-llm",
3
- "version": "0.102.0-0",
3
+ "version": "0.102.0-10",
4
4
  "description": "Promptbook: Run AI apps in plain human language across multiple models and platforms",
5
5
  "private": false,
6
6
  "sideEffects": false,
@@ -96,7 +96,7 @@
96
96
  "module": "./esm/index.es.js",
97
97
  "typings": "./esm/typings/src/_packages/fake-llm.index.d.ts",
98
98
  "peerDependencies": {
99
- "@promptbook/core": "0.102.0-0"
99
+ "@promptbook/core": "0.102.0-10"
100
100
  },
101
101
  "dependencies": {
102
102
  "crypto": "1.0.1",
package/umd/index.umd.js CHANGED
@@ -22,7 +22,7 @@
22
22
  * @generated
23
23
  * @see https://github.com/webgptorg/promptbook
24
24
  */
25
- const PROMPTBOOK_ENGINE_VERSION = '0.102.0-0';
25
+ const PROMPTBOOK_ENGINE_VERSION = '0.102.0-10';
26
26
  /**
27
27
  * TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
28
28
  * Note: [💞] Ignore a discrepancy between file name and entity name
@@ -847,14 +847,16 @@
847
847
  const rawPromptContent = templateParameters(prompt.content, { ...prompt.parameters, modelName });
848
848
  const usage = ZERO_USAGE;
849
849
  // <- TODO: [🧠] Compute here at least words, characters,... etc
850
+ const thread = prompt /* <- [🩱] */.thread;
850
851
  return exportJson({
851
852
  name: 'promptResult',
852
853
  message: `Result of \`MockedEchoLlmExecutionTools.callChatModel\``,
853
854
  order: [],
854
855
  value: {
856
+ // Note: The „quotes“ are intentional to test AI humanization and Promptbookification
855
857
  content: spaceTrim.spaceTrim((block) => `
856
858
  You said:
857
- ${block(rawPromptContent)}
859
+ „${block(rawPromptContent)}“${thread ? ` +${thread.length} other messages` : ''}
858
860
 
859
861
  [1️⃣ Say that again!](?message=${encodeURIComponent(rawPromptContent)})
860
862
  [2️⃣ Say that twice!](?message=${encodeURIComponent(rawPromptContent).repeat(2)})
@@ -1436,24 +1438,6 @@
1436
1438
  * TODO: [🌺] Use some intermediate util splitWords
1437
1439
  */
1438
1440
 
1439
- /**
1440
- * Removes emojis from a string and fix whitespaces
1441
- *
1442
- * Note: [🔂] This function is idempotent.
1443
- *
1444
- * @param text with emojis
1445
- * @returns text without emojis
1446
- * @public exported from `@promptbook/utils`
1447
- */
1448
- function removeEmojis(text) {
1449
- // Replace emojis (and also ZWJ sequence) with hyphens
1450
- text = text.replace(/(\p{Extended_Pictographic})\p{Modifier_Symbol}/gu, '$1');
1451
- text = text.replace(/(\p{Extended_Pictographic})[\u{FE00}-\u{FE0F}]/gu, '$1');
1452
- text = text.replace(/(\p{Extended_Pictographic})(\u{200D}\p{Extended_Pictographic})*/gu, '$1');
1453
- text = text.replace(/\p{Extended_Pictographic}/gu, '');
1454
- return text;
1455
- }
1456
-
1457
1441
  /**
1458
1442
  * Converts a given text to kebab-case format.
1459
1443
  *
@@ -1505,6 +1489,24 @@
1505
1489
  * Note: [💞] Ignore a discrepancy between file name and entity name
1506
1490
  */
1507
1491
 
1492
+ /**
1493
+ * Removes emojis from a string and fix whitespaces
1494
+ *
1495
+ * Note: [🔂] This function is idempotent.
1496
+ *
1497
+ * @param text with emojis
1498
+ * @returns text without emojis
1499
+ * @public exported from `@promptbook/utils`
1500
+ */
1501
+ function removeEmojis(text) {
1502
+ // Replace emojis (and also ZWJ sequence) with hyphens
1503
+ text = text.replace(/(\p{Extended_Pictographic})\p{Modifier_Symbol}/gu, '$1');
1504
+ text = text.replace(/(\p{Extended_Pictographic})[\u{FE00}-\u{FE0F}]/gu, '$1');
1505
+ text = text.replace(/(\p{Extended_Pictographic})(\u{200D}\p{Extended_Pictographic})*/gu, '$1');
1506
+ text = text.replace(/\p{Extended_Pictographic}/gu, '');
1507
+ return text;
1508
+ }
1509
+
1508
1510
  /**
1509
1511
  * This error indicates that the promptbook in a markdown format cannot be parsed into a valid promptbook object
1510
1512
  *
@@ -1812,41 +1814,6 @@
1812
1814
  return text;
1813
1815
  }
1814
1816
 
1815
- /**
1816
- * Function trimCodeBlock will trim starting and ending code block from the string if it is present.
1817
- *
1818
- * Note: [🔂] This function is idempotent.
1819
- * Note: This is useful for post-processing of the result of the chat LLM model
1820
- * when the model wraps the result in the (markdown) code block.
1821
- *
1822
- * @public exported from `@promptbook/utils`
1823
- */
1824
- function trimCodeBlock(value) {
1825
- value = spaceTrim.spaceTrim(value);
1826
- if (!/^```[a-z]*(.*)```$/is.test(value)) {
1827
- return value;
1828
- }
1829
- value = value.replace(/^```[a-z]*/i, '');
1830
- value = value.replace(/```$/i, '');
1831
- value = spaceTrim.spaceTrim(value);
1832
- return value;
1833
- }
1834
-
1835
- /**
1836
- * Function trimEndOfCodeBlock will remove ending code block from the string if it is present.
1837
- *
1838
- * Note: This is useful for post-processing of the result of the completion LLM model
1839
- * if you want to start code block in the prompt but you don't want to end it in the result.
1840
- *
1841
- * @public exported from `@promptbook/utils`
1842
- */
1843
- function trimEndOfCodeBlock(value) {
1844
- value = spaceTrim.spaceTrim(value);
1845
- value = value.replace(/```$/g, '');
1846
- value = spaceTrim.spaceTrim(value);
1847
- return value;
1848
- }
1849
-
1850
1817
  /**
1851
1818
  * Removes quotes and optional introduce text from a string
1852
1819
  *
@@ -2040,42 +2007,45 @@
2040
2007
  * @param content raw html code
2041
2008
  * @returns formatted html code
2042
2009
  * @private withing the package because of HUGE size of prettier dependency
2010
+ * @deprecated Prettier removed from Promptbook due to package size
2043
2011
  */
2044
2012
  function prettifyMarkdown(content) {
2045
- // In browser/Next.js environments, just return the original content
2046
- // since prettier parsers are not available and would cause bundling issues
2047
- if (typeof window !== 'undefined') {
2048
- return content;
2049
- }
2050
- try {
2051
- // Use dynamic require to avoid static imports that cause bundling issues
2052
- // This will only work in Node.js environments
2053
- const prettierStandalone = eval('require')('prettier/standalone');
2054
- const parserMarkdown = eval('require')('prettier/parser-markdown');
2055
- const parserHtml = eval('require')('prettier/parser-html');
2056
- return prettierStandalone.format(content, {
2057
- parser: 'markdown',
2058
- plugins: [parserMarkdown, parserHtml],
2059
- // TODO: DRY - make some import or auto-copy of .prettierrc
2060
- endOfLine: 'lf',
2061
- tabWidth: 4,
2062
- singleQuote: true,
2063
- trailingComma: 'all',
2064
- arrowParens: 'always',
2065
- printWidth: 120,
2066
- htmlWhitespaceSensitivity: 'ignore',
2067
- jsxBracketSameLine: false,
2068
- bracketSpacing: true,
2069
- });
2070
- }
2071
- catch (error) {
2072
- // TODO: [🟥] Detect browser / node and make it colorful
2073
- console.error('There was an error with prettifying the markdown, using the original as the fallback', {
2074
- error,
2075
- html: content,
2076
- });
2077
- return content;
2013
+ return (content + `\n\n<!-- Note: Prettier removed from Promptbook -->`);
2014
+ }
2015
+
2016
+ /**
2017
+ * Function trimCodeBlock will trim starting and ending code block from the string if it is present.
2018
+ *
2019
+ * Note: [🔂] This function is idempotent.
2020
+ * Note: This is useful for post-processing of the result of the chat LLM model
2021
+ * when the model wraps the result in the (markdown) code block.
2022
+ *
2023
+ * @public exported from `@promptbook/markdown-utils`
2024
+ */
2025
+ function trimCodeBlock(value) {
2026
+ value = spaceTrim.spaceTrim(value);
2027
+ if (!/^```[a-z]*(.*)```$/is.test(value)) {
2028
+ return value;
2078
2029
  }
2030
+ value = value.replace(/^```[a-z]*/i, '');
2031
+ value = value.replace(/```$/i, '');
2032
+ value = spaceTrim.spaceTrim(value);
2033
+ return value;
2034
+ }
2035
+
2036
+ /**
2037
+ * Function trimEndOfCodeBlock will remove ending code block from the string if it is present.
2038
+ *
2039
+ * Note: This is useful for post-processing of the result of the completion LLM model
2040
+ * if you want to start code block in the prompt but you don't want to end it in the result.
2041
+ *
2042
+ * @public exported from `@promptbook/markdown-utils`
2043
+ */
2044
+ function trimEndOfCodeBlock(value) {
2045
+ value = spaceTrim.spaceTrim(value);
2046
+ value = value.replace(/```$/g, '');
2047
+ value = spaceTrim.spaceTrim(value);
2048
+ return value;
2079
2049
  }
2080
2050
 
2081
2051
  /**