@promptbook/website-crawler 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('spacetrim'), require('@mozilla/readability'), require('jsdom'), require('crypto-js'), require('crypto-js/enc-hex'), require('fs/promises'), require('path'), require('crypto'), require('rxjs'), require('waitasecond'), require('crypto-js/sha256'), require('mime-types'), require('papaparse'), require('showdown')) :
3
3
  typeof define === 'function' && define.amd ? define(['exports', 'spacetrim', '@mozilla/readability', 'jsdom', 'crypto-js', 'crypto-js/enc-hex', 'fs/promises', 'path', 'crypto', 'rxjs', 'waitasecond', 'crypto-js/sha256', 'mime-types', 'papaparse', 'showdown'], factory) :
4
- (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global["promptbook-website-crawler"] = {}, global.spaceTrim, global.readability, global.jsdom, global.cryptoJs, global.hexEncoder, global.promises, global.path, global.crypto, global.rxjs, global.waitasecond, global.sha256, global.mimeTypes, global.papaparse, global.showdown));
5
- })(this, (function (exports, spaceTrim, readability, jsdom, cryptoJs, hexEncoder, promises, path, crypto, rxjs, waitasecond, sha256, mimeTypes, papaparse, showdown) { 'use strict';
4
+ (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global["promptbook-website-crawler"] = {}, global.spaceTrim$1, global.readability, global.jsdom, global.cryptoJs, global.hexEncoder, global.promises, global.path, global.crypto, global.rxjs, global.waitasecond, global.sha256, global.mimeTypes, global.papaparse, global.showdown));
5
+ })(this, (function (exports, spaceTrim$1, readability, jsdom, cryptoJs, hexEncoder, promises, path, crypto, rxjs, waitasecond, sha256, mimeTypes, papaparse, showdown) { '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
@@ -74,6 +74,17 @@
74
74
  * TODO: [🧠] Is there a way how to meaningfully test this utility
75
75
  */
76
76
 
77
+ /**
78
+ * Trims string from all 4 sides
79
+ *
80
+ * Note: This is a re-exported function from the `spacetrim` package which is
81
+ * Developed by same author @hejny as this package
82
+ *
83
+ * @public exported from `@promptbook/utils`
84
+ * @see https://github.com/hejny/spacetrim#usage
85
+ */
86
+ const spaceTrim = spaceTrim$1.spaceTrim;
87
+
77
88
  /**
78
89
  * @private util of `@promptbook/color`
79
90
  * @de
@@ -122,6 +133,7 @@
122
133
  * @public exported from `@promptbook/color`
123
134
  */
124
135
  const CSS_COLORS = {
136
+ promptbook: '#79EAFD',
125
137
  transparent: 'rgba(0,0,0,0)',
126
138
  aliceblue: '#f0f8ff',
127
139
  antiquewhite: '#faebd7',
@@ -337,6 +349,28 @@
337
349
  throw new Error(`Can not create color from given object`);
338
350
  }
339
351
  }
352
+ /**
353
+ * Creates a new Color instance from miscellaneous formats
354
+ * It just does not throw error when it fails, it returns PROMPTBOOK_COLOR instead
355
+ *
356
+ * @param color
357
+ * @returns Color object
358
+ */
359
+ static fromSafe(color) {
360
+ try {
361
+ return Color.from(color);
362
+ }
363
+ catch (error) {
364
+ // <- Note: Can not use `assertsError(error)` here because it causes circular dependency
365
+ console.warn(spaceTrim((block) => `
366
+ Color.fromSafe error:
367
+ ${block(error.message)}
368
+
369
+ Returning default PROMPTBOOK_COLOR.
370
+ `));
371
+ return Color.fromString('promptbook');
372
+ }
373
+ }
340
374
  /**
341
375
  * Creates a new Color instance from miscellaneous string formats
342
376
  *
@@ -946,7 +980,7 @@
946
980
  *
947
981
  * @public exported from `@promptbook/core`
948
982
  */
949
- const PROMPTBOOK_COLOR = Color.fromHex('#79EAFD');
983
+ const PROMPTBOOK_COLOR = Color.fromString('promptbook');
950
984
  // <- TODO: [🧠][🈵] Using `Color` here increases the package size approx 3kb, maybe remove it
951
985
  /**
952
986
  * Colors for syntax highlighting in the `<BookEditor/>`
@@ -1143,7 +1177,7 @@
1143
1177
  */
1144
1178
  class NotYetImplementedError extends Error {
1145
1179
  constructor(message) {
1146
- super(spaceTrim.spaceTrim((block) => `
1180
+ super(spaceTrim$1.spaceTrim((block) => `
1147
1181
  ${block(message)}
1148
1182
 
1149
1183
  Note: This feature is not implemented yet but it will be soon.
@@ -1210,7 +1244,7 @@
1210
1244
  */
1211
1245
  class UnexpectedError extends Error {
1212
1246
  constructor(message) {
1213
- super(spaceTrim.spaceTrim((block) => `
1247
+ super(spaceTrim$1.spaceTrim((block) => `
1214
1248
  ${block(message)}
1215
1249
 
1216
1250
  Note: This error should not happen.
@@ -1994,7 +2028,7 @@
1994
2028
  constructor(whatWasThrown) {
1995
2029
  const tag = `[🤮]`;
1996
2030
  console.error(tag, whatWasThrown);
1997
- super(spaceTrim.spaceTrim(`
2031
+ super(spaceTrim$1.spaceTrim(`
1998
2032
  Non-Error object was thrown
1999
2033
 
2000
2034
  Note: Look for ${tag} in the console for more details
@@ -2642,7 +2676,7 @@
2642
2676
  if (!(error instanceof PipelineLogicError)) {
2643
2677
  throw error;
2644
2678
  }
2645
- console.error(spaceTrim.spaceTrim((block) => `
2679
+ console.error(spaceTrim$1.spaceTrim((block) => `
2646
2680
  Pipeline is not valid but logic errors are temporarily disabled via \`IS_PIPELINE_LOGIC_VALIDATED\`
2647
2681
 
2648
2682
  ${block(error.message)}
@@ -2669,7 +2703,7 @@
2669
2703
  })();
2670
2704
  if (pipeline.pipelineUrl !== undefined && !isValidPipelineUrl(pipeline.pipelineUrl)) {
2671
2705
  // <- Note: [🚲]
2672
- throw new PipelineLogicError(spaceTrim.spaceTrim((block) => `
2706
+ throw new PipelineLogicError(spaceTrim$1.spaceTrim((block) => `
2673
2707
  Invalid promptbook URL "${pipeline.pipelineUrl}"
2674
2708
 
2675
2709
  ${block(pipelineIdentification)}
@@ -2677,7 +2711,7 @@
2677
2711
  }
2678
2712
  if (pipeline.bookVersion !== undefined && !isValidPromptbookVersion(pipeline.bookVersion)) {
2679
2713
  // <- Note: [🚲]
2680
- throw new PipelineLogicError(spaceTrim.spaceTrim((block) => `
2714
+ throw new PipelineLogicError(spaceTrim$1.spaceTrim((block) => `
2681
2715
  Invalid Promptbook Version "${pipeline.bookVersion}"
2682
2716
 
2683
2717
  ${block(pipelineIdentification)}
@@ -2686,7 +2720,7 @@
2686
2720
  // TODO: [🧠] Maybe do here some proper JSON-schema / ZOD checking
2687
2721
  if (!Array.isArray(pipeline.parameters)) {
2688
2722
  // TODO: [🧠] what is the correct error tp throw - maybe PromptbookSchemaError
2689
- throw new ParseError(spaceTrim.spaceTrim((block) => `
2723
+ throw new ParseError(spaceTrim$1.spaceTrim((block) => `
2690
2724
  Pipeline is valid JSON but with wrong structure
2691
2725
 
2692
2726
  \`PipelineJson.parameters\` expected to be an array, but got ${typeof pipeline.parameters}
@@ -2697,7 +2731,7 @@
2697
2731
  // TODO: [🧠] Maybe do here some proper JSON-schema / ZOD checking
2698
2732
  if (!Array.isArray(pipeline.tasks)) {
2699
2733
  // TODO: [🧠] what is the correct error tp throw - maybe PromptbookSchemaError
2700
- throw new ParseError(spaceTrim.spaceTrim((block) => `
2734
+ throw new ParseError(spaceTrim$1.spaceTrim((block) => `
2701
2735
  Pipeline is valid JSON but with wrong structure
2702
2736
 
2703
2737
  \`PipelineJson.tasks\` expected to be an array, but got ${typeof pipeline.tasks}
@@ -2723,7 +2757,7 @@
2723
2757
  // Note: Check each parameter individually
2724
2758
  for (const parameter of pipeline.parameters) {
2725
2759
  if (parameter.isInput && parameter.isOutput) {
2726
- throw new PipelineLogicError(spaceTrim.spaceTrim((block) => `
2760
+ throw new PipelineLogicError(spaceTrim$1.spaceTrim((block) => `
2727
2761
 
2728
2762
  Parameter \`{${parameter.name}}\` can not be both input and output
2729
2763
 
@@ -2734,7 +2768,7 @@
2734
2768
  if (!parameter.isInput &&
2735
2769
  !parameter.isOutput &&
2736
2770
  !pipeline.tasks.some((task) => task.dependentParameterNames.includes(parameter.name))) {
2737
- throw new PipelineLogicError(spaceTrim.spaceTrim((block) => `
2771
+ throw new PipelineLogicError(spaceTrim$1.spaceTrim((block) => `
2738
2772
  Parameter \`{${parameter.name}}\` is created but not used
2739
2773
 
2740
2774
  You can declare {${parameter.name}} as output parameter by adding in the header:
@@ -2746,7 +2780,7 @@
2746
2780
  }
2747
2781
  // Note: Testing that parameter is either input or result of some task
2748
2782
  if (!parameter.isInput && !pipeline.tasks.some((task) => task.resultingParameterName === parameter.name)) {
2749
- throw new PipelineLogicError(spaceTrim.spaceTrim((block) => `
2783
+ throw new PipelineLogicError(spaceTrim$1.spaceTrim((block) => `
2750
2784
  Parameter \`{${parameter.name}}\` is declared but not defined
2751
2785
 
2752
2786
  You can do one of these:
@@ -2762,14 +2796,14 @@
2762
2796
  // Note: Checking each task individually
2763
2797
  for (const task of pipeline.tasks) {
2764
2798
  if (definedParameters.has(task.resultingParameterName)) {
2765
- throw new PipelineLogicError(spaceTrim.spaceTrim((block) => `
2799
+ throw new PipelineLogicError(spaceTrim$1.spaceTrim((block) => `
2766
2800
  Parameter \`{${task.resultingParameterName}}\` is defined multiple times
2767
2801
 
2768
2802
  ${block(pipelineIdentification)}
2769
2803
  `));
2770
2804
  }
2771
2805
  if (RESERVED_PARAMETER_NAMES.includes(task.resultingParameterName)) {
2772
- throw new PipelineLogicError(spaceTrim.spaceTrim((block) => `
2806
+ throw new PipelineLogicError(spaceTrim$1.spaceTrim((block) => `
2773
2807
  Parameter name {${task.resultingParameterName}} is reserved, please use different name
2774
2808
 
2775
2809
  ${block(pipelineIdentification)}
@@ -2779,7 +2813,7 @@
2779
2813
  if (task.jokerParameterNames && task.jokerParameterNames.length > 0) {
2780
2814
  if (!task.format &&
2781
2815
  !task.expectations /* <- TODO: Require at least 1 -> min <- expectation to use jokers */) {
2782
- throw new PipelineLogicError(spaceTrim.spaceTrim((block) => `
2816
+ throw new PipelineLogicError(spaceTrim$1.spaceTrim((block) => `
2783
2817
  Joker parameters are used for {${task.resultingParameterName}} but no expectations are defined
2784
2818
 
2785
2819
  ${block(pipelineIdentification)}
@@ -2787,7 +2821,7 @@
2787
2821
  }
2788
2822
  for (const joker of task.jokerParameterNames) {
2789
2823
  if (!task.dependentParameterNames.includes(joker)) {
2790
- throw new PipelineLogicError(spaceTrim.spaceTrim((block) => `
2824
+ throw new PipelineLogicError(spaceTrim$1.spaceTrim((block) => `
2791
2825
  Parameter \`{${joker}}\` is used for {${task.resultingParameterName}} as joker but not in \`dependentParameterNames\`
2792
2826
 
2793
2827
  ${block(pipelineIdentification)}
@@ -2798,21 +2832,21 @@
2798
2832
  if (task.expectations) {
2799
2833
  for (const [unit, { min, max }] of Object.entries(task.expectations)) {
2800
2834
  if (min !== undefined && max !== undefined && min > max) {
2801
- throw new PipelineLogicError(spaceTrim.spaceTrim((block) => `
2835
+ throw new PipelineLogicError(spaceTrim$1.spaceTrim((block) => `
2802
2836
  Min expectation (=${min}) of ${unit} is higher than max expectation (=${max})
2803
2837
 
2804
2838
  ${block(pipelineIdentification)}
2805
2839
  `));
2806
2840
  }
2807
2841
  if (min !== undefined && min < 0) {
2808
- throw new PipelineLogicError(spaceTrim.spaceTrim((block) => `
2842
+ throw new PipelineLogicError(spaceTrim$1.spaceTrim((block) => `
2809
2843
  Min expectation of ${unit} must be zero or positive
2810
2844
 
2811
2845
  ${block(pipelineIdentification)}
2812
2846
  `));
2813
2847
  }
2814
2848
  if (max !== undefined && max <= 0) {
2815
- throw new PipelineLogicError(spaceTrim.spaceTrim((block) => `
2849
+ throw new PipelineLogicError(spaceTrim$1.spaceTrim((block) => `
2816
2850
  Max expectation of ${unit} must be positive
2817
2851
 
2818
2852
  ${block(pipelineIdentification)}
@@ -2834,7 +2868,7 @@
2834
2868
  while (unresovedTasks.length > 0) {
2835
2869
  if (loopLimit-- < 0) {
2836
2870
  // Note: Really UnexpectedError not LimitReachedError - this should not happen and be caught below
2837
- throw new UnexpectedError(spaceTrim.spaceTrim((block) => `
2871
+ throw new UnexpectedError(spaceTrim$1.spaceTrim((block) => `
2838
2872
  Loop limit reached during detection of circular dependencies in \`validatePipeline\`
2839
2873
 
2840
2874
  ${block(pipelineIdentification)}
@@ -2844,7 +2878,7 @@
2844
2878
  if (currentlyResovedTasks.length === 0) {
2845
2879
  throw new PipelineLogicError(
2846
2880
  // TODO: [🐎] DRY
2847
- spaceTrim.spaceTrim((block) => `
2881
+ spaceTrim$1.spaceTrim((block) => `
2848
2882
 
2849
2883
  Can not resolve some parameters:
2850
2884
  Either you are using a parameter that is not defined, or there are some circular dependencies.
@@ -3008,7 +3042,7 @@
3008
3042
  for (const pipeline of pipelines) {
3009
3043
  // TODO: [👠] DRY
3010
3044
  if (pipeline.pipelineUrl === undefined) {
3011
- throw new PipelineUrlError(spaceTrim.spaceTrim(`
3045
+ throw new PipelineUrlError(spaceTrim$1.spaceTrim(`
3012
3046
  Pipeline with name "${pipeline.title}" does not have defined URL
3013
3047
 
3014
3048
  File:
@@ -3030,7 +3064,7 @@
3030
3064
  pipelineJsonToString(unpreparePipeline(pipeline)) !==
3031
3065
  pipelineJsonToString(unpreparePipeline(this.collection.get(pipeline.pipelineUrl)))) {
3032
3066
  const existing = this.collection.get(pipeline.pipelineUrl);
3033
- throw new PipelineUrlError(spaceTrim.spaceTrim(`
3067
+ throw new PipelineUrlError(spaceTrim$1.spaceTrim(`
3034
3068
  Pipeline with URL ${pipeline.pipelineUrl} is already in the collection 🍎
3035
3069
 
3036
3070
  Conflicting files:
@@ -3062,13 +3096,13 @@
3062
3096
  const pipeline = this.collection.get(url);
3063
3097
  if (!pipeline) {
3064
3098
  if (this.listPipelines().length === 0) {
3065
- throw new NotFoundError(spaceTrim.spaceTrim(`
3099
+ throw new NotFoundError(spaceTrim$1.spaceTrim(`
3066
3100
  Pipeline with url "${url}" not found
3067
3101
 
3068
3102
  No pipelines available
3069
3103
  `));
3070
3104
  }
3071
- throw new NotFoundError(spaceTrim.spaceTrim((block) => `
3105
+ throw new NotFoundError(spaceTrim$1.spaceTrim((block) => `
3072
3106
  Pipeline with url "${url}" not found
3073
3107
 
3074
3108
  Available pipelines:
@@ -3109,7 +3143,7 @@
3109
3143
  */
3110
3144
  class MissingToolsError extends Error {
3111
3145
  constructor(message) {
3112
- super(spaceTrim.spaceTrim((block) => `
3146
+ super(spaceTrim$1.spaceTrim((block) => `
3113
3147
  ${block(message)}
3114
3148
 
3115
3149
  Note: You have probably forgot to provide some tools for pipeline execution or preparation
@@ -3533,11 +3567,11 @@
3533
3567
  throw deserializeError(errors[0]);
3534
3568
  }
3535
3569
  else {
3536
- throw new PipelineExecutionError(spaceTrim.spaceTrim((block) => `
3570
+ throw new PipelineExecutionError(spaceTrim$1.spaceTrim((block) => `
3537
3571
  Multiple errors occurred during Promptbook execution
3538
3572
 
3539
3573
  ${block(errors
3540
- .map(({ name, stack, message }, index) => spaceTrim.spaceTrim((block) => `
3574
+ .map(({ name, stack, message }, index) => spaceTrim$1.spaceTrim((block) => `
3541
3575
  ${name} ${index + 1}:
3542
3576
  ${block(stack || message)}
3543
3577
  `))
@@ -4817,7 +4851,7 @@
4817
4851
  if (task.taskType === 'PROMPT_TASK' &&
4818
4852
  knowledgePiecesCount > 0 &&
4819
4853
  !dependentParameterNames.includes('knowledge')) {
4820
- preparedContent = spaceTrim.spaceTrim(`
4854
+ preparedContent = spaceTrim$1.spaceTrim(`
4821
4855
  {content}
4822
4856
 
4823
4857
  ## Knowledge
@@ -5130,7 +5164,7 @@
5130
5164
  }
5131
5165
  catch (error) {
5132
5166
  assertsError(error);
5133
- throw new ParseError(spaceTrim.spaceTrim((block) => `
5167
+ throw new ParseError(spaceTrim$1.spaceTrim((block) => `
5134
5168
  Can not extract variables from the script
5135
5169
  ${block(error.stack || error.message)}
5136
5170
 
@@ -5967,7 +6001,7 @@
5967
6001
  }
5968
6002
  catch (error) {
5969
6003
  keepUnused(error);
5970
- throw new ExpectError(spaceTrim.spaceTrim((block) => `
6004
+ throw new ExpectError(spaceTrim$1.spaceTrim((block) => `
5971
6005
  Expected valid JSON string
5972
6006
 
5973
6007
  The expected JSON text:
@@ -6030,7 +6064,7 @@
6030
6064
  const jokerParameterName = jokerParameterNames[jokerParameterNames.length + attemptIndex];
6031
6065
  // TODO: [🧠][🍭] JOKERS, EXPECTATIONS, POSTPROCESSING and FOREACH
6032
6066
  if (isJokerAttempt && !jokerParameterName) {
6033
- throw new UnexpectedError(spaceTrim.spaceTrim((block) => `
6067
+ throw new UnexpectedError(spaceTrim$1.spaceTrim((block) => `
6034
6068
  Joker not found in attempt ${attemptIndex}
6035
6069
 
6036
6070
  ${block(pipelineIdentification)}
@@ -6041,7 +6075,7 @@
6041
6075
  $ongoingTaskResult.$expectError = null;
6042
6076
  if (isJokerAttempt) {
6043
6077
  if (parameters[jokerParameterName] === undefined) {
6044
- throw new PipelineExecutionError(spaceTrim.spaceTrim((block) => `
6078
+ throw new PipelineExecutionError(spaceTrim$1.spaceTrim((block) => `
6045
6079
  Joker parameter {${jokerParameterName}} not defined
6046
6080
 
6047
6081
  ${block(pipelineIdentification)}
@@ -6099,7 +6133,7 @@
6099
6133
  $ongoingTaskResult.$resultString = $ongoingTaskResult.$completionResult.content;
6100
6134
  break variant;
6101
6135
  case 'EMBEDDING':
6102
- throw new PipelineExecutionError(spaceTrim.spaceTrim((block) => `
6136
+ throw new PipelineExecutionError(spaceTrim$1.spaceTrim((block) => `
6103
6137
  Embedding model can not be used in pipeline
6104
6138
 
6105
6139
  This should be catched during parsing
@@ -6110,7 +6144,7 @@
6110
6144
  break variant;
6111
6145
  // <- case [🤖]:
6112
6146
  default:
6113
- throw new PipelineExecutionError(spaceTrim.spaceTrim((block) => `
6147
+ throw new PipelineExecutionError(spaceTrim$1.spaceTrim((block) => `
6114
6148
  Unknown model variant "${task.modelRequirements.modelVariant}"
6115
6149
 
6116
6150
  ${block(pipelineIdentification)}
@@ -6121,14 +6155,14 @@
6121
6155
  break;
6122
6156
  case 'SCRIPT_TASK':
6123
6157
  if (arrayableToArray(tools.script).length === 0) {
6124
- throw new PipelineExecutionError(spaceTrim.spaceTrim((block) => `
6158
+ throw new PipelineExecutionError(spaceTrim$1.spaceTrim((block) => `
6125
6159
  No script execution tools are available
6126
6160
 
6127
6161
  ${block(pipelineIdentification)}
6128
6162
  `));
6129
6163
  }
6130
6164
  if (!task.contentLanguage) {
6131
- throw new PipelineExecutionError(spaceTrim.spaceTrim((block) => `
6165
+ throw new PipelineExecutionError(spaceTrim$1.spaceTrim((block) => `
6132
6166
  Script language is not defined for SCRIPT TASK "${task.name}"
6133
6167
 
6134
6168
  ${block(pipelineIdentification)}
@@ -6159,7 +6193,7 @@
6159
6193
  throw $ongoingTaskResult.$scriptPipelineExecutionErrors[0];
6160
6194
  }
6161
6195
  else {
6162
- throw new PipelineExecutionError(spaceTrim.spaceTrim((block) => `
6196
+ throw new PipelineExecutionError(spaceTrim$1.spaceTrim((block) => `
6163
6197
  Script execution failed ${$ongoingTaskResult.$scriptPipelineExecutionErrors.length}x
6164
6198
 
6165
6199
  ${block(pipelineIdentification)}
@@ -6173,7 +6207,7 @@
6173
6207
  break taskType;
6174
6208
  case 'DIALOG_TASK':
6175
6209
  if (tools.userInterface === undefined) {
6176
- throw new PipelineExecutionError(spaceTrim.spaceTrim((block) => `
6210
+ throw new PipelineExecutionError(spaceTrim$1.spaceTrim((block) => `
6177
6211
  User interface tools are not available
6178
6212
 
6179
6213
  ${block(pipelineIdentification)}
@@ -6191,7 +6225,7 @@
6191
6225
  break taskType;
6192
6226
  // <- case: [🅱]
6193
6227
  default:
6194
- throw new PipelineExecutionError(spaceTrim.spaceTrim((block) => `
6228
+ throw new PipelineExecutionError(spaceTrim$1.spaceTrim((block) => `
6195
6229
  Unknown execution type "${task.taskType}"
6196
6230
 
6197
6231
  ${block(pipelineIdentification)}
@@ -6289,7 +6323,7 @@
6289
6323
  if ($ongoingTaskResult.$expectError !== null && attemptIndex === maxAttempts - 1) {
6290
6324
  // Note: Create a summary of all failures
6291
6325
  const failuresSummary = $ongoingTaskResult.$failedResults
6292
- .map((failure) => spaceTrim.spaceTrim((block) => {
6326
+ .map((failure) => spaceTrim$1.spaceTrim((block) => {
6293
6327
  var _a, _b;
6294
6328
  return `
6295
6329
  Attempt ${failure.attemptIndex + 1}:
@@ -6299,14 +6333,14 @@
6299
6333
  Result:
6300
6334
  ${block(failure.result === null
6301
6335
  ? 'null'
6302
- : spaceTrim.spaceTrim(failure.result)
6336
+ : spaceTrim$1.spaceTrim(failure.result)
6303
6337
  .split('\n')
6304
6338
  .map((line) => `> ${line}`)
6305
6339
  .join('\n'))}
6306
6340
  `;
6307
6341
  }))
6308
6342
  .join('\n\n---\n\n');
6309
- throw new PipelineExecutionError(spaceTrim.spaceTrim((block) => {
6343
+ throw new PipelineExecutionError(spaceTrim$1.spaceTrim((block) => {
6310
6344
  var _a;
6311
6345
  return `
6312
6346
  LLM execution failed ${maxExecutionAttempts}x
@@ -6326,7 +6360,7 @@
6326
6360
  }
6327
6361
  }
6328
6362
  if ($ongoingTaskResult.$resultString === null) {
6329
- throw new UnexpectedError(spaceTrim.spaceTrim((block) => `
6363
+ throw new UnexpectedError(spaceTrim$1.spaceTrim((block) => `
6330
6364
  Something went wrong and prompt result is null
6331
6365
 
6332
6366
  ${block(pipelineIdentification)}
@@ -6632,7 +6666,7 @@
6632
6666
  // Note: Doublecheck that ALL reserved parameters are defined:
6633
6667
  for (const parameterName of RESERVED_PARAMETER_NAMES) {
6634
6668
  if (reservedParameters[parameterName] === undefined) {
6635
- throw new UnexpectedError(spaceTrim.spaceTrim((block) => `
6669
+ throw new UnexpectedError(spaceTrim$1.spaceTrim((block) => `
6636
6670
  Reserved parameter {${parameterName}} is not defined
6637
6671
 
6638
6672
  ${block(pipelineIdentification)}
@@ -6658,7 +6692,7 @@
6658
6692
  const dependentParameterNames = new Set(currentTask.dependentParameterNames);
6659
6693
  // TODO: [👩🏾‍🤝‍👩🏻] Use here `mapAvailableToExpectedParameters`
6660
6694
  if (difference(union(difference(usedParameterNames, dependentParameterNames), difference(dependentParameterNames, usedParameterNames)), new Set(RESERVED_PARAMETER_NAMES)).size !== 0) {
6661
- throw new UnexpectedError(spaceTrim.spaceTrim((block) => `
6695
+ throw new UnexpectedError(spaceTrim$1.spaceTrim((block) => `
6662
6696
  Dependent parameters are not consistent with used parameters:
6663
6697
 
6664
6698
  Dependent parameters:
@@ -6702,7 +6736,7 @@
6702
6736
  else if (!definedParameterNames.has(parameterName) && usedParameterNames.has(parameterName)) {
6703
6737
  // Houston, we have a problem
6704
6738
  // Note: Checking part is also done in `validatePipeline`, but it’s good to doublecheck
6705
- throw new UnexpectedError(spaceTrim.spaceTrim((block) => `
6739
+ throw new UnexpectedError(spaceTrim$1.spaceTrim((block) => `
6706
6740
  Parameter \`{${parameterName}}\` is NOT defined
6707
6741
  BUT used in task "${currentTask.title || currentTask.name}"
6708
6742
 
@@ -6771,7 +6805,7 @@
6771
6805
  for (const parameter of preparedPipeline.parameters.filter(({ isOutput }) => isOutput)) {
6772
6806
  if (parametersToPass[parameter.name] === undefined) {
6773
6807
  // [4]
6774
- $warnings.push(new PipelineExecutionError(spaceTrim.spaceTrim((block) => `
6808
+ $warnings.push(new PipelineExecutionError(spaceTrim$1.spaceTrim((block) => `
6775
6809
  Parameter \`{${parameter.name}}\` should be an output parameter, but it was not generated during pipeline execution
6776
6810
 
6777
6811
  Note: This is a warning which happened after the pipeline was executed, and \`{${parameter.name}}\` was not for some reason defined in output parameters
@@ -6879,7 +6913,7 @@
6879
6913
  for (const parameterName of Object.keys(inputParameters)) {
6880
6914
  const parameter = preparedPipeline.parameters.find(({ name }) => name === parameterName);
6881
6915
  if (parameter === undefined) {
6882
- warnings.push(new PipelineExecutionError(spaceTrim.spaceTrim((block) => `
6916
+ warnings.push(new PipelineExecutionError(spaceTrim$1.spaceTrim((block) => `
6883
6917
  Extra parameter {${parameterName}} is being passed which is not part of the pipeline.
6884
6918
 
6885
6919
  ${block(pipelineIdentification)}
@@ -6894,7 +6928,7 @@
6894
6928
  // TODO: [🧠] This should be also non-critical error
6895
6929
  return exportJson({
6896
6930
  name: 'pipelineExecutorResult',
6897
- message: spaceTrim.spaceTrim((block) => `
6931
+ message: spaceTrim$1.spaceTrim((block) => `
6898
6932
  Unsuccessful PipelineExecutorResult (with extra parameter {${parameter.name}}) PipelineExecutorResult
6899
6933
 
6900
6934
  ${block(pipelineIdentification)}
@@ -6903,7 +6937,7 @@
6903
6937
  value: {
6904
6938
  isSuccessful: false,
6905
6939
  errors: [
6906
- new PipelineExecutionError(spaceTrim.spaceTrim((block) => `
6940
+ new PipelineExecutionError(spaceTrim$1.spaceTrim((block) => `
6907
6941
  Parameter \`{${parameter.name}}\` is passed as input parameter but it is not input
6908
6942
 
6909
6943
  ${block(pipelineIdentification)}
@@ -6930,7 +6964,7 @@
6930
6964
  while (unresovedTasks.length > 0) {
6931
6965
  if (loopLimit-- < 0) {
6932
6966
  // Note: Really UnexpectedError not LimitReachedError - this should be catched during validatePipeline
6933
- throw new UnexpectedError(spaceTrim.spaceTrim((block) => `
6967
+ throw new UnexpectedError(spaceTrim$1.spaceTrim((block) => `
6934
6968
  Loop limit reached during resolving parameters pipeline execution
6935
6969
 
6936
6970
  ${block(pipelineIdentification)}
@@ -6940,7 +6974,7 @@
6940
6974
  if (!currentTask && resolving.length === 0) {
6941
6975
  throw new UnexpectedError(
6942
6976
  // TODO: [🐎] DRY
6943
- spaceTrim.spaceTrim((block) => `
6977
+ spaceTrim$1.spaceTrim((block) => `
6944
6978
  Can not resolve some parameters:
6945
6979
 
6946
6980
  ${block(pipelineIdentification)}
@@ -6980,7 +7014,7 @@
6980
7014
  tools,
6981
7015
  onProgress(newOngoingResult) {
6982
7016
  if (isReturned) {
6983
- throw new UnexpectedError(spaceTrim.spaceTrim((block) => `
7017
+ throw new UnexpectedError(spaceTrim$1.spaceTrim((block) => `
6984
7018
  Can not call \`onProgress\` after pipeline execution is finished
6985
7019
 
6986
7020
  ${block(pipelineIdentification)}
@@ -6997,7 +7031,7 @@
6997
7031
  },
6998
7032
  logLlmCall,
6999
7033
  $executionReport: executionReport,
7000
- pipelineIdentification: spaceTrim.spaceTrim((block) => `
7034
+ pipelineIdentification: spaceTrim$1.spaceTrim((block) => `
7001
7035
  ${block(pipelineIdentification)}
7002
7036
  Task name: ${currentTask.name}
7003
7037
  Task title: ${currentTask.title}
@@ -7106,7 +7140,7 @@
7106
7140
  preparedPipeline = pipeline;
7107
7141
  }
7108
7142
  else if (isNotPreparedWarningSuppressed !== true) {
7109
- console.warn(spaceTrim.spaceTrim((block) => `
7143
+ console.warn(spaceTrim$1.spaceTrim((block) => `
7110
7144
  Pipeline is not prepared
7111
7145
 
7112
7146
  ${block(pipelineIdentification)}
@@ -7131,7 +7165,7 @@
7131
7165
  tools,
7132
7166
  onProgress,
7133
7167
  logLlmCall,
7134
- pipelineIdentification: spaceTrim.spaceTrim((block) => `
7168
+ pipelineIdentification: spaceTrim$1.spaceTrim((block) => `
7135
7169
  ${block(pipelineIdentification)}
7136
7170
  ${runCount === 1 ? '' : `Run #${runCount}`}
7137
7171
  `),