@promptbook/fake-llm 0.103.0-55 โ 0.103.0-66
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 +71 -19
- package/esm/index.es.js.map +1 -1
- package/esm/typings/src/_packages/components.index.d.ts +2 -2
- package/esm/typings/src/_packages/core.index.d.ts +6 -8
- package/esm/typings/src/_packages/types.index.d.ts +7 -1
- package/esm/typings/src/book-2.0/agent-source/AgentBasicInformation.d.ts +2 -1
- package/esm/typings/src/book-2.0/agent-source/createCommitmentRegex.d.ts +1 -1
- package/esm/typings/src/book-components/Chat/AgentChat/AgentChat.d.ts +3 -0
- package/esm/typings/src/book-components/Chat/Chat/ChatProps.d.ts +6 -0
- package/esm/typings/src/book-components/Chat/LlmChat/LlmChatProps.d.ts +5 -0
- package/esm/typings/src/book-components/PromptbookAgent/PromptbookAgentIntegration.d.ts +52 -0
- package/esm/typings/src/book-components/PromptbookAgent/PromptbookAgentSeamlessIntegration.d.ts +14 -0
- package/esm/typings/src/book-components/icons/SendIcon.d.ts +3 -0
- package/esm/typings/src/commitments/CLOSED/CLOSED.d.ts +4 -0
- package/esm/typings/src/commitments/CLOSED/CLOSED.test.d.ts +4 -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 +42 -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/_base/BaseCommitmentDefinition.d.ts +6 -0
- package/esm/typings/src/commitments/index.d.ts +93 -1
- package/esm/typings/src/llm-providers/agent/Agent.d.ts +3 -1
- package/esm/typings/src/other/templates/getTemplatesPipelineCollection.d.ts +1 -1
- package/esm/typings/src/playground/playground.d.ts +3 -0
- package/esm/typings/src/types/typeAliases.d.ts +6 -0
- package/esm/typings/src/utils/color/Color.d.ts +9 -1
- package/esm/typings/src/utils/color/css-colors.d.ts +1 -0
- package/esm/typings/src/utils/random/$generateBookBoilerplate.d.ts +6 -0
- package/esm/typings/src/utils/random/CzechNamePool.d.ts +7 -0
- package/esm/typings/src/utils/random/EnglishNamePool.d.ts +7 -0
- package/esm/typings/src/utils/random/NamePool.d.ts +17 -0
- package/esm/typings/src/utils/random/getNamePool.d.ts +10 -0
- package/esm/typings/src/version.d.ts +1 -1
- package/package.json +3 -3
- package/umd/index.umd.js +71 -19
- package/umd/index.umd.js.map +1 -1
- package/esm/typings/src/book-components/PromptbookAgent/PromptbookAgent.d.ts +0 -29
- package/esm/typings/src/commitments/registry.d.ts +0 -68
- package/esm/typings/src/playground/playground1.d.ts +0 -2
|
@@ -9,6 +9,12 @@ type GenerateBookBoilerplateOptions = PartialDeep<Omit<AgentBasicInformation, 'p
|
|
|
9
9
|
* @default 'Adam'
|
|
10
10
|
*/
|
|
11
11
|
parentAgentName?: string_agent_name_in_book;
|
|
12
|
+
/**
|
|
13
|
+
* Name pool to use for generating agent name
|
|
14
|
+
*
|
|
15
|
+
* @default 'ENGLISH'
|
|
16
|
+
*/
|
|
17
|
+
namePool?: string;
|
|
12
18
|
};
|
|
13
19
|
/**
|
|
14
20
|
* Generates boilerplate for a new agent book
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { string_color, string_person_fullname } from '../../types/typeAliases';
|
|
2
|
+
/**
|
|
3
|
+
* Result of generating a name
|
|
4
|
+
*/
|
|
5
|
+
export type GenerateNameResult = {
|
|
6
|
+
fullname: string_person_fullname;
|
|
7
|
+
color: string_color;
|
|
8
|
+
};
|
|
9
|
+
/**
|
|
10
|
+
* Interface for a name pool
|
|
11
|
+
*/
|
|
12
|
+
export type NamePool = {
|
|
13
|
+
/**
|
|
14
|
+
* Generates a random name
|
|
15
|
+
*/
|
|
16
|
+
generateName(): GenerateNameResult;
|
|
17
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { NamePool } from './NamePool';
|
|
2
|
+
/**
|
|
3
|
+
* Gets the name pool based on the language code
|
|
4
|
+
*
|
|
5
|
+
* @param language - The language code (e.g. 'ENGLISH', 'CZECH')
|
|
6
|
+
* @returns The name pool
|
|
7
|
+
*
|
|
8
|
+
* @private [๐] Maybe expose via some package
|
|
9
|
+
*/
|
|
10
|
+
export declare function getNamePool(language: string): NamePool;
|
|
@@ -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-65`).
|
|
19
19
|
*
|
|
20
20
|
* @generated
|
|
21
21
|
*/
|
package/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@promptbook/fake-llm",
|
|
3
|
-
"version": "0.103.0-
|
|
3
|
+
"version": "0.103.0-66",
|
|
4
4
|
"description": "Promptbook: Turn your company's scattered knowledge into AI ready books",
|
|
5
5
|
"private": false,
|
|
6
6
|
"sideEffects": false,
|
|
7
7
|
"repository": {
|
|
8
8
|
"type": "git",
|
|
9
|
-
"url": "https://github.com/webgptorg/promptbook"
|
|
9
|
+
"url": "git+https://github.com/webgptorg/promptbook.git"
|
|
10
10
|
},
|
|
11
11
|
"author": "Pavol Hejnรฝ <pavol@ptbk.io> (https://www.pavolhejny.com/)",
|
|
12
12
|
"contributors": [
|
|
@@ -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-66"
|
|
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-66';
|
|
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',
|
|
@@ -383,21 +395,61 @@
|
|
|
383
395
|
* @param color
|
|
384
396
|
* @returns Color object
|
|
385
397
|
*/
|
|
386
|
-
static from(color) {
|
|
387
|
-
if (color
|
|
398
|
+
static from(color, _isSingleValue = false) {
|
|
399
|
+
if (color === '') {
|
|
400
|
+
throw new Error(`Can not create color from empty string`);
|
|
401
|
+
}
|
|
402
|
+
else if (color instanceof Color) {
|
|
388
403
|
return take(color);
|
|
389
404
|
}
|
|
390
405
|
else if (Color.isColor(color)) {
|
|
391
406
|
return take(color);
|
|
392
407
|
}
|
|
393
408
|
else if (typeof color === 'string') {
|
|
394
|
-
|
|
409
|
+
try {
|
|
410
|
+
return Color.fromString(color);
|
|
411
|
+
}
|
|
412
|
+
catch (error) {
|
|
413
|
+
// <- Note: Can not use `assertsError(error)` here because it causes circular dependency
|
|
414
|
+
if (_isSingleValue) {
|
|
415
|
+
throw error;
|
|
416
|
+
}
|
|
417
|
+
const parts = color.split(/[\s+,;|]/);
|
|
418
|
+
if (parts.length > 0) {
|
|
419
|
+
return Color.from(parts[0].trim(), true);
|
|
420
|
+
}
|
|
421
|
+
else {
|
|
422
|
+
throw new Error(`Can not create color from given string "${color}"`);
|
|
423
|
+
}
|
|
424
|
+
}
|
|
395
425
|
}
|
|
396
426
|
else {
|
|
397
427
|
console.error({ color });
|
|
398
428
|
throw new Error(`Can not create color from given object`);
|
|
399
429
|
}
|
|
400
430
|
}
|
|
431
|
+
/**
|
|
432
|
+
* Creates a new Color instance from miscellaneous formats
|
|
433
|
+
* It just does not throw error when it fails, it returns PROMPTBOOK_COLOR instead
|
|
434
|
+
*
|
|
435
|
+
* @param color
|
|
436
|
+
* @returns Color object
|
|
437
|
+
*/
|
|
438
|
+
static fromSafe(color) {
|
|
439
|
+
try {
|
|
440
|
+
return Color.from(color);
|
|
441
|
+
}
|
|
442
|
+
catch (error) {
|
|
443
|
+
// <- Note: Can not use `assertsError(error)` here because it causes circular dependency
|
|
444
|
+
console.warn(spaceTrim((block) => `
|
|
445
|
+
Color.fromSafe error:
|
|
446
|
+
${block(error.message)}
|
|
447
|
+
|
|
448
|
+
Returning default PROMPTBOOK_COLOR.
|
|
449
|
+
`));
|
|
450
|
+
return Color.fromString('promptbook');
|
|
451
|
+
}
|
|
452
|
+
}
|
|
401
453
|
/**
|
|
402
454
|
* Creates a new Color instance from miscellaneous string formats
|
|
403
455
|
*
|
|
@@ -987,7 +1039,7 @@
|
|
|
987
1039
|
*
|
|
988
1040
|
* @public exported from `@promptbook/core`
|
|
989
1041
|
*/
|
|
990
|
-
const PROMPTBOOK_COLOR = Color.
|
|
1042
|
+
const PROMPTBOOK_COLOR = Color.fromString('promptbook');
|
|
991
1043
|
// <- TODO: [๐ง ][๐ต] Using `Color` here increases the package size approx 3kb, maybe remove it
|
|
992
1044
|
/**
|
|
993
1045
|
* Colors for syntax highlighting in the `<BookEditor/>`
|
|
@@ -1145,7 +1197,7 @@
|
|
|
1145
1197
|
*/
|
|
1146
1198
|
class UnexpectedError extends Error {
|
|
1147
1199
|
constructor(message) {
|
|
1148
|
-
super(spaceTrim.spaceTrim((block) => `
|
|
1200
|
+
super(spaceTrim$1.spaceTrim((block) => `
|
|
1149
1201
|
${block(message)}
|
|
1150
1202
|
|
|
1151
1203
|
Note: This error should not happen.
|
|
@@ -1171,7 +1223,7 @@
|
|
|
1171
1223
|
constructor(whatWasThrown) {
|
|
1172
1224
|
const tag = `[๐คฎ]`;
|
|
1173
1225
|
console.error(tag, whatWasThrown);
|
|
1174
|
-
super(spaceTrim.spaceTrim(`
|
|
1226
|
+
super(spaceTrim$1.spaceTrim(`
|
|
1175
1227
|
Non-Error object was thrown
|
|
1176
1228
|
|
|
1177
1229
|
Note: Look for ${tag} in the console for more details
|
|
@@ -1722,7 +1774,7 @@
|
|
|
1722
1774
|
order: [],
|
|
1723
1775
|
value: {
|
|
1724
1776
|
// Note: The โquotesโ are intentional to test AI humanization and Promptbookification
|
|
1725
|
-
content: spaceTrim.spaceTrim((block) => `
|
|
1777
|
+
content: spaceTrim$1.spaceTrim((block) => `
|
|
1726
1778
|
You said:
|
|
1727
1779
|
โ${block(rawPromptContent)}โ${thread ? ` +${thread.length} other messages` : ''}
|
|
1728
1780
|
|
|
@@ -1761,7 +1813,7 @@
|
|
|
1761
1813
|
message: `Result of \`MockedEchoLlmExecutionTools.callCompletionModel\``,
|
|
1762
1814
|
order: [],
|
|
1763
1815
|
value: {
|
|
1764
|
-
content: spaceTrim.spaceTrim((block) => `
|
|
1816
|
+
content: spaceTrim$1.spaceTrim((block) => `
|
|
1765
1817
|
${block(rawPromptContent)}
|
|
1766
1818
|
And so on...
|
|
1767
1819
|
`),
|
|
@@ -2710,7 +2762,7 @@
|
|
|
2710
2762
|
let trimmedText = text;
|
|
2711
2763
|
// Remove leading and trailing spaces and newlines
|
|
2712
2764
|
if (isTrimmed) {
|
|
2713
|
-
trimmedText = spaceTrim.spaceTrim(trimmedText);
|
|
2765
|
+
trimmedText = spaceTrim$1.spaceTrim(trimmedText);
|
|
2714
2766
|
}
|
|
2715
2767
|
let processedText = trimmedText;
|
|
2716
2768
|
if (isIntroduceSentenceRemoved) {
|
|
@@ -2719,7 +2771,7 @@
|
|
|
2719
2771
|
// Remove the introduce sentence and quotes by replacing it with an empty string
|
|
2720
2772
|
processedText = processedText.replace(introduceSentenceRegex, '');
|
|
2721
2773
|
}
|
|
2722
|
-
processedText = spaceTrim.spaceTrim(processedText);
|
|
2774
|
+
processedText = spaceTrim$1.spaceTrim(processedText);
|
|
2723
2775
|
}
|
|
2724
2776
|
if (processedText.length < 3) {
|
|
2725
2777
|
return trimmedText;
|
|
@@ -2901,13 +2953,13 @@
|
|
|
2901
2953
|
* @public exported from `@promptbook/markdown-utils`
|
|
2902
2954
|
*/
|
|
2903
2955
|
function trimCodeBlock(value) {
|
|
2904
|
-
value = spaceTrim.spaceTrim(value);
|
|
2956
|
+
value = spaceTrim$1.spaceTrim(value);
|
|
2905
2957
|
if (!/^```[a-z]*(.*)```$/is.test(value)) {
|
|
2906
2958
|
return value;
|
|
2907
2959
|
}
|
|
2908
2960
|
value = value.replace(/^```[a-z]*/i, '');
|
|
2909
2961
|
value = value.replace(/```$/i, '');
|
|
2910
|
-
value = spaceTrim.spaceTrim(value);
|
|
2962
|
+
value = spaceTrim$1.spaceTrim(value);
|
|
2911
2963
|
return value;
|
|
2912
2964
|
}
|
|
2913
2965
|
|
|
@@ -2920,9 +2972,9 @@
|
|
|
2920
2972
|
* @public exported from `@promptbook/markdown-utils`
|
|
2921
2973
|
*/
|
|
2922
2974
|
function trimEndOfCodeBlock(value) {
|
|
2923
|
-
value = spaceTrim.spaceTrim(value);
|
|
2975
|
+
value = spaceTrim$1.spaceTrim(value);
|
|
2924
2976
|
value = value.replace(/```$/g, '');
|
|
2925
|
-
value = spaceTrim.spaceTrim(value);
|
|
2977
|
+
value = spaceTrim$1.spaceTrim(value);
|
|
2926
2978
|
return value;
|
|
2927
2979
|
}
|
|
2928
2980
|
|
|
@@ -3206,7 +3258,7 @@
|
|
|
3206
3258
|
text += (text ? ' ' : '') + nextWord;
|
|
3207
3259
|
}
|
|
3208
3260
|
}
|
|
3209
|
-
throw new LimitReachedError(spaceTrim.spaceTrim((block) => `
|
|
3261
|
+
throw new LimitReachedError(spaceTrim$1.spaceTrim((block) => `
|
|
3210
3262
|
Can not generate fake text to met the expectations
|
|
3211
3263
|
|
|
3212
3264
|
Loop limit reached
|