@promptbook/documents 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 CHANGED
@@ -1,5 +1,5 @@
1
1
  import { mkdir, rm, readFile } from 'fs/promises';
2
- import spaceTrim$1, { spaceTrim } from 'spacetrim';
2
+ import spaceTrim$2, { spaceTrim as spaceTrim$1 } from 'spacetrim';
3
3
  import { spawn } from 'child_process';
4
4
  import colors from 'colors';
5
5
  import { forTime } from 'waitasecond';
@@ -26,7 +26,7 @@ const BOOK_LANGUAGE_VERSION = '2.0.0';
26
26
  * @generated
27
27
  * @see https://github.com/webgptorg/promptbook
28
28
  */
29
- const PROMPTBOOK_ENGINE_VERSION = '0.103.0-55';
29
+ const PROMPTBOOK_ENGINE_VERSION = '0.103.0-56';
30
30
  /**
31
31
  * TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
32
32
  * Note: [💞] Ignore a discrepancy between file name and entity name
@@ -49,6 +49,17 @@ const PROMPTBOOK_ENGINE_VERSION = '0.103.0-55';
49
49
  function keepUnused(...valuesToKeep) {
50
50
  }
51
51
 
52
+ /**
53
+ * Trims string from all 4 sides
54
+ *
55
+ * Note: This is a re-exported function from the `spacetrim` package which is
56
+ * Developed by same author @hejny as this package
57
+ *
58
+ * @public exported from `@promptbook/utils`
59
+ * @see https://github.com/hejny/spacetrim#usage
60
+ */
61
+ const spaceTrim = spaceTrim$1;
62
+
52
63
  /**
53
64
  * @private util of `@promptbook/color`
54
65
  * @de
@@ -97,6 +108,7 @@ function take(initialValue) {
97
108
  * @public exported from `@promptbook/color`
98
109
  */
99
110
  const CSS_COLORS = {
111
+ promptbook: '#79EAFD',
100
112
  transparent: 'rgba(0,0,0,0)',
101
113
  aliceblue: '#f0f8ff',
102
114
  antiquewhite: '#faebd7',
@@ -312,6 +324,28 @@ class Color {
312
324
  throw new Error(`Can not create color from given object`);
313
325
  }
314
326
  }
327
+ /**
328
+ * Creates a new Color instance from miscellaneous formats
329
+ * It just does not throw error when it fails, it returns PROMPTBOOK_COLOR instead
330
+ *
331
+ * @param color
332
+ * @returns Color object
333
+ */
334
+ static fromSafe(color) {
335
+ try {
336
+ return Color.from(color);
337
+ }
338
+ catch (error) {
339
+ // <- Note: Can not use `assertsError(error)` here because it causes circular dependency
340
+ console.warn(spaceTrim((block) => `
341
+ Color.fromSafe error:
342
+ ${block(error.message)}
343
+
344
+ Returning default PROMPTBOOK_COLOR.
345
+ `));
346
+ return Color.fromString('promptbook');
347
+ }
348
+ }
315
349
  /**
316
350
  * Creates a new Color instance from miscellaneous string formats
317
351
  *
@@ -921,7 +955,7 @@ const ADMIN_GITHUB_NAME = 'hejny';
921
955
  *
922
956
  * @public exported from `@promptbook/core`
923
957
  */
924
- const PROMPTBOOK_COLOR = Color.fromHex('#79EAFD');
958
+ const PROMPTBOOK_COLOR = Color.fromString('promptbook');
925
959
  // <- TODO: [🧠][🈵] Using `Color` here increases the package size approx 3kb, maybe remove it
926
960
  /**
927
961
  * Colors for syntax highlighting in the `<BookEditor/>`
@@ -1144,7 +1178,7 @@ class KnowledgeScrapeError extends Error {
1144
1178
  */
