@promptbook/node 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 +116 -82
- 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 +124 -90
- 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
package/esm/index.es.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import colors from 'colors';
|
|
2
2
|
import { stat, access, constants, readFile, writeFile, readdir, mkdir, watch, unlink } from 'fs/promises';
|
|
3
3
|
import { basename, join, dirname, isAbsolute, relative } from 'path';
|
|
4
|
-
import spaceTrim, { spaceTrim as spaceTrim$1 } from 'spacetrim';
|
|
4
|
+
import spaceTrim$2, { spaceTrim as spaceTrim$1 } from 'spacetrim';
|
|
5
5
|
import JSZip from 'jszip';
|
|
6
6
|
import { randomBytes } from 'crypto';
|
|
7
7
|
import { Subject } from 'rxjs';
|
|
@@ -28,12 +28,23 @@ const BOOK_LANGUAGE_VERSION = '2.0.0';
|
|
|
28
28
|
* @generated
|
|
29
29
|
* @see https://github.com/webgptorg/promptbook
|
|
30
30
|
*/
|
|
31
|
-
const PROMPTBOOK_ENGINE_VERSION = '0.103.0-
|
|
31
|
+
const PROMPTBOOK_ENGINE_VERSION = '0.103.0-56';
|
|
32
32
|
/**
|
|
33
33
|
* TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
|
|
34
34
|
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
35
35
|
*/
|
|
36
36
|
|
|
37
|
+
/**
|
|
38
|
+
* Trims string from all 4 sides
|
|
39
|
+
*
|
|
40
|
+
* Note: This is a re-exported function from the `spacetrim` package which is
|
|
41
|
+
* Developed by same author @hejny as this package
|
|
42
|
+
*
|
|
43
|
+
* @public exported from `@promptbook/utils`
|
|
44
|
+
* @see https://github.com/hejny/spacetrim#usage
|
|
45
|
+
*/
|
|
46
|
+
const spaceTrim = spaceTrim$1;
|
|
47
|
+
|
|
37
48
|
/**
|
|
38
49
|
* @private util of `@promptbook/color`
|
|
39
50
|
* @de
|
|
@@ -82,6 +93,7 @@ function take(initialValue) {
|
|
|
82
93
|
* @public exported from `@promptbook/color`
|
|
83
94
|
*/
|
|
84
95
|
const CSS_COLORS = {
|
|
96
|
+
promptbook: '#79EAFD',
|
|
85
97
|
transparent: 'rgba(0,0,0,0)',
|
|
86
98
|
aliceblue: '#f0f8ff',
|
|
87
99
|
antiquewhite: '#faebd7',
|
|
@@ -297,6 +309,28 @@ class Color {
|
|
|
297
309
|
throw new Error(`Can not create color from given object`);
|
|
298
310
|
}
|
|
299
311
|
}
|
|
312
|
+
/**
|
|
313
|
+
* Creates a new Color instance from miscellaneous formats
|
|
314
|
+
* It just does not throw error when it fails, it returns PROMPTBOOK_COLOR instead
|
|
315
|
+
*
|
|
316
|
+
* @param color
|
|
317
|
+
* @returns Color object
|
|
318
|
+
*/
|
|
319
|
+
static fromSafe(color) {
|
|
320
|
+
try {
|
|
321
|
+
return Color.from(color);
|
|
322
|
+
}
|
|
323
|
+
catch (error) {
|
|
324
|
+
// <- Note: Can not use `assertsError(error)` here because it causes circular dependency
|
|
325
|
+
console.warn(spaceTrim((block) => `
|
|
326
|
+
Color.fromSafe error:
|
|
327
|
+
${block(error.message)}
|
|
328
|
+
|
|
329
|
+
Returning default PROMPTBOOK_COLOR.
|
|
330
|
+
`));
|
|
331
|
+
return Color.fromString('promptbook');
|
|
332
|
+
}
|
|
333
|
+
}
|
|
300
334
|
/**
|
|
301
335
|
* Creates a new Color instance from miscellaneous string formats
|
|
302
336
|
*
|
|
@@ -906,7 +940,7 @@ const ADMIN_GITHUB_NAME = 'hejny';
|
|
|
906
940
|
*
|
|
907
941
|
* @public exported from `@promptbook/core`
|
|
908
942
|
*/
|
|
909
|
-
const PROMPTBOOK_COLOR = Color.
|
|
943
|
+
const PROMPTBOOK_COLOR = Color.fromString('promptbook');
|
|
910
944
|
// <- TODO: [🧠][🈵] Using `Color` here increases the package size approx 3kb, maybe remove it
|
|
911
945
|
/**
|
|
912
946
|
* Colors for syntax highlighting in the `<BookEditor/>`
|
|
@@ -1131,7 +1165,7 @@ true);
|
|
|
1131
1165
|
function getErrorReportUrl(error) {
|
|
1132
1166
|
const report = {
|
|
1133
1167
|
title: `🐜 Error report from ${NAME}`,
|
|
1134
|
-
body: spaceTrim((block) => `
|
|
1168
|
+
body: spaceTrim$2((block) => `
|
|
1135
1169
|
|
|
1136
1170
|
|
|
1137
1171
|
\`${error.name || 'Error'}\` has occurred in the [${NAME}], please look into it @${ADMIN_GITHUB_NAME}.
|
|
@@ -1204,7 +1238,7 @@ function jsonParse(value) {
|
|
|
1204
1238
|
}
|
|
1205
1239
|
else if (typeof value !== 'string') {
|
|
1206
1240
|
console.error('Can not parse JSON from non-string value.', { text: value });
|
|
1207
|
-
throw new Error(spaceTrim(`
|
|
1241
|
+
throw new Error(spaceTrim$2(`
|
|
1208
1242
|
Can not parse JSON from non-string value.
|
|
1209
1243
|
|
|
1210
1244
|
The value type: ${typeof value}
|
|
@@ -1218,7 +1252,7 @@ function jsonParse(value) {
|
|
|
1218
1252
|
if (!(error instanceof Error)) {
|
|
1219
1253
|
throw error;
|
|
1220
1254
|
}
|
|
1221
|
-
throw new Error(spaceTrim((block) => `
|
|
1255
|
+
throw new Error(spaceTrim$2((block) => `
|
|
1222
1256
|
${block(error.message)}
|
|
1223
1257
|
|
|
1224
1258
|
The expected JSON text:
|
|
@@ -1367,7 +1401,7 @@ function checkSerializableAsJson(options) {
|
|
|
1367
1401
|
}
|
|
1368
1402
|
else if (typeof value === 'object') {
|
|
1369
1403
|
if (value instanceof Date) {
|
|
1370
|
-
throw new UnexpectedError(spaceTrim((block) => `
|
|
1404
|
+
throw new UnexpectedError(spaceTrim$2((block) => `
|
|
1371
1405
|
\`${name}\` is Date
|
|
1372
1406
|
|
|
1373
1407
|
Use \`string_date_iso8601\` instead
|
|
@@ -1386,7 +1420,7 @@ function checkSerializableAsJson(options) {
|
|
|
1386
1420
|
throw new UnexpectedError(`${name} is RegExp`);
|
|
1387
1421
|
}
|
|
1388
1422
|
else if (value instanceof Error) {
|
|
1389
|
-
throw new UnexpectedError(spaceTrim((block) => `
|
|
1423
|
+
throw new UnexpectedError(spaceTrim$2((block) => `
|
|
1390
1424
|
\`${name}\` is unserialized Error
|
|
1391
1425
|
|
|
1392
1426
|
Use function \`serializeError\`
|
|
@@ -1409,7 +1443,7 @@ function checkSerializableAsJson(options) {
|
|
|
1409
1443
|
}
|
|
1410
1444
|
catch (error) {
|
|
1411
1445
|
assertsError(error);
|
|
1412
|
-
throw new UnexpectedError(spaceTrim((block) => `
|
|
1446
|
+
throw new UnexpectedError(spaceTrim$2((block) => `
|
|
1413
1447
|
\`${name}\` is not serializable
|
|
1414
1448
|
|
|
1415
1449
|
${block(error.stack || error.message)}
|
|
@@ -1441,7 +1475,7 @@ function checkSerializableAsJson(options) {
|
|
|
1441
1475
|
}
|
|
1442
1476
|
}
|
|
1443
1477
|
else {
|
|
1444
|
-
throw new UnexpectedError(spaceTrim((block) => `
|
|
1478
|
+
throw new UnexpectedError(spaceTrim$2((block) => `
|
|
1445
1479
|
\`${name}\` is unknown type
|
|
1446
1480
|
|
|
1447
1481
|
Additional message for \`${name}\`:
|
|
@@ -2294,7 +2328,7 @@ function pipelineJsonToString(pipelineJson) {
|
|
|
2294
2328
|
pipelineString += '\n\n';
|
|
2295
2329
|
pipelineString += '```' + contentLanguage;
|
|
2296
2330
|
pipelineString += '\n';
|
|
2297
|
-
pipelineString += spaceTrim(content);
|
|
2331
|
+
pipelineString += spaceTrim$2(content);
|
|
2298
2332
|
// <- TODO: [main] !!3 Escape
|
|
2299
2333
|
// <- TODO: [🧠] Some clear strategy how to spaceTrim the blocks
|
|
2300
2334
|
pipelineString += '\n';
|
|
@@ -2862,7 +2896,7 @@ function serializeError(error) {
|
|
|
2862
2896
|
const { name, message, stack } = error;
|
|
2863
2897
|
const { id } = error;
|
|
2864
2898
|
if (!Object.keys(ALL_ERRORS).includes(name)) {
|
|
2865
|
-
console.error(spaceTrim((block) => `
|
|
2899
|
+
console.error(spaceTrim$2((block) => `
|
|
2866
2900
|
|
|
2867
2901
|
Cannot serialize error with name "${name}"
|
|
2868
2902
|
|
|
@@ -2926,7 +2960,7 @@ function deserializeError(error) {
|
|
|
2926
2960
|
message = `${name}: ${message}`;
|
|
2927
2961
|
}
|
|
2928
2962
|
if (stack !== undefined && stack !== '') {
|
|
2929
|
-
message = spaceTrim((block) => `
|
|
2963
|
+
message = spaceTrim$2((block) => `
|
|
2930
2964
|
${block(message)}
|
|
2931
2965
|
|
|
2932
2966
|
Original stack trace:
|
|
@@ -3604,7 +3638,7 @@ const CsvFormatParser = {
|
|
|
3604
3638
|
const { value, outputParameterName, settings, mapCallback, onProgress } = options;
|
|
3605
3639
|
const csv = csvParse(value, settings);
|
|
3606
3640
|
if (csv.errors.length !== 0) {
|
|
3607
|
-
throw new CsvFormatError(spaceTrim((block) => `
|
|
3641
|
+
throw new CsvFormatError(spaceTrim$2((block) => `
|
|
3608
3642
|
CSV parsing error
|
|
3609
3643
|
|
|
3610
3644
|
Error(s) from CSV parsing:
|
|
@@ -3649,7 +3683,7 @@ const CsvFormatParser = {
|
|
|
3649
3683
|
const { value, settings, mapCallback, onProgress } = options;
|
|
3650
3684
|
const csv = csvParse(value, settings);
|
|
3651
3685
|
if (csv.errors.length !== 0) {
|
|
3652
|
-
throw new CsvFormatError(spaceTrim((block) => `
|
|
3686
|
+
throw new CsvFormatError(spaceTrim$2((block) => `
|
|
3653
3687
|
CSV parsing error
|
|
3654
3688
|
|
|
3655
3689
|
Error(s) from CSV parsing:
|
|
@@ -3859,7 +3893,7 @@ function mapAvailableToExpectedParameters(options) {
|
|
|
3859
3893
|
}
|
|
3860
3894
|
// Phase 2️⃣: Non-matching mapping
|
|
3861
3895
|
if (expectedParameterNames.size !== availableParametersNames.size) {
|
|
3862
|
-
throw new PipelineExecutionError(spaceTrim((block) => `
|
|
3896
|
+
throw new PipelineExecutionError(spaceTrim$2((block) => `
|
|
3863
3897
|
Can not map available parameters to expected parameters
|
|
3864
3898
|
|
|
3865
3899
|
Mapped parameters:
|
|
@@ -3937,14 +3971,14 @@ class MultipleLlmExecutionTools {
|
|
|
3937
3971
|
if (description === undefined) {
|
|
3938
3972
|
return headLine;
|
|
3939
3973
|
}
|
|
3940
|
-
return spaceTrim((block) => `
|
|
3974
|
+
return spaceTrim$2((block) => `
|
|
3941
3975
|
${headLine}
|
|
3942
3976
|
|
|
3943
3977
|
${ /* <- Note: Indenting the description: */block(description)}
|
|
3944
3978
|
`);
|
|
3945
3979
|
})
|
|
3946
3980
|
.join('\n\n');
|
|
3947
|
-
return spaceTrim((block) => `
|
|
3981
|
+
return spaceTrim$2((block) => `
|
|
3948
3982
|
Multiple LLM Providers:
|
|
3949
3983
|
|
|
3950
3984
|
${block(innerModelsTitlesAndDescriptions)}
|
|
@@ -4035,7 +4069,7 @@ class MultipleLlmExecutionTools {
|
|
|
4035
4069
|
// 1) OpenAI throw PipelineExecutionError: Parameter `{knowledge}` is not defined
|
|
4036
4070
|
// 2) AnthropicClaude throw PipelineExecutionError: Parameter `{knowledge}` is not defined
|
|
4037
4071
|
// 3) ...
|
|
4038
|
-
spaceTrim((block) => `
|
|
4072
|
+
spaceTrim$2((block) => `
|
|
4039
4073
|
All execution tools of ${this.title} failed:
|
|
4040
4074
|
|
|
4041
4075
|
${block(errors
|
|
@@ -4048,7 +4082,7 @@ class MultipleLlmExecutionTools {
|
|
|
4048
4082
|
throw new PipelineExecutionError(`You have not provided any \`LlmExecutionTools\` into ${this.title}`);
|
|
4049
4083
|
}
|
|
4050
4084
|
else {
|
|
4051
|
-
throw new PipelineExecutionError(spaceTrim((block) => `
|
|
4085
|
+
throw new PipelineExecutionError(spaceTrim$2((block) => `
|
|
4052
4086
|
You have not provided any \`LlmExecutionTools\` that support model variant "${prompt.modelRequirements.modelVariant}" into ${this.title}
|
|
4053
4087
|
|
|
4054
4088
|
Available \`LlmExecutionTools\`:
|
|
@@ -4081,7 +4115,7 @@ class MultipleLlmExecutionTools {
|
|
|
4081
4115
|
*/
|
|
4082
4116
|
function joinLlmExecutionTools(title, ...llmExecutionTools) {
|
|
4083
4117
|
if (llmExecutionTools.length === 0) {
|
|
4084
|
-
const warningMessage = spaceTrim(`
|
|
4118
|
+
const warningMessage = spaceTrim$2(`
|
|
4085
4119
|
You have not provided any \`LlmExecutionTools\`
|
|
4086
4120
|
This means that you won't be able to execute any prompts that require large language models like GPT-4 or Anthropic's Claude.
|
|
4087
4121
|
|
|
@@ -5170,7 +5204,7 @@ async function executeFormatSubvalues(options) {
|
|
|
5170
5204
|
return /* not await */ executeAttempts({ ...options, logLlmCall });
|
|
5171
5205
|
}
|
|
5172
5206
|
if (jokerParameterNames.length !== 0) {
|
|
5173
|
-
throw new UnexpectedError(spaceTrim((block) => `
|
|
5207
|
+
throw new UnexpectedError(spaceTrim$2((block) => `
|
|
5174
5208
|
JOKER parameters are not supported together with FOREACH command
|
|
5175
5209
|
|
|
5176
5210
|
[🧞♀️] This should be prevented in \`validatePipeline\`
|
|
@@ -5183,7 +5217,7 @@ async function executeFormatSubvalues(options) {
|
|
|
5183
5217
|
if (formatDefinition === undefined) {
|
|
5184
5218
|
throw new UnexpectedError(
|
|
5185
5219
|
// <- TODO: [🧠][🧐] Should be formats fixed per promptbook version or behave as plugins (=> change UnexpectedError)
|
|
5186
|
-
spaceTrim((block) => `
|
|
5220
|
+
spaceTrim$2((block) => `
|
|
5187
5221
|
Unsupported format "${task.foreach.formatName}"
|
|
5188
5222
|
|
|
5189
5223
|
Available formats:
|
|
@@ -5200,7 +5234,7 @@ async function executeFormatSubvalues(options) {
|
|
|
5200
5234
|
if (subvalueParser === undefined) {
|
|
5201
5235
|
throw new UnexpectedError(
|
|
5202
5236
|
// <- TODO: [🧠][🧐] Should be formats fixed per promptbook version or behave as plugins (=> change UnexpectedError)
|
|
5203
|
-
spaceTrim((block) => `
|
|
5237
|
+
spaceTrim$2((block) => `
|
|
5204
5238
|
Unsupported subformat name "${task.foreach.subformatName}" for format "${task.foreach.formatName}"
|
|
5205
5239
|
|
|
5206
5240
|
Available subformat names for format "${formatDefinition.formatName}":
|
|
@@ -5240,7 +5274,7 @@ async function executeFormatSubvalues(options) {
|
|
|
5240
5274
|
if (!(error instanceof PipelineExecutionError)) {
|
|
5241
5275
|
throw error;
|
|
5242
5276
|
}
|
|
5243
|
-
const highLevelError = new PipelineExecutionError(spaceTrim((block) => `
|
|
5277
|
+
const highLevelError = new PipelineExecutionError(spaceTrim$2((block) => `
|
|
5244
5278
|
${error.message}
|
|
5245
5279
|
|
|
5246
5280
|
This is error in FOREACH command when mapping ${formatDefinition.formatName} ${subvalueParser.subvalueName} data (${index + 1}/${length})
|
|
@@ -5264,7 +5298,7 @@ async function executeFormatSubvalues(options) {
|
|
|
5264
5298
|
...options,
|
|
5265
5299
|
priority: priority + index,
|
|
5266
5300
|
parameters: allSubparameters,
|
|
5267
|
-
pipelineIdentification: spaceTrim((block) => `
|
|
5301
|
+
pipelineIdentification: spaceTrim$2((block) => `
|
|
5268
5302
|
${block(pipelineIdentification)}
|
|
5269
5303
|
Subparameter index: ${index}
|
|
5270
5304
|
`),
|
|
@@ -5273,7 +5307,7 @@ async function executeFormatSubvalues(options) {
|
|
|
5273
5307
|
}
|
|
5274
5308
|
catch (error) {
|
|
5275
5309
|
if (length > BIG_DATASET_TRESHOLD) {
|
|
5276
|
-
console.error(spaceTrim((block) => `
|
|
5310
|
+
console.error(spaceTrim$2((block) => `
|
|
5277
5311
|
${error.message}
|
|
5278
5312
|
|
|
5279
5313
|
This is error in FOREACH command when processing ${formatDefinition.formatName} ${subvalueParser.subvalueName} data (${index + 1}/${length})
|
|
@@ -6416,14 +6450,14 @@ function $registeredScrapersMessage(availableScrapers) {
|
|
|
6416
6450
|
return { ...metadata, isMetadataAviailable, isInstalled, isAvailableInTools };
|
|
6417
6451
|
});
|
|
6418
6452
|
if (metadata.length === 0) {
|
|
6419
|
-
return spaceTrim(`
|
|
6453
|
+
return spaceTrim$2(`
|
|
6420
6454
|
**No scrapers are available**
|
|
6421
6455
|
|
|
6422
6456
|
This is a unexpected behavior, you are probably using some broken version of Promptbook
|
|
6423
6457
|
At least there should be available the metadata of the scrapers
|
|
6424
6458
|
`);
|
|
6425
6459
|
}
|
|
6426
|
-
return spaceTrim((block) => `
|
|
6460
|
+
return spaceTrim$2((block) => `
|
|
6427
6461
|
Available scrapers are:
|
|
6428
6462
|
${block(metadata
|
|
6429
6463
|
.map(({ packageName, className, isMetadataAviailable, isInstalled, mimeTypes, isAvailableInBrowser, isAvailableInTools, }, i) => {
|
|
@@ -6666,7 +6700,7 @@ const promptbookFetch = async (urlOrRequest, init) => {
|
|
|
6666
6700
|
else if (urlOrRequest instanceof Request) {
|
|
6667
6701
|
url = urlOrRequest.url;
|
|
6668
6702
|
}
|
|
6669
|
-
throw new PromptbookFetchError(spaceTrim((block) => `
|
|
6703
|
+
throw new PromptbookFetchError(spaceTrim$2((block) => `
|
|
6670
6704
|
Can not fetch "${url}"
|
|
6671
6705
|
|
|
6672
6706
|
Fetch error:
|
|
@@ -6827,7 +6861,7 @@ async function makeKnowledgeSourceHandler(knowledgeSource, tools, options) {
|
|
|
6827
6861
|
const fileExtension = getFileExtension(filename);
|
|
6828
6862
|
const mimeType = extensionToMimeType(fileExtension || '');
|
|
6829
6863
|
if (!(await isFileExisting(filename, tools.fs))) {
|
|
6830
|
-
throw new NotFoundError(spaceTrim((block) => `
|
|
6864
|
+
throw new NotFoundError(spaceTrim$2((block) => `
|
|
6831
6865
|
Can not make source handler for file which does not exist:
|
|
6832
6866
|
|
|
6833
6867
|
File:
|
|
@@ -6920,7 +6954,7 @@ async function prepareKnowledgePieces(knowledgeSources, tools, options) {
|
|
|
6920
6954
|
// <- TODO: [🪓] Here should be no need for spreading new array, just `partialPieces = partialPiecesUnchecked`
|
|
6921
6955
|
break;
|
|
6922
6956
|
}
|
|
6923
|
-
console.warn(spaceTrim((block) => `
|
|
6957
|
+
console.warn(spaceTrim$2((block) => `
|
|
6924
6958
|
Cannot scrape knowledge from source despite the scraper \`${scraper.metadata.className}\` supports the mime type "${sourceHandler.mimeType}".
|
|
6925
6959
|
|
|
6926
6960
|
The source:
|
|
@@ -6936,7 +6970,7 @@ async function prepareKnowledgePieces(knowledgeSources, tools, options) {
|
|
|
6936
6970
|
// <- TODO: [🏮] Some standard way how to transform errors into warnings and how to handle non-critical fails during the tasks
|
|
6937
6971
|
}
|
|
6938
6972
|
if (partialPieces === null) {
|
|
6939
|
-
throw new KnowledgeScrapeError(spaceTrim((block) => `
|
|
6973
|
+
throw new KnowledgeScrapeError(spaceTrim$2((block) => `
|
|
6940
6974
|
Cannot scrape knowledge
|
|
6941
6975
|
|
|
6942
6976
|
The source:
|
|
@@ -7272,7 +7306,7 @@ const knowledgeCommandParser = {
|
|
|
7272
7306
|
*/
|
|
7273
7307
|
parse(input) {
|
|
7274
7308
|
const { args } = input;
|
|
7275
|
-
const knowledgeSourceContent = spaceTrim(args[0] || '');
|
|
7309
|
+
const knowledgeSourceContent = spaceTrim$2(args[0] || '');
|
|
7276
7310
|
if (knowledgeSourceContent === '') {
|
|
7277
7311
|
throw new ParseError(`Source is not defined`);
|
|
7278
7312
|
}
|
|
@@ -7416,7 +7450,7 @@ const sectionCommandParser = {
|
|
|
7416
7450
|
normalized = normalized.split('DIALOGUE').join('DIALOG');
|
|
7417
7451
|
const taskTypes = SectionTypes.filter((sectionType) => normalized.includes(sectionType.split('_TASK').join('')));
|
|
7418
7452
|
if (taskTypes.length !== 1) {
|
|
7419
|
-
throw new ParseError(spaceTrim((block) => `
|
|
7453
|
+
throw new ParseError(spaceTrim$2((block) => `
|
|
7420
7454
|
Unknown section type "${normalized}"
|
|
7421
7455
|
|
|
7422
7456
|
Supported section types are:
|
|
@@ -7436,7 +7470,7 @@ const sectionCommandParser = {
|
|
|
7436
7470
|
*/
|
|
7437
7471
|
$applyToTaskJson(command, $taskJson, $pipelineJson) {
|
|
7438
7472
|
if ($taskJson.isSectionTypeSet === true) {
|
|
7439
|
-
throw new ParseError(spaceTrim(`
|
|
7473
|
+
throw new ParseError(spaceTrim$2(`
|
|
7440
7474
|
Section type is already defined in the section.
|
|
7441
7475
|
It can be defined only once.
|
|
7442
7476
|
`));
|
|
@@ -7785,7 +7819,7 @@ const expectCommandParser = {
|
|
|
7785
7819
|
/**
|
|
7786
7820
|
* Description of the FORMAT command
|
|
7787
7821
|
*/
|
|
7788
|
-
description: spaceTrim(`
|
|
7822
|
+
description: spaceTrim$2(`
|
|
7789
7823
|
Expect command describes the desired output of the task *(after post-processing)*
|
|
7790
7824
|
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.
|
|
7791
7825
|
`),
|
|
@@ -7859,7 +7893,7 @@ const expectCommandParser = {
|
|
|
7859
7893
|
}
|
|
7860
7894
|
catch (error) {
|
|
7861
7895
|
assertsError(error);
|
|
7862
|
-
throw new ParseError(spaceTrim((block) => `
|
|
7896
|
+
throw new ParseError(spaceTrim$2((block) => `
|
|
7863
7897
|
Invalid FORMAT command
|
|
7864
7898
|
${block(error.message)}:
|
|
7865
7899
|
`));
|
|
@@ -8049,7 +8083,7 @@ function validateParameterName(parameterName) {
|
|
|
8049
8083
|
if (!(error instanceof ParseError)) {
|
|
8050
8084
|
throw error;
|
|
8051
8085
|
}
|
|
8052
|
-
throw new ParseError(spaceTrim((block) => `
|
|
8086
|
+
throw new ParseError(spaceTrim$2((block) => `
|
|
8053
8087
|
${block(error.message)}
|
|
8054
8088
|
|
|
8055
8089
|
Tried to validate parameter name:
|
|
@@ -8108,7 +8142,7 @@ const foreachCommandParser = {
|
|
|
8108
8142
|
const assignSign = args[3];
|
|
8109
8143
|
const formatDefinition = FORMAT_DEFINITIONS.find((formatDefinition) => [formatDefinition.formatName, ...(formatDefinition.aliases || [])].includes(formatName));
|
|
8110
8144
|
if (formatDefinition === undefined) {
|
|
8111
|
-
throw new ParseError(spaceTrim((block) => `
|
|
8145
|
+
throw new ParseError(spaceTrim$2((block) => `
|
|
8112
8146
|
Unsupported format "${formatName}"
|
|
8113
8147
|
|
|
8114
8148
|
Available formats:
|
|
@@ -8120,7 +8154,7 @@ const foreachCommandParser = {
|
|
|
8120
8154
|
}
|
|
8121
8155
|
const subvalueParser = formatDefinition.subvalueParsers.find((subvalueParser) => [subvalueParser.subvalueName, ...(subvalueParser.aliases || [])].includes(subformatName));
|
|
8122
8156
|
if (subvalueParser === undefined) {
|
|
8123
|
-
throw new ParseError(spaceTrim((block) => `
|
|
8157
|
+
throw new ParseError(spaceTrim$2((block) => `
|
|
8124
8158
|
Unsupported subformat name "${subformatName}" for format "${formatName}"
|
|
8125
8159
|
|
|
8126
8160
|
Available subformat names for format "${formatDefinition.formatName}":
|
|
@@ -8168,7 +8202,7 @@ const foreachCommandParser = {
|
|
|
8168
8202
|
outputSubparameterName = 'newLine';
|
|
8169
8203
|
}
|
|
8170
8204
|
else {
|
|
8171
|
-
throw new ParseError(spaceTrim(`
|
|
8205
|
+
throw new ParseError(spaceTrim$2(`
|
|
8172
8206
|
FOREACH ${formatName} ${subformatName} must specify output subparameter
|
|
8173
8207
|
|
|
8174
8208
|
Correct example:
|
|
@@ -8244,7 +8278,7 @@ const formatCommandParser = {
|
|
|
8244
8278
|
/**
|
|
8245
8279
|
* Description of the FORMAT command
|
|
8246
8280
|
*/
|
|
8247
|
-
description: spaceTrim(`
|
|
8281
|
+
description: spaceTrim$2(`
|
|
8248
8282
|
Format command describes the desired output of the task (after post-processing)
|
|
8249
8283
|
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.
|
|
8250
8284
|
`),
|
|
@@ -8616,7 +8650,7 @@ const formfactorCommandParser = {
|
|
|
8616
8650
|
const formfactorNameCandidate = args[0].toUpperCase();
|
|
8617
8651
|
const formfactor = FORMFACTOR_DEFINITIONS.find((definition) => [definition.name, ...{ aliasNames: [], ...definition }.aliasNames].includes(formfactorNameCandidate));
|
|
8618
8652
|
if (formfactor === undefined) {
|
|
8619
|
-
throw new ParseError(spaceTrim((block) => `
|
|
8653
|
+
throw new ParseError(spaceTrim$2((block) => `
|
|
8620
8654
|
Unknown formfactor name "${formfactorNameCandidate}"
|
|
8621
8655
|
|
|
8622
8656
|
Available formfactors:
|
|
@@ -8635,7 +8669,7 @@ const formfactorCommandParser = {
|
|
|
8635
8669
|
*/
|
|
8636
8670
|
$applyToPipelineJson(command, $pipelineJson) {
|
|
8637
8671
|
if ($pipelineJson.formfactorName !== undefined && $pipelineJson.formfactorName !== command.formfactorName) {
|
|
8638
|
-
throw new ParseError(spaceTrim(`
|
|
8672
|
+
throw new ParseError(spaceTrim$2(`
|
|
8639
8673
|
Redefinition of \`FORMFACTOR\` in the pipeline head
|
|
8640
8674
|
|
|
8641
8675
|
You have used:
|
|
@@ -8778,7 +8812,7 @@ const modelCommandParser = {
|
|
|
8778
8812
|
*/
|
|
8779
8813
|
parse(input) {
|
|
8780
8814
|
const { args, normalized } = input;
|
|
8781
|
-
const availableVariantsMessage = spaceTrim((block) => `
|
|
8815
|
+
const availableVariantsMessage = spaceTrim$2((block) => `
|
|
8782
8816
|
Available variants are:
|
|
8783
8817
|
${block(MODEL_VARIANTS.map((variantName) => `- ${variantName}${variantName !== 'EMBEDDING' ? '' : ' (Not available in pipeline)'}`).join('\n'))}
|
|
8784
8818
|
`);
|
|
@@ -8800,14 +8834,14 @@ const modelCommandParser = {
|
|
|
8800
8834
|
// <- Note: [🤖]
|
|
8801
8835
|
}
|
|
8802
8836
|
else if (normalized.startsWith('MODEL_VARIANT_EMBED')) {
|
|
8803
|
-
spaceTrim((block) => `
|
|
8837
|
+
spaceTrim$2((block) => `
|
|
8804
8838
|
Embedding model can not be used in pipeline
|
|
8805
8839
|
|
|
8806
8840
|
${block(availableVariantsMessage)}
|
|
8807
8841
|
`);
|
|
8808
8842
|
}
|
|
8809
8843
|
else {
|
|
8810
|
-
throw new ParseError(spaceTrim((block) => `
|
|
8844
|
+
throw new ParseError(spaceTrim$2((block) => `
|
|
8811
8845
|
Unknown model variant in command:
|
|
8812
8846
|
|
|
8813
8847
|
${block(availableVariantsMessage)}
|
|
@@ -8822,7 +8856,7 @@ const modelCommandParser = {
|
|
|
8822
8856
|
};
|
|
8823
8857
|
}
|
|
8824
8858
|
else {
|
|
8825
|
-
throw new ParseError(spaceTrim((block) => `
|
|
8859
|
+
throw new ParseError(spaceTrim$2((block) => `
|
|
8826
8860
|
Unknown model key in command.
|
|
8827
8861
|
|
|
8828
8862
|
Supported model keys are:
|
|
@@ -8849,7 +8883,7 @@ const modelCommandParser = {
|
|
|
8849
8883
|
// <- TODO: [🏮] Some standard way how to transform errors into warnings and how to handle non-critical fails during the tasks
|
|
8850
8884
|
}
|
|
8851
8885
|
else {
|
|
8852
|
-
throw new ParseError(spaceTrim(`
|
|
8886
|
+
throw new ParseError(spaceTrim$2(`
|
|
8853
8887
|
Redefinition of \`MODEL ${command.key}\` in the pipeline head
|
|
8854
8888
|
|
|
8855
8889
|
You have used:
|
|
@@ -8881,7 +8915,7 @@ const modelCommandParser = {
|
|
|
8881
8915
|
// <- TODO: [🏮] Some standard way how to transform errors into warnings and how to handle non-critical fails during the tasks
|
|
8882
8916
|
}
|
|
8883
8917
|
else {
|
|
8884
|
-
throw new ParseError(spaceTrim(`
|
|
8918
|
+
throw new ParseError(spaceTrim$2(`
|
|
8885
8919
|
Redefinition of MODEL \`${command.key}\` in the task "${$taskJson.title || $taskJson.name}"
|
|
8886
8920
|
|
|
8887
8921
|
You have used:
|
|
@@ -8891,7 +8925,7 @@ const modelCommandParser = {
|
|
|
8891
8925
|
}
|
|
8892
8926
|
}
|
|
8893
8927
|
if (command.value === ($pipelineJson.defaultModelRequirements || {})[command.key]) {
|
|
8894
|
-
console.log(spaceTrim(`
|
|
8928
|
+
console.log(spaceTrim$2(`
|
|
8895
8929
|
Setting MODEL \`${command.key}\` in the task "${$taskJson.title || $taskJson.name}" to the same value as in the pipeline head
|
|
8896
8930
|
|
|
8897
8931
|
In pipeline head:
|
|
@@ -8974,7 +9008,7 @@ const parameterCommandParser = {
|
|
|
8974
9008
|
// <- TODO: When [🥶] fixed, change to:
|
|
8975
9009
|
// > const parameterDescriptionRaw = rawArgs.split(parameterNameRaw).join('').trim();
|
|
8976
9010
|
if (parameterDescriptionRaw && parameterDescriptionRaw.match(/\{(?<embeddedParameterName>[a-z0-9_]+)\}/im)) {
|
|
8977
|
-
throw new ParseError(spaceTrim((block) => `
|
|
9011
|
+
throw new ParseError(spaceTrim$2((block) => `
|
|
8978
9012
|
Parameter \`{${parameterNameRaw}}\` can not contain another parameter in description
|
|
8979
9013
|
|
|
8980
9014
|
The description:
|
|
@@ -9156,7 +9190,7 @@ function $applyToTaskJson(command, $taskJson, $pipelineJson) {
|
|
|
9156
9190
|
persona.description = personaDescription;
|
|
9157
9191
|
return;
|
|
9158
9192
|
}
|
|
9159
|
-
console.warn(spaceTrim(`
|
|
9193
|
+
console.warn(spaceTrim$2(`
|
|
9160
9194
|
|
|
9161
9195
|
Persona "${personaName}" is defined multiple times with different description:
|
|
9162
9196
|
|
|
@@ -9167,7 +9201,7 @@ function $applyToTaskJson(command, $taskJson, $pipelineJson) {
|
|
|
9167
9201
|
${personaDescription}
|
|
9168
9202
|
|
|
9169
9203
|
`));
|
|
9170
|
-
persona.description += spaceTrim('\n\n' + personaDescription);
|
|
9204
|
+
persona.description += spaceTrim$2('\n\n' + personaDescription);
|
|
9171
9205
|
}
|
|
9172
9206
|
|
|
9173
9207
|
/**
|
|
@@ -10022,7 +10056,7 @@ function removeMarkdownComments(content) {
|
|
|
10022
10056
|
*/
|
|
10023
10057
|
function isFlatPipeline(pipelineString) {
|
|
10024
10058
|
pipelineString = removeMarkdownComments(pipelineString);
|
|
10025
|
-
pipelineString = spaceTrim(pipelineString);
|
|
10059
|
+
pipelineString = spaceTrim$2(pipelineString);
|
|
10026
10060
|
const isMarkdownBeginningWithHeadline = pipelineString.startsWith('# ');
|
|
10027
10061
|
//const isLastLineReturnStatement = pipelineString.split('\n').pop()!.split('`').join('').startsWith('->');
|
|
10028
10062
|
const isBacktickBlockUsed = pipelineString.includes('```');
|
|
@@ -10048,7 +10082,7 @@ function deflatePipeline(pipelineString) {
|
|
|
10048
10082
|
if (!isFlatPipeline(pipelineString)) {
|
|
10049
10083
|
return pipelineString;
|
|
10050
10084
|
}
|
|
10051
|
-
pipelineString = spaceTrim(pipelineString);
|
|
10085
|
+
pipelineString = spaceTrim$2(pipelineString);
|
|
10052
10086
|
const pipelineStringLines = pipelineString.split('\n');
|
|
10053
10087
|
const potentialReturnStatement = pipelineStringLines.pop();
|
|
10054
10088
|
let returnStatement;
|
|
@@ -10061,19 +10095,19 @@ function deflatePipeline(pipelineString) {
|
|
|
10061
10095
|
returnStatement = `-> {${DEFAULT_BOOK_OUTPUT_PARAMETER_NAME}}`;
|
|
10062
10096
|
pipelineStringLines.push(potentialReturnStatement);
|
|
10063
10097
|
}
|
|
10064
|
-
const prompt = spaceTrim(pipelineStringLines.join('\n'));
|
|
10098
|
+
const prompt = spaceTrim$2(pipelineStringLines.join('\n'));
|
|
10065
10099
|
let quotedPrompt;
|
|
10066
10100
|
if (prompt.split('\n').length <= 1) {
|
|
10067
10101
|
quotedPrompt = `> ${prompt}`;
|
|
10068
10102
|
}
|
|
10069
10103
|
else {
|
|
10070
|
-
quotedPrompt = spaceTrim((block) => `
|
|
10104
|
+
quotedPrompt = spaceTrim$2((block) => `
|
|
10071
10105
|
\`\`\`
|
|
10072
10106
|
${block(prompt.split('`').join('\\`'))}
|
|
10073
10107
|
\`\`\`
|
|
10074
10108
|
`);
|
|
10075
10109
|
}
|
|
10076
|
-
pipelineString = validatePipelineString(spaceTrim((block) => `
|
|
10110
|
+
pipelineString = validatePipelineString(spaceTrim$2((block) => `
|
|
10077
10111
|
# ${DEFAULT_BOOK_TITLE}
|
|
10078
10112
|
|
|
10079
10113
|
## Prompt
|
|
@@ -10137,7 +10171,7 @@ function extractAllListItemsFromMarkdown(markdown) {
|
|
|
10137
10171
|
function extractOneBlockFromMarkdown(markdown) {
|
|
10138
10172
|
const codeBlocks = extractAllBlocksFromMarkdown(markdown);
|
|
10139
10173
|
if (codeBlocks.length !== 1) {
|
|
10140
|
-
throw new ParseError(spaceTrim((block) => `
|
|
10174
|
+
throw new ParseError(spaceTrim$2((block) => `
|
|
10141
10175
|
There should be exactly 1 code block in task section, found ${codeBlocks.length} code blocks
|
|
10142
10176
|
|
|
10143
10177
|
${block(codeBlocks.map((block, i) => `Block ${i + 1}:\n${block.content}`).join('\n\n\n'))}
|
|
@@ -10162,7 +10196,7 @@ function parseMarkdownSection(value) {
|
|
|
10162
10196
|
}
|
|
10163
10197
|
const title = lines[0].replace(/^#+\s*/, '');
|
|
10164
10198
|
const level = (_b = (_a = lines[0].match(/^#+/)) === null || _a === void 0 ? void 0 : _a[0].length) !== null && _b !== void 0 ? _b : 0;
|
|
10165
|
-
const content = spaceTrim(lines.slice(1).join('\n'));
|
|
10199
|
+
const content = spaceTrim$2(lines.slice(1).join('\n'));
|
|
10166
10200
|
if (level < 1 || level > 6) {
|
|
10167
10201
|
throw new ParseError('Markdown section must have heading level between 1 and 6');
|
|
10168
10202
|
}
|
|
@@ -10190,7 +10224,7 @@ function splitMarkdownIntoSections(markdown) {
|
|
|
10190
10224
|
if (buffer.length === 0) {
|
|
10191
10225
|
return;
|
|
10192
10226
|
}
|
|
10193
|
-
let section = spaceTrim(buffer.join('\n'));
|
|
10227
|
+
let section = spaceTrim$2(buffer.join('\n'));
|
|
10194
10228
|
if (section === '') {
|
|
10195
10229
|
return;
|
|
10196
10230
|
}
|
|
@@ -10265,7 +10299,7 @@ function flattenMarkdown(markdown) {
|
|
|
10265
10299
|
flattenedMarkdown += `## ${title}` + `\n\n`;
|
|
10266
10300
|
flattenedMarkdown += content + `\n\n`; // <- [🧠] Maybe 3 new lines?
|
|
10267
10301
|
}
|
|
10268
|
-
return spaceTrim(flattenedMarkdown);
|
|
10302
|
+
return spaceTrim$2(flattenedMarkdown);
|
|
10269
10303
|
}
|
|
10270
10304
|
/**
|
|
10271
10305
|
* TODO: [🏛] This can be part of markdown builder
|
|
@@ -11270,13 +11304,13 @@ function $registeredLlmToolsMessage() {
|
|
|
11270
11304
|
});
|
|
11271
11305
|
const usedEnvMessage = $usedEnvFilename === null ? `Unknown \`.env\` file` : `Used \`.env\` file:\n${$usedEnvFilename}`;
|
|
11272
11306
|
if (metadata.length === 0) {
|
|
11273
|
-
return spaceTrim((block) => `
|
|
11307
|
+
return spaceTrim$2((block) => `
|
|
11274
11308
|
No LLM providers are available.
|
|
11275
11309
|
|
|
11276
11310
|
${block(usedEnvMessage)}
|
|
11277
11311
|
`);
|
|
11278
11312
|
}
|
|
11279
|
-
return spaceTrim((block) => `
|
|
11313
|
+
return spaceTrim$2((block) => `
|
|
11280
11314
|
|
|
11281
11315
|
${block(usedEnvMessage)}
|
|
11282
11316
|
|
|
@@ -11322,7 +11356,7 @@ function $registeredLlmToolsMessage() {
|
|
|
11322
11356
|
morePieces.push(`Not configured`); // <- Note: Can not be configured via environment variables
|
|
11323
11357
|
}
|
|
11324
11358
|
}
|
|
11325
|
-
let providerMessage = spaceTrim(`
|
|
11359
|
+
let providerMessage = spaceTrim$2(`
|
|
11326
11360
|
${i + 1}) **${title}** \`${className}\` from \`${packageName}\`
|
|
11327
11361
|
${morePieces.join('; ')}
|
|
11328
11362
|
`);
|
|
@@ -11484,7 +11518,7 @@ function createLlmToolsFromConfiguration(configuration, options = {}) {
|
|
|
11484
11518
|
.find(({ packageName, className }) => llmConfiguration.packageName === packageName && llmConfiguration.className === className);
|
|
11485
11519
|
if (registeredItem === undefined) {
|
|
11486
11520
|
// console.log('$llmToolsRegister.list()', $llmToolsRegister.list());
|
|
11487
|
-
throw new Error(spaceTrim((block) => `
|
|
11521
|
+
throw new Error(spaceTrim$2((block) => `
|
|
11488
11522
|
There is no constructor for LLM provider \`${llmConfiguration.className}\` from \`${llmConfiguration.packageName}\`
|
|
11489
11523
|
Running in ${!$isRunningInBrowser() ? '' : 'browser environment'}${!$isRunningInNode() ? '' : 'node environment'}${!$isRunningInWebWorker() ? '' : 'worker environment'}
|
|
11490
11524
|
|
|
@@ -11552,14 +11586,14 @@ async function $provideLlmToolsFromEnv(options = {}) {
|
|
|
11552
11586
|
const configuration = await $provideLlmToolsConfigurationFromEnv();
|
|
11553
11587
|
if (configuration.length === 0) {
|
|
11554
11588
|
if ($llmToolsMetadataRegister.list().length === 0) {
|
|
11555
|
-
throw new UnexpectedError(spaceTrim((block) => `
|
|
11589
|
+
throw new UnexpectedError(spaceTrim$2((block) => `
|
|
11556
11590
|
No LLM tools registered, this is probably a bug in the Promptbook library
|
|
11557
11591
|
|
|
11558
11592
|
${block($registeredLlmToolsMessage())}}
|
|
11559
11593
|
`));
|
|
11560
11594
|
}
|
|
11561
11595
|
// TODO: [🥃]
|
|
11562
|
-
throw new Error(spaceTrim((block) => `
|
|
11596
|
+
throw new Error(spaceTrim$2((block) => `
|
|
11563
11597
|
No LLM tools found in the environment
|
|
11564
11598
|
|
|
11565
11599
|
${block($registeredLlmToolsMessage())}}
|
|
@@ -11917,8 +11951,8 @@ class JavascriptEvalExecutionTools {
|
|
|
11917
11951
|
}
|
|
11918
11952
|
// Note: [💎]
|
|
11919
11953
|
// Note: Using direct eval, following variables are in same scope as eval call so they are accessible from inside the evaluated script:
|
|
11920
|
-
const spaceTrim
|
|
11921
|
-
$preserve(spaceTrim
|
|
11954
|
+
const spaceTrim = (_) => spaceTrim$2(_);
|
|
11955
|
+
$preserve(spaceTrim);
|
|
11922
11956
|
const removeQuotes$1 = removeQuotes;
|
|
11923
11957
|
$preserve(removeQuotes$1);
|
|
11924
11958
|
const unwrapResult$1 = unwrapResult;
|
|
@@ -11971,7 +12005,7 @@ class JavascriptEvalExecutionTools {
|
|
|
11971
12005
|
// TODO: DRY [🍯]
|
|
11972
12006
|
const buildinFunctions = {
|
|
11973
12007
|
// TODO: [🍯] DRY all these functions across the file
|
|
11974
|
-
spaceTrim
|
|
12008
|
+
spaceTrim,
|
|
11975
12009
|
removeQuotes: removeQuotes$1,
|
|
11976
12010
|
unwrapResult: unwrapResult$1,
|
|
11977
12011
|
trimEndOfCodeBlock: trimEndOfCodeBlock$1,
|
|
@@ -12008,7 +12042,7 @@ class JavascriptEvalExecutionTools {
|
|
|
12008
12042
|
.join('\n');
|
|
12009
12043
|
// script = templateParameters(script, parameters);
|
|
12010
12044
|
// <- TODO: [🧠][🥳] Should be this is one of two variants how to use parameters in script
|
|
12011
|
-
const statementToEvaluate = spaceTrim((block) => `
|
|
12045
|
+
const statementToEvaluate = spaceTrim$2((block) => `
|
|
12012
12046
|
|
|
12013
12047
|
// Build-in functions:
|
|
12014
12048
|
${block(buildinFunctionsStatement)}
|
|
@@ -12023,7 +12057,7 @@ class JavascriptEvalExecutionTools {
|
|
|
12023
12057
|
(()=>{ ${script} })()
|
|
12024
12058
|
`);
|
|
12025
12059
|
if (this.options.isVerbose) {
|
|
12026
|
-
console.info(spaceTrim((block) => `
|
|
12060
|
+
console.info(spaceTrim$2((block) => `
|
|
12027
12061
|
🚀 Evaluating ${scriptLanguage} script:
|
|
12028
12062
|
|
|
12029
12063
|
${block(statementToEvaluate)}`));
|
|
@@ -12045,7 +12079,7 @@ class JavascriptEvalExecutionTools {
|
|
|
12045
12079
|
To: [PipelineExecutionError: Parameter `{thing}` is not defined],
|
|
12046
12080
|
*/
|
|
12047
12081
|
if (!statementToEvaluate.includes(undefinedName + '(')) {
|
|
12048
|
-
throw new PipelineExecutionError(spaceTrim((block) => `
|
|
12082
|
+
throw new PipelineExecutionError(spaceTrim$2((block) => `
|
|
12049
12083
|
|
|
12050
12084
|
Parameter \`{${undefinedName}}\` is not defined
|
|
12051
12085
|
|
|
@@ -12067,7 +12101,7 @@ class JavascriptEvalExecutionTools {
|
|
|
12067
12101
|
`));
|
|
12068
12102
|
}
|
|
12069
12103
|
else {
|
|
12070
|
-
throw new PipelineExecutionError(spaceTrim((block) => `
|
|
12104
|
+
throw new PipelineExecutionError(spaceTrim$2((block) => `
|
|
12071
12105
|
Function ${undefinedName}() is not defined
|
|
12072
12106
|
|
|
12073
12107
|
- Make sure that the function is one of built-in functions
|
|
@@ -12314,7 +12348,7 @@ async function createPipelineCollectionFromDirectory(rootPath, tools, options) {
|
|
|
12314
12348
|
catch (error) {
|
|
12315
12349
|
assertsError(error);
|
|
12316
12350
|
// TODO: [7] DRY
|
|
12317
|
-
const wrappedErrorMessage = spaceTrim((block) => `
|
|
12351
|
+
const wrappedErrorMessage = spaceTrim$2((block) => `
|
|
12318
12352
|
${error.name} in pipeline ${fileName.split('\\').join('/')}:
|
|
12319
12353
|
|
|
12320
12354
|
Original error message:
|
|
@@ -12349,7 +12383,7 @@ async function createPipelineCollectionFromDirectory(rootPath, tools, options) {
|
|
|
12349
12383
|
pipeline = { ...pipeline, pipelineUrl };
|
|
12350
12384
|
}
|
|
12351
12385
|
else if (!pipeline.pipelineUrl.startsWith(rootUrl)) {
|
|
12352
|
-
throw new PipelineUrlError(spaceTrim(`
|
|
12386
|
+
throw new PipelineUrlError(spaceTrim$2(`
|
|
12353
12387
|
Pipeline with URL ${pipeline.pipelineUrl} is not a child of the root URL ${rootUrl} 🍏
|
|
12354
12388
|
|
|
12355
12389
|
File:
|
|
@@ -12387,7 +12421,7 @@ async function createPipelineCollectionFromDirectory(rootPath, tools, options) {
|
|
|
12387
12421
|
}
|
|
12388
12422
|
else {
|
|
12389
12423
|
const existing = collection.get(pipeline.pipelineUrl);
|
|
12390
|
-
throw new PipelineUrlError(spaceTrim(`
|
|
12424
|
+
throw new PipelineUrlError(spaceTrim$2(`
|
|
12391
12425
|
Pipeline with URL ${pipeline.pipelineUrl} is already in the collection 🍏
|
|
12392
12426
|
|
|
12393
12427
|
Conflicting files:
|
|
@@ -12405,7 +12439,7 @@ async function createPipelineCollectionFromDirectory(rootPath, tools, options) {
|
|
|
12405
12439
|
catch (error) {
|
|
12406
12440
|
assertsError(error);
|
|
12407
12441
|
// TODO: [7] DRY
|
|
12408
|
-
const wrappedErrorMessage = spaceTrim((block) => `
|
|
12442
|
+
const wrappedErrorMessage = spaceTrim$2((block) => `
|
|
12409
12443
|
${error.name} in pipeline ${fileName.split('\\').join('/')}:
|
|
12410
12444
|
|
|
12411
12445
|
Original error message:
|
|
@@ -12462,7 +12496,7 @@ async function $provideScriptingForNode(options) {
|
|
|
12462
12496
|
*/
|
|
12463
12497
|
function stringifyPipelineJson(pipeline) {
|
|
12464
12498
|
if (!isSerializableAsJson(pipeline)) {
|
|
12465
|
-
throw new UnexpectedError(spaceTrim(`
|
|
12499
|
+
throw new UnexpectedError(spaceTrim$2(`
|
|
12466
12500
|
Cannot stringify the pipeline, because it is not serializable as JSON
|
|
12467
12501
|
|
|
12468
12502
|
There can be multiple reasons:
|