@promptbook/fake-llm 0.103.0-55 โ 0.103.0-56
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/esm/index.es.js +50 -16
- package/esm/index.es.js.map +1 -1
- package/esm/typings/src/_packages/core.index.d.ts +6 -8
- package/esm/typings/src/_packages/types.index.d.ts +1 -1
- package/esm/typings/src/book-components/Chat/LlmChat/LlmChatProps.d.ts +5 -0
- package/esm/typings/src/commitments/META_COLOR/META_COLOR.d.ts +6 -0
- package/esm/typings/src/commitments/META_FONT/META_FONT.d.ts +42 -0
- package/esm/typings/src/commitments/USE/USE.d.ts +53 -0
- package/esm/typings/src/commitments/USE_BROWSER/USE_BROWSER.d.ts +38 -0
- package/esm/typings/src/commitments/USE_BROWSER/USE_BROWSER.test.d.ts +1 -0
- package/esm/typings/src/commitments/{IMPORTANT/IMPORTANT.d.ts โ USE_MCP/USE_MCP.d.ts} +16 -5
- package/esm/typings/src/commitments/USE_SEARCH_ENGINE/USE_SEARCH_ENGINE.d.ts +38 -0
- package/esm/typings/src/commitments/index.d.ts +93 -1
- package/esm/typings/src/playground/playground.d.ts +3 -0
- package/esm/typings/src/utils/color/Color.d.ts +8 -0
- package/esm/typings/src/utils/color/css-colors.d.ts +1 -0
- package/esm/typings/src/version.d.ts +1 -1
- package/package.json +2 -2
- package/umd/index.umd.js +50 -16
- package/umd/index.umd.js.map +1 -1
- package/esm/typings/src/commitments/registry.d.ts +0 -68
- package/esm/typings/src/playground/playground1.d.ts +0 -2
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import type { AgentModelRequirements } from '../../book-2.0/agent-source/AgentModelRequirements';
|
|
2
|
+
import { BaseCommitmentDefinition } from '../_base/BaseCommitmentDefinition';
|
|
3
|
+
/**
|
|
4
|
+
* META FONT commitment definition
|
|
5
|
+
*
|
|
6
|
+
* The META FONT commitment sets the agent's font.
|
|
7
|
+
* This commitment is special because it doesn't affect the system message,
|
|
8
|
+
* but is handled separately in the parsing logic.
|
|
9
|
+
*
|
|
10
|
+
* Example usage in agent source:
|
|
11
|
+
*
|
|
12
|
+
* ```book
|
|
13
|
+
* META FONT Poppins, Arial, sans-serif
|
|
14
|
+
* META FONT Roboto
|
|
15
|
+
* ```
|
|
16
|
+
*
|
|
17
|
+
* @private [๐ช] Maybe export the commitments through some package
|
|
18
|
+
*/
|
|
19
|
+
export declare class MetaFontCommitmentDefinition extends BaseCommitmentDefinition<'META FONT'> {
|
|
20
|
+
constructor();
|
|
21
|
+
/**
|
|
22
|
+
* Short one-line description of META FONT.
|
|
23
|
+
*/
|
|
24
|
+
get description(): string;
|
|
25
|
+
/**
|
|
26
|
+
* Icon for this commitment.
|
|
27
|
+
*/
|
|
28
|
+
get icon(): string;
|
|
29
|
+
/**
|
|
30
|
+
* Markdown documentation for META FONT commitment.
|
|
31
|
+
*/
|
|
32
|
+
get documentation(): string;
|
|
33
|
+
applyToAgentModelRequirements(requirements: AgentModelRequirements, content: string): AgentModelRequirements;
|
|
34
|
+
/**
|
|
35
|
+
* Extracts the font from the content
|
|
36
|
+
* This is used by the parsing logic
|
|
37
|
+
*/
|
|
38
|
+
extractProfileFont(content: string): string | null;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Note: [๐] Ignore a discrepancy between file name and entity name
|
|
42
|
+
*/
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import type { AgentModelRequirements } from '../../book-2.0/agent-source/AgentModelRequirements';
|
|
2
|
+
import { BaseCommitmentDefinition } from '../_base/BaseCommitmentDefinition';
|
|
3
|
+
/**
|
|
4
|
+
* USE commitment definition
|
|
5
|
+
*
|
|
6
|
+
* The USE commitment indicates that the agent should utilize specific tools or capabilities
|
|
7
|
+
* to access and interact with external systems when necessary.
|
|
8
|
+
*
|
|
9
|
+
* Supported USE types:
|
|
10
|
+
* - USE BROWSER: Enables the agent to use a web browser tool
|
|
11
|
+
* - USE SEARCH ENGINE (future): Enables search engine access
|
|
12
|
+
* - USE FILE SYSTEM (future): Enables file system operations
|
|
13
|
+
* - USE MCP (future): Enables MCP server connections
|
|
14
|
+
*
|
|
15
|
+
* The content following the USE commitment is ignored (similar to NOTE).
|
|
16
|
+
*
|
|
17
|
+
* Example usage in agent source:
|
|
18
|
+
*
|
|
19
|
+
* ```book
|
|
20
|
+
* USE BROWSER
|
|
21
|
+
* USE SEARCH ENGINE
|
|
22
|
+
* ```
|
|
23
|
+
*
|
|
24
|
+
* @private [๐ช] Maybe export the commitments through some package
|
|
25
|
+
*/
|
|
26
|
+
export declare class UseCommitmentDefinition extends BaseCommitmentDefinition<`USE${string}`> {
|
|
27
|
+
constructor();
|
|
28
|
+
/**
|
|
29
|
+
* Short one-line description of USE commitments.
|
|
30
|
+
*/
|
|
31
|
+
get description(): string;
|
|
32
|
+
/**
|
|
33
|
+
* Icon for this commitment.
|
|
34
|
+
*/
|
|
35
|
+
get icon(): string;
|
|
36
|
+
/**
|
|
37
|
+
* Markdown documentation for USE commitment.
|
|
38
|
+
*/
|
|
39
|
+
get documentation(): string;
|
|
40
|
+
applyToAgentModelRequirements(requirements: AgentModelRequirements, content: string): AgentModelRequirements;
|
|
41
|
+
/**
|
|
42
|
+
* Extracts the tool type from the USE commitment
|
|
43
|
+
* This is used by the parsing logic
|
|
44
|
+
*/
|
|
45
|
+
extractToolType(content: string): string | null;
|
|
46
|
+
/**
|
|
47
|
+
* Checks if this is a known USE type
|
|
48
|
+
*/
|
|
49
|
+
isKnownUseType(useType: string): boolean;
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Note: [๐] Ignore a discrepancy between file name and entity name
|
|
53
|
+
*/
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import type { AgentModelRequirements } from '../../book-2.0/agent-source/AgentModelRequirements';
|
|
2
|
+
import { BaseCommitmentDefinition } from '../_base/BaseCommitmentDefinition';
|
|
3
|
+
/**
|
|
4
|
+
* USE BROWSER commitment definition
|
|
5
|
+
*
|
|
6
|
+
* The `USE BROWSER` commitment indicates that the agent should utilize a web browser tool
|
|
7
|
+
* to access and retrieve up-to-date information from the internet when necessary.
|
|
8
|
+
*
|
|
9
|
+
* The content following `USE BROWSER` is ignored (similar to NOTE).
|
|
10
|
+
*
|
|
11
|
+
* Example usage in agent source:
|
|
12
|
+
*
|
|
13
|
+
* ```book
|
|
14
|
+
* USE BROWSER
|
|
15
|
+
* USE BROWSER This will be ignored
|
|
16
|
+
* ```
|
|
17
|
+
*
|
|
18
|
+
* @private [๐ช] Maybe export the commitments through some package
|
|
19
|
+
*/
|
|
20
|
+
export declare class UseBrowserCommitmentDefinition extends BaseCommitmentDefinition<'USE BROWSER'> {
|
|
21
|
+
constructor();
|
|
22
|
+
/**
|
|
23
|
+
* Short one-line description of USE BROWSER.
|
|
24
|
+
*/
|
|
25
|
+
get description(): string;
|
|
26
|
+
/**
|
|
27
|
+
* Icon for this commitment.
|
|
28
|
+
*/
|
|
29
|
+
get icon(): string;
|
|
30
|
+
/**
|
|
31
|
+
* Markdown documentation for USE BROWSER commitment.
|
|
32
|
+
*/
|
|
33
|
+
get documentation(): string;
|
|
34
|
+
applyToAgentModelRequirements(requirements: AgentModelRequirements, content: string): AgentModelRequirements;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Note: [๐] Ignore a discrepancy between file name and entity name
|
|
38
|
+
*/
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,23 +1,34 @@
|
|
|
1
1
|
import type { AgentModelRequirements } from '../../book-2.0/agent-source/AgentModelRequirements';
|
|
2
2
|
import { BaseCommitmentDefinition } from '../_base/BaseCommitmentDefinition';
|
|
3
3
|
/**
|
|
4
|
-
*
|
|
4
|
+
* USE MCP commitment definition
|
|
5
5
|
*
|
|
6
|
-
* The
|
|
7
|
-
*
|
|
6
|
+
* The `USE MCP` commitment allows to specify an MCP server URL which the agent will connect to
|
|
7
|
+
* for retrieving additional instructions and actions.
|
|
8
|
+
*
|
|
9
|
+
* The content following `USE MCP` is the URL of the MCP server.
|
|
8
10
|
*
|
|
9
11
|
* Example usage in agent source:
|
|
10
12
|
*
|
|
11
13
|
* ```book
|
|
12
|
-
*
|
|
14
|
+
* USE MCP http://mcp-server-url.com
|
|
13
15
|
* ```
|
|
14
16
|
*
|
|
15
17
|
* @private [๐ช] Maybe export the commitments through some package
|
|
16
18
|
*/
|
|
17
|
-
export declare class
|
|
19
|
+
export declare class UseMcpCommitmentDefinition extends BaseCommitmentDefinition<'USE MCP'> {
|
|
18
20
|
constructor();
|
|
21
|
+
/**
|
|
22
|
+
* Short one-line description of USE MCP.
|
|
23
|
+
*/
|
|
19
24
|
get description(): string;
|
|
25
|
+
/**
|
|
26
|
+
* Icon for this commitment.
|
|
27
|
+
*/
|
|
20
28
|
get icon(): string;
|
|
29
|
+
/**
|
|
30
|
+
* Markdown documentation for USE MCP commitment.
|
|
31
|
+
*/
|
|
21
32
|
get documentation(): string;
|
|
22
33
|
applyToAgentModelRequirements(requirements: AgentModelRequirements, content: string): AgentModelRequirements;
|
|
23
34
|
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import type { AgentModelRequirements } from '../../book-2.0/agent-source/AgentModelRequirements';
|
|
2
|
+
import { BaseCommitmentDefinition } from '../_base/BaseCommitmentDefinition';
|
|
3
|
+
/**
|
|
4
|
+
* USE SEARCH ENGINE commitment definition
|
|
5
|
+
*
|
|
6
|
+
* The `USE SEARCH ENGINE` commitment indicates that the agent should utilize a search engine tool
|
|
7
|
+
* to access and retrieve up-to-date information from the internet when necessary.
|
|
8
|
+
*
|
|
9
|
+
* The content following `USE SEARCH ENGINE` is ignored (similar to NOTE).
|
|
10
|
+
*
|
|
11
|
+
* Example usage in agent source:
|
|
12
|
+
*
|
|
13
|
+
* ```book
|
|
14
|
+
* USE SEARCH ENGINE
|
|
15
|
+
* USE SEARCH ENGINE This will be ignored
|
|
16
|
+
* ```
|
|
17
|
+
*
|
|
18
|
+
* @private [๐ช] Maybe export the commitments through some package
|
|
19
|
+
*/
|
|
20
|
+
export declare class UseSearchEngineCommitmentDefinition extends BaseCommitmentDefinition<'USE SEARCH ENGINE'> {
|
|
21
|
+
constructor();
|
|
22
|
+
/**
|
|
23
|
+
* Short one-line description of USE SEARCH ENGINE.
|
|
24
|
+
*/
|
|
25
|
+
get description(): string;
|
|
26
|
+
/**
|
|
27
|
+
* Icon for this commitment.
|
|
28
|
+
*/
|
|
29
|
+
get icon(): string;
|
|
30
|
+
/**
|
|
31
|
+
* Markdown documentation for USE SEARCH ENGINE commitment.
|
|
32
|
+
*/
|
|
33
|
+
get documentation(): string;
|
|
34
|
+
applyToAgentModelRequirements(requirements: AgentModelRequirements, content: string): AgentModelRequirements;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Note: [๐] Ignore a discrepancy between file name and entity name
|
|
38
|
+
*/
|
|
@@ -1 +1,93 @@
|
|
|
1
|
-
|
|
1
|
+
import type { BookCommitment } from './_base/BookCommitment';
|
|
2
|
+
import type { CommitmentDefinition } from './_base/CommitmentDefinition';
|
|
3
|
+
import { ActionCommitmentDefinition } from './ACTION/ACTION';
|
|
4
|
+
import { ClosedCommitmentDefinition } from './CLOSED/CLOSED';
|
|
5
|
+
import { ComponentCommitmentDefinition } from './COMPONENT/COMPONENT';
|
|
6
|
+
import { DeleteCommitmentDefinition } from './DELETE/DELETE';
|
|
7
|
+
import { FormatCommitmentDefinition } from './FORMAT/FORMAT';
|
|
8
|
+
import { FromCommitmentDefinition } from './FROM/FROM';
|
|
9
|
+
import { GoalCommitmentDefinition } from './GOAL/GOAL';
|
|
10
|
+
import { KnowledgeCommitmentDefinition } from './KNOWLEDGE/KNOWLEDGE';
|
|
11
|
+
import { LanguageCommitmentDefinition } from './LANGUAGE/LANGUAGE';
|
|
12
|
+
import { MemoryCommitmentDefinition } from './MEMORY/MEMORY';
|
|
13
|
+
import { AgentMessageCommitmentDefinition } from './MESSAGE/AgentMessageCommitmentDefinition';
|
|
14
|
+
import { InitialMessageCommitmentDefinition } from './MESSAGE/InitialMessageCommitmentDefinition';
|
|
15
|
+
import { MessageCommitmentDefinition } from './MESSAGE/MESSAGE';
|
|
16
|
+
import { UserMessageCommitmentDefinition } from './MESSAGE/UserMessageCommitmentDefinition';
|
|
17
|
+
import { MetaCommitmentDefinition } from './META/META';
|
|
18
|
+
import { MetaColorCommitmentDefinition } from './META_COLOR/META_COLOR';
|
|
19
|
+
import { MetaFontCommitmentDefinition } from './META_FONT/META_FONT';
|
|
20
|
+
import { MetaImageCommitmentDefinition } from './META_IMAGE/META_IMAGE';
|
|
21
|
+
import { MetaLinkCommitmentDefinition } from './META_LINK/META_LINK';
|
|
22
|
+
import { ModelCommitmentDefinition } from './MODEL/MODEL';
|
|
23
|
+
import { NoteCommitmentDefinition } from './NOTE/NOTE';
|
|
24
|
+
import { OpenCommitmentDefinition } from './OPEN/OPEN';
|
|
25
|
+
import { PersonaCommitmentDefinition } from './PERSONA/PERSONA';
|
|
26
|
+
import { RuleCommitmentDefinition } from './RULE/RULE';
|
|
27
|
+
import { SampleCommitmentDefinition } from './SAMPLE/SAMPLE';
|
|
28
|
+
import { ScenarioCommitmentDefinition } from './SCENARIO/SCENARIO';
|
|
29
|
+
import { StyleCommitmentDefinition } from './STYLE/STYLE';
|
|
30
|
+
import { UseCommitmentDefinition } from './USE/USE';
|
|
31
|
+
import { UseBrowserCommitmentDefinition } from './USE_BROWSER/USE_BROWSER';
|
|
32
|
+
import { UseMcpCommitmentDefinition } from './USE_MCP/USE_MCP';
|
|
33
|
+
import { UseSearchEngineCommitmentDefinition } from './USE_SEARCH_ENGINE/USE_SEARCH_ENGINE';
|
|
34
|
+
import { NotYetImplementedCommitmentDefinition } from './_base/NotYetImplementedCommitmentDefinition';
|
|
35
|
+
/**
|
|
36
|
+
* Registry of all available commitment definitions
|
|
37
|
+
* This array contains instances of all commitment definitions
|
|
38
|
+
* This is the single source of truth for all commitments in the system
|
|
39
|
+
*
|
|
40
|
+
* @private Use functions to access commitments instead of this array directly
|
|
41
|
+
*/
|
|
42
|
+
export declare const COMMITMENT_REGISTRY: readonly [PersonaCommitmentDefinition, PersonaCommitmentDefinition, KnowledgeCommitmentDefinition, MemoryCommitmentDefinition, MemoryCommitmentDefinition, StyleCommitmentDefinition, StyleCommitmentDefinition, RuleCommitmentDefinition, RuleCommitmentDefinition, LanguageCommitmentDefinition, LanguageCommitmentDefinition, SampleCommitmentDefinition, SampleCommitmentDefinition, FormatCommitmentDefinition, FormatCommitmentDefinition, FromCommitmentDefinition, ModelCommitmentDefinition, ModelCommitmentDefinition, ActionCommitmentDefinition, ActionCommitmentDefinition, ComponentCommitmentDefinition, MetaImageCommitmentDefinition, MetaColorCommitmentDefinition, MetaFontCommitmentDefinition, MetaLinkCommitmentDefinition, MetaCommitmentDefinition, NoteCommitmentDefinition, NoteCommitmentDefinition, NoteCommitmentDefinition, NoteCommitmentDefinition, GoalCommitmentDefinition, GoalCommitmentDefinition, InitialMessageCommitmentDefinition, UserMessageCommitmentDefinition, AgentMessageCommitmentDefinition, MessageCommitmentDefinition, MessageCommitmentDefinition, ScenarioCommitmentDefinition, ScenarioCommitmentDefinition, DeleteCommitmentDefinition, DeleteCommitmentDefinition, DeleteCommitmentDefinition, DeleteCommitmentDefinition, OpenCommitmentDefinition, ClosedCommitmentDefinition, UseBrowserCommitmentDefinition, UseSearchEngineCommitmentDefinition, UseMcpCommitmentDefinition, UseCommitmentDefinition, NotYetImplementedCommitmentDefinition<"EXPECT">, NotYetImplementedCommitmentDefinition<"BEHAVIOUR">, NotYetImplementedCommitmentDefinition<"BEHAVIOURS">, NotYetImplementedCommitmentDefinition<"AVOID">, NotYetImplementedCommitmentDefinition<"AVOIDANCE">, NotYetImplementedCommitmentDefinition<"CONTEXT">];
|
|
43
|
+
/**
|
|
44
|
+
* Gets a commitment definition by its type
|
|
45
|
+
* @param type The commitment type to look up
|
|
46
|
+
* @returns The commitment definition or null if not found
|
|
47
|
+
*
|
|
48
|
+
* @public exported from `@promptbook/core`
|
|
49
|
+
*/
|
|
50
|
+
export declare function getCommitmentDefinition(type: BookCommitment): CommitmentDefinition | null;
|
|
51
|
+
/**
|
|
52
|
+
* Gets all available commitment definitions
|
|
53
|
+
* @returns Array of all commitment definitions
|
|
54
|
+
*
|
|
55
|
+
* @public exported from `@promptbook/core`
|
|
56
|
+
*/
|
|
57
|
+
export declare function getAllCommitmentDefinitions(): ReadonlyArray<CommitmentDefinition>;
|
|
58
|
+
/**
|
|
59
|
+
* Gets all available commitment types
|
|
60
|
+
* @returns Array of all commitment types
|
|
61
|
+
*
|
|
62
|
+
* @public exported from `@promptbook/core`
|
|
63
|
+
*/
|
|
64
|
+
export declare function getAllCommitmentTypes(): ReadonlyArray<BookCommitment>;
|
|
65
|
+
/**
|
|
66
|
+
* Checks if a commitment type is supported
|
|
67
|
+
* @param type The commitment type to check
|
|
68
|
+
* @returns True if the commitment type is supported
|
|
69
|
+
*
|
|
70
|
+
* @public exported from `@promptbook/core`
|
|
71
|
+
*/
|
|
72
|
+
export declare function isCommitmentSupported(type: BookCommitment): boolean;
|
|
73
|
+
/**
|
|
74
|
+
* Grouped commitment definition
|
|
75
|
+
*
|
|
76
|
+
* @public exported from `@promptbook/core`
|
|
77
|
+
*/
|
|
78
|
+
export type GroupedCommitmentDefinition = {
|
|
79
|
+
primary: CommitmentDefinition;
|
|
80
|
+
aliases: string[];
|
|
81
|
+
};
|
|
82
|
+
/**
|
|
83
|
+
* Gets all commitment definitions grouped by their aliases
|
|
84
|
+
*
|
|
85
|
+
* @returns Array of grouped commitment definitions
|
|
86
|
+
*
|
|
87
|
+
* @public exported from `@promptbook/core`
|
|
88
|
+
*/
|
|
89
|
+
export declare function getGroupedCommitmentDefinitions(): ReadonlyArray<GroupedCommitmentDefinition>;
|
|
90
|
+
/**
|
|
91
|
+
* TODO: [๐ง ] Maybe create through standardized $register
|
|
92
|
+
* Note: [๐] Ignore a discrepancy between file name and entity name
|
|
93
|
+
*/
|
|
@@ -24,6 +24,14 @@ export declare class Color {
|
|
|
24
24
|
* @returns Color object
|
|
25
25
|
*/
|
|
26
26
|
static from(color: string_color | Color): WithTake<Color>;
|
|
27
|
+
/**
|
|
28
|
+
* Creates a new Color instance from miscellaneous formats
|
|
29
|
+
* It just does not throw error when it fails, it returns PROMPTBOOK_COLOR instead
|
|
30
|
+
*
|
|
31
|
+
* @param color
|
|
32
|
+
* @returns Color object
|
|
33
|
+
*/
|
|
34
|
+
static fromSafe(color: string_color | Color): WithTake<Color>;
|
|
27
35
|
/**
|
|
28
36
|
* Creates a new Color instance from miscellaneous string formats
|
|
29
37
|
*
|
|
@@ -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.103.0-
|
|
18
|
+
* It follows semantic versioning (e.g., `0.103.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.103.0-
|
|
3
|
+
"version": "0.103.0-56",
|
|
4
4
|
"description": "Promptbook: Turn your company's scattered knowledge into AI ready books",
|
|
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.103.0-
|
|
99
|
+
"@promptbook/core": "0.103.0-56"
|
|
100
100
|
},
|
|
101
101
|
"dependencies": {
|
|
102
102
|
"crypto": "1.0.1",
|
package/umd/index.umd.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
(function (global, factory) {
|
|
2
2
|
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('spacetrim'), require('waitasecond'), require('crypto'), require('lorem-ipsum'), require('path'), require('crypto-js'), require('crypto-js/enc-hex')) :
|
|
3
3
|
typeof define === 'function' && define.amd ? define(['exports', 'spacetrim', 'waitasecond', 'crypto', 'lorem-ipsum', 'path', 'crypto-js', 'crypto-js/enc-hex'], factory) :
|
|
4
|
-
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global["promptbook-fake-llm"] = {}, global.spaceTrim, global.waitasecond, global.crypto, global.loremIpsum));
|
|
5
|
-
})(this, (function (exports, spaceTrim, waitasecond, crypto, loremIpsum) { 'use strict';
|
|
4
|
+
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global["promptbook-fake-llm"] = {}, global.spaceTrim$1, global.waitasecond, global.crypto, global.loremIpsum));
|
|
5
|
+
})(this, (function (exports, spaceTrim$1, waitasecond, crypto, loremIpsum) { 'use strict';
|
|
6
6
|
|
|
7
7
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
8
8
|
|
|
9
|
-
var spaceTrim__default = /*#__PURE__*/_interopDefaultLegacy(spaceTrim);
|
|
9
|
+
var spaceTrim__default = /*#__PURE__*/_interopDefaultLegacy(spaceTrim$1);
|
|
10
10
|
|
|
11
11
|
// โ ๏ธ WARNING: This code has been generated so that any manual changes will be overwritten
|
|
12
12
|
/**
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
* @generated
|
|
23
23
|
* @see https://github.com/webgptorg/promptbook
|
|
24
24
|
*/
|
|
25
|
-
const PROMPTBOOK_ENGINE_VERSION = '0.103.0-
|
|
25
|
+
const PROMPTBOOK_ENGINE_VERSION = '0.103.0-56';
|
|
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
|
|
@@ -135,6 +135,17 @@
|
|
|
135
135
|
return new Date().toISOString();
|
|
136
136
|
}
|
|
137
137
|
|
|
138
|
+
/**
|
|
139
|
+
* Trims string from all 4 sides
|
|
140
|
+
*
|
|
141
|
+
* Note: This is a re-exported function from the `spacetrim` package which is
|
|
142
|
+
* Developed by same author @hejny as this package
|
|
143
|
+
*
|
|
144
|
+
* @public exported from `@promptbook/utils`
|
|
145
|
+
* @see https://github.com/hejny/spacetrim#usage
|
|
146
|
+
*/
|
|
147
|
+
const spaceTrim = spaceTrim$1.spaceTrim;
|
|
148
|
+
|
|
138
149
|
/**
|
|
139
150
|
* @private util of `@promptbook/color`
|
|
140
151
|
* @de
|
|
@@ -183,6 +194,7 @@
|
|
|
183
194
|
* @public exported from `@promptbook/color`
|
|
184
195
|
*/
|
|
185
196
|
const CSS_COLORS = {
|
|
197
|
+
promptbook: '#79EAFD',
|
|
186
198
|
transparent: 'rgba(0,0,0,0)',
|
|
187
199
|
aliceblue: '#f0f8ff',
|
|
188
200
|
antiquewhite: '#faebd7',
|
|
@@ -398,6 +410,28 @@
|
|
|
398
410
|
throw new Error(`Can not create color from given object`);
|
|
399
411
|
}
|
|
400
412
|
}
|
|
413
|
+
/**
|
|
414
|
+
* Creates a new Color instance from miscellaneous formats
|
|
415
|
+
* It just does not throw error when it fails, it returns PROMPTBOOK_COLOR instead
|
|
416
|
+
*
|
|
417
|
+
* @param color
|
|
418
|
+
* @returns Color object
|
|
419
|
+
*/
|
|
420
|
+
static fromSafe(color) {
|
|
421
|
+
try {
|
|
422
|
+
return Color.from(color);
|
|
423
|
+
}
|
|
424
|
+
catch (error) {
|
|
425
|
+
// <- Note: Can not use `assertsError(error)` here because it causes circular dependency
|
|
426
|
+
console.warn(spaceTrim((block) => `
|
|
427
|
+
Color.fromSafe error:
|
|
428
|
+
${block(error.message)}
|
|
429
|
+
|
|
430
|
+
Returning default PROMPTBOOK_COLOR.
|
|
431
|
+
`));
|
|
432
|
+
return Color.fromString('promptbook');
|
|
433
|
+
}
|
|
434
|
+
}
|
|
401
435
|
/**
|
|
402
436
|
* Creates a new Color instance from miscellaneous string formats
|
|
403
437
|
*
|
|
@@ -987,7 +1021,7 @@
|
|
|
987
1021
|
*
|
|
988
1022
|
* @public exported from `@promptbook/core`
|
|
989
1023
|
*/
|
|
990
|
-
const PROMPTBOOK_COLOR = Color.
|
|
1024
|
+
const PROMPTBOOK_COLOR = Color.fromString('promptbook');
|
|
991
1025
|
// <- TODO: [๐ง ][๐ต] Using `Color` here increases the package size approx 3kb, maybe remove it
|
|
992
1026
|
/**
|
|
993
1027
|
* Colors for syntax highlighting in the `<BookEditor/>`
|
|
@@ -1145,7 +1179,7 @@
|
|
|
1145
1179
|
*/
|
|
1146
1180
|
class UnexpectedError extends Error {
|
|
1147
1181
|
constructor(message) {
|
|
1148
|
-
super(spaceTrim.spaceTrim((block) => `
|
|
1182
|
+
super(spaceTrim$1.spaceTrim((block) => `
|
|
1149
1183
|
${block(message)}
|
|
1150
1184
|
|
|
1151
1185
|
Note: This error should not happen.
|
|
@@ -1171,7 +1205,7 @@
|
|
|
1171
1205
|
constructor(whatWasThrown) {
|
|
1172
1206
|
const tag = `[๐คฎ]`;
|
|
1173
1207
|
console.error(tag, whatWasThrown);
|
|
1174
|
-
super(spaceTrim.spaceTrim(`
|
|
1208
|
+
super(spaceTrim$1.spaceTrim(`
|
|
1175
1209
|
Non-Error object was thrown
|
|
1176
1210
|
|
|
1177
1211
|
Note: Look for ${tag} in the console for more details
|
|
@@ -1722,7 +1756,7 @@
|
|
|
1722
1756
|
order: [],
|
|
1723
1757
|
value: {
|
|
1724
1758
|
// Note: The โquotesโ are intentional to test AI humanization and Promptbookification
|
|
1725
|
-
content: spaceTrim.spaceTrim((block) => `
|
|
1759
|
+
content: spaceTrim$1.spaceTrim((block) => `
|
|
1726
1760
|
You said:
|
|
1727
1761
|
โ${block(rawPromptContent)}โ${thread ? ` +${thread.length} other messages` : ''}
|
|
1728
1762
|
|
|
@@ -1761,7 +1795,7 @@
|
|
|
1761
1795
|
message: `Result of \`MockedEchoLlmExecutionTools.callCompletionModel\``,
|
|
1762
1796
|
order: [],
|
|
1763
1797
|
value: {
|
|
1764
|
-
content: spaceTrim.spaceTrim((block) => `
|
|
1798
|
+
content: spaceTrim$1.spaceTrim((block) => `
|
|
1765
1799
|
${block(rawPromptContent)}
|
|
1766
1800
|
And so on...
|
|
1767
1801
|
`),
|
|
@@ -2710,7 +2744,7 @@
|
|
|
2710
2744
|
let trimmedText = text;
|
|
2711
2745
|
// Remove leading and trailing spaces and newlines
|
|
2712
2746
|
if (isTrimmed) {
|
|
2713
|
-
trimmedText = spaceTrim.spaceTrim(trimmedText);
|
|
2747
|
+
trimmedText = spaceTrim$1.spaceTrim(trimmedText);
|
|
2714
2748
|
}
|
|
2715
2749
|
let processedText = trimmedText;
|
|
2716
2750
|
if (isIntroduceSentenceRemoved) {
|
|
@@ -2719,7 +2753,7 @@
|
|
|
2719
2753
|
// Remove the introduce sentence and quotes by replacing it with an empty string
|
|
2720
2754
|
processedText = processedText.replace(introduceSentenceRegex, '');
|
|
2721
2755
|
}
|
|
2722
|
-
processedText = spaceTrim.spaceTrim(processedText);
|
|
2756
|
+
processedText = spaceTrim$1.spaceTrim(processedText);
|
|
2723
2757
|
}
|
|
2724
2758
|
if (processedText.length < 3) {
|
|
2725
2759
|
return trimmedText;
|
|
@@ -2901,13 +2935,13 @@
|
|
|
2901
2935
|
* @public exported from `@promptbook/markdown-utils`
|
|
2902
2936
|
*/
|
|
2903
2937
|
function trimCodeBlock(value) {
|
|
2904
|
-
value = spaceTrim.spaceTrim(value);
|
|
2938
|
+
value = spaceTrim$1.spaceTrim(value);
|
|
2905
2939
|
if (!/^```[a-z]*(.*)```$/is.test(value)) {
|
|
2906
2940
|
return value;
|
|
2907
2941
|
}
|
|
2908
2942
|
value = value.replace(/^```[a-z]*/i, '');
|
|
2909
2943
|
value = value.replace(/```$/i, '');
|
|
2910
|
-
value = spaceTrim.spaceTrim(value);
|
|
2944
|
+
value = spaceTrim$1.spaceTrim(value);
|
|
2911
2945
|
return value;
|
|
2912
2946
|
}
|
|
2913
2947
|
|
|
@@ -2920,9 +2954,9 @@
|
|
|
2920
2954
|
* @public exported from `@promptbook/markdown-utils`
|
|
2921
2955
|
*/
|
|
2922
2956
|
function trimEndOfCodeBlock(value) {
|
|
2923
|
-
value = spaceTrim.spaceTrim(value);
|
|
2957
|
+
value = spaceTrim$1.spaceTrim(value);
|
|
2924
2958
|
value = value.replace(/```$/g, '');
|
|
2925
|
-
value = spaceTrim.spaceTrim(value);
|
|
2959
|
+
value = spaceTrim$1.spaceTrim(value);
|
|
2926
2960
|
return value;
|
|
2927
2961
|
}
|
|
2928
2962
|
|
|
@@ -3206,7 +3240,7 @@
|
|
|
3206
3240
|
text += (text ? ' ' : '') + nextWord;
|
|
3207
3241
|
}
|
|
3208
3242
|
}
|
|
3209
|
-
throw new LimitReachedError(spaceTrim.spaceTrim((block) => `
|
|
3243
|
+
throw new LimitReachedError(spaceTrim$1.spaceTrim((block) => `
|
|
3210
3244
|
Can not generate fake text to met the expectations
|
|
3211
3245
|
|
|
3212
3246
|
Loop limit reached
|