1145
1179
  class MissingToolsError extends Error {
1146
1180
  constructor(message) {
1147
- super(spaceTrim((block) => `
1181
+ super(spaceTrim$1((block) => `
1148
1182
  ${block(message)}
1149
1183
 
1150
1184
  Note: You have probably forgot to provide some tools for pipeline execution or preparation
@@ -1163,7 +1197,7 @@ class MissingToolsError extends Error {
1163
1197
  function getErrorReportUrl(error) {
1164
1198
  const report = {
1165
1199
  title: `🐜 Error report from ${NAME}`,
1166
- body: spaceTrim$1((block) => `
1200
+ body: spaceTrim$2((block) => `
1167
1201
 
1168
1202
 
1169
1203
  \`${error.name || 'Error'}\` has occurred in the [${NAME}], please look into it @${ADMIN_GITHUB_NAME}.
@@ -1206,7 +1240,7 @@ function getErrorReportUrl(error) {
1206
1240
  */
1207
1241
  class UnexpectedError extends Error {
1208
1242
  constructor(message) {
1209
- super(spaceTrim((block) => `
1243
+ super(spaceTrim$1((block) => `
1210
1244
  ${block(message)}
1211
1245
 
1212
1246
  Note: This error should not happen.
@@ -1367,11 +1401,11 @@ function $execCommand(options) {
1367
1401
  console.warn(`Command "${humanReadableCommand}" exited with code ${code}`);
1368
1402
  // <- TODO: [🏮] Some standard way how to transform errors into warnings and how to handle non-critical fails during the tasks
1369
1403
  }
1370
- resolve(spaceTrim(output.join('\n')));
1404
+ resolve(spaceTrim$1(output.join('\n')));
1371
1405
  }
1372
1406
  }
1373
1407
  else {
1374
- resolve(spaceTrim(output.join('\n')));
1408
+ resolve(spaceTrim$1(output.join('\n')));
1375
1409
  }
1376
1410
  };
1377
1411
  commandProcess.on('close', finishWithCode);
@@ -1389,7 +1423,7 @@ function $execCommand(options) {
1389
1423
  console.warn(error);
1390
1424
  // <- TODO: [🏮] Some standard way how to transform errors into warnings and how to handle non-critical fails during the tasks
1391
1425
  }
1392
- resolve(spaceTrim(output.join('\n')));
1426
+ resolve(spaceTrim$1(output.join('\n')));
1393
1427
  }
1394
1428
  });
1395
1429
  }
@@ -2006,7 +2040,7 @@ class WrappedError extends Error {
2006
2040
  constructor(whatWasThrown) {
2007
2041
  const tag = `[🤮]`;
2008
2042
  console.error(tag, whatWasThrown);
2009
- super(spaceTrim(`
2043
+ super(spaceTrim$1(`
2010
2044
  Non-Error object was thrown
2011
2045
 
2012
2046
  Note: Look for ${tag} in the console for more details
@@ -2232,7 +2266,7 @@ function pipelineJsonToString(pipelineJson) {
2232
2266
  pipelineString += '\n\n';
2233
2267
  pipelineString += '```' + contentLanguage;
2234
2268
  pipelineString += '\n';
2235
- pipelineString += spaceTrim$1(content);
2269
+ pipelineString += spaceTrim$2(content);
2236
2270
  // <- TODO: [main] !!3 Escape
2237
2271
  // <- TODO: [🧠] Some clear strategy how to spaceTrim the blocks
2238
2272
  pipelineString += '\n';
@@ -2353,7 +2387,7 @@ function checkSerializableAsJson(options) {
2353
2387
  }
2354
2388
  else if (typeof value === 'object') {
2355
2389
  if (value instanceof Date) {
2356
- throw new UnexpectedError(spaceTrim$1((block) => `
2390
+ throw new UnexpectedError(spaceTrim$2((block) => `
2357
2391
  \`${name}\` is Date
2358
2392
 
2359
2393
  Use \`string_date_iso8601\` instead
@@ -2372,7 +2406,7 @@ function checkSerializableAsJson(options) {
2372
2406
  throw new UnexpectedError(`${name} is RegExp`);
2373
2407
  }
2374
2408
  else if (value instanceof Error) {
2375
- throw new UnexpectedError(spaceTrim$1((block) => `
2409
+ throw new UnexpectedError(spaceTrim$2((block) => `
2376
2410
  \`${name}\` is unserialized Error
2377
2411
 
2378
2412
  Use function \`serializeError\`
@@ -2395,7 +2429,7 @@ function checkSerializableAsJson(options) {
2395
2429
  }
2396
2430
  catch (error) {
2397
2431
  assertsError(error);
2398
- throw new UnexpectedError(spaceTrim$1((block) => `
2432
+ throw new UnexpectedError(spaceTrim$2((block) => `
2399
2433
  \`${name}\` is not serializable
2400
2434
 
2401
2435
  ${block(error.stack || error.message)}
@@ -2427,7 +2461,7 @@ function checkSerializableAsJson(options) {
2427
2461
  }
2428
2462
  }
2429
2463
  else {
2430
- throw new UnexpectedError(spaceTrim$1((block) => `
2464
+ throw new UnexpectedError(spaceTrim$2((block) => `
2431
2465
  \`${name}\` is unknown type
2432
2466
 
2433
2467
  Additional message for \`${name}\`:
@@ -2681,7 +2715,7 @@ function validatePipeline(pipeline) {
2681
2715
  if (!(error instanceof PipelineLogicError)) {
2682
2716
  throw error;
2683
2717
  }
2684
- console.error(spaceTrim((block) => `
2718
+ console.error(spaceTrim$1((block) => `
2685
2719
  Pipeline is not valid but logic errors are temporarily disabled via \`IS_PIPELINE_LOGIC_VALIDATED\`
2686
2720
 
2687
2721
  ${block(error.message)}
@@ -2708,7 +2742,7 @@ function validatePipeline_InnerFunction(pipeline) {
2708
2742
  })();
2709
2743
  if (pipeline.pipelineUrl !== undefined && !isValidPipelineUrl(pipeline.pipelineUrl)) {
2710
2744
  // <- Note: [🚲]
2711
- throw new PipelineLogicError(spaceTrim((block) => `
2745
+ throw new PipelineLogicError(spaceTrim$1((block) => `
2712
2746
  Invalid promptbook URL "${pipeline.pipelineUrl}"
2713
2747
 
2714
2748
  ${block(pipelineIdentification)}
@@ -2716,7 +2750,7 @@ function validatePipeline_InnerFunction(pipeline) {
2716
2750
  }
2717
2751
  if (pipeline.bookVersion !== undefined && !isValidPromptbookVersion(pipeline.bookVersion)) {
2718
2752
  // <- Note: [🚲]
2719
- throw new PipelineLogicError(spaceTrim((block) => `
2753
+ throw new PipelineLogicError(spaceTrim$1((block) => `
2720
2754
  Invalid Promptbook Version "${pipeline.bookVersion}"
2721
2755
 
2722
2756
  ${block(pipelineIdentification)}
@@ -2725,7 +2759,7 @@ function validatePipeline_InnerFunction(pipeline) {
2725
2759
  // TODO: [🧠] Maybe do here some proper JSON-schema / ZOD checking
2726
2760
  if (!Array.isArray(pipeline.parameters)) {
2727
2761
  // TODO: [🧠] what is the correct error tp throw - maybe PromptbookSchemaError
2728
- throw new ParseError(spaceTrim((block) => `
2762
+ throw new ParseError(spaceTrim$1((block) => `
2729
2763
  Pipeline is valid JSON but with wrong structure
2730
2764
 
2731
2765
  \`PipelineJson.parameters\` expected to be an array, but got ${typeof pipeline.parameters}
@@ -2736,7 +2770,7 @@ function validatePipeline_InnerFunction(pipeline) {
2736
2770
  // TODO: [🧠] Maybe do here some proper JSON-schema / ZOD checking
2737
2771
  if (!Array.isArray(pipeline.tasks)) {
2738
2772
  // TODO: [🧠] what is the correct error tp throw - maybe PromptbookSchemaError
2739
- throw new ParseError(spaceTrim((block) => `
2773
+ throw new ParseError(spaceTrim$1((block) => `
2740
2774
  Pipeline is valid JSON but with wrong structure
2741
2775
 
2742
2776
  \`PipelineJson.tasks\` expected to be an array, but got ${typeof pipeline.tasks}
@@ -2762,7 +2796,7 @@ function validatePipeline_InnerFunction(pipeline) {
2762
2796
  // Note: Check each parameter individually
2763
2797
  for (const parameter of pipeline.parameters) {
2764
2798
  if (parameter.isInput && parameter.isOutput) {
2765
- throw new PipelineLogicError(spaceTrim((block) => `
2799
+ throw new PipelineLogicError(spaceTrim$1((block) => `
2766
2800
 
2767
2801
  Parameter \`{${parameter.name}}\` can not be both input and output
2768
2802
 
@@ -2773,7 +2807,7 @@ function validatePipeline_InnerFunction(pipeline) {
2773
2807
  if (!parameter.isInput &&
2774
2808
  !parameter.isOutput &&
2775
2809
  !pipeline.tasks.some((task) => task.dependentParameterNames.includes(parameter.name))) {
2776
- throw new PipelineLogicError(spaceTrim((block) => `
2810
+ throw new PipelineLogicError(spaceTrim$1((block) => `
2777
2811
  Parameter \`{${parameter.name}}\` is created but not used
2778
2812
 
2779
2813
  You can declare {${parameter.name}} as output parameter by adding in the header:
@@ -2785,7 +2819,7 @@ function validatePipeline_InnerFunction(pipeline) {
2785
2819
  }
2786
2820
  // Note: Testing that parameter is either input or result of some task
2787
2821
  if (!parameter.isInput && !pipeline.tasks.some((task) => task.resultingParameterName === parameter.name)) {
2788
- throw new PipelineLogicError(spaceTrim((block) => `
2822
+ throw new PipelineLogicError(spaceTrim$1((block) => `
2789
2823
  Parameter \`{${parameter.name}}\` is declared but not defined
2790
2824
 
2791
2825
  You can do one of these:
@@ -2801,14 +2835,14 @@ function validatePipeline_InnerFunction(pipeline) {
2801
2835
  // Note: Checking each task individually
2802
2836
  for (const task of pipeline.tasks) {
2803
2837
  if (definedParameters.has(task.resultingParameterName)) {
2804
- throw new PipelineLogicError(spaceTrim((block) => `
2838
+ throw new PipelineLogicError(spaceTrim$1((block) => `
2805
2839
  Parameter \`{${task.resultingParameterName}}\` is defined multiple times
2806
2840
 
2807
2841
  ${block(pipelineIdentification)}
2808
2842
  `));
2809
2843
  }
2810
2844
  if (RESERVED_PARAMETER_NAMES.includes(task.resultingParameterName)) {
2811
- throw new PipelineLogicError(spaceTrim((block) => `
2845
+ throw new PipelineLogicError(spaceTrim$1((block) => `
2812
2846
  Parameter name {${task.resultingParameterName}} is reserved, please use different name
2813
2847
 
2814
2848
  ${block(pipelineIdentification)}
@@ -2818,7 +2852,7 @@ function validatePipeline_InnerFunction(pipeline) {
2818
2852
  if (task.jokerParameterNames && task.jokerParameterNames.length > 0) {
2819
2853
  if (!task.format &&
2820
2854
  !task.expectations /* <- TODO: Require at least 1 -> min <- expectation to use jokers */) {
2821
- throw new PipelineLogicError(spaceTrim((block) => `
2855
+ throw new PipelineLogicError(spaceTrim$1((block) => `
2822
2856
  Joker parameters are used for {${task.resultingParameterName}} but no expectations are defined
2823
2857
 
2824
2858
  ${block(pipelineIdentification)}
@@ -2826,7 +2860,7 @@ function validatePipeline_InnerFunction(pipeline) {
2826
2860
  }
2827
2861
  for (const joker of task.jokerParameterNames) {
2828
2862
  if (!task.dependentParameterNames.includes(joker)) {
2829
- throw new PipelineLogicError(spaceTrim((block) => `
2863
+ throw new PipelineLogicError(spaceTrim$1((block) => `
2830
2864
  Parameter \`{${joker}}\` is used for {${task.resultingParameterName}} as joker but not in \`dependentParameterNames\`
2831
2865
 
2832
2866
  ${block(pipelineIdentification)}
@@ -2837,21 +2871,21 @@ function validatePipeline_InnerFunction(pipeline) {
2837
2871
  if (task.expectations) {
2838
2872
  for (const [unit, { min, max }] of Object.entries(task.expectations)) {
2839
2873
  if (min !== undefined && max !== undefined && min > max) {
2840
- throw new PipelineLogicError(spaceTrim((block) => `
2874
+ throw new PipelineLogicError(spaceTrim$1((block) => `
2841
2875
  Min expectation (=${min}) of ${unit} is higher than max expectation (=${max})
2842
2876
 
2843
2877
  ${block(pipelineIdentification)}
2844
2878
  `));
2845
2879
  }
2846
2880
  if (min !== undefined && min < 0) {
2847
- throw new PipelineLogicError(spaceTrim((block) => `
2881
+ throw new PipelineLogicError(spaceTrim$1((block) => `
2848
2882
  Min expectation of ${unit} must be zero or positive
2849
2883
 
2850
2884
  ${block(pipelineIdentification)}
2851
2885
  `));
2852
2886
  }
2853
2887
  if (max !== undefined && max <= 0) {
2854
- throw new PipelineLogicError(spaceTrim((block) => `
2888
+ throw new PipelineLogicError(spaceTrim$1((block) => `
2855
2889
  Max expectation of ${unit} must be positive
2856
2890
 
2857
2891
  ${block(pipelineIdentification)}
@@ -2873,7 +2907,7 @@ function validatePipeline_InnerFunction(pipeline) {
2873
2907
  while (unresovedTasks.length > 0) {
2874
2908
  if (loopLimit-- < 0) {
2875
2909
  // Note: Really UnexpectedError not LimitReachedError - this should not happen and be caught below
2876
- throw new UnexpectedError(spaceTrim((block) => `
2910
+ throw new UnexpectedError(spaceTrim$1((block) => `
2877
2911
  Loop limit reached during detection of circular dependencies in \`validatePipeline\`
2878
2912
 
2879
2913
  ${block(pipelineIdentification)}
@@ -2883,7 +2917,7 @@ function validatePipeline_InnerFunction(pipeline) {
2883
2917
  if (currentlyResovedTasks.length === 0) {
2884
2918
  throw new PipelineLogicError(
2885
2919
  // TODO: [🐎] DRY
2886
- spaceTrim((block) => `
2920
+ spaceTrim$1((block) => `
2887
2921
 
2888
2922
  Can not resolve some parameters:
2889
2923
  Either you are using a parameter that is not defined, or there are some circular dependencies.
@@ -3047,7 +3081,7 @@ class SimplePipelineCollection {
3047
3081
  for (const pipeline of pipelines) {
3048
3082
  // TODO: [👠] DRY
3049
3083
  if (pipeline.pipelineUrl === undefined) {
3050
- throw new PipelineUrlError(spaceTrim(`
3084
+ throw new PipelineUrlError(spaceTrim$1(`
3051
3085
  Pipeline with name "${pipeline.title}" does not have defined URL
3052
3086
 
3053
3087
  File:
@@ -3069,7 +3103,7 @@ class SimplePipelineCollection {
3069
3103
  pipelineJsonToString(unpreparePipeline(pipeline)) !==
3070
3104
  pipelineJsonToString(unpreparePipeline(this.collection.get(pipeline.pipelineUrl)))) {
3071
3105
  const existing = this.collection.get(pipeline.pipelineUrl);
3072
- throw new PipelineUrlError(spaceTrim(`
3106
+ throw new PipelineUrlError(spaceTrim$1(`
3073
3107
  Pipeline with URL ${pipeline.pipelineUrl} is already in the collection 🍎
3074
3108
 
3075
3109
  Conflicting files:
@@ -3101,13 +3135,13 @@ class SimplePipelineCollection {
3101
3135
  const pipeline = this.collection.get(url);
3102
3136
  if (!pipeline) {
3103
3137
  if (this.listPipelines().length === 0) {
3104
- throw new NotFoundError(spaceTrim(`
3138
+ throw new NotFoundError(spaceTrim$1(`
3105
3139
  Pipeline with url "${url}" not found
3106
3140
 
3107
3141
  No pipelines available
3108
3142
  `));
3109
3143
  }
3110
- throw new NotFoundError(spaceTrim((block) => `
3144
+ throw new NotFoundError(spaceTrim$1((block) => `
3111
3145
  Pipeline with url "${url}" not found
3112
3146
 
3113
3147
  Available pipelines:
@@ -3338,7 +3372,7 @@ class NotAllowed extends Error {
3338
3372
  */
3339
3373
  class NotYetImplementedError extends Error {
3340
3374
  constructor(message) {
3341
- super(spaceTrim((block) => `
3375
+ super(spaceTrim$1((block) => `
3342
3376
  ${block(message)}
3343
3377
 
3344
3378
  Note: This feature is not implemented yet but it will be soon.
@@ -3440,7 +3474,7 @@ function serializeError(error) {
3440
3474
  const { name, message, stack } = error;
3441
3475
  const { id } = error;
3442
3476
  if (!Object.keys(ALL_ERRORS).includes(name)) {
3443
- console.error(spaceTrim$1((block) => `
3477
+ console.error(spaceTrim$2((block) => `
3444
3478
 
3445
3479
  Cannot serialize error with name "${name}"
3446
3480
 
@@ -3473,7 +3507,7 @@ function jsonParse(value) {
3473
3507
  }
3474
3508
  else if (typeof value !== 'string') {
3475
3509
  console.error('Can not parse JSON from non-string value.', { text: value });
3476
- throw new Error(spaceTrim$1(`
3510
+ throw new Error(spaceTrim$2(`
3477
3511
  Can not parse JSON from non-string value.
3478
3512
 
3479
3513
  The value type: ${typeof value}
@@ -3487,7 +3521,7 @@ function jsonParse(value) {
3487
3521
  if (!(error instanceof Error)) {
3488
3522
  throw error;
3489
3523
  }
3490
- throw new Error(spaceTrim$1((block) => `
3524
+ throw new Error(spaceTrim$2((block) => `
3491
3525
  ${block(error.message)}
3492
3526
 
3493
3527
  The expected JSON text:
@@ -3540,7 +3574,7 @@ function deserializeError(error) {
3540
3574
  message = `${name}: ${message}`;
3541
3575
  }
3542
3576
  if (stack !== undefined && stack !== '') {
3543
- message = spaceTrim$1((block) => `
3577
+ message = spaceTrim$2((block) => `
3544
3578
  ${block(message)}
3545
3579
 
3546
3580
  Original stack trace:
@@ -3577,11 +3611,11 @@ function assertsTaskSuccessful(executionResult) {
3577
3611
  throw deserializeError(errors[0]);
3578
3612
  }
3579
3613
  else {
3580
- throw new PipelineExecutionError(spaceTrim((block) => `
3614
+ throw new PipelineExecutionError(spaceTrim$1((block) => `
3581
3615
  Multiple errors occurred during Promptbook execution
3582
3616
 
3583
3617
  ${block(errors
3584
- .map(({ name, stack, message }, index) => spaceTrim((block) => `
3618
+ .map(({ name, stack, message }, index) => spaceTrim$1((block) => `
3585
3619
  ${name} ${index + 1}:
3586
3620
  ${block(stack || message)}
3587
3621
  `))
@@ -4052,14 +4086,14 @@ class MultipleLlmExecutionTools {
4052
4086
  if (description === undefined) {
4053
4087
  return headLine;
4054
4088
  }
4055
- return spaceTrim$1((block) => `
4089
+ return spaceTrim$2((block) => `
4056
4090
  ${headLine}
4057
4091
 
4058
4092
  ${ /* <- Note: Indenting the description: */block(description)}
4059
4093
  `);
4060
4094
  })
4061
4095
  .join('\n\n');
4062
- return spaceTrim$1((block) => `
4096
+ return spaceTrim$2((block) => `
4063
4097
  Multiple LLM Providers:
4064
4098
 
4065
4099
  ${block(innerModelsTitlesAndDescriptions)}
@@ -4150,7 +4184,7 @@ class MultipleLlmExecutionTools {
4150
4184
  // 1) OpenAI throw PipelineExecutionError: Parameter `{knowledge}` is not defined
4151
4185
  // 2) AnthropicClaude throw PipelineExecutionError: Parameter `{knowledge}` is not defined
4152
4186
  // 3) ...
4153
- spaceTrim$1((block) => `
4187
+ spaceTrim$2((block) => `
4154
4188
  All execution tools of ${this.title} failed:
4155
4189
 
4156
4190
  ${block(errors
@@ -4163,7 +4197,7 @@ class MultipleLlmExecutionTools {
4163
4197
  throw new PipelineExecutionError(`You have not provided any \`LlmExecutionTools\` into ${this.title}`);
4164
4198
  }
4165
4199
  else {
4166
- throw new PipelineExecutionError(spaceTrim$1((block) => `
4200
+ throw new PipelineExecutionError(spaceTrim$2((block) => `
4167
4201
  You have not provided any \`LlmExecutionTools\` that support model variant "${prompt.modelRequirements.modelVariant}" into ${this.title}
4168
4202
 
4169
4203
  Available \`LlmExecutionTools\`:
@@ -4196,7 +4230,7 @@ class MultipleLlmExecutionTools {
4196
4230
  */
4197
4231
  function joinLlmExecutionTools(title, ...llmExecutionTools) {
4198
4232
  if (llmExecutionTools.length === 0) {
4199
- const warningMessage = spaceTrim$1(`
4233
+ const warningMessage = spaceTrim$2(`
4200
4234
  You have not provided any \`LlmExecutionTools\`
4201
4235
  This means that you won't be able to execute any prompts that require large language models like GPT-4 or Anthropic's Claude.
4202
4236
 
@@ -4513,14 +4547,14 @@ function $registeredScrapersMessage(availableScrapers) {
4513
4547
  return { ...metadata, isMetadataAviailable, isInstalled, isAvailableInTools };
4514
4548
  });
4515
4549
  if (metadata.length === 0) {
4516
- return spaceTrim$1(`
4550
+ return spaceTrim$2(`
4517
4551
  **No scrapers are available**
4518
4552
 
4519
4553
  This is a unexpected behavior, you are probably using some broken version of Promptbook
4520
4554
  At least there should be available the metadata of the scrapers
4521
4555
  `);
4522
4556
  }
4523
- return spaceTrim$1((block) => `
4557
+ return spaceTrim$2((block) => `
4524
4558
  Available scrapers are:
4525
4559
  ${block(metadata
4526
4560
  .map(({ packageName, className, isMetadataAviailable, isInstalled, mimeTypes, isAvailableInBrowser, isAvailableInTools, }, i) => {
@@ -4621,7 +4655,7 @@ const promptbookFetch = async (urlOrRequest, init) => {
4621
4655
  else if (urlOrRequest instanceof Request) {
4622
4656
  url = urlOrRequest.url;
4623
4657
  }
4624
- throw new PromptbookFetchError(spaceTrim$1((block) => `
4658
+ throw new PromptbookFetchError(spaceTrim$2((block) => `
4625
4659
  Can not fetch "${url}"
4626
4660
 
4627
4661
  Fetch error:
@@ -4782,7 +4816,7 @@ async function makeKnowledgeSourceHandler(knowledgeSource, tools, options) {
4782
4816
  const fileExtension = getFileExtension(filename);
4783
4817
  const mimeType = extensionToMimeType(fileExtension || '');
4784
4818
  if (!(await isFileExisting(filename, tools.fs))) {
4785
- throw new NotFoundError(spaceTrim$1((block) => `
4819
+ throw new NotFoundError(spaceTrim$2((block) => `
4786
4820
  Can not make source handler for file which does not exist:
4787
4821
 
4788
4822
  File:
@@ -4875,7 +4909,7 @@ async function prepareKnowledgePieces(knowledgeSources, tools, options) {
4875
4909
  // <- TODO: [🪓] Here should be no need for spreading new array, just `partialPieces = partialPiecesUnchecked`
4876
4910
  break;
4877
4911
  }
4878
- console.warn(spaceTrim$1((block) => `
4912
+ console.warn(spaceTrim$2((block) => `
4879
4913
  Cannot scrape knowledge from source despite the scraper \`${scraper.metadata.className}\` supports the mime type "${sourceHandler.mimeType}".
4880
4914
 
4881
4915
  The source:
@@ -4891,7 +4925,7 @@ async function prepareKnowledgePieces(knowledgeSources, tools, options) {
4891
4925
  // <- TODO: [🏮] Some standard way how to transform errors into warnings and how to handle non-critical fails during the tasks
4892
4926
  }
4893
4927
  if (partialPieces === null) {
4894
- throw new KnowledgeScrapeError(spaceTrim$1((block) => `
4928
+ throw new KnowledgeScrapeError(spaceTrim$2((block) => `
4895
4929
  Cannot scrape knowledge
4896
4930
 
4897
4931
  The source:
@@ -4970,7 +5004,7 @@ async function prepareTasks(pipeline, tools, options) {
4970
5004
  if (task.taskType === 'PROMPT_TASK' &&
4971
5005
  knowledgePiecesCount > 0 &&
4972
5006
  !dependentParameterNames.includes('knowledge')) {
4973
- preparedContent = spaceTrim(`
5007
+ preparedContent = spaceTrim$1(`
4974
5008
  {content}
4975
5009
 
4976
5010
  ## Knowledge
@@ -5283,7 +5317,7 @@ function extractVariablesFromJavascript(script) {
5283
5317
  }
5284
5318
  catch (error) {
5285
5319
  assertsError(error);
5286
- throw new ParseError(spaceTrim((block) => `
5320
+ throw new ParseError(spaceTrim$1((block) => `
5287
5321
  Can not extract variables from the script
5288
5322
  ${block(error.stack || error.message)}
5289
5323
 
@@ -5466,7 +5500,7 @@ const CsvFormatParser = {
5466
5500
  const { value, outputParameterName, settings, mapCallback, onProgress } = options;
5467
5501
  const csv = csvParse(value, settings);
5468
5502
  if (csv.errors.length !== 0) {
5469
- throw new CsvFormatError(spaceTrim$1((block) => `
5503
+ throw new CsvFormatError(spaceTrim$2((block) => `
5470
5504
  CSV parsing error
5471
5505
 
5472
5506
  Error(s) from CSV parsing:
@@ -5511,7 +5545,7 @@ const CsvFormatParser = {
5511
5545
  const { value, settings, mapCallback, onProgress } = options;
5512
5546
  const csv = csvParse(value, settings);
5513
5547
  if (csv.errors.length !== 0) {
5514
- throw new CsvFormatError(spaceTrim$1((block) => `
5548
+ throw new CsvFormatError(spaceTrim$2((block) => `
5515
5549
  CSV parsing error
5516
5550
 
5517
5551
  Error(s) from CSV parsing:
@@ -5721,7 +5755,7 @@ function mapAvailableToExpectedParameters(options) {
5721
5755
  }
5722
5756
  // Phase 2️⃣: Non-matching mapping
5723
5757
  if (expectedParameterNames.size !== availableParametersNames.size) {
5724
- throw new PipelineExecutionError(spaceTrim$1((block) => `
5758
+ throw new PipelineExecutionError(spaceTrim$2((block) => `
5725
5759
  Can not map available parameters to expected parameters
5726
5760
 
5727
5761
  Mapped parameters:
@@ -6120,7 +6154,7 @@ function validatePromptResult(options) {
6120
6154
  }
6121
6155
  catch (error) {
6122
6156
  keepUnused(error);
6123
- throw new ExpectError(spaceTrim((block) => `
6157
+ throw new ExpectError(spaceTrim$1((block) => `
6124
6158
  Expected valid JSON string
6125
6159
 
6126
6160
  The expected JSON text:
@@ -6183,7 +6217,7 @@ async function executeAttempts(options) {
6183
6217
  const jokerParameterName = jokerParameterNames[jokerParameterNames.length + attemptIndex];
6184
6218
  // TODO: [🧠][🍭] JOKERS, EXPECTATIONS, POSTPROCESSING and FOREACH
6185
6219
  if (isJokerAttempt && !jokerParameterName) {
6186
- throw new UnexpectedError(spaceTrim((block) => `
6220
+ throw new UnexpectedError(spaceTrim$1((block) => `
6187
6221
  Joker not found in attempt ${attemptIndex}
6188
6222
 
6189
6223
  ${block(pipelineIdentification)}
@@ -6194,7 +6228,7 @@ async function executeAttempts(options) {
6194
6228
  $ongoingTaskResult.$expectError = null;
6195
6229
  if (isJokerAttempt) {
6196
6230
  if (parameters[jokerParameterName] === undefined) {
6197
- throw new PipelineExecutionError(spaceTrim((block) => `
6231
+ throw new PipelineExecutionError(spaceTrim$1((block) => `
6198
6232
  Joker parameter {${jokerParameterName}} not defined
6199
6233
 
6200
6234
  ${block(pipelineIdentification)}
@@ -6252,7 +6286,7 @@ async function executeAttempts(options) {
6252
6286
  $ongoingTaskResult.$resultString = $ongoingTaskResult.$completionResult.content;
6253
6287
  break variant;
6254
6288
  case 'EMBEDDING':
6255
- throw new PipelineExecutionError(spaceTrim((block) => `
6289
+ throw new PipelineExecutionError(spaceTrim$1((block) => `
6256
6290
  Embedding model can not be used in pipeline
6257
6291
 
6258
6292
  This should be catched during parsing
@@ -6263,7 +6297,7 @@ async function executeAttempts(options) {
6263
6297
  break variant;
6264
6298
  // <- case [🤖]:
6265
6299
  default:
6266
- throw new PipelineExecutionError(spaceTrim((block) => `
6300
+ throw new PipelineExecutionError(spaceTrim$1((block) => `
6267
6301
  Unknown model variant "${task.modelRequirements.modelVariant}"
6268
6302
 
6269
6303
  ${block(pipelineIdentification)}
@@ -6274,14 +6308,14 @@ async function executeAttempts(options) {
6274
6308
  break;
6275
6309
  case 'SCRIPT_TASK':
6276
6310
  if (arrayableToArray(tools.script).length === 0) {
6277
- throw new PipelineExecutionError(spaceTrim((block) => `
6311
+ throw new PipelineExecutionError(spaceTrim$1((block) => `
6278
6312
  No script execution tools are available
6279
6313
 
6280
6314
  ${block(pipelineIdentification)}
6281
6315
  `));
6282
6316
  }
6283
6317
  if (!task.contentLanguage) {
6284
- throw new PipelineExecutionError(spaceTrim((block) => `
6318
+ throw new PipelineExecutionError(spaceTrim$1((block) => `
6285
6319
  Script language is not defined for SCRIPT TASK "${task.name}"
6286
6320
 
6287
6321
  ${block(pipelineIdentification)}
@@ -6312,7 +6346,7 @@ async function executeAttempts(options) {
6312
6346
  throw $ongoingTaskResult.$scriptPipelineExecutionErrors[0];
6313
6347
  }
6314
6348
  else {
6315
- throw new PipelineExecutionError(spaceTrim((block) => `
6349
+ throw new PipelineExecutionError(spaceTrim$1((block) => `
6316
6350
  Script execution failed ${$ongoingTaskResult.$scriptPipelineExecutionErrors.length}x
6317
6351
 
6318
6352
  ${block(pipelineIdentification)}
@@ -6326,7 +6360,7 @@ async function executeAttempts(options) {
6326
6360
  break taskType;
6327
6361
  case 'DIALOG_TASK':
6328
6362
  if (tools.userInterface === undefined) {
6329
- throw new PipelineExecutionError(spaceTrim((block) => `
6363
+ throw new PipelineExecutionError(spaceTrim$1((block) => `
6330
6364
  User interface tools are not available
6331
6365
 
6332
6366
  ${block(pipelineIdentification)}
@@ -6344,7 +6378,7 @@ async function executeAttempts(options) {
6344
6378
  break taskType;
6345
6379
  // <- case: [🅱]
6346
6380
  default:
6347
- throw new PipelineExecutionError(spaceTrim((block) => `
6381
+ throw new PipelineExecutionError(spaceTrim$1((block) => `
6348
6382
  Unknown execution type "${task.taskType}"
6349
6383
 
6350
6384
  ${block(pipelineIdentification)}
@@ -6442,7 +6476,7 @@ async function executeAttempts(options) {
6442
6476
  if ($ongoingTaskResult.$expectError !== null && attemptIndex === maxAttempts - 1) {
6443
6477
  // Note: Create a summary of all failures
6444
6478
  const failuresSummary = $ongoingTaskResult.$failedResults
6445
- .map((failure) => spaceTrim((block) => {
6479
+ .map((failure) => spaceTrim$1((block) => {
6446
6480
  var _a, _b;
6447
6481
  return `
6448
6482
  Attempt ${failure.attemptIndex + 1}:
@@ -6452,14 +6486,14 @@ async function executeAttempts(options) {
6452
6486
  Result:
6453
6487
  ${block(failure.result === null
6454
6488
  ? 'null'
6455
- : spaceTrim(failure.result)
6489
+ : spaceTrim$1(failure.result)
6456
6490
  .split('\n')
6457
6491
  .map((line) => `> ${line}`)
6458
6492
  .join('\n'))}
6459
6493
  `;
6460
6494
  }))
6461
6495
  .join('\n\n---\n\n');
6462
- throw new PipelineExecutionError(spaceTrim((block) => {
6496
+ throw new PipelineExecutionError(spaceTrim$1((block) => {
6463
6497
  var _a;
6464
6498
  return `
6465
6499
  LLM execution failed ${maxExecutionAttempts}x
@@ -6479,7 +6513,7 @@ async function executeAttempts(options) {
6479
6513
  }
6480
6514
  }
6481
6515
  if ($ongoingTaskResult.$resultString === null) {
6482
- throw new UnexpectedError(spaceTrim((block) => `
6516
+ throw new UnexpectedError(spaceTrim$1((block) => `
6483
6517
  Something went wrong and prompt result is null
6484
6518
 
6485
6519
  ${block(pipelineIdentification)}
@@ -6506,7 +6540,7 @@ async function executeFormatSubvalues(options) {
6506
6540
  return /* not await */ executeAttempts({ ...options, logLlmCall });
6507
6541
  }
6508
6542
  if (jokerParameterNames.length !== 0) {
6509
- throw new UnexpectedError(spaceTrim$1((block) => `
6543
+ throw new UnexpectedError(spaceTrim$2((block) => `
6510
6544
  JOKER parameters are not supported together with FOREACH command
6511
6545
 
6512
6546
  [🧞‍♀️] This should be prevented in \`validatePipeline\`
@@ -6519,7 +6553,7 @@ async function executeFormatSubvalues(options) {
6519
6553
  if (formatDefinition === undefined) {
6520
6554
  throw new UnexpectedError(
6521
6555
  // <- TODO: [🧠][🧐] Should be formats fixed per promptbook version or behave as plugins (=> change UnexpectedError)
6522
- spaceTrim$1((block) => `
6556
+ spaceTrim$2((block) => `
6523
6557
  Unsupported format "${task.foreach.formatName}"
6524
6558
 
6525
6559
  Available formats:
@@ -6536,7 +6570,7 @@ async function executeFormatSubvalues(options) {
6536
6570
  if (subvalueParser === undefined) {
6537
6571
  throw new UnexpectedError(
6538
6572
  // <- TODO: [🧠][🧐] Should be formats fixed per promptbook version or behave as plugins (=> change UnexpectedError)
6539
- spaceTrim$1((block) => `
6573
+ spaceTrim$2((block) => `
6540
6574
  Unsupported subformat name "${task.foreach.subformatName}" for format "${task.foreach.formatName}"
6541
6575
 
6542
6576
  Available subformat names for format "${formatDefinition.formatName}":
@@ -6576,7 +6610,7 @@ async function executeFormatSubvalues(options) {
6576
6610
  if (!(error instanceof PipelineExecutionError)) {
6577
6611
  throw error;
6578
6612
  }
6579
- const highLevelError = new PipelineExecutionError(spaceTrim$1((block) => `
6613
+ const highLevelError = new PipelineExecutionError(spaceTrim$2((block) => `
6580
6614
  ${error.message}
6581
6615
 
6582
6616
  This is error in FOREACH command when mapping ${formatDefinition.formatName} ${subvalueParser.subvalueName} data (${index + 1}/${length})
@@ -6600,7 +6634,7 @@ async function executeFormatSubvalues(options) {
6600
6634
  ...options,
6601
6635
  priority: priority + index,
6602
6636
  parameters: allSubparameters,
6603
- pipelineIdentification: spaceTrim$1((block) => `
6637
+ pipelineIdentification: spaceTrim$2((block) => `
6604
6638
  ${block(pipelineIdentification)}
6605
6639
  Subparameter index: ${index}
6606
6640
  `),
@@ -6609,7 +6643,7 @@ async function executeFormatSubvalues(options) {
6609
6643
  }
6610
6644
  catch (error) {
6611
6645
  if (length > BIG_DATASET_TRESHOLD) {
6612
- console.error(spaceTrim$1((block) => `
6646
+ console.error(spaceTrim$2((block) => `
6613
6647
  ${error.message}
6614
6648
 
6615
6649
  This is error in FOREACH command when processing ${formatDefinition.formatName} ${subvalueParser.subvalueName} data (${index + 1}/${length})
@@ -6785,7 +6819,7 @@ async function getReservedParametersForTask(options) {
6785
6819
  // Note: Doublecheck that ALL reserved parameters are defined:
6786
6820
  for (const parameterName of RESERVED_PARAMETER_NAMES) {
6787
6821
  if (reservedParameters[parameterName] === undefined) {
6788
- throw new UnexpectedError(spaceTrim((block) => `
6822
+ throw new UnexpectedError(spaceTrim$1((block) => `
6789
6823
  Reserved parameter {${parameterName}} is not defined
6790
6824
 
6791
6825
  ${block(pipelineIdentification)}
@@ -6811,7 +6845,7 @@ async function executeTask(options) {
6811
6845
  const dependentParameterNames = new Set(currentTask.dependentParameterNames);
6812
6846
  // TODO: [👩🏾‍🤝‍👩🏻] Use here `mapAvailableToExpectedParameters`
6813
6847
  if (difference(union(difference(usedParameterNames, dependentParameterNames), difference(dependentParameterNames, usedParameterNames)), new Set(RESERVED_PARAMETER_NAMES)).size !== 0) {
6814
- throw new UnexpectedError(spaceTrim((block) => `
6848
+ throw new UnexpectedError(spaceTrim$1((block) => `
6815
6849
  Dependent parameters are not consistent with used parameters:
6816
6850
 
6817
6851
  Dependent parameters:
@@ -6855,7 +6889,7 @@ async function executeTask(options) {
6855
6889
  else if (!definedParameterNames.has(parameterName) && usedParameterNames.has(parameterName)) {
6856
6890
  // Houston, we have a problem
6857
6891
  // Note: Checking part is also done in `validatePipeline`, but it’s good to doublecheck
6858
- throw new UnexpectedError(spaceTrim((block) => `
6892
+ throw new UnexpectedError(spaceTrim$1((block) => `
6859
6893
  Parameter \`{${parameterName}}\` is NOT defined
6860
6894
  BUT used in task "${currentTask.title || currentTask.name}"
6861
6895
 
@@ -6924,7 +6958,7 @@ function filterJustOutputParameters(options) {
6924
6958
  for (const parameter of preparedPipeline.parameters.filter(({ isOutput }) => isOutput)) {
6925
6959
  if (parametersToPass[parameter.name] === undefined) {
6926
6960
  // [4]
6927
- $warnings.push(new PipelineExecutionError(spaceTrim((block) => `
6961
+ $warnings.push(new PipelineExecutionError(spaceTrim$1((block) => `
6928
6962
  Parameter \`{${parameter.name}}\` should be an output parameter, but it was not generated during pipeline execution
6929
6963
 
6930
6964
  Note: This is a warning which happened after the pipeline was executed, and \`{${parameter.name}}\` was not for some reason defined in output parameters
@@ -7032,7 +7066,7 @@ async function executePipeline(options) {
7032
7066
  for (const parameterName of Object.keys(inputParameters)) {
7033
7067
  const parameter = preparedPipeline.parameters.find(({ name }) => name === parameterName);
7034
7068
  if (parameter === undefined) {
7035
- warnings.push(new PipelineExecutionError(spaceTrim((block) => `
7069
+ warnings.push(new PipelineExecutionError(spaceTrim$1((block) => `
7036
7070
  Extra parameter {${parameterName}} is being passed which is not part of the pipeline.
7037
7071
 
7038
7072
  ${block(pipelineIdentification)}
@@ -7047,7 +7081,7 @@ async function executePipeline(options) {
7047
7081
  // TODO: [🧠] This should be also non-critical error
7048
7082
  return exportJson({
7049
7083
  name: 'pipelineExecutorResult',
7050
- message: spaceTrim((block) => `
7084
+ message: spaceTrim$1((block) => `
7051
7085
  Unsuccessful PipelineExecutorResult (with extra parameter {${parameter.name}}) PipelineExecutorResult
7052
7086
 
7053
7087
  ${block(pipelineIdentification)}
@@ -7056,7 +7090,7 @@ async function executePipeline(options) {
7056
7090
  value: {
7057
7091
  isSuccessful: false,
7058
7092
  errors: [
7059
- new PipelineExecutionError(spaceTrim((block) => `
7093
+ new PipelineExecutionError(spaceTrim$1((block) => `
7060
7094
  Parameter \`{${parameter.name}}\` is passed as input parameter but it is not input
7061
7095
 
7062
7096
  ${block(pipelineIdentification)}
@@ -7083,7 +7117,7 @@ async function executePipeline(options) {
7083
7117
  while (unresovedTasks.length > 0) {
7084
7118
  if (loopLimit-- < 0) {
7085
7119
  // Note: Really UnexpectedError not LimitReachedError - this should be catched during validatePipeline
7086
- throw new UnexpectedError(spaceTrim((block) => `
7120
+ throw new UnexpectedError(spaceTrim$1((block) => `
7087
7121
  Loop limit reached during resolving parameters pipeline execution
7088
7122
 
7089
7123
  ${block(pipelineIdentification)}
@@ -7093,7 +7127,7 @@ async function executePipeline(options) {
7093
7127
  if (!currentTask && resolving.length === 0) {
7094
7128
  throw new UnexpectedError(
7095
7129
  // TODO: [🐎] DRY
7096
- spaceTrim((block) => `
7130
+ spaceTrim$1((block) => `
7097
7131
  Can not resolve some parameters:
7098
7132
 
7099
7133
  ${block(pipelineIdentification)}
@@ -7133,7 +7167,7 @@ async function executePipeline(options) {
7133
7167
  tools,
7134
7168
  onProgress(newOngoingResult) {
7135
7169
  if (isReturned) {
7136
- throw new UnexpectedError(spaceTrim((block) => `
7170
+ throw new UnexpectedError(spaceTrim$1((block) => `
7137
7171
  Can not call \`onProgress\` after pipeline execution is finished
7138
7172
 
7139
7173
  ${block(pipelineIdentification)}
@@ -7150,7 +7184,7 @@ async function executePipeline(options) {
7150
7184
  },
7151
7185
  logLlmCall,
7152
7186
  $executionReport: executionReport,
7153
- pipelineIdentification: spaceTrim((block) => `
7187
+ pipelineIdentification: spaceTrim$1((block) => `
7154
7188
  ${block(pipelineIdentification)}
7155
7189
  Task name: ${currentTask.name}
7156
7190
  Task title: ${currentTask.title}
@@ -7259,7 +7293,7 @@ function createPipelineExecutor(options) {
7259
7293
  preparedPipeline = pipeline;
7260
7294
  }
7261
7295
  else if (isNotPreparedWarningSuppressed !== true) {
7262
- console.warn(spaceTrim((block) => `
7296
+ console.warn(spaceTrim$1((block) => `
7263
7297
  Pipeline is not prepared
7264
7298
 
7265
7299
  ${block(pipelineIdentification)}
@@ -7284,7 +7318,7 @@ function createPipelineExecutor(options) {
7284
7318
  tools,
7285
7319
  onProgress,
7286
7320
  logLlmCall,
7287
- pipelineIdentification: spaceTrim((block) => `
7321
+ pipelineIdentification: spaceTrim$1((block) => `
7288
7322
  ${block(pipelineIdentification)}
7289
7323
  ${runCount === 1 ? '' : `Run #${runCount}`}
7290
7324
  `),
@@ -7481,8 +7515,8 @@ class MarkdownScraper {
7481
7515
  knowledgeTextPieces.map(async (knowledgeTextPiece, i) => {
7482
7516
  // Note: These are just default values, they will be overwritten by the actual values:
7483
7517
  let name = `piece-${i}`;
7484
- let title = spaceTrim$1(knowledgeTextPiece.substring(0, 100));
7485
- const knowledgePieceContent = spaceTrim$1(knowledgeTextPiece);
7518
+ let title = spaceTrim$2(knowledgeTextPiece.substring(0, 100));
7519
+ const knowledgePieceContent = spaceTrim$2(knowledgeTextPiece);
7486
7520
  let keywords = [];
7487
7521
  const index = [];
7488
7522
  /*
@@ -7495,7 +7529,7 @@ class MarkdownScraper {
7495
7529
  isCrashedOnError: true,
7496
7530
  });
7497
7531
  const { title: titleRaw = 'Untitled' } = titleResult.outputParameters;
7498
- title = spaceTrim$1(titleRaw) /* <- TODO: Maybe do in pipeline */;
7532
+ title = spaceTrim$2(titleRaw) /* <- TODO: Maybe do in pipeline */;
7499
7533
  name = titleToName(title);
7500
7534
  // --- Keywords
7501
7535
  const keywordsResult = await prepareKeywordsExecutor({ knowledgePieceContent }).asPromise({
@@ -7641,7 +7675,7 @@ class DocumentScraper {
7641
7675
  await $execCommand(command);
7642
7676
  // Note: [0]
7643
7677
  if (!(await isFileExisting(cacheFilehandler.filename, this.tools.fs))) {
7644
- throw new UnexpectedError(spaceTrim$1((block) => `
7678
+ throw new UnexpectedError(spaceTrim$2((block) => `
7645
7679
  File that was supposed to be created by Pandoc does not exist for unknown reason
7646
7680
 
7647
7681
  Expected file: