@promptbook/editable 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 +95 -43
- 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 +68 -16
- 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
package/esm/index.es.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import spaceTrim, { spaceTrim as spaceTrim$1 } from 'spacetrim';
|
|
1
|
+
import spaceTrim$2, { spaceTrim as spaceTrim$1 } from 'spacetrim';
|
|
2
2
|
import { parse, unparse } from 'papaparse';
|
|
3
3
|
import { SHA256 } from 'crypto-js';
|
|
4
4
|
import hexEncoder from 'crypto-js/enc-hex';
|
|
@@ -17,12 +17,23 @@ const BOOK_LANGUAGE_VERSION = '2.0.0';
|
|
|
17
17
|
* @generated
|
|
18
18
|
* @see https://github.com/webgptorg/promptbook
|
|
19
19
|
*/
|
|
20
|
-
const PROMPTBOOK_ENGINE_VERSION = '0.103.0-
|
|
20
|
+
const PROMPTBOOK_ENGINE_VERSION = '0.103.0-66';
|
|
21
21
|
/**
|
|
22
22
|
* TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
|
|
23
23
|
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
24
24
|
*/
|
|
25
25
|
|
|
26
|
+
/**
|
|
27
|
+
* Trims string from all 4 sides
|
|
28
|
+
*
|
|
29
|
+
* Note: This is a re-exported function from the `spacetrim` package which is
|
|
30
|
+
* Developed by same author @hejny as this package
|
|
31
|
+
*
|
|
32
|
+
* @public exported from `@promptbook/utils`
|
|
33
|
+
* @see https://github.com/hejny/spacetrim#usage
|
|
34
|
+
*/
|
|
35
|
+
const spaceTrim = spaceTrim$1;
|
|
36
|
+
|
|
26
37
|
/**
|
|
27
38
|
* @private util of `@promptbook/color`
|
|
28
39
|
* @de
|
|
@@ -71,6 +82,7 @@ function take(initialValue) {
|
|
|
71
82
|
* @public exported from `@promptbook/color`
|
|
72
83
|
*/
|
|
73
84
|
const CSS_COLORS = {
|
|
85
|
+
promptbook: '#79EAFD',
|
|
74
86
|
transparent: 'rgba(0,0,0,0)',
|
|
75
87
|
aliceblue: '#f0f8ff',
|
|
76
88
|
antiquewhite: '#faebd7',
|
|
@@ -271,21 +283,61 @@ class Color {
|
|
|
271
283
|
* @param color
|
|
272
284
|
* @returns Color object
|
|
273
285
|
*/
|
|
274
|
-
static from(color) {
|
|
275
|
-
if (color
|
|
286
|
+
static from(color, _isSingleValue = false) {
|
|
287
|
+
if (color === '') {
|
|
288
|
+
throw new Error(`Can not create color from empty string`);
|
|
289
|
+
}
|
|
290
|
+
else if (color instanceof Color) {
|
|
276
291
|
return take(color);
|
|
277
292
|
}
|
|
278
293
|
else if (Color.isColor(color)) {
|
|
279
294
|
return take(color);
|
|
280
295
|
}
|
|
281
296
|
else if (typeof color === 'string') {
|
|
282
|
-
|
|
297
|
+
try {
|
|
298
|
+
return Color.fromString(color);
|
|
299
|
+
}
|
|
300
|
+
catch (error) {
|
|
301
|
+
// <- Note: Can not use `assertsError(error)` here because it causes circular dependency
|
|
302
|
+
if (_isSingleValue) {
|
|
303
|
+
throw error;
|
|
304
|
+
}
|
|
305
|
+
const parts = color.split(/[\s+,;|]/);
|
|
306
|
+
if (parts.length > 0) {
|
|
307
|
+
return Color.from(parts[0].trim(), true);
|
|
308
|
+
}
|
|
309
|
+
else {
|
|
310
|
+
throw new Error(`Can not create color from given string "${color}"`);
|
|
311
|
+
}
|
|
312
|
+
}
|
|
283
313
|
}
|
|
284
314
|
else {
|
|
285
315
|
console.error({ color });
|
|
286
316
|
throw new Error(`Can not create color from given object`);
|
|
287
317
|
}
|
|
288
318
|
}
|
|
319
|
+
/**
|
|
320
|
+
* Creates a new Color instance from miscellaneous formats
|
|
321
|
+
* It just does not throw error when it fails, it returns PROMPTBOOK_COLOR instead
|
|
322
|
+
*
|
|
323
|
+
* @param color
|
|
324
|
+
* @returns Color object
|
|
325
|
+
*/
|
|
326
|
+
static fromSafe(color) {
|
|
327
|
+
try {
|
|
328
|
+
return Color.from(color);
|
|
329
|
+
}
|
|
330
|
+
catch (error) {
|
|
331
|
+
// <- Note: Can not use `assertsError(error)` here because it causes circular dependency
|
|
332
|
+
console.warn(spaceTrim((block) => `
|
|
333
|
+
Color.fromSafe error:
|
|
334
|
+
${block(error.message)}
|
|
335
|
+
|
|
336
|
+
Returning default PROMPTBOOK_COLOR.
|
|
337
|
+
`));
|
|
338
|
+
return Color.fromString('promptbook');
|
|
339
|
+
}
|
|
340
|
+
}
|
|
289
341
|
/**
|
|
290
342
|
* Creates a new Color instance from miscellaneous string formats
|
|
291
343
|
*
|
|
@@ -895,7 +947,7 @@ const ADMIN_GITHUB_NAME = 'hejny';
|
|
|
895
947
|
*
|
|
896
948
|
* @public exported from `@promptbook/core`
|
|
897
949
|
*/
|
|
898
|
-
const PROMPTBOOK_COLOR = Color.
|
|
950
|
+
const PROMPTBOOK_COLOR = Color.fromString('promptbook');
|
|
899
951
|
// <- TODO: [🧠][🈵] Using `Color` here increases the package size approx 3kb, maybe remove it
|
|
900
952
|
/**
|
|
901
953
|
* Colors for syntax highlighting in the `<BookEditor/>`
|
|
@@ -981,7 +1033,7 @@ parseInt(process.env.API_REQUEST_TIMEOUT || '90000');
|
|
|
981
1033
|
function getErrorReportUrl(error) {
|
|
982
1034
|
const report = {
|
|
983
1035
|
title: `🐜 Error report from ${NAME}`,
|
|
984
|
-
body: spaceTrim((block) => `
|
|
1036
|
+
body: spaceTrim$2((block) => `
|
|
985
1037
|
|
|
986
1038
|
|
|
987
1039
|
\`${error.name || 'Error'}\` has occurred in the [${NAME}], please look into it @${ADMIN_GITHUB_NAME}.
|
|
@@ -1440,7 +1492,7 @@ const expectCommandParser = {
|
|
|
1440
1492
|
/**
|
|
1441
1493
|
* Description of the FORMAT command
|
|
1442
1494
|
*/
|
|
1443
|
-
description: spaceTrim(`
|
|
1495
|
+
description: spaceTrim$2(`
|
|
1444
1496
|
Expect command describes the desired output of the task *(after post-processing)*
|
|
1445
1497
|
It can set limits for the maximum/minimum length of the output, measured in characters, words, sentences, paragraphs or some other shape of the output.
|
|
1446
1498
|
`),
|
|
@@ -1514,7 +1566,7 @@ const expectCommandParser = {
|
|
|
1514
1566
|
}
|
|
1515
1567
|
catch (error) {
|
|
1516
1568
|
assertsError(error);
|
|
1517
|
-
throw new ParseError(spaceTrim((block) => `
|
|
1569
|
+
throw new ParseError(spaceTrim$2((block) => `
|
|
1518
1570
|
Invalid FORMAT command
|
|
1519
1571
|
${block(error.message)}:
|
|
1520
1572
|
`));
|
|
@@ -1666,7 +1718,7 @@ const CsvFormatParser = {
|
|
|
1666
1718
|
const { value, outputParameterName, settings, mapCallback, onProgress } = options;
|
|
1667
1719
|
const csv = csvParse(value, settings);
|
|
1668
1720
|
if (csv.errors.length !== 0) {
|
|
1669
|
-
throw new CsvFormatError(spaceTrim((block) => `
|
|
1721
|
+
throw new CsvFormatError(spaceTrim$2((block) => `
|
|
1670
1722
|
CSV parsing error
|
|
1671
1723
|
|
|
1672
1724
|
Error(s) from CSV parsing:
|
|
@@ -1711,7 +1763,7 @@ const CsvFormatParser = {
|
|
|
1711
1763
|
const { value, settings, mapCallback, onProgress } = options;
|
|
1712
1764
|
const csv = csvParse(value, settings);
|
|
1713
1765
|
if (csv.errors.length !== 0) {
|
|
1714
|
-
throw new CsvFormatError(spaceTrim((block) => `
|
|
1766
|
+
throw new CsvFormatError(spaceTrim$2((block) => `
|
|
1715
1767
|
CSV parsing error
|
|
1716
1768
|
|
|
1717
1769
|
Error(s) from CSV parsing:
|
|
@@ -2056,7 +2108,7 @@ function checkSerializableAsJson(options) {
|
|
|
2056
2108
|
}
|
|
2057
2109
|
else if (typeof value === 'object') {
|
|
2058
2110
|
if (value instanceof Date) {
|
|
2059
|
-
throw new UnexpectedError(spaceTrim((block) => `
|
|
2111
|
+
throw new UnexpectedError(spaceTrim$2((block) => `
|
|
2060
2112
|
\`${name}\` is Date
|
|
2061
2113
|
|
|
2062
2114
|
Use \`string_date_iso8601\` instead
|
|
@@ -2075,7 +2127,7 @@ function checkSerializableAsJson(options) {
|
|
|
2075
2127
|
throw new UnexpectedError(`${name} is RegExp`);
|
|
2076
2128
|
}
|
|
2077
2129
|
else if (value instanceof Error) {
|
|
2078
|
-
throw new UnexpectedError(spaceTrim((block) => `
|
|
2130
|
+
throw new UnexpectedError(spaceTrim$2((block) => `
|
|
2079
2131
|
\`${name}\` is unserialized Error
|
|
2080
2132
|
|
|
2081
2133
|
Use function \`serializeError\`
|
|
@@ -2098,7 +2150,7 @@ function checkSerializableAsJson(options) {
|
|
|
2098
2150
|
}
|
|
2099
2151
|
catch (error) {
|
|
2100
2152
|
assertsError(error);
|
|
2101
|
-
throw new UnexpectedError(spaceTrim((block) => `
|
|
2153
|
+
throw new UnexpectedError(spaceTrim$2((block) => `
|
|
2102
2154
|
\`${name}\` is not serializable
|
|
2103
2155
|
|
|
2104
2156
|
${block(error.stack || error.message)}
|
|
@@ -2130,7 +2182,7 @@ function checkSerializableAsJson(options) {
|
|
|
2130
2182
|
}
|
|
2131
2183
|
}
|
|
2132
2184
|
else {
|
|
2133
|
-
throw new UnexpectedError(spaceTrim((block) => `
|
|
2185
|
+
throw new UnexpectedError(spaceTrim$2((block) => `
|
|
2134
2186
|
\`${name}\` is unknown type
|
|
2135
2187
|
|
|
2136
2188
|
Additional message for \`${name}\`:
|
|
@@ -2660,7 +2712,7 @@ function validateParameterName(parameterName) {
|
|
|
2660
2712
|
if (!(error instanceof ParseError)) {
|
|
2661
2713
|
throw error;
|
|
2662
2714
|
}
|
|
2663
|
-
throw new ParseError(spaceTrim((block) => `
|
|
2715
|
+
throw new ParseError(spaceTrim$2((block) => `
|
|
2664
2716
|
${block(error.message)}
|
|
2665
2717
|
|
|
2666
2718
|
Tried to validate parameter name:
|
|
@@ -2719,7 +2771,7 @@ const foreachCommandParser = {
|
|
|
2719
2771
|
const assignSign = args[3];
|
|
2720
2772
|
const formatDefinition = FORMAT_DEFINITIONS.find((formatDefinition) => [formatDefinition.formatName, ...(formatDefinition.aliases || [])].includes(formatName));
|
|
2721
2773
|
if (formatDefinition === undefined) {
|
|
2722
|
-
throw new ParseError(spaceTrim((block) => `
|
|
2774
|
+
throw new ParseError(spaceTrim$2((block) => `
|
|
2723
2775
|
Unsupported format "${formatName}"
|
|
2724
2776
|
|
|
2725
2777
|
Available formats:
|
|
@@ -2731,7 +2783,7 @@ const foreachCommandParser = {
|
|
|
2731
2783
|
}
|
|
2732
2784
|
const subvalueParser = formatDefinition.subvalueParsers.find((subvalueParser) => [subvalueParser.subvalueName, ...(subvalueParser.aliases || [])].includes(subformatName));
|
|
2733
2785
|
if (subvalueParser === undefined) {
|
|
2734
|
-
throw new ParseError(spaceTrim((block) => `
|
|
2786
|
+
throw new ParseError(spaceTrim$2((block) => `
|
|
2735
2787
|
Unsupported subformat name "${subformatName}" for format "${formatName}"
|
|
2736
2788
|
|
|
2737
2789
|
Available subformat names for format "${formatDefinition.formatName}":
|
|
@@ -2779,7 +2831,7 @@ const foreachCommandParser = {
|
|
|
2779
2831
|
outputSubparameterName = 'newLine';
|
|
2780
2832
|
}
|
|
2781
2833
|
else {
|
|
2782
|
-
throw new ParseError(spaceTrim(`
|
|
2834
|
+
throw new ParseError(spaceTrim$2(`
|
|
2783
2835
|
FOREACH ${formatName} ${subformatName} must specify output subparameter
|
|
2784
2836
|
|
|
2785
2837
|
Correct example:
|
|
@@ -2855,7 +2907,7 @@ const formatCommandParser = {
|
|
|
2855
2907
|
/**
|
|
2856
2908
|
* Description of the FORMAT command
|
|
2857
2909
|
*/
|
|
2858
|
-
description: spaceTrim(`
|
|
2910
|
+
description: spaceTrim$2(`
|
|
2859
2911
|
Format command describes the desired output of the task (after post-processing)
|
|
2860
2912
|
It can set limits for the maximum/minimum length of the output, measured in characters, words, sentences, paragraphs or some other shape of the output.
|
|
2861
2913
|
`),
|
|
@@ -3227,7 +3279,7 @@ const formfactorCommandParser = {
|
|
|
3227
3279
|
const formfactorNameCandidate = args[0].toUpperCase();
|
|
3228
3280
|
const formfactor = FORMFACTOR_DEFINITIONS.find((definition) => [definition.name, ...{ aliasNames: [], ...definition }.aliasNames].includes(formfactorNameCandidate));
|
|
3229
3281
|
if (formfactor === undefined) {
|
|
3230
|
-
throw new ParseError(spaceTrim((block) => `
|
|
3282
|
+
throw new ParseError(spaceTrim$2((block) => `
|
|
3231
3283
|
Unknown formfactor name "${formfactorNameCandidate}"
|
|
3232
3284
|
|
|
3233
3285
|
Available formfactors:
|
|
@@ -3246,7 +3298,7 @@ const formfactorCommandParser = {
|
|
|
3246
3298
|
*/
|
|
3247
3299
|
$applyToPipelineJson(command, $pipelineJson) {
|
|
3248
3300
|
if ($pipelineJson.formfactorName !== undefined && $pipelineJson.formfactorName !== command.formfactorName) {
|
|
3249
|
-
throw new ParseError(spaceTrim(`
|
|
3301
|
+
throw new ParseError(spaceTrim$2(`
|
|
3250
3302
|
Redefinition of \`FORMFACTOR\` in the pipeline head
|
|
3251
3303
|
|
|
3252
3304
|
You have used:
|
|
@@ -3549,7 +3601,7 @@ const knowledgeCommandParser = {
|
|
|
3549
3601
|
*/
|
|
3550
3602
|
parse(input) {
|
|
3551
3603
|
const { args } = input;
|
|
3552
|
-
const knowledgeSourceContent = spaceTrim(args[0] || '');
|
|
3604
|
+
const knowledgeSourceContent = spaceTrim$2(args[0] || '');
|
|
3553
3605
|
if (knowledgeSourceContent === '') {
|
|
3554
3606
|
throw new ParseError(`Source is not defined`);
|
|
3555
3607
|
}
|
|
@@ -3643,7 +3695,7 @@ const modelCommandParser = {
|
|
|
3643
3695
|
*/
|
|
3644
3696
|
parse(input) {
|
|
3645
3697
|
const { args, normalized } = input;
|
|
3646
|
-
const availableVariantsMessage = spaceTrim((block) => `
|
|
3698
|
+
const availableVariantsMessage = spaceTrim$2((block) => `
|
|
3647
3699
|
Available variants are:
|
|
3648
3700
|
${block(MODEL_VARIANTS.map((variantName) => `- ${variantName}${variantName !== 'EMBEDDING' ? '' : ' (Not available in pipeline)'}`).join('\n'))}
|
|
3649
3701
|
`);
|
|
@@ -3665,14 +3717,14 @@ const modelCommandParser = {
|
|
|
3665
3717
|
// <- Note: [🤖]
|
|
3666
3718
|
}
|
|
3667
3719
|
else if (normalized.startsWith('MODEL_VARIANT_EMBED')) {
|
|
3668
|
-
spaceTrim((block) => `
|
|
3720
|
+
spaceTrim$2((block) => `
|
|
3669
3721
|
Embedding model can not be used in pipeline
|
|
3670
3722
|
|
|
3671
3723
|
${block(availableVariantsMessage)}
|
|
3672
3724
|
`);
|
|
3673
3725
|
}
|
|
3674
3726
|
else {
|
|
3675
|
-
throw new ParseError(spaceTrim((block) => `
|
|
3727
|
+
throw new ParseError(spaceTrim$2((block) => `
|
|
3676
3728
|
Unknown model variant in command:
|
|
3677
3729
|
|
|
3678
3730
|
${block(availableVariantsMessage)}
|
|
@@ -3687,7 +3739,7 @@ const modelCommandParser = {
|
|
|
3687
3739
|
};
|
|
3688
3740
|
}
|
|
3689
3741
|
else {
|
|
3690
|
-
throw new ParseError(spaceTrim((block) => `
|
|
3742
|
+
throw new ParseError(spaceTrim$2((block) => `
|
|
3691
3743
|
Unknown model key in command.
|
|
3692
3744
|
|
|
3693
3745
|
Supported model keys are:
|
|
@@ -3714,7 +3766,7 @@ const modelCommandParser = {
|
|
|
3714
3766
|
// <- TODO: [🏮] Some standard way how to transform errors into warnings and how to handle non-critical fails during the tasks
|
|
3715
3767
|
}
|
|
3716
3768
|
else {
|
|
3717
|
-
throw new ParseError(spaceTrim(`
|
|
3769
|
+
throw new ParseError(spaceTrim$2(`
|
|
3718
3770
|
Redefinition of \`MODEL ${command.key}\` in the pipeline head
|
|
3719
3771
|
|
|
3720
3772
|
You have used:
|
|
@@ -3746,7 +3798,7 @@ const modelCommandParser = {
|
|
|
3746
3798
|
// <- TODO: [🏮] Some standard way how to transform errors into warnings and how to handle non-critical fails during the tasks
|
|
3747
3799
|
}
|
|
3748
3800
|
else {
|
|
3749
|
-
throw new ParseError(spaceTrim(`
|
|
3801
|
+
throw new ParseError(spaceTrim$2(`
|
|
3750
3802
|
Redefinition of MODEL \`${command.key}\` in the task "${$taskJson.title || $taskJson.name}"
|
|
3751
3803
|
|
|
3752
3804
|
You have used:
|
|
@@ -3756,7 +3808,7 @@ const modelCommandParser = {
|
|
|
3756
3808
|
}
|
|
3757
3809
|
}
|
|
3758
3810
|
if (command.value === ($pipelineJson.defaultModelRequirements || {})[command.key]) {
|
|
3759
|
-
console.log(spaceTrim(`
|
|
3811
|
+
console.log(spaceTrim$2(`
|
|
3760
3812
|
Setting MODEL \`${command.key}\` in the task "${$taskJson.title || $taskJson.name}" to the same value as in the pipeline head
|
|
3761
3813
|
|
|
3762
3814
|
In pipeline head:
|
|
@@ -3839,7 +3891,7 @@ const parameterCommandParser = {
|
|
|
3839
3891
|
// <- TODO: When [🥶] fixed, change to:
|
|
3840
3892
|
// > const parameterDescriptionRaw = rawArgs.split(parameterNameRaw).join('').trim();
|
|
3841
3893
|
if (parameterDescriptionRaw && parameterDescriptionRaw.match(/\{(?<embeddedParameterName>[a-z0-9_]+)\}/im)) {
|
|
3842
|
-
throw new ParseError(spaceTrim((block) => `
|
|
3894
|
+
throw new ParseError(spaceTrim$2((block) => `
|
|
3843
3895
|
Parameter \`{${parameterNameRaw}}\` can not contain another parameter in description
|
|
3844
3896
|
|
|
3845
3897
|
The description:
|
|
@@ -4021,7 +4073,7 @@ function $applyToTaskJson(command, $taskJson, $pipelineJson) {
|
|
|
4021
4073
|
persona.description = personaDescription;
|
|
4022
4074
|
return;
|
|
4023
4075
|
}
|
|
4024
|
-
console.warn(spaceTrim(`
|
|
4076
|
+
console.warn(spaceTrim$2(`
|
|
4025
4077
|
|
|
4026
4078
|
Persona "${personaName}" is defined multiple times with different description:
|
|
4027
4079
|
|
|
@@ -4032,7 +4084,7 @@ function $applyToTaskJson(command, $taskJson, $pipelineJson) {
|
|
|
4032
4084
|
${personaDescription}
|
|
4033
4085
|
|
|
4034
4086
|
`));
|
|
4035
|
-
persona.description += spaceTrim('\n\n' + personaDescription);
|
|
4087
|
+
persona.description += spaceTrim$2('\n\n' + personaDescription);
|
|
4036
4088
|
}
|
|
4037
4089
|
|
|
4038
4090
|
/**
|
|
@@ -4254,7 +4306,7 @@ const sectionCommandParser = {
|
|
|
4254
4306
|
normalized = normalized.split('DIALOGUE').join('DIALOG');
|
|
4255
4307
|
const taskTypes = SectionTypes.filter((sectionType) => normalized.includes(sectionType.split('_TASK').join('')));
|
|
4256
4308
|
if (taskTypes.length !== 1) {
|
|
4257
|
-
throw new ParseError(spaceTrim((block) => `
|
|
4309
|
+
throw new ParseError(spaceTrim$2((block) => `
|
|
4258
4310
|
Unknown section type "${normalized}"
|
|
4259
4311
|
|
|
4260
4312
|
Supported section types are:
|
|
@@ -4274,7 +4326,7 @@ const sectionCommandParser = {
|
|
|
4274
4326
|
*/
|
|
4275
4327
|
$applyToTaskJson(command, $taskJson, $pipelineJson) {
|
|
4276
4328
|
if ($taskJson.isSectionTypeSet === true) {
|
|
4277
|
-
throw new ParseError(spaceTrim(`
|
|
4329
|
+
throw new ParseError(spaceTrim$2(`
|
|
4278
4330
|
Section type is already defined in the section.
|
|
4279
4331
|
It can be defined only once.
|
|
4280
4332
|
`));
|
|
@@ -4947,7 +4999,7 @@ function removeMarkdownComments(content) {
|
|
|
4947
4999
|
*/
|
|
4948
5000
|
function isFlatPipeline(pipelineString) {
|
|
4949
5001
|
pipelineString = removeMarkdownComments(pipelineString);
|
|
4950
|
-
pipelineString = spaceTrim(pipelineString);
|
|
5002
|
+
pipelineString = spaceTrim$2(pipelineString);
|
|
4951
5003
|
const isMarkdownBeginningWithHeadline = pipelineString.startsWith('# ');
|
|
4952
5004
|
//const isLastLineReturnStatement = pipelineString.split('\n').pop()!.split('`').join('').startsWith('->');
|
|
4953
5005
|
const isBacktickBlockUsed = pipelineString.includes('```');
|
|
@@ -4973,7 +5025,7 @@ function deflatePipeline(pipelineString) {
|
|
|
4973
5025
|
if (!isFlatPipeline(pipelineString)) {
|
|
4974
5026
|
return pipelineString;
|
|
4975
5027
|
}
|
|
4976
|
-
pipelineString = spaceTrim(pipelineString);
|
|
5028
|
+
pipelineString = spaceTrim$2(pipelineString);
|
|
4977
5029
|
const pipelineStringLines = pipelineString.split('\n');
|
|
4978
5030
|
const potentialReturnStatement = pipelineStringLines.pop();
|
|
4979
5031
|
let returnStatement;
|
|
@@ -4986,19 +5038,19 @@ function deflatePipeline(pipelineString) {
|
|
|
4986
5038
|
returnStatement = `-> {${DEFAULT_BOOK_OUTPUT_PARAMETER_NAME}}`;
|
|
4987
5039
|
pipelineStringLines.push(potentialReturnStatement);
|
|
4988
5040
|
}
|
|
4989
|
-
const prompt = spaceTrim(pipelineStringLines.join('\n'));
|
|
5041
|
+
const prompt = spaceTrim$2(pipelineStringLines.join('\n'));
|
|
4990
5042
|
let quotedPrompt;
|
|
4991
5043
|
if (prompt.split('\n').length <= 1) {
|
|
4992
5044
|
quotedPrompt = `> ${prompt}`;
|
|
4993
5045
|
}
|
|
4994
5046
|
else {
|
|
4995
|
-
quotedPrompt = spaceTrim((block) => `
|
|
5047
|
+
quotedPrompt = spaceTrim$2((block) => `
|
|
4996
5048
|
\`\`\`
|
|
4997
5049
|
${block(prompt.split('`').join('\\`'))}
|
|
4998
5050
|
\`\`\`
|
|
4999
5051
|
`);
|
|
5000
5052
|
}
|
|
5001
|
-
pipelineString = validatePipelineString(spaceTrim((block) => `
|
|
5053
|
+
pipelineString = validatePipelineString(spaceTrim$2((block) => `
|
|
5002
5054
|
# ${DEFAULT_BOOK_TITLE}
|
|
5003
5055
|
|
|
5004
5056
|
## Prompt
|
|
@@ -5066,7 +5118,7 @@ function addPipelineCommand(options) {
|
|
|
5066
5118
|
);
|
|
5067
5119
|
*/
|
|
5068
5120
|
}
|
|
5069
|
-
return spaceTrim(newLines.join('\n'));
|
|
5121
|
+
return spaceTrim$2(newLines.join('\n'));
|
|
5070
5122
|
}
|
|
5071
5123
|
/**
|
|
5072
5124
|
* TODO: [🧠] What is the better solution - `- xxx`, - `- xxx` or preserve (see also next TODO)
|
|
@@ -5108,7 +5160,7 @@ function removePipelineCommand(options) {
|
|
|
5108
5160
|
}
|
|
5109
5161
|
newLines.push(line);
|
|
5110
5162
|
}
|
|
5111
|
-
const newPipeline = spaceTrim(newLines.join('\n'));
|
|
5163
|
+
const newPipeline = spaceTrim$2(newLines.join('\n'));
|
|
5112
5164
|
return newPipeline;
|
|
5113
5165
|
}
|
|
5114
5166
|
|
|
@@ -5211,7 +5263,7 @@ function isSerializableAsJson(value) {
|
|
|
5211
5263
|
*/
|
|
5212
5264
|
function stringifyPipelineJson(pipeline) {
|
|
5213
5265
|
if (!isSerializableAsJson(pipeline)) {
|
|
5214
|
-
throw new UnexpectedError(spaceTrim(`
|
|
5266
|
+
throw new UnexpectedError(spaceTrim$2(`
|
|
5215
5267
|
Cannot stringify the pipeline, because it is not serializable as JSON
|
|
5216
5268
|
|
|
5217
5269
|
There can be multiple reasons:
|