@promptbook/pdf 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/umd/index.umd.js CHANGED
@@ -1,12 +1,12 @@
1
1
  (function (global, factory) {
2
2
  typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('fs/promises'), require('spacetrim'), require('crypto-js'), require('crypto-js/enc-hex'), require('path'), require('crypto'), require('rxjs'), require('waitasecond'), require('crypto-js/sha256'), require('mime-types'), require('papaparse')) :
3
3
  typeof define === 'function' && define.amd ? define(['exports', 'fs/promises', 'spacetrim', 'crypto-js', 'crypto-js/enc-hex', 'path', 'crypto', 'rxjs', 'waitasecond', 'crypto-js/sha256', 'mime-types', 'papaparse'], factory) :
4
- (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global["promptbook-pdf"] = {}, global.promises, global.spaceTrim, global.cryptoJs, global.hexEncoder, global.path, global.crypto, global.rxjs, global.waitasecond, global.sha256, global.mimeTypes, global.papaparse));
5
- })(this, (function (exports, promises, spaceTrim, cryptoJs, hexEncoder, path, crypto, rxjs, waitasecond, sha256, mimeTypes, papaparse) { 'use strict';
4
+ (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global["promptbook-pdf"] = {}, global.promises, global.spaceTrim$1, global.cryptoJs, global.hexEncoder, global.path, global.crypto, global.rxjs, global.waitasecond, global.sha256, global.mimeTypes, global.papaparse));
5
+ })(this, (function (exports, promises, spaceTrim$1, cryptoJs, hexEncoder, path, crypto, rxjs, waitasecond, sha256, mimeTypes, papaparse) { 'use strict';
6
6
 
7
7
  function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
8
8
 
9
- var spaceTrim__default = /*#__PURE__*/_interopDefaultLegacy(spaceTrim);
9
+ var spaceTrim__default = /*#__PURE__*/_interopDefaultLegacy(spaceTrim$1);
10
10
  var hexEncoder__default = /*#__PURE__*/_interopDefaultLegacy(hexEncoder);
11
11
  var sha256__default = /*#__PURE__*/_interopDefaultLegacy(sha256);
12
12
 
@@ -24,7 +24,7 @@
24
24
  * @generated
25
25
  * @see https://github.com/webgptorg/promptbook
26
26
  */
27
- const PROMPTBOOK_ENGINE_VERSION = '0.103.0-55';
27
+ const PROMPTBOOK_ENGINE_VERSION = '0.103.0-56';
28
28
  /**
29
29
  * TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
30
30
  * Note: [๐Ÿ’ž] Ignore a discrepancy between file name and entity name
@@ -47,6 +47,17 @@
47
47
  function keepUnused(...valuesToKeep) {
48
48
  }
49
49
 
50
+ /**
51
+ * Trims string from all 4 sides
52
+ *
53
+ * Note: This is a re-exported function from the `spacetrim` package which is
54
+ * Developed by same author @hejny as this package
55
+ *
56
+ * @public exported from `@promptbook/utils`
57
+ * @see https://github.com/hejny/spacetrim#usage
58
+ */
59
+ const spaceTrim = spaceTrim$1.spaceTrim;
60
+
50
61
  /**
51
62
  * Just marks a place of place where should be something implemented
52
63
  * No side effects.
@@ -108,6 +119,7 @@
108
119
  * @public exported from `@promptbook/color`
109
120
  */
110
121
  const CSS_COLORS = {
122
+ promptbook: '#79EAFD',
111
123
  transparent: 'rgba(0,0,0,0)',
112
124
  aliceblue: '#f0f8ff',
113
125
  antiquewhite: '#faebd7',
@@ -323,6 +335,28 @@
323
335
  throw new Error(`Can not create color from given object`);
324
336
  }
325
337
  }
338
+ /**
339
+ * Creates a new Color instance from miscellaneous formats
340
+ * It just does not throw error when it fails, it returns PROMPTBOOK_COLOR instead
341
+ *
342
+ * @param color
343
+ * @returns Color object
344
+ */
345
+ static fromSafe(color) {
346
+ try {
347
+ return Color.from(color);
348
+ }
349
+ catch (error) {
350
+ // <- Note: Can not use `assertsError(error)` here because it causes circular dependency
351
+ console.warn(spaceTrim((block) => `
352
+ Color.fromSafe error:
353
+ ${block(error.message)}
354
+
355
+ Returning default PROMPTBOOK_COLOR.
356
+ `));
357
+ return Color.fromString('promptbook');
358
+ }
359
+ }
326
360
  /**
327
361
  * Creates a new Color instance from miscellaneous string formats
328
362
  *
@@ -932,7 +966,7 @@
932
966
  *
933
967
  * @public exported from `@promptbook/core`
934
968
  */
935
- const PROMPTBOOK_COLOR = Color.fromHex('#79EAFD');
969
+ const PROMPTBOOK_COLOR = Color.fromString('promptbook');
936
970
  // <- TODO: [๐Ÿง ][๐Ÿˆต] Using `Color` here increases the package size approx 3kb, maybe remove it
937
971
  /**
938
972
  * Colors for syntax highlighting in the `<BookEditor/>`
@@ -1199,7 +1233,7 @@
1199
1233
  */
1200
1234
  class UnexpectedError extends Error {
1201
1235
  constructor(message) {
1202
- super(spaceTrim.spaceTrim((block) => `
1236
+ super(spaceTrim$1.spaceTrim((block) => `
1203
1237
  ${block(message)}
1204
1238
 
1205
1239
  Note: This error should not happen.
@@ -1827,7 +1861,7 @@
1827
1861
  constructor(whatWasThrown) {
1828
1862
  const tag = `[๐Ÿคฎ]`;
1829
1863
  console.error(tag, whatWasThrown);
1830
- super(spaceTrim.spaceTrim(`
1864
+ super(spaceTrim$1.spaceTrim(`
1831
1865
  Non-Error object was thrown
1832
1866
 
1833
1867
  Note: Look for ${tag} in the console for more details
@@ -2502,7 +2536,7 @@
2502
2536
  if (!(error instanceof PipelineLogicError)) {
2503
2537
  throw error;
2504
2538
  }
2505
- console.error(spaceTrim.spaceTrim((block) => `
2539
+ console.error(spaceTrim$1.spaceTrim((block) => `
2506
2540
  Pipeline is not valid but logic errors are temporarily disabled via \`IS_PIPELINE_LOGIC_VALIDATED\`
2507
2541
 
2508
2542
  ${block(error.message)}
@@ -2529,7 +2563,7 @@
2529
2563
  })();
2530
2564
  if (pipeline.pipelineUrl !== undefined && !isValidPipelineUrl(pipeline.pipelineUrl)) {
2531
2565
  // <- Note: [๐Ÿšฒ]
2532
- throw new PipelineLogicError(spaceTrim.spaceTrim((block) => `
2566
+ throw new PipelineLogicError(spaceTrim$1.spaceTrim((block) => `
2533
2567
  Invalid promptbook URL "${pipeline.pipelineUrl}"
2534
2568
 
2535
2569
  ${block(pipelineIdentification)}
@@ -2537,7 +2571,7 @@
2537
2571
  }
2538
2572
  if (pipeline.bookVersion !== undefined && !isValidPromptbookVersion(pipeline.bookVersion)) {
2539
2573
  // <- Note: [๐Ÿšฒ]
2540
- throw new PipelineLogicError(spaceTrim.spaceTrim((block) => `
2574
+ throw new PipelineLogicError(spaceTrim$1.spaceTrim((block) => `
2541
2575
  Invalid Promptbook Version "${pipeline.bookVersion}"
2542
2576
 
2543
2577
  ${block(pipelineIdentification)}
@@ -2546,7 +2580,7 @@
2546
2580
  // TODO: [๐Ÿง ] Maybe do here some proper JSON-schema / ZOD checking
2547
2581
  if (!Array.isArray(pipeline.parameters)) {
2548
2582
  // TODO: [๐Ÿง ] what is the correct error tp throw - maybe PromptbookSchemaError
2549
- throw new ParseError(spaceTrim.spaceTrim((block) => `
2583
+ throw new ParseError(spaceTrim$1.spaceTrim((block) => `
2550
2584
  Pipeline is valid JSON but with wrong structure
2551
2585
 
2552
2586
  \`PipelineJson.parameters\` expected to be an array, but got ${typeof pipeline.parameters}
@@ -2557,7 +2591,7 @@
2557
2591
  // TODO: [๐Ÿง ] Maybe do here some proper JSON-schema / ZOD checking
2558
2592
  if (!Array.isArray(pipeline.tasks)) {
2559
2593
  // TODO: [๐Ÿง ] what is the correct error tp throw - maybe PromptbookSchemaError
2560
- throw new ParseError(spaceTrim.spaceTrim((block) => `
2594
+ throw new ParseError(spaceTrim$1.spaceTrim((block) => `
2561
2595
  Pipeline is valid JSON but with wrong structure
2562
2596
 
2563
2597
  \`PipelineJson.tasks\` expected to be an array, but got ${typeof pipeline.tasks}
@@ -2583,7 +2617,7 @@
2583
2617
  // Note: Check each parameter individually
2584
2618
  for (const parameter of pipeline.parameters) {
2585
2619
  if (parameter.isInput && parameter.isOutput) {
2586
- throw new PipelineLogicError(spaceTrim.spaceTrim((block) => `
2620
+ throw new PipelineLogicError(spaceTrim$1.spaceTrim((block) => `
2587
2621
 
2588
2622
  Parameter \`{${parameter.name}}\` can not be both input and output
2589
2623
 
@@ -2594,7 +2628,7 @@
2594
2628
  if (!parameter.isInput &&
2595
2629
  !parameter.isOutput &&
2596
2630
  !pipeline.tasks.some((task) => task.dependentParameterNames.includes(parameter.name))) {
2597
- throw new PipelineLogicError(spaceTrim.spaceTrim((block) => `
2631
+ throw new PipelineLogicError(spaceTrim$1.spaceTrim((block) => `
2598
2632
  Parameter \`{${parameter.name}}\` is created but not used
2599
2633
 
2600
2634
  You can declare {${parameter.name}} as output parameter by adding in the header:
@@ -2606,7 +2640,7 @@
2606
2640
  }
2607
2641
  // Note: Testing that parameter is either input or result of some task
2608
2642
  if (!parameter.isInput && !pipeline.tasks.some((task) => task.resultingParameterName === parameter.name)) {
2609
- throw new PipelineLogicError(spaceTrim.spaceTrim((block) => `
2643
+ throw new PipelineLogicError(spaceTrim$1.spaceTrim((block) => `
2610
2644
  Parameter \`{${parameter.name}}\` is declared but not defined
2611
2645
 
2612
2646
  You can do one of these:
@@ -2622,14 +2656,14 @@
2622
2656
  // Note: Checking each task individually
2623
2657
  for (const task of pipeline.tasks) {
2624
2658
  if (definedParameters.has(task.resultingParameterName)) {
2625
- throw new PipelineLogicError(spaceTrim.spaceTrim((block) => `
2659
+ throw new PipelineLogicError(spaceTrim$1.spaceTrim((block) => `
2626
2660
  Parameter \`{${task.resultingParameterName}}\` is defined multiple times
2627
2661
 
2628
2662
  ${block(pipelineIdentification)}
2629
2663
  `));
2630
2664
  }
2631
2665
  if (RESERVED_PARAMETER_NAMES.includes(task.resultingParameterName)) {
2632
- throw new PipelineLogicError(spaceTrim.spaceTrim((block) => `
2666
+ throw new PipelineLogicError(spaceTrim$1.spaceTrim((block) => `
2633
2667
  Parameter name {${task.resultingParameterName}} is reserved, please use different name
2634
2668
 
2635
2669
  ${block(pipelineIdentification)}
@@ -2639,7 +2673,7 @@
2639
2673
  if (task.jokerParameterNames && task.jokerParameterNames.length > 0) {
2640
2674
  if (!task.format &&
2641
2675
  !task.expectations /* <- TODO: Require at least 1 -> min <- expectation to use jokers */) {
2642
- throw new PipelineLogicError(spaceTrim.spaceTrim((block) => `
2676
+ throw new PipelineLogicError(spaceTrim$1.spaceTrim((block) => `
2643
2677
  Joker parameters are used for {${task.resultingParameterName}} but no expectations are defined
2644
2678
 
2645
2679
  ${block(pipelineIdentification)}
@@ -2647,7 +2681,7 @@
2647
2681
  }
2648
2682
  for (const joker of task.jokerParameterNames) {
2649
2683
  if (!task.dependentParameterNames.includes(joker)) {
2650
- throw new PipelineLogicError(spaceTrim.spaceTrim((block) => `
2684
+ throw new PipelineLogicError(spaceTrim$1.spaceTrim((block) => `
2651
2685
  Parameter \`{${joker}}\` is used for {${task.resultingParameterName}} as joker but not in \`dependentParameterNames\`
2652
2686
 
2653
2687
  ${block(pipelineIdentification)}
@@ -2658,21 +2692,21 @@
2658
2692
  if (task.expectations) {
2659
2693
  for (const [unit, { min, max }] of Object.entries(task.expectations)) {
2660
2694
  if (min !== undefined && max !== undefined && min > max) {
2661
- throw new PipelineLogicError(spaceTrim.spaceTrim((block) => `
2695
+ throw new PipelineLogicError(spaceTrim$1.spaceTrim((block) => `
2662
2696
  Min expectation (=${min}) of ${unit} is higher than max expectation (=${max})
2663
2697
 
2664
2698
  ${block(pipelineIdentification)}
2665
2699
  `));
2666
2700
  }
2667
2701
  if (min !== undefined && min < 0) {
2668
- throw new PipelineLogicError(spaceTrim.spaceTrim((block) => `
2702
+ throw new PipelineLogicError(spaceTrim$1.spaceTrim((block) => `
2669
2703
  Min expectation of ${unit} must be zero or positive
2670
2704
 
2671
2705
  ${block(pipelineIdentification)}
2672
2706
  `));
2673
2707
  }
2674
2708
  if (max !== undefined && max <= 0) {
2675
- throw new PipelineLogicError(spaceTrim.spaceTrim((block) => `
2709
+ throw new PipelineLogicError(spaceTrim$1.spaceTrim((block) => `
2676
2710
  Max expectation of ${unit} must be positive
2677
2711
 
2678
2712
  ${block(pipelineIdentification)}
@@ -2694,7 +2728,7 @@
2694
2728
  while (unresovedTasks.length > 0) {
2695
2729
  if (loopLimit-- < 0) {
2696
2730
  // Note: Really UnexpectedError not LimitReachedError - this should not happen and be caught below
2697
- throw new UnexpectedError(spaceTrim.spaceTrim((block) => `
2731
+ throw new UnexpectedError(spaceTrim$1.spaceTrim((block) => `
2698
2732
  Loop limit reached during detection of circular dependencies in \`validatePipeline\`
2699
2733
 
2700
2734
  ${block(pipelineIdentification)}
@@ -2704,7 +2738,7 @@
2704
2738
  if (currentlyResovedTasks.length === 0) {
2705
2739
  throw new PipelineLogicError(
2706
2740
  // TODO: [๐ŸŽ] DRY
2707
- spaceTrim.spaceTrim((block) => `
2741
+ spaceTrim$1.spaceTrim((block) => `
2708
2742
 
2709
2743
  Can not resolve some parameters:
2710
2744
  Either you are using a parameter that is not defined, or there are some circular dependencies.
@@ -2868,7 +2902,7 @@
2868
2902
  for (const pipeline of pipelines) {
2869
2903
  // TODO: [๐Ÿ‘ ] DRY
2870
2904
  if (pipeline.pipelineUrl === undefined) {
2871
- throw new PipelineUrlError(spaceTrim.spaceTrim(`
2905
+ throw new PipelineUrlError(spaceTrim$1.spaceTrim(`
2872
2906
  Pipeline with name "${pipeline.title}" does not have defined URL
2873
2907
 
2874
2908
  File:
@@ -2890,7 +2924,7 @@
2890
2924
  pipelineJsonToString(unpreparePipeline(pipeline)) !==
2891
2925
  pipelineJsonToString(unpreparePipeline(this.collection.get(pipeline.pipelineUrl)))) {
2892
2926
  const existing = this.collection.get(pipeline.pipelineUrl);
2893
- throw new PipelineUrlError(spaceTrim.spaceTrim(`
2927
+ throw new PipelineUrlError(spaceTrim$1.spaceTrim(`
2894
2928
  Pipeline with URL ${pipeline.pipelineUrl} is already in the collection ๐ŸŽ
2895
2929
 
2896
2930
  Conflicting files:
@@ -2922,13 +2956,13 @@
2922
2956
  const pipeline = this.collection.get(url);
2923
2957
  if (!pipeline) {
2924
2958
  if (this.listPipelines().length === 0) {
2925
- throw new NotFoundError(spaceTrim.spaceTrim(`
2959
+ throw new NotFoundError(spaceTrim$1.spaceTrim(`
2926
2960
  Pipeline with url "${url}" not found
2927
2961
 
2928
2962
  No pipelines available
2929
2963
  `));
2930
2964
  }
2931
- throw new NotFoundError(spaceTrim.spaceTrim((block) => `
2965
+ throw new NotFoundError(spaceTrim$1.spaceTrim((block) => `
2932
2966
  Pipeline with url "${url}" not found
2933
2967
 
2934
2968
  Available pipelines:
@@ -2969,7 +3003,7 @@
2969
3003
  */
2970
3004
  class MissingToolsError extends Error {
2971
3005
  constructor(message) {
2972
- super(spaceTrim.spaceTrim((block) => `
3006
+ super(spaceTrim$1.spaceTrim((block) => `
2973
3007
  ${block(message)}
2974
3008
 
2975
3009
  Note: You have probably forgot to provide some tools for pipeline execution or preparation
@@ -3177,7 +3211,7 @@
3177
3211
  */
3178
3212
  class NotYetImplementedError extends Error {
3179
3213
  constructor(message) {
3180
- super(spaceTrim.spaceTrim((block) => `
3214
+ super(spaceTrim$1.spaceTrim((block) => `
3181
3215
  ${block(message)}
3182
3216
 
3183
3217
  Note: This feature is not implemented yet but it will be soon.
@@ -3416,11 +3450,11 @@
3416
3450
  throw deserializeError(errors[0]);
3417
3451
  }
3418
3452
  else {
3419
- throw new PipelineExecutionError(spaceTrim.spaceTrim((block) => `
3453
+ throw new PipelineExecutionError(spaceTrim$1.spaceTrim((block) => `
3420
3454
  Multiple errors occurred during Promptbook execution
3421
3455
 
3422
3456
  ${block(errors
3423
- .map(({ name, stack, message }, index) => spaceTrim.spaceTrim((block) => `
3457
+ .map(({ name, stack, message }, index) => spaceTrim$1.spaceTrim((block) => `
3424
3458
  ${name} ${index + 1}:
3425
3459
  ${block(stack || message)}
3426
3460
  `))
@@ -4819,7 +4853,7 @@
4819
4853
  if (task.taskType === 'PROMPT_TASK' &&
4820
4854
  knowledgePiecesCount > 0 &&
4821
4855
  !dependentParameterNames.includes('knowledge')) {
4822
- preparedContent = spaceTrim.spaceTrim(`
4856
+ preparedContent = spaceTrim$1.spaceTrim(`
4823
4857
  {content}
4824
4858
 
4825
4859
  ## Knowledge
@@ -5132,7 +5166,7 @@
5132
5166
  }
5133
5167
  catch (error) {
5134
5168
  assertsError(error);
5135
- throw new ParseError(spaceTrim.spaceTrim((block) => `
5169
+ throw new ParseError(spaceTrim$1.spaceTrim((block) => `
5136
5170
  Can not extract variables from the script
5137
5171
  ${block(error.stack || error.message)}
5138
5172
 
@@ -5969,7 +6003,7 @@
5969
6003
  }
5970
6004
  catch (error) {
5971
6005
  keepUnused(error);
5972
- throw new ExpectError(spaceTrim.spaceTrim((block) => `
6006
+ throw new ExpectError(spaceTrim$1.spaceTrim((block) => `
5973
6007
  Expected valid JSON string
5974
6008
 
5975
6009
  The expected JSON text:
@@ -6032,7 +6066,7 @@
6032
6066
  const jokerParameterName = jokerParameterNames[jokerParameterNames.length + attemptIndex];
6033
6067
  // TODO: [๐Ÿง ][๐Ÿญ] JOKERS, EXPECTATIONS, POSTPROCESSING and FOREACH
6034
6068
  if (isJokerAttempt && !jokerParameterName) {
6035
- throw new UnexpectedError(spaceTrim.spaceTrim((block) => `
6069
+ throw new UnexpectedError(spaceTrim$1.spaceTrim((block) => `
6036
6070
  Joker not found in attempt ${attemptIndex}
6037
6071
 
6038
6072
  ${block(pipelineIdentification)}
@@ -6043,7 +6077,7 @@
6043
6077
  $ongoingTaskResult.$expectError = null;
6044
6078
  if (isJokerAttempt) {
6045
6079
  if (parameters[jokerParameterName] === undefined) {
6046
- throw new PipelineExecutionError(spaceTrim.spaceTrim((block) => `
6080
+ throw new PipelineExecutionError(spaceTrim$1.spaceTrim((block) => `
6047
6081
  Joker parameter {${jokerParameterName}} not defined
6048
6082
 
6049
6083
  ${block(pipelineIdentification)}
@@ -6101,7 +6135,7 @@
6101
6135
  $ongoingTaskResult.$resultString = $ongoingTaskResult.$completionResult.content;
6102
6136
  break variant;
6103
6137
  case 'EMBEDDING':
6104
- throw new PipelineExecutionError(spaceTrim.spaceTrim((block) => `
6138
+ throw new PipelineExecutionError(spaceTrim$1.spaceTrim((block) => `
6105
6139
  Embedding model can not be used in pipeline
6106
6140
 
6107
6141
  This should be catched during parsing
@@ -6112,7 +6146,7 @@
6112
6146
  break variant;
6113
6147
  // <- case [๐Ÿค–]:
6114
6148
  default:
6115
- throw new PipelineExecutionError(spaceTrim.spaceTrim((block) => `
6149
+ throw new PipelineExecutionError(spaceTrim$1.spaceTrim((block) => `
6116
6150
  Unknown model variant "${task.modelRequirements.modelVariant}"
6117
6151
 
6118
6152
  ${block(pipelineIdentification)}
@@ -6123,14 +6157,14 @@
6123
6157
  break;
6124
6158
  case 'SCRIPT_TASK':
6125
6159
  if (arrayableToArray(tools.script).length === 0) {
6126
- throw new PipelineExecutionError(spaceTrim.spaceTrim((block) => `
6160
+ throw new PipelineExecutionError(spaceTrim$1.spaceTrim((block) => `
6127
6161
  No script execution tools are available
6128
6162
 
6129
6163
  ${block(pipelineIdentification)}
6130
6164
  `));
6131
6165
  }
6132
6166
  if (!task.contentLanguage) {
6133
- throw new PipelineExecutionError(spaceTrim.spaceTrim((block) => `
6167
+ throw new PipelineExecutionError(spaceTrim$1.spaceTrim((block) => `
6134
6168
  Script language is not defined for SCRIPT TASK "${task.name}"
6135
6169
 
6136
6170
  ${block(pipelineIdentification)}
@@ -6161,7 +6195,7 @@
6161
6195
  throw $ongoingTaskResult.$scriptPipelineExecutionErrors[0];
6162
6196
  }
6163
6197
  else {
6164
- throw new PipelineExecutionError(spaceTrim.spaceTrim((block) => `
6198
+ throw new PipelineExecutionError(spaceTrim$1.spaceTrim((block) => `
6165
6199
  Script execution failed ${$ongoingTaskResult.$scriptPipelineExecutionErrors.length}x
6166
6200
 
6167
6201
  ${block(pipelineIdentification)}
@@ -6175,7 +6209,7 @@
6175
6209
  break taskType;
6176
6210
  case 'DIALOG_TASK':
6177
6211
  if (tools.userInterface === undefined) {
6178
- throw new PipelineExecutionError(spaceTrim.spaceTrim((block) => `
6212
+ throw new PipelineExecutionError(spaceTrim$1.spaceTrim((block) => `
6179
6213
  User interface tools are not available
6180
6214
 
6181
6215
  ${block(pipelineIdentification)}
@@ -6193,7 +6227,7 @@
6193
6227
  break taskType;
6194
6228
  // <- case: [๐Ÿ…ฑ]
6195
6229
  default:
6196
- throw new PipelineExecutionError(spaceTrim.spaceTrim((block) => `
6230
+ throw new PipelineExecutionError(spaceTrim$1.spaceTrim((block) => `
6197
6231
  Unknown execution type "${task.taskType}"
6198
6232
 
6199
6233
  ${block(pipelineIdentification)}
@@ -6291,7 +6325,7 @@
6291
6325
  if ($ongoingTaskResult.$expectError !== null && attemptIndex === maxAttempts - 1) {
6292
6326
  // Note: Create a summary of all failures
6293
6327
  const failuresSummary = $ongoingTaskResult.$failedResults
6294
- .map((failure) => spaceTrim.spaceTrim((block) => {
6328
+ .map((failure) => spaceTrim$1.spaceTrim((block) => {
6295
6329
  var _a, _b;
6296
6330
  return `
6297
6331
  Attempt ${failure.attemptIndex + 1}:
@@ -6301,14 +6335,14 @@
6301
6335
  Result:
6302
6336
  ${block(failure.result === null
6303
6337
  ? 'null'
6304
- : spaceTrim.spaceTrim(failure.result)
6338
+ : spaceTrim$1.spaceTrim(failure.result)
6305
6339
  .split('\n')
6306
6340
  .map((line) => `> ${line}`)
6307
6341
  .join('\n'))}
6308
6342
  `;
6309
6343
  }))
6310
6344
  .join('\n\n---\n\n');
6311
- throw new PipelineExecutionError(spaceTrim.spaceTrim((block) => {
6345
+ throw new PipelineExecutionError(spaceTrim$1.spaceTrim((block) => {
6312
6346
  var _a;
6313
6347
  return `
6314
6348
  LLM execution failed ${maxExecutionAttempts}x
@@ -6328,7 +6362,7 @@
6328
6362
  }
6329
6363
  }
6330
6364
  if ($ongoingTaskResult.$resultString === null) {
6331
- throw new UnexpectedError(spaceTrim.spaceTrim((block) => `
6365
+ throw new UnexpectedError(spaceTrim$1.spaceTrim((block) => `
6332
6366
  Something went wrong and prompt result is null
6333
6367
 
6334
6368
  ${block(pipelineIdentification)}
@@ -6634,7 +6668,7 @@
6634
6668
  // Note: Doublecheck that ALL reserved parameters are defined:
6635
6669
  for (const parameterName of RESERVED_PARAMETER_NAMES) {
6636
6670
  if (reservedParameters[parameterName] === undefined) {
6637
- throw new UnexpectedError(spaceTrim.spaceTrim((block) => `
6671
+ throw new UnexpectedError(spaceTrim$1.spaceTrim((block) => `
6638
6672
  Reserved parameter {${parameterName}} is not defined
6639
6673
 
6640
6674
  ${block(pipelineIdentification)}
@@ -6660,7 +6694,7 @@
6660
6694
  const dependentParameterNames = new Set(currentTask.dependentParameterNames);
6661
6695
  // TODO: [๐Ÿ‘ฉ๐Ÿพโ€๐Ÿคโ€๐Ÿ‘ฉ๐Ÿป] Use here `mapAvailableToExpectedParameters`
6662
6696
  if (difference(union(difference(usedParameterNames, dependentParameterNames), difference(dependentParameterNames, usedParameterNames)), new Set(RESERVED_PARAMETER_NAMES)).size !== 0) {
6663
- throw new UnexpectedError(spaceTrim.spaceTrim((block) => `
6697
+ throw new UnexpectedError(spaceTrim$1.spaceTrim((block) => `
6664
6698
  Dependent parameters are not consistent with used parameters:
6665
6699
 
6666
6700
  Dependent parameters:
@@ -6704,7 +6738,7 @@
6704
6738
  else if (!definedParameterNames.has(parameterName) && usedParameterNames.has(parameterName)) {
6705
6739
  // Houston, we have a problem
6706
6740
  // Note: Checking part is also done in `validatePipeline`, but itโ€™s good to doublecheck
6707
- throw new UnexpectedError(spaceTrim.spaceTrim((block) => `
6741
+ throw new UnexpectedError(spaceTrim$1.spaceTrim((block) => `
6708
6742
  Parameter \`{${parameterName}}\` is NOT defined
6709
6743
  BUT used in task "${currentTask.title || currentTask.name}"
6710
6744
 
@@ -6773,7 +6807,7 @@
6773
6807
  for (const parameter of preparedPipeline.parameters.filter(({ isOutput }) => isOutput)) {
6774
6808
  if (parametersToPass[parameter.name] === undefined) {
6775
6809
  // [4]
6776
- $warnings.push(new PipelineExecutionError(spaceTrim.spaceTrim((block) => `
6810
+ $warnings.push(new PipelineExecutionError(spaceTrim$1.spaceTrim((block) => `
6777
6811
  Parameter \`{${parameter.name}}\` should be an output parameter, but it was not generated during pipeline execution
6778
6812
 
6779
6813
  Note: This is a warning which happened after the pipeline was executed, and \`{${parameter.name}}\` was not for some reason defined in output parameters
@@ -6881,7 +6915,7 @@
6881
6915
  for (const parameterName of Object.keys(inputParameters)) {
6882
6916
  const parameter = preparedPipeline.parameters.find(({ name }) => name === parameterName);
6883
6917
  if (parameter === undefined) {
6884
- warnings.push(new PipelineExecutionError(spaceTrim.spaceTrim((block) => `
6918
+ warnings.push(new PipelineExecutionError(spaceTrim$1.spaceTrim((block) => `
6885
6919
  Extra parameter {${parameterName}} is being passed which is not part of the pipeline.
6886
6920
 
6887
6921
  ${block(pipelineIdentification)}
@@ -6896,7 +6930,7 @@
6896
6930
  // TODO: [๐Ÿง ] This should be also non-critical error
6897
6931
  return exportJson({
6898
6932
  name: 'pipelineExecutorResult',
6899
- message: spaceTrim.spaceTrim((block) => `
6933
+ message: spaceTrim$1.spaceTrim((block) => `
6900
6934
  Unsuccessful PipelineExecutorResult (with extra parameter {${parameter.name}}) PipelineExecutorResult
6901
6935
 
6902
6936
  ${block(pipelineIdentification)}
@@ -6905,7 +6939,7 @@
6905
6939
  value: {
6906
6940
  isSuccessful: false,
6907
6941
  errors: [
6908
- new PipelineExecutionError(spaceTrim.spaceTrim((block) => `
6942
+ new PipelineExecutionError(spaceTrim$1.spaceTrim((block) => `
6909
6943
  Parameter \`{${parameter.name}}\` is passed as input parameter but it is not input
6910
6944
 
6911
6945
  ${block(pipelineIdentification)}
@@ -6932,7 +6966,7 @@
6932
6966
  while (unresovedTasks.length > 0) {
6933
6967
  if (loopLimit-- < 0) {
6934
6968
  // Note: Really UnexpectedError not LimitReachedError - this should be catched during validatePipeline
6935
- throw new UnexpectedError(spaceTrim.spaceTrim((block) => `
6969
+ throw new UnexpectedError(spaceTrim$1.spaceTrim((block) => `
6936
6970
  Loop limit reached during resolving parameters pipeline execution
6937
6971
 
6938
6972
  ${block(pipelineIdentification)}
@@ -6942,7 +6976,7 @@
6942
6976
  if (!currentTask && resolving.length === 0) {
6943
6977
  throw new UnexpectedError(
6944
6978
  // TODO: [๐ŸŽ] DRY
6945
- spaceTrim.spaceTrim((block) => `
6979
+ spaceTrim$1.spaceTrim((block) => `
6946
6980
  Can not resolve some parameters:
6947
6981
 
6948
6982
  ${block(pipelineIdentification)}
@@ -6982,7 +7016,7 @@
6982
7016
  tools,
6983
7017
  onProgress(newOngoingResult) {
6984
7018
  if (isReturned) {
6985
- throw new UnexpectedError(spaceTrim.spaceTrim((block) => `
7019
+ throw new UnexpectedError(spaceTrim$1.spaceTrim((block) => `
6986
7020
  Can not call \`onProgress\` after pipeline execution is finished
6987
7021
 
6988
7022
  ${block(pipelineIdentification)}
@@ -6999,7 +7033,7 @@
6999
7033
  },
7000
7034
  logLlmCall,
7001
7035
  $executionReport: executionReport,
7002
- pipelineIdentification: spaceTrim.spaceTrim((block) => `
7036
+ pipelineIdentification: spaceTrim$1.spaceTrim((block) => `
7003
7037
  ${block(pipelineIdentification)}
7004
7038
  Task name: ${currentTask.name}
7005
7039
  Task title: ${currentTask.title}
@@ -7108,7 +7142,7 @@
7108
7142
  preparedPipeline = pipeline;
7109
7143
  }
7110
7144
  else if (isNotPreparedWarningSuppressed !== true) {
7111
- console.warn(spaceTrim.spaceTrim((block) => `
7145
+ console.warn(spaceTrim$1.spaceTrim((block) => `
7112
7146
  Pipeline is not prepared
7113
7147
 
7114
7148
  ${block(pipelineIdentification)}
@@ -7133,7 +7167,7 @@
7133
7167
  tools,
7134
7168
  onProgress,
7135
7169
  logLlmCall,
7136
- pipelineIdentification: spaceTrim.spaceTrim((block) => `
7170
+ pipelineIdentification: spaceTrim$1.spaceTrim((block) => `
7137
7171
  ${block(pipelineIdentification)}
7138
7172
  ${runCount === 1 ? '' : `Run #${runCount}`}
7139
7173
  `),