@promptbook/fake-llm 0.100.0-6 → 0.100.0-61

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 (129) hide show
  1. package/README.md +2 -8
  2. package/esm/index.es.js +116 -42
  3. package/esm/index.es.js.map +1 -1
  4. package/esm/typings/src/_packages/color.index.d.ts +50 -0
  5. package/esm/typings/src/_packages/components.index.d.ts +36 -0
  6. package/esm/typings/src/_packages/core.index.d.ts +30 -0
  7. package/esm/typings/src/_packages/types.index.d.ts +38 -0
  8. package/esm/typings/src/book-2.0/agent-source/parseAgentSource.d.ts +30 -0
  9. package/esm/typings/src/book-2.0/agent-source/parseAgentSource.test.d.ts +1 -0
  10. package/esm/typings/src/book-2.0/agent-source/string_book.d.ts +26 -0
  11. package/esm/typings/src/book-2.0/commitments/ACTION/ACTION.d.ts +38 -0
  12. package/esm/typings/src/book-2.0/commitments/FORMAT/FORMAT.d.ts +39 -0
  13. package/esm/typings/src/book-2.0/commitments/KNOWLEDGE/KNOWLEDGE.d.ts +45 -0
  14. package/esm/typings/src/book-2.0/commitments/META_IMAGE/META_IMAGE.d.ts +44 -0
  15. package/esm/typings/src/book-2.0/commitments/META_LINK/META_LINK.d.ts +56 -0
  16. package/esm/typings/src/book-2.0/commitments/MODEL/MODEL.d.ts +39 -0
  17. package/esm/typings/src/book-2.0/commitments/NOTE/NOTE.d.ts +49 -0
  18. package/esm/typings/src/book-2.0/commitments/PERSONA/PERSONA.d.ts +46 -0
  19. package/esm/typings/src/book-2.0/commitments/RULE/RULE.d.ts +44 -0
  20. package/esm/typings/src/book-2.0/commitments/SAMPLE/SAMPLE.d.ts +44 -0
  21. package/esm/typings/src/book-2.0/commitments/STYLE/STYLE.d.ts +38 -0
  22. package/esm/typings/src/book-2.0/commitments/_base/BaseCommitmentDefinition.d.ts +52 -0
  23. package/esm/typings/src/book-2.0/commitments/_base/BookCommitment.d.ts +5 -0
  24. package/esm/typings/src/book-2.0/commitments/_base/CommitmentDefinition.d.ts +48 -0
  25. package/esm/typings/src/book-2.0/commitments/_base/NotYetImplementedCommitmentDefinition.d.ts +22 -0
  26. package/esm/typings/src/book-2.0/commitments/_base/createEmptyAgentModelRequirements.d.ts +19 -0
  27. package/esm/typings/src/book-2.0/commitments/_misc/AgentModelRequirements.d.ts +37 -0
  28. package/esm/typings/src/book-2.0/commitments/_misc/AgentSourceParseResult.d.ts +18 -0
  29. package/esm/typings/src/book-2.0/commitments/_misc/ParsedCommitment.d.ts +22 -0
  30. package/esm/typings/src/book-2.0/commitments/_misc/createAgentModelRequirements.d.ts +62 -0
  31. package/esm/typings/src/book-2.0/commitments/_misc/createAgentModelRequirementsWithCommitments.d.ts +36 -0
  32. package/esm/typings/src/book-2.0/commitments/_misc/createCommitmentRegex.d.ts +20 -0
  33. package/esm/typings/src/book-2.0/commitments/_misc/parseAgentSourceWithCommitments.d.ts +24 -0
  34. package/esm/typings/src/book-2.0/commitments/_misc/removeCommentsFromSystemMessage.d.ts +11 -0
  35. package/esm/typings/src/book-2.0/commitments/index.d.ts +56 -0
  36. package/esm/typings/src/book-2.0/utils/profileImageUtils.d.ts +39 -0
  37. package/esm/typings/src/book-components/AvatarProfile/AvatarChip/AvatarChip.d.ts +35 -0
  38. package/esm/typings/src/book-components/AvatarProfile/AvatarChip/AvatarChipFromSource.d.ts +21 -0
  39. package/esm/typings/src/book-components/AvatarProfile/AvatarChip/index.d.ts +2 -0
  40. package/esm/typings/src/book-components/AvatarProfile/AvatarProfile/AvatarProfile.d.ts +26 -0
  41. package/esm/typings/src/book-components/AvatarProfile/AvatarProfile/AvatarProfileFromSource.d.ts +19 -0
  42. package/esm/typings/src/book-components/BookEditor/BookEditor.d.ts +35 -0
  43. package/esm/typings/src/book-components/BookEditor/BookEditorInner.d.ts +15 -0
  44. package/esm/typings/src/book-components/BookEditor/config.d.ts +10 -0
  45. package/esm/typings/src/book-components/BookEditor/injectCssModuleIntoShadowRoot.d.ts +11 -0
  46. package/esm/typings/src/book-components/Chat/Chat/Chat.d.ts +20 -0
  47. package/esm/typings/src/book-components/Chat/Chat/ChatProps.d.ts +110 -0
  48. package/esm/typings/src/book-components/Chat/LlmChat/LlmChat.d.ts +14 -0
  49. package/esm/typings/src/book-components/Chat/LlmChat/LlmChat.test.d.ts +1 -0
  50. package/esm/typings/src/book-components/Chat/LlmChat/LlmChatProps.d.ts +24 -0
  51. package/esm/typings/src/book-components/Chat/types/ChatMessage.d.ts +16 -0
  52. package/esm/typings/src/book-components/Chat/types/ChatParticipant.d.ts +32 -0
  53. package/esm/typings/src/book-components/Chat/utils/ChatPersistence.d.ts +25 -0
  54. package/esm/typings/src/book-components/Chat/utils/ExportFormat.d.ts +4 -0
  55. package/esm/typings/src/book-components/Chat/utils/addUtmParamsToUrl.d.ts +7 -0
  56. package/esm/typings/src/book-components/Chat/utils/createShortLinkForChat.d.ts +7 -0
  57. package/esm/typings/src/book-components/Chat/utils/downloadFile.d.ts +6 -0
  58. package/esm/typings/src/book-components/Chat/utils/exportChatHistory.d.ts +9 -0
  59. package/esm/typings/src/book-components/Chat/utils/generatePdfContent.d.ts +8 -0
  60. package/esm/typings/src/book-components/Chat/utils/generateQrDataUrl.d.ts +7 -0
  61. package/esm/typings/src/book-components/Chat/utils/getPromptbookBranding.d.ts +6 -0
  62. package/esm/typings/src/book-components/Chat/utils/messagesToHtml.d.ts +8 -0
  63. package/esm/typings/src/book-components/Chat/utils/messagesToJson.d.ts +7 -0
  64. package/esm/typings/src/book-components/Chat/utils/messagesToMarkdown.d.ts +8 -0
  65. package/esm/typings/src/book-components/Chat/utils/messagesToText.d.ts +8 -0
  66. package/esm/typings/src/book-components/_common/react-utils/classNames.d.ts +7 -0
  67. package/esm/typings/src/book-components/_common/react-utils/collectCssTextsForClass.d.ts +7 -0
  68. package/esm/typings/src/book-components/_common/react-utils/escapeHtml.d.ts +6 -0
  69. package/esm/typings/src/book-components/_common/react-utils/escapeRegex.d.ts +6 -0
  70. package/esm/typings/src/config.d.ts +19 -0
  71. package/esm/typings/src/execution/AvailableModel.d.ts +4 -0
  72. package/esm/typings/src/execution/ExecutionTask.d.ts +27 -1
  73. package/esm/typings/src/execution/LlmExecutionTools.d.ts +8 -0
  74. package/esm/typings/src/execution/createPipelineExecutor/40-executeAttempts.d.ts +6 -1
  75. package/esm/typings/src/llm-providers/_common/filterModels.d.ts +0 -3
  76. package/esm/typings/src/llm-providers/_common/profiles/llmProviderProfiles.d.ts +81 -0
  77. package/esm/typings/src/llm-providers/_common/profiles/test/llmProviderProfiles.test.d.ts +1 -0
  78. package/esm/typings/src/llm-providers/_multiple/MultipleLlmExecutionTools.d.ts +5 -0
  79. package/esm/typings/src/llm-providers/anthropic-claude/AnthropicClaudeExecutionTools.d.ts +5 -5
  80. package/esm/typings/src/llm-providers/anthropic-claude/anthropic-claude-models.d.ts +1 -1
  81. package/esm/typings/src/llm-providers/deepseek/deepseek-models.d.ts +1 -1
  82. package/esm/typings/src/llm-providers/google/google-models.d.ts +1 -1
  83. package/esm/typings/src/llm-providers/mocked/MockedEchoLlmExecutionTools.d.ts +5 -0
  84. package/esm/typings/src/llm-providers/ollama/ollama-models.d.ts +1 -1
  85. package/esm/typings/src/llm-providers/openai/OpenAiCompatibleExecutionTools.d.ts +8 -0
  86. package/esm/typings/src/llm-providers/openai/OpenAiExecutionTools.d.ts +5 -0
  87. package/esm/typings/src/llm-providers/openai/openai-models.d.ts +1 -1
  88. package/esm/typings/src/llm-providers/remote/RemoteLlmExecutionTools.d.ts +5 -0
  89. package/esm/typings/src/pipeline/book-notation.d.ts +2 -1
  90. package/esm/typings/src/playground/permanent/error-handling-playground.d.ts +5 -0
  91. package/esm/typings/src/types/ModelRequirements.d.ts +0 -2
  92. package/esm/typings/src/types/typeAliases.d.ts +6 -0
  93. package/esm/typings/src/utils/color/$randomColor.d.ts +11 -0
  94. package/esm/typings/src/utils/color/Color.d.ts +180 -0
  95. package/esm/typings/src/utils/color/css-colors.d.ts +159 -0
  96. package/esm/typings/src/utils/color/internal-utils/checkChannelValue.d.ts +14 -0
  97. package/esm/typings/src/utils/color/internal-utils/hslToRgb.d.ts +17 -0
  98. package/esm/typings/src/utils/color/internal-utils/rgbToHsl.d.ts +17 -0
  99. package/esm/typings/src/utils/color/operators/ColorTransformer.d.ts +5 -0
  100. package/esm/typings/src/utils/color/operators/darken.d.ts +9 -0
  101. package/esm/typings/src/utils/color/operators/furthest.d.ts +16 -0
  102. package/esm/typings/src/utils/color/operators/grayscale.d.ts +9 -0
  103. package/esm/typings/src/utils/color/operators/lighten.d.ts +12 -0
  104. package/esm/typings/src/utils/color/operators/mixWithColor.d.ts +11 -0
  105. package/esm/typings/src/utils/color/operators/nearest.d.ts +10 -0
  106. package/esm/typings/src/utils/color/operators/negative.d.ts +7 -0
  107. package/esm/typings/src/utils/color/operators/negativeLightness.d.ts +7 -0
  108. package/esm/typings/src/utils/color/operators/withAlpha.d.ts +9 -0
  109. package/esm/typings/src/utils/color/utils/areColorsEqual.d.ts +14 -0
  110. package/esm/typings/src/utils/color/utils/colorDistance.d.ts +21 -0
  111. package/esm/typings/src/utils/color/utils/colorHue.d.ts +11 -0
  112. package/esm/typings/src/utils/color/utils/colorHueDistance.d.ts +11 -0
  113. package/esm/typings/src/utils/color/utils/colorHueDistance.test.d.ts +1 -0
  114. package/esm/typings/src/utils/color/utils/colorLuminance.d.ts +9 -0
  115. package/esm/typings/src/utils/color/utils/colorSatulightion.d.ts +7 -0
  116. package/esm/typings/src/utils/color/utils/colorSaturation.d.ts +9 -0
  117. package/esm/typings/src/utils/color/utils/colorToDataUrl.d.ts +10 -0
  118. package/esm/typings/src/utils/color/utils/mixColors.d.ts +11 -0
  119. package/esm/typings/src/utils/organization/preserve.d.ts +21 -0
  120. package/esm/typings/src/utils/take/classes/TakeChain.d.ts +11 -0
  121. package/esm/typings/src/utils/take/interfaces/ITakeChain.d.ts +12 -0
  122. package/esm/typings/src/utils/take/interfaces/Takeable.d.ts +7 -0
  123. package/esm/typings/src/utils/take/take.d.ts +12 -0
  124. package/esm/typings/src/utils/take/take.test.d.ts +1 -0
  125. package/esm/typings/src/version.d.ts +1 -1
  126. package/package.json +2 -3
  127. package/umd/index.umd.js +119 -45
  128. package/umd/index.umd.js.map +1 -1
  129. package/esm/typings/src/scripting/javascript/utils/preserve.d.ts +0 -14
@@ -0,0 +1,17 @@
1
+ import type { number_integer } from '../../../types/typeAliases';
2
+ import type { number_percent } from '../../../types/typeAliases';
3
+ import type { number_positive } from '../../../types/typeAliases';
4
+ /**
5
+ * Converts RGB values to HSL values
6
+ *
7
+ * @param red [0-255]
8
+ * @param green [0-255]
9
+ * @param blue [0-255]
10
+ * @returns [hue, saturation, lightness] [0-1]
11
+ *
12
+ * @private util of `@promptbook/color`
13
+ */
14
+ export declare function rgbToHsl(red: number_positive & number_integer, green: number_positive & number_integer, blue: number_positive & number_integer): readonly [number_percent, number_percent, number_percent];
15
+ /**
16
+ * TODO: Properly name all used internal variables
17
+ */
@@ -0,0 +1,5 @@
1
+ import { Color } from '../Color';
2
+ /**
3
+ * @public exported from `@promptbook/color`
4
+ */
5
+ export type ColorTransformer = (color: Color) => Color;
@@ -0,0 +1,9 @@
1
+ import type { ColorTransformer } from './ColorTransformer';
2
+ /**
3
+ * Makes color transformer which darker the given color
4
+ *
5
+ * @param amount from 0 to 1
6
+ *
7
+ * @public exported from `@promptbook/color`
8
+ */
9
+ export declare function darken(amount: number): ColorTransformer;
@@ -0,0 +1,16 @@
1
+ import { Color } from '../Color';
2
+ import type { ColorTransformer } from './ColorTransformer';
3
+ /**
4
+ * Makes color transformer which finds the furthest color from the given list
5
+ *
6
+ * @param colors array of colors to choose from
7
+ *
8
+ * @public exported from `@promptbook/color`
9
+ */
10
+ export declare function furthest(...colors: Color[]): ColorTransformer;
11
+ /**
12
+ * Makes color transformer which finds the best text color (black or white) for the given background color
13
+ *
14
+ * @public exported from `@promptbook/color`
15
+ */
16
+ export declare const textColor: ColorTransformer;
@@ -0,0 +1,9 @@
1
+ import type { ColorTransformer } from './ColorTransformer';
2
+ /**
3
+ * Makes color transformer which returns a grayscale version of the color
4
+ *
5
+ * @param amount from 0 to 1
6
+ *
7
+ * @public exported from `@promptbook/color`
8
+ */
9
+ export declare function grayscale(amount: number): ColorTransformer;
@@ -0,0 +1,12 @@
1
+ import type { ColorTransformer } from './ColorTransformer';
2
+ /**
3
+ * Makes color transformer which lighten the given color
4
+ *
5
+ * @param amount from 0 to 1
6
+ *
7
+ * @public exported from `@promptbook/color`
8
+ */
9
+ export declare function lighten(amount: number): ColorTransformer;
10
+ /**
11
+ * TODO: Maybe implement by mix+hsl
12
+ */
@@ -0,0 +1,11 @@
1
+ import { Color } from '../Color';
2
+ import type { ColorTransformer } from './ColorTransformer';
3
+ /**
4
+ * Makes color transformer which returns a mix of two colors based on a ratio
5
+ *
6
+ * @param ratio the ratio of the first color to the second color, from 0 to 1
7
+ * @param additionalColor the second color to mix with the first color
8
+ *
9
+ * @public exported from `@promptbook/color`
10
+ */
11
+ export declare function mixWithColor(ratio: number, additionalColor: Color): ColorTransformer;
@@ -0,0 +1,10 @@
1
+ import { Color } from '../Color';
2
+ import type { ColorTransformer } from './ColorTransformer';
3
+ /**
4
+ * Makes color transformer which finds the nearest color from the given list
5
+ *
6
+ * @param colors array of colors to choose from
7
+ *
8
+ * @public exported from `@promptbook/color`
9
+ */
10
+ export declare function nearest(...colors: Color[]): ColorTransformer;
@@ -0,0 +1,7 @@
1
+ import { Color } from '../Color';
2
+ /**
3
+ * Color transformer which returns the negative color
4
+ *
5
+ * @public exported from `@promptbook/color`
6
+ */
7
+ export declare function negative(color: Color): Color;
@@ -0,0 +1,7 @@
1
+ import { Color } from '../Color';
2
+ /**
3
+ * Color transformer which returns the negative color but preserves hue and saturation
4
+ *
5
+ * @public exported from `@promptbook/color`
6
+ */
7
+ export declare function negativeLightness(color: Color): Color;
@@ -0,0 +1,9 @@
1
+ import type { ColorTransformer } from './ColorTransformer';
2
+ /**
3
+ * Makes color transformer which sets alpha channel to given color
4
+ *
5
+ * @param alpha number from 0 (transparent) to 1 (opaque)
6
+ *
7
+ * @public exported from `@promptbook/color`
8
+ */
9
+ export declare function withAlpha(alpha: number): ColorTransformer;
@@ -0,0 +1,14 @@
1
+ import { Color } from '../Color';
2
+ /**
3
+ * Compares two colors to determine if they are equal based on their RGB values.
4
+ *
5
+ * @param color1 - The first color to compare.
6
+ * @param color2 - The second color to compare.
7
+ * @returns {boolean} True if the colors are equal, false otherwise.
8
+ *
9
+ * @public exported from `@promptbook/color`
10
+ */
11
+ export declare function areColorsEqual(color1: Color, color2: Color): boolean;
12
+ /**
13
+ * TODO: [🥎] Implement for N colors
14
+ */
@@ -0,0 +1,21 @@
1
+ import { Color } from '../Color';
2
+ /**
3
+ * Calculates distance between two colors
4
+ *
5
+ * @param color1 first color
6
+ * @param color2 second color
7
+ *
8
+ * Note: This function is inefficient. Use colorDistanceSquared instead if possible.
9
+ *
10
+ * @public exported from `@promptbook/color`
11
+ */
12
+ export declare function colorDistance(color1: Color, color2: Color): number;
13
+ /**
14
+ * Calculates distance between two colors without square root
15
+ *
16
+ * @param color1 first color
17
+ * @param color2 second color
18
+ *
19
+ * @public exported from `@promptbook/color`
20
+ */
21
+ export declare function colorDistanceSquared(color1: Color, color2: Color): number;
@@ -0,0 +1,11 @@
1
+ import { Color } from '../Color';
2
+ /**
3
+ * Calculates hue of the color
4
+ *
5
+ * @returns hue in degrees <0-360)
6
+ *
7
+ * @see https://en.wikipedia.org/wiki/HSL_and_HSV#Hue_and_chroma
8
+ *
9
+ * @public exported from `@promptbook/color`
10
+ */
11
+ export declare function colorHue(color: Color): number;
@@ -0,0 +1,11 @@
1
+ import { Color } from '../Color';
2
+ /**
3
+ * Calculates hue distance of two colors
4
+ *
5
+ * @returns hue distance in degrees <0-180)
6
+ *
7
+ * @see https://en.wikipedia.org/wiki/HSL_and_HSV#Hue_and_chroma
8
+ *
9
+ * @public exported from `@promptbook/color`
10
+ */
11
+ export declare function colorHueDistance(color1: Color, color2: Color): number;
@@ -0,0 +1,9 @@
1
+ import { Color } from '../Color';
2
+ /**
3
+ * Calculates luminance of the color
4
+ *
5
+ * @see https://en.wikipedia.org/wiki/Relative_luminance
6
+ *
7
+ * @public exported from `@promptbook/color`
8
+ */
9
+ export declare function colorLuminance(color: Color): number;
@@ -0,0 +1,7 @@
1
+ import { Color } from '../Color';
2
+ /**
3
+ * Calculates saturation*luminance of the color
4
+ *
5
+ * @public exported from `@promptbook/color`
6
+ */
7
+ export declare function colorSatulightion(color: Color): number;
@@ -0,0 +1,9 @@
1
+ import { Color } from "../Color";
2
+ /**
3
+ * Calculates saturation of the color
4
+ *
5
+ * @see https://en.wikipedia.org/wiki/HSL_and_HSV#Saturation
6
+ *
7
+ * @public exported from `@promptbook/color`
8
+ */
9
+ export declare function colorSaturation(color: Color): number;
@@ -0,0 +1,10 @@
1
+ import { Color } from '../Color';
2
+ /**
3
+ * Makes data url from color
4
+ *
5
+ * @public exported from `@promptbook/color`
6
+ */
7
+ export declare function colorToDataUrl(color: Color): string;
8
+ /**
9
+ * TODO: Make as functions NOT const
10
+ */
@@ -0,0 +1,11 @@
1
+ import type { WithTake } from '../../take/interfaces/ITakeChain';
2
+ import { Color } from '../Color';
3
+ /**
4
+ * Mixes an array of colors and returns the average color
5
+ *
6
+ * @param {...Color} colors - The array of colors to be mixed.
7
+ * @returns {WithTake<Color>} - The mixed color.
8
+ *
9
+ * @public exported from `@promptbook/color`
10
+ */
11
+ export declare function mixColors(...colors: Array<Color>): WithTake<Color>;
@@ -0,0 +1,21 @@
1
+ import type { really_any } from './really_any';
2
+ /**
3
+ * Does nothing, but preserves the function in the bundle
4
+ * Compiler is tricked into thinking the function is used
5
+ *
6
+ * @param value any function to preserve
7
+ * @returns nothing
8
+ * @private within the repository
9
+ */
10
+ export declare function $preserve(...value: Array<really_any>): void;
11
+ /**
12
+ * DO NOT USE THIS FUNCTION
13
+ * Only purpose of this function is to trick the compiler and javascript engine
14
+ * that `_preserved` array can be used in the future and should not be garbage collected
15
+ *
16
+ * @private internal for `preserve`
17
+ */
18
+ export declare function __DO_NOT_USE_getPreserved(): Array<really_any>;
19
+ /**
20
+ * Note: [💞] Ignore a discrepancy between file name and entity name
21
+ */
@@ -0,0 +1,11 @@
1
+ import type { ITakeChain } from '../interfaces/ITakeChain';
2
+ import type { Takeable } from '../interfaces/Takeable';
3
+ /**
4
+ * @private util of `@promptbook/color`
5
+ * @de
6
+ */
7
+ export declare class TakeChain<TValue extends Takeable> implements ITakeChain<TValue> {
8
+ value: TValue;
9
+ constructor(value: TValue);
10
+ then<TResultValue extends Takeable>(callback: (oldValue: TValue) => TResultValue): TResultValue & ITakeChain<TResultValue>;
11
+ }
@@ -0,0 +1,12 @@
1
+ import type { Takeable } from './Takeable';
2
+ /**
3
+ * Represents any value with take chain functionality
4
+ *
5
+ * @private util of `@promptbook/color`
6
+ * @deprecated [🤡] Use some better functional library instead of `TakeChain`
7
+ */
8
+ export type WithTake<TValue extends Takeable> = TValue & ITakeChain<TValue>;
9
+ export interface ITakeChain<TValue extends Takeable> {
10
+ readonly value: TValue;
11
+ then<TResultValue extends Takeable>(callback: (value: TValue) => TResultValue): WithTake<TResultValue>;
12
+ }
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Represents a type that can be chained in take pipe
3
+ *
4
+ * @private util of `@promptbook/color`
5
+ * @deprecated [🤡] Use some better functional library instead of `TakeChain`
6
+ */
7
+ export type Takeable = Exclude<object, null>;
@@ -0,0 +1,12 @@
1
+ import type { WithTake } from './interfaces/ITakeChain';
2
+ import type { Takeable } from './interfaces/Takeable';
3
+ /**
4
+ * A function that takes an initial value and returns a proxy object with chainable methods.
5
+ *
6
+ * @param {*} initialValue - The initial value.
7
+ * @returns {Proxy<WithTake<TValue>>} - A proxy object with a `take` method.
8
+ *
9
+ * @private util of `@promptbook/color`
10
+ * @deprecated [🤡] Use some better functional library instead of `TakeChain`
11
+ */
12
+ export declare function take<TValue extends Takeable>(initialValue: TValue): WithTake<TValue>;
@@ -0,0 +1 @@
1
+ export {};
@@ -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.0-5`).
18
+ * It follows semantic versioning (e.g., `0.100.0-55`).
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.100.0-6",
3
+ "version": "0.100.0-61",
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,12 +96,11 @@
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.100.0-6"
99
+ "@promptbook/core": "0.100.0-61"
100
100
  },
101
101
  "dependencies": {
102
102
  "crypto": "1.0.1",
103
103
  "lorem-ipsum": "2.0.8",
104
- "prettier": "2.8.1",
105
104
  "spacetrim": "0.11.59",
106
105
  "waitasecond": "1.11.83"
107
106
  }
package/umd/index.umd.js CHANGED
@@ -1,13 +1,14 @@
1
1
  (function (global, factory) {
2
- typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('spacetrim'), require('crypto'), require('lorem-ipsum'), require('path'), require('prettier'), require('prettier/parser-html'), require('waitasecond')) :
3
- typeof define === 'function' && define.amd ? define(['exports', 'spacetrim', 'crypto', 'lorem-ipsum', 'path', 'prettier', 'prettier/parser-html', 'waitasecond'], factory) :
4
- (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global["promptbook-fake-llm"] = {}, global.spaceTrim, global.crypto, global.loremIpsum, null, global.prettier, global.parserHtml, global.waitasecond));
5
- })(this, (function (exports, spaceTrim, crypto, loremIpsum, path, prettier, parserHtml, waitasecond) { 'use strict';
2
+ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('spacetrim'), require('crypto'), require('waitasecond'), require('lorem-ipsum'), require('path'), require('prettier/parser-html'), require('prettier/parser-markdown'), require('prettier/standalone')) :
3
+ typeof define === 'function' && define.amd ? define(['exports', 'spacetrim', 'crypto', 'waitasecond', 'lorem-ipsum', 'path', 'prettier/parser-html', 'prettier/parser-markdown', 'prettier/standalone'], factory) :
4
+ (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global["promptbook-fake-llm"] = {}, global.spaceTrim, global.crypto, global.waitasecond, global.loremIpsum, null, global.parserHtml, global.parserMarkdown, global.standalone));
5
+ })(this, (function (exports, spaceTrim, crypto, waitasecond, loremIpsum, path, parserHtml, parserMarkdown, standalone) { 'use strict';
6
6
 
7
7
  function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
8
8
 
9
9
  var spaceTrim__default = /*#__PURE__*/_interopDefaultLegacy(spaceTrim);
10
10
  var parserHtml__default = /*#__PURE__*/_interopDefaultLegacy(parserHtml);
11
+ var parserMarkdown__default = /*#__PURE__*/_interopDefaultLegacy(parserMarkdown);
11
12
 
12
13
  // ⚠️ WARNING: This code has been generated so that any manual changes will be overwritten
13
14
  /**
@@ -23,12 +24,82 @@
23
24
  * @generated
24
25
  * @see https://github.com/webgptorg/promptbook
25
26
  */
26
- const PROMPTBOOK_ENGINE_VERSION = '0.100.0-6';
27
+ const PROMPTBOOK_ENGINE_VERSION = '0.100.0-61';
27
28
  /**
28
29
  * TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
29
30
  * Note: [💞] Ignore a discrepancy between file name and entity name
30
31
  */
31
32
 
33
+ /**
34
+ * Predefined profiles for LLM providers to maintain consistency across the application
35
+ * These profiles represent each provider as a virtual persona in chat interfaces
36
+ *
37
+ * @private !!!!
38
+ */
39
+ const LLM_PROVIDER_PROFILES = {
40
+ OPENAI: {
41
+ name: 'OPENAI',
42
+ fullname: 'OpenAI GPT',
43
+ color: '#10a37f', // OpenAI's signature green
44
+ // Note: avatarSrc could be added when we have provider logos available
45
+ },
46
+ ANTHROPIC: {
47
+ name: 'ANTHROPIC',
48
+ fullname: 'Anthropic Claude',
49
+ color: '#d97706', // Anthropic's orange/amber color
50
+ },
51
+ AZURE_OPENAI: {
52
+ name: 'AZURE_OPENAI',
53
+ fullname: 'Azure OpenAI',
54
+ color: '#0078d4', // Microsoft Azure blue
55
+ },
56
+ GOOGLE: {
57
+ name: 'GOOGLE',
58
+ fullname: 'Google Gemini',
59
+ color: '#4285f4', // Google blue
60
+ },
61
+ DEEPSEEK: {
62
+ name: 'DEEPSEEK',
63
+ fullname: 'DeepSeek',
64
+ color: '#7c3aed', // Purple color for DeepSeek
65
+ },
66
+ OLLAMA: {
67
+ name: 'OLLAMA',
68
+ fullname: 'Ollama',
69
+ color: '#059669', // Emerald green for local models
70
+ },
71
+ REMOTE: {
72
+ name: 'REMOTE',
73
+ fullname: 'Remote Server',
74
+ color: '#6b7280', // Gray for remote/proxy connections
75
+ },
76
+ MOCKED_ECHO: {
77
+ name: 'MOCKED_ECHO',
78
+ fullname: 'Echo (Test)',
79
+ color: '#8b5cf6', // Purple for test/mock tools
80
+ },
81
+ MOCKED_FAKE: {
82
+ name: 'MOCKED_FAKE',
83
+ fullname: 'Fake LLM (Test)',
84
+ color: '#ec4899', // Pink for fake/test tools
85
+ },
86
+ VERCEL: {
87
+ name: 'VERCEL',
88
+ fullname: 'Vercel AI',
89
+ color: '#000000', // Vercel's black
90
+ },
91
+ MULTIPLE: {
92
+ name: 'MULTIPLE',
93
+ fullname: 'Multiple Providers',
94
+ color: '#6366f1', // Indigo for combined/multiple providers
95
+ },
96
+ };
97
+ /**
98
+ * TODO: Refactor this - each profile must be alongside the provider definition
99
+ * TODO: Unite `AvatarProfileProps` and `ChatParticipant`
100
+ * Note: [💞] Ignore a discrepancy between file name and entity name
101
+ */
102
+
32
103
  /**
33
104
  * Freezes the given object and all its nested objects recursively
34
105
  *
@@ -202,6 +273,13 @@
202
273
  newline: '\n',
203
274
  skipEmptyLines: true,
204
275
  });
276
+ /**
277
+ * API request timeout in milliseconds
278
+ * Can be overridden via API_REQUEST_TIMEOUT environment variable
279
+ *
280
+ * @public exported from `@promptbook/core`
281
+ */
282
+ parseInt(process.env.API_REQUEST_TIMEOUT || '90000');
205
283
  /**
206
284
  * Note: [💞] Ignore a discrepancy between file name and entity name
207
285
  * TODO: [🧠][🧜‍♂️] Maybe join remoteServerUrl and path into single value
@@ -793,6 +871,9 @@
793
871
  get description() {
794
872
  return 'What you say is whay you get - just for testing';
795
873
  }
874
+ get profile() {
875
+ return LLM_PROVIDER_PROFILES.MOCKED_ECHO;
876
+ }
796
877
  /**
797
878
  * Does nothing, just to implement the interface
798
879
  */
@@ -824,6 +905,7 @@
824
905
  if (this.options.isVerbose) {
825
906
  console.info('💬 Mocked callChatModel call');
826
907
  }
908
+ await waitasecond.forTime((1 + Math.random() * 4) * 1000);
827
909
  const modelName = 'mocked-echo';
828
910
  const rawPromptContent = templateParameters(prompt.content, { ...prompt.parameters, modelName });
829
911
  const usage = ZERO_USAGE;
@@ -1997,9 +2079,9 @@
1997
2079
  */
1998
2080
  function prettifyMarkdown(content) {
1999
2081
  try {
2000
- return prettier.format(content, {
2082
+ return standalone.format(content, {
2001
2083
  parser: 'markdown',
2002
- plugins: [parserHtml__default["default"]],
2084
+ plugins: [parserMarkdown__default["default"], parserHtml__default["default"]],
2003
2085
  // TODO: DRY - make some import or auto-copy of .prettierrc
2004
2086
  endOfLine: 'lf',
2005
2087
  tabWidth: 4,
@@ -2022,31 +2104,23 @@
2022
2104
  }
2023
2105
  }
2024
2106
 
2107
+ /**
2108
+ * @private internal for `preserve`
2109
+ */
2110
+ const _preserved = [];
2025
2111
  /**
2026
2112
  * Does nothing, but preserves the function in the bundle
2027
2113
  * Compiler is tricked into thinking the function is used
2028
2114
  *
2029
2115
  * @param value any function to preserve
2030
2116
  * @returns nothing
2031
- * @private internal function of `JavascriptExecutionTools` and `JavascriptEvalExecutionTools`
2032
- */
2033
- function preserve(func) {
2034
- // Note: NOT calling the function
2035
- (async () => {
2036
- // TODO: [💩] Change to `await forEver` or `forTime(Infinity)`
2037
- await waitasecond.forTime(100000000);
2038
- // [1]
2039
- try {
2040
- await func();
2041
- }
2042
- finally {
2043
- // do nothing
2044
- }
2045
- })();
2117
+ * @private within the repository
2118
+ */
2119
+ function $preserve(...value) {
2120
+ _preserved.push(...value);
2046
2121
  }
2047
2122
  /**
2048
- * TODO: Probably remove in favour of `keepImported`
2049
- * TODO: [1] This maybe does memory leak
2123
+ * Note: [💞] Ignore a discrepancy between file name and entity name
2050
2124
  */
2051
2125
 
2052
2126
  // Note: [💎]
@@ -2074,25 +2148,25 @@
2074
2148
  // Note: [💎]
2075
2149
  // Note: Using direct eval, following variables are in same scope as eval call so they are accessible from inside the evaluated script:
2076
2150
  const spaceTrim = (_) => spaceTrim__default["default"](_);
2077
- preserve(spaceTrim);
2151
+ $preserve(spaceTrim);
2078
2152
  const removeQuotes$1 = removeQuotes;
2079
- preserve(removeQuotes$1);
2153
+ $preserve(removeQuotes$1);
2080
2154
  const unwrapResult$1 = unwrapResult;
2081
- preserve(unwrapResult$1);
2155
+ $preserve(unwrapResult$1);
2082
2156
  const trimEndOfCodeBlock$1 = trimEndOfCodeBlock;
2083
- preserve(trimEndOfCodeBlock$1);
2157
+ $preserve(trimEndOfCodeBlock$1);
2084
2158
  const trimCodeBlock$1 = trimCodeBlock;
2085
- preserve(trimCodeBlock$1);
2159
+ $preserve(trimCodeBlock$1);
2086
2160
  // TODO: DRY [🍯]
2087
2161
  const trim = (str) => str.trim();
2088
- preserve(trim);
2162
+ $preserve(trim);
2089
2163
  // TODO: DRY [🍯]
2090
2164
  const reverse = (str) => str.split('').reverse().join('');
2091
- preserve(reverse);
2165
+ $preserve(reverse);
2092
2166
  const removeEmojis$1 = removeEmojis;
2093
- preserve(removeEmojis$1);
2167
+ $preserve(removeEmojis$1);
2094
2168
  const prettifyMarkdown$1 = prettifyMarkdown;
2095
- preserve(prettifyMarkdown$1);
2169
+ $preserve(prettifyMarkdown$1);
2096
2170
  //-------[n12:]---
2097
2171
  const capitalize$1 = capitalize;
2098
2172
  const decapitalize$1 = decapitalize;
@@ -2108,18 +2182,18 @@
2108
2182
  // TODO: DRY [🍯]
2109
2183
  Array.from(parseKeywordsFromString(input)).join(', '); /* <- TODO: [🧠] What is the best format comma list, bullet list,...? */
2110
2184
  const normalizeTo_SCREAMING_CASE$1 = normalizeTo_SCREAMING_CASE;
2111
- preserve(capitalize$1);
2112
- preserve(decapitalize$1);
2113
- preserve(nameToUriPart$1);
2114
- preserve(nameToUriParts$1);
2115
- preserve(removeDiacritics$1);
2116
- preserve(normalizeWhitespaces$1);
2117
- preserve(normalizeToKebabCase$1);
2118
- preserve(normalizeTo_camelCase$1);
2119
- preserve(normalizeTo_snake_case$1);
2120
- preserve(normalizeTo_PascalCase$1);
2121
- preserve(parseKeywords);
2122
- preserve(normalizeTo_SCREAMING_CASE$1);
2185
+ $preserve(capitalize$1);
2186
+ $preserve(decapitalize$1);
2187
+ $preserve(nameToUriPart$1);
2188
+ $preserve(nameToUriParts$1);
2189
+ $preserve(removeDiacritics$1);
2190
+ $preserve(normalizeWhitespaces$1);
2191
+ $preserve(normalizeToKebabCase$1);
2192
+ $preserve(normalizeTo_camelCase$1);
2193
+ $preserve(normalizeTo_snake_case$1);
2194
+ $preserve(normalizeTo_PascalCase$1);
2195
+ $preserve(parseKeywords);
2196
+ $preserve(normalizeTo_SCREAMING_CASE$1);
2123
2197
  //-------[/n12]---
2124
2198
  if (!script.includes('return')) {
2125
2199
  script = `return ${script}`;