@promptbook/browser 0.103.0-56 → 0.103.0-67
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 +65 -10
- package/esm/index.es.js.map +1 -1
- package/esm/typings/src/_packages/components.index.d.ts +2 -2
- package/esm/typings/src/_packages/types.index.d.ts +6 -0
- 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/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/USE_BROWSER/USE_BROWSER.d.ts +4 -0
- package/esm/typings/src/commitments/_base/BaseCommitmentDefinition.d.ts +6 -0
- 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/types/typeAliases.d.ts +6 -0
- package/esm/typings/src/utils/color/Color.d.ts +1 -1
- 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 +65 -10
- package/umd/index.umd.js.map +1 -1
- package/esm/typings/src/book-components/PromptbookAgent/PromptbookAgent.d.ts +0 -29
package/esm/index.es.js
CHANGED
|
@@ -19,7 +19,7 @@ const BOOK_LANGUAGE_VERSION = '2.0.0';
|
|
|
19
19
|
* @generated
|
|
20
20
|
* @see https://github.com/webgptorg/promptbook
|
|
21
21
|
*/
|
|
22
|
-
const PROMPTBOOK_ENGINE_VERSION = '0.103.0-
|
|
22
|
+
const PROMPTBOOK_ENGINE_VERSION = '0.103.0-67';
|
|
23
23
|
/**
|
|
24
24
|
* TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
|
|
25
25
|
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
@@ -411,15 +411,33 @@ class Color {
|
|
|
411
411
|
* @param color
|
|
412
412
|
* @returns Color object
|
|
413
413
|
*/
|
|
414
|
-
static from(color) {
|
|
415
|
-
if (color
|
|
414
|
+
static from(color, _isSingleValue = false) {
|
|
415
|
+
if (color === '') {
|
|
416
|
+
throw new Error(`Can not create color from empty string`);
|
|
417
|
+
}
|
|
418
|
+
else if (color instanceof Color) {
|
|
416
419
|
return take(color);
|
|
417
420
|
}
|
|
418
421
|
else if (Color.isColor(color)) {
|
|
419
422
|
return take(color);
|
|
420
423
|
}
|
|
421
424
|
else if (typeof color === 'string') {
|
|
422
|
-
|
|
425
|
+
try {
|
|
426
|
+
return Color.fromString(color);
|
|
427
|
+
}
|
|
428
|
+
catch (error) {
|
|
429
|
+
// <- Note: Can not use `assertsError(error)` here because it causes circular dependency
|
|
430
|
+
if (_isSingleValue) {
|
|
431
|
+
throw error;
|
|
432
|
+
}
|
|
433
|
+
const parts = color.split(/[\s+,;|]/);
|
|
434
|
+
if (parts.length > 0) {
|
|
435
|
+
return Color.from(parts[0].trim(), true);
|
|
436
|
+
}
|
|
437
|
+
else {
|
|
438
|
+
throw new Error(`Can not create color from given string "${color}"`);
|
|
439
|
+
}
|
|
440
|
+
}
|
|
423
441
|
}
|
|
424
442
|
else {
|
|
425
443
|
console.error({ color });
|
|
@@ -2704,15 +2722,19 @@ function createDefaultAgentName(agentSource) {
|
|
|
2704
2722
|
*
|
|
2705
2723
|
* @private - TODO: [🧠] Maybe should be public?
|
|
2706
2724
|
*/
|
|
2707
|
-
function createCommitmentRegex(commitment, aliases = []) {
|
|
2725
|
+
function createCommitmentRegex(commitment, aliases = [], requiresContent = true) {
|
|
2708
2726
|
const allCommitments = [commitment, ...aliases];
|
|
2709
2727
|
const patterns = allCommitments.map((c) => {
|
|
2710
2728
|
const escapedCommitment = c.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
|
|
2711
2729
|
return escapedCommitment.split(/\s+/).join('\\s+');
|
|
2712
2730
|
});
|
|
2713
2731
|
const keywordPattern = patterns.join('|');
|
|
2714
|
-
|
|
2715
|
-
|
|
2732
|
+
if (requiresContent) {
|
|
2733
|
+
return new RegExp(`^\\s*(?<type>${keywordPattern})\\b\\s+(?<contents>.+)$`, 'gim');
|
|
2734
|
+
}
|
|
2735
|
+
else {
|
|
2736
|
+
return new RegExp(`^\\s*(?<type>${keywordPattern})\\b(?:\\s+(?<contents>.+))?$`, 'gim');
|
|
2737
|
+
}
|
|
2716
2738
|
}
|
|
2717
2739
|
/**
|
|
2718
2740
|
* Generates a regex pattern to match a specific commitment type
|
|
@@ -2745,12 +2767,20 @@ class BaseCommitmentDefinition {
|
|
|
2745
2767
|
this.type = type;
|
|
2746
2768
|
this.aliases = aliases;
|
|
2747
2769
|
}
|
|
2770
|
+
/**
|
|
2771
|
+
* Whether this commitment requires content.
|
|
2772
|
+
* If true, regex will match only if there is content after the commitment keyword.
|
|
2773
|
+
* If false, regex will match even if there is no content.
|
|
2774
|
+
*/
|
|
2775
|
+
get requiresContent() {
|
|
2776
|
+
return true;
|
|
2777
|
+
}
|
|
2748
2778
|
/**
|
|
2749
2779
|
* Creates a regex pattern to match this commitment in agent source
|
|
2750
2780
|
* Uses the existing createCommitmentRegex function as internal helper
|
|
2751
2781
|
*/
|
|
2752
2782
|
createRegex() {
|
|
2753
|
-
return createCommitmentRegex(this.type, this.aliases);
|
|
2783
|
+
return createCommitmentRegex(this.type, this.aliases, this.requiresContent);
|
|
2754
2784
|
}
|
|
2755
2785
|
/**
|
|
2756
2786
|
* Creates a regex pattern to match just the commitment type
|
|
@@ -2902,6 +2932,12 @@ class ClosedCommitmentDefinition extends BaseCommitmentDefinition {
|
|
|
2902
2932
|
constructor() {
|
|
2903
2933
|
super('CLOSED');
|
|
2904
2934
|
}
|
|
2935
|
+
/**
|
|
2936
|
+
* The `CLOSED` commitment is standalone.
|
|
2937
|
+
*/
|
|
2938
|
+
get requiresContent() {
|
|
2939
|
+
return false;
|
|
2940
|
+
}
|
|
2905
2941
|
/**
|
|
2906
2942
|
* Short one-line description of CLOSED.
|
|
2907
2943
|
*/
|
|
@@ -5581,6 +5617,12 @@ class UseBrowserCommitmentDefinition extends BaseCommitmentDefinition {
|
|
|
5581
5617
|
constructor() {
|
|
5582
5618
|
super('USE BROWSER', ['BROWSER']);
|
|
5583
5619
|
}
|
|
5620
|
+
/**
|
|
5621
|
+
* The `USE BROWSER` commitment is standalone.
|
|
5622
|
+
*/
|
|
5623
|
+
get requiresContent() {
|
|
5624
|
+
return false;
|
|
5625
|
+
}
|
|
5584
5626
|
/**
|
|
5585
5627
|
* Short one-line description of USE BROWSER.
|
|
5586
5628
|
*/
|
|
@@ -6188,11 +6230,11 @@ function parseAgentSource(agentSource) {
|
|
|
6188
6230
|
continue;
|
|
6189
6231
|
}
|
|
6190
6232
|
if (commitment.type === 'META COLOR') {
|
|
6191
|
-
meta.color =
|
|
6233
|
+
meta.color = normalizeSeparator(commitment.content);
|
|
6192
6234
|
continue;
|
|
6193
6235
|
}
|
|
6194
6236
|
if (commitment.type === 'META FONT') {
|
|
6195
|
-
meta.font =
|
|
6237
|
+
meta.font = normalizeSeparator(commitment.content);
|
|
6196
6238
|
continue;
|
|
6197
6239
|
}
|
|
6198
6240
|
if (commitment.type !== 'META') {
|
|
@@ -6228,6 +6270,19 @@ function parseAgentSource(agentSource) {
|
|
|
6228
6270
|
parameters,
|
|
6229
6271
|
};
|
|
6230
6272
|
}
|
|
6273
|
+
/**
|
|
6274
|
+
* Normalizes the separator in the content
|
|
6275
|
+
*
|
|
6276
|
+
* @param content - The content to normalize
|
|
6277
|
+
* @returns The content with normalized separators
|
|
6278
|
+
*/
|
|
6279
|
+
function normalizeSeparator(content) {
|
|
6280
|
+
const trimmed = spaceTrim$2(content);
|
|
6281
|
+
if (trimmed.includes(',')) {
|
|
6282
|
+
return trimmed;
|
|
6283
|
+
}
|
|
6284
|
+
return trimmed.split(/\s+/).join(', ');
|
|
6285
|
+
}
|
|
6231
6286
|
/**
|
|
6232
6287
|
* TODO: [🕛] Unite `AgentBasicInformation`, `ChatParticipant`, `LlmExecutionTools` + `LlmToolsMetadata`
|
|
6233
6288
|
*/
